<commit_before># -*- ruby -*-

def spec_frozen
  "#{RUBINIUS_BASE}/spec/frozen"
end

def spec_ruby
  "#{RUBINIUS_BASE}/spec/ruby"
end

desc "Run all 'known good' specs (task alias for spec:ci)"
task :spec => 'spec:ci'

namespace :spec do
  namespace :setup do
    # Setup for 'Subtend' specs. No need to call this yourself.
    task :subtend do
      Dir["spec/subtend/**/Rakefile"].each do |rakefile|
        sh "rake -f #{rakefile}"
      end
    end
  end

  desc "Initialize git submodules for mspec and rubyspec"
  task :init => 'mspec:init' do
    unless File.exist? "#{spec_frozen}/1.8"
      puts "Initializing CI rubyspecs submodule..."
      Dir.chdir RUBINIUS_BASE do
        rm_rf "spec/frozen"
        sh "git submodule init spec/frozen"
        sh "git submodule update spec/frozen"
      end
    end
  end

  desc "Clone a committer version of the rubyspecs"
  task :clone do
    unless File.exist? "#{spec_ruby}/.git"
      rm_rf spec_ruby if File.exist? spec_ruby
      sh "git clone git://github.com/brixen/rubyspec.git #{spec_ruby}"
    end
  end

  desc "Update submodule sources for mspec and rubyspec"
  task :update => %w[init mspec:update clone] do
    Dir.chdir RUBINIUS_BASE do
      sh "git submodule update spec/frozen"
    end

    puts "\nUpdating rubyspec repository..."
    Dir.chdir spec_ruby do
      git_update
    end
  end

  task :pull => :update

  desc "Commit changes to rubyspec sources"
  task :commit do
    puts "\nCommitting changes to rubyspec sources..."
    Dir.chdir spec_ruby do
      sh "git commit -a"
    end
  end

  desc "Push changes to the rubyspec repository"
  task :push => :update do
    puts "\nPushing changes to the rubyspec repository..."
    Dir.chdir spec_ruby do
      git_push
    end
  end

  desc "Synchronize rubyspec submodule to current remote version"
  task :sync do
    Dir.chdir spec_frozen do
      sh "git fetch"
      sh "git rebase origin"
    end
    version = `git log --pretty=oneline -1 #{spec_frozen}`[0..7]
    sh "git add spec/frozen"
    sh "git commit -m 'Updated RubySpec submodule to #{version}'"
  end

  desc "Switch to the rubyspec commiter URL"
  task :committer do
    Dir.chdir spec_ruby do
      sh "git config remote.origin.url <EMAIL>:brixen/rubyspec.git"
    end
    puts "\nYou're now accessing rubyspec via the committer URL."
  end

  desc "Switch to the rubyspec anonymous URL"
  task :anon do
    Dir.chdir spec_ruby do
      sh "git config remote.origin.url git://github.com/brixen/rubyspec.git"
    end
    puts "\nYou're now accessing rubyspec via the anonymous URL."
  end

  desc "Run all rubyspecs under MatzRuby"
  task :check do
    sh "bin/mspec -t ruby #{spec_ruby}"
  end

  desc "Run continuous integration examples"<commit_msg>Fixed spec:sync to get correct commit hash for spec/frozen.<commit_after># -*- ruby -*-

def spec_frozen
  "#{RUBINIUS_BASE}/spec/frozen"
end

def spec_ruby
  "#{RUBINIUS_BASE}/spec/ruby"
end

desc "Run all 'known good' specs (task alias for spec:ci)"
task :spec => 'spec:ci'

namespace :spec do
  namespace :setup do
    # Setup for 'Subtend' specs. No need to call this yourself.
    task :subtend do
      Dir["spec/subtend/**/Rakefile"].each do |rakefile|
        sh "rake -f #{rakefile}"
      end
    end
  end

  desc "Initialize git submodules for mspec and rubyspec"
  task :init => 'mspec:init' do
    unless File.exist? "#{spec_frozen}/1.8"
      puts "Initializing CI rubyspecs submodule..."
      Dir.chdir RUBINIUS_BASE do
        rm_rf "spec/frozen"
        sh "git submodule init spec/frozen"
        sh "git submodule update spec/frozen"
      end
    end
  end

  desc "Clone a committer version of the rubyspecs"
  task :clone do
    unless File.exist? "#{spec_ruby}/.git"
      rm_rf spec_ruby if File.exist? spec_ruby
      sh "git clone git://github.com/brixen/rubyspec.git #{spec_ruby}"
    end
  end

  desc "Update submodule sources for mspec and rubyspec"
  task :update => %w[init mspec:update clone] do
    Dir.chdir RUBINIUS_BASE do
      sh "git submodule update spec/frozen"
    end

    puts "\nUpdating rubyspec repository..."
    Dir.chdir spec_ruby do
      git_update
    end
  end

  task :pull => :update

  desc "Commit changes to rubyspec sources"
  task :commit do
    puts "\nCommitting changes to rubyspec sources..."
    Dir.chdir spec_ruby do
      sh "git commit -a"
    end
  end

  desc "Push changes to the rubyspec repository"
  task :push => :update do
    puts "\nPushing changes to the rubyspec repository..."
    Dir.chdir spec_ruby do
      git_push
    end
  end

  desc "Synchronize rubyspec submodule to current remote version"
  task :sync do
    Dir.chdir spec_frozen do
      sh "git fetch"
      sh "git rebase origin"
    end
    Dir.chdir RUBINIUS_BASE do
      version = `git log --pretty=oneline -1 spec/frozen`[0..7]
      sh "git add spec/frozen"
      sh "git commit -m 'Updated RubySpec submodule to #{version}.'"
    end
  end

  desc "Switch to the rubyspec commiter URL"
  task :committer do
    Dir.chdir spec_ruby do
      sh "git config remote.origin.url <EMAIL>:brixen/rubyspec.git"
    end
    puts "\nYou're now accessing rubyspec via the committer URL."
  end

  desc "Switch to the rubyspec anonymous URL"
  task :anon do
    Dir.chdir spec_ruby do
      sh "git config remote.origin.url git://github.com/brixen/rubyspec.git"
    end
    puts "\nYou're now accessing rubyspec via the anonymous URL."
  end

  desc "Run all rubyspecs under MatzRuby"
  task :check do
    sh "bin/mspec -t ruby #{spec_ruby}"
  end

  desc "Run continuous integration examples"
{'fraction_non_alphanumeric': 0.09146232325040272, 'fraction_numerical': 0.0017898693395382137, 'mean_word_length': 2.7303070761014685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1601752', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1884, 'n_words': 651}