From d55cd34ba8680310fb07c2f5c1c6a27b4902865d Mon Sep 17 00:00:00 2001 From: eregon Date: Thu, 29 Jun 2017 14:35:09 +0000 Subject: Update to ruby/mspec@021a119 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/mspec/tool/sync/sync-rubyspec.rb | 54 ++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 20 deletions(-) (limited to 'spec/mspec/tool/sync') diff --git a/spec/mspec/tool/sync/sync-rubyspec.rb b/spec/mspec/tool/sync/sync-rubyspec.rb index be5082e240..4073608ce3 100644 --- a/spec/mspec/tool/sync/sync-rubyspec.rb +++ b/spec/mspec/tool/sync/sync-rubyspec.rb @@ -18,10 +18,17 @@ IMPLS = { }, } +MSPEC = ARGV.delete('--mspec') + # Assuming the rubyspec repo is a sibling of the mspec repo RUBYSPEC_REPO = File.expand_path("../../../../rubyspec", __FILE__) raise RUBYSPEC_REPO unless Dir.exist?(RUBYSPEC_REPO) +MSPEC_REPO = File.expand_path("../../../../mspec", __FILE__) +raise MSPEC_REPO if MSPEC && !Dir.exist?(MSPEC_REPO) + +SOURCE_REPO = MSPEC ? MSPEC_REPO : RUBYSPEC_REPO + NOW = Time.now BRIGHT_YELLOW = "\e[33;1m" @@ -57,10 +64,13 @@ class RubyImplementation end def last_merge_message - @data[:merge_message] || "Merge ruby/spec commit" + message = @data[:merge_message] || "Merge ruby/spec commit" + message.gsub!("ruby/spec", "ruby/mspec") if MSPEC + message end def prefix + return "spec/mspec" if MSPEC @data[:prefix] || "spec/ruby" end @@ -96,18 +106,18 @@ end def filter_commits(impl) Dir.chdir(impl.repo_name) do date = NOW.strftime("%F") - branch = "specs-#{date}" + branch = "#{MSPEC ? :mspec : :specs}-#{date}" unless branch?(branch) sh "git", "checkout", "-b", branch sh "git", "filter-branch", "-f", "--subdirectory-filter", impl.prefix, *impl.from_commit - sh "git", "push", "-f", RUBYSPEC_REPO, "#{branch}:#{impl.name}" + sh "git", "push", "-f", SOURCE_REPO, "#{branch}:#{impl.name}" end end end def rebase_commits(impl) - Dir.chdir(RUBYSPEC_REPO) do + Dir.chdir(SOURCE_REPO) do sh "git", "checkout", "master" sh "git", "pull" @@ -144,25 +154,29 @@ end def test_new_specs require "yaml" - Dir.chdir(RUBYSPEC_REPO) do - versions = YAML.load_file(".travis.yml") - versions = versions["matrix"]["include"].map { |job| job["rvm"] } - versions.delete "ruby-head" - min_version, max_version = versions.minmax - - run_rubyspec = -> version { - command = "chruby #{version} && ../mspec/bin/mspec -j" - sh ENV["SHELL"], "-c", command - } - run_rubyspec[min_version] - run_rubyspec[max_version] - run_rubyspec["trunk"] + Dir.chdir(SOURCE_REPO) do + if MSPEC + sh "bundle", "exec", "rspec" + else + versions = YAML.load_file(".travis.yml") + versions = versions["matrix"]["include"].map { |job| job["rvm"] } + versions.delete "ruby-head" + min_version, max_version = versions.minmax + + run_rubyspec = -> version { + command = "chruby #{version} && ../mspec/bin/mspec -j" + sh ENV["SHELL"], "-c", command + } + run_rubyspec[min_version] + run_rubyspec[max_version] + run_rubyspec["trunk"] + end end end def verify_commits(impl) puts - Dir.chdir(RUBYSPEC_REPO) do + Dir.chdir(SOURCE_REPO) do history = `git log master...` history.lines.slice_before(/^commit \h{40}$/).each do |commit, *message| commit = commit.chomp.split.last @@ -182,7 +196,7 @@ def verify_commits(impl) end def fast_forward_master(impl) - Dir.chdir(RUBYSPEC_REPO) do + Dir.chdir(SOURCE_REPO) do sh "git", "checkout", "master" sh "git", "merge", "--ff-only", "#{impl.name}-rebased" end @@ -192,7 +206,7 @@ def check_ci puts puts <<-EOS Push to master, and check that the CI passes: - https://github.com/ruby/spec/commits/master + https://github.com/ruby/#{:m if MSPEC}spec/commits/master EOS end -- cgit v1.2.3