<commit_before>desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle exec foo)"
task :create_local_gemfile do |t|

  datamapper        = File.expand_path('../../..', __FILE__)
  excluded_adapters = ENV['EXCLUDED_ADAPTERS'].to_s.split(',')

  source_regex     = /datamapper = 'git:\/\/github.com\/datamapper'/
  gem_source_regex = /:git => \"#\{datamapper\}\/(.+?)(?:\.git)?\"/

  File.open(File.expand_path('../../Gemfile.local', __FILE__), 'w') do |f|
    File.open(File.expand_path('../../Gemfile', __FILE__), 'r').each do |line|
      line.sub!(source_regex, "datamapper = '#{datamapper}'")
      line.sub!(gem_source_regex, ':path => "#{datamapper}/\1"')<commit_msg>Minor simplification to create_local_gemfile rake task using Pathname<commit_after>desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle exec foo)"
task :create_local_gemfile do |t|

  base              = Pathname(__FILE__).dirname.parent
  datamapper        = base.parent
  excluded_adapters = ENV['EXCLUDED_ADAPTERS'].to_s.split(',')

  source_regex     = /datamapper = 'git:\/\/github.com\/datamapper'/
  gem_source_regex = /:git => \"#\{datamapper\}\/(.+?)(?:\.git)?\"/

  base.join('Gemfile.local').open('w') do |f|
    base.join('Gemfile').open.each do |line|
      line.sub!(source_regex,     "datamapper = '#{datamapper}'")
      line.sub!(gem_source_regex, ':path => "#{datamapper}/\1"')
{'fraction_non_alphanumeric': 0.19471488178025034, 'fraction_numerical': 0.0013908205841446453, 'mean_word_length': 3.8779661016949154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067730', 'n_tokens_mistral': 543, 'n_tokens_neox': 512, 'n_words': 89}