From 9860cb992bbed2bdca1c2f55f6322293015d3fa5 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Thu, 20 Feb 2025 19:18:36 +0700 Subject: [PATCH 01/29] Revert "Drop MRI 1.8.7-2.2 support (#158)" This reverts commit 92d5134994003d6f17e874117483bac7e8fb7829. --- .github/workflows/main.yml | 18 ++- .rubocop.yml | 17 +++ .rubocop_gradual.lock | 111 ++++++++++++++++++ .tool-versions | 1 + Gemfile | 26 +++- Gemfile-1.8 | 6 + Gemfile-2.0 | 4 + Gemfile-2.1 | 4 + README.md | 28 ++--- Rakefile | 13 +- appraisal.gemspec | 59 +++++++--- bin/bundle | 30 +++-- exe/appraisal | 2 +- gemfiles/modular/style.gemfile | 12 ++ lib/appraisal/appraisal.rb | 28 ++--- lib/appraisal/appraisal_file.rb | 8 +- lib/appraisal/bundler_dsl.rb | 43 ++++--- lib/appraisal/cli.rb | 52 ++++---- lib/appraisal/command.rb | 22 ++-- lib/appraisal/customize.rb | 26 ++-- lib/appraisal/dependency.rb | 12 +- lib/appraisal/dependency_list.rb | 15 +-- lib/appraisal/gemfile.rb | 2 +- lib/appraisal/gemspec.rb | 2 +- lib/appraisal/git.rb | 4 +- lib/appraisal/group.rb | 12 +- lib/appraisal/ordered_hash.rb | 22 ++++ lib/appraisal/path.rb | 4 +- lib/appraisal/platform.rb | 12 +- lib/appraisal/source.rb | 12 +- lib/appraisal/task.rb | 50 ++++---- lib/appraisal/utils.rb | 26 ++-- ...als_file_bundler_dsl_compatibility_spec.rb | 22 +++- .../bundle_with_custom_path_spec.rb | 22 +++- spec/acceptance/bundle_without_spec.rb | 5 +- spec/acceptance/cli/install_spec.rb | 14 +-- spec/acceptance/cli/update_spec.rb | 4 +- spec/acceptance/gemspec_spec.rb | 9 +- spec/appraisal/appraisal_file_spec.rb | 14 +-- spec/appraisal/appraisal_spec.rb | 40 +++---- spec/appraisal/customize_spec.rb | 85 +++++++------- spec/appraisal/dependency_list_spec.rb | 4 +- spec/appraisal/gemfile_spec.rb | 107 ++++++++--------- spec/appraisal/utils_spec.rb | 39 +++--- spec/spec_helper.rb | 6 +- spec/support/acceptance_test_helpers.rb | 39 +++--- spec/support/dependency_helpers.rb | 49 ++++---- spec/support/stream_helpers.rb | 2 +- 48 files changed, 723 insertions(+), 421 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .rubocop_gradual.lock create mode 100644 .tool-versions create mode 100644 Gemfile-1.8 create mode 100644 Gemfile-2.0 create mode 100644 Gemfile-2.1 create mode 100644 gemfiles/modular/style.gemfile create mode 100644 lib/appraisal/ordered_hash.rb diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2d43edaa..7e5742e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,8 +40,24 @@ jobs: RUBY_VERSION: ${{ matrix.ruby }} run: | case ${RUBY_VERSION} in + 1.8|1.9|2.0|2.1|2.2) + gem install bundler -v 1.17.3 + ;; + + 2.3|2.4|2.5) + gem install bundler -v 2.3.27 + ;; + + 2.6|2.7) + gem install bundler -v 2.4.22 + ;; + + 3.0) + gem install bundler -v 2.5.23 + ;; + truffleruby|truffleruby-head) - gem install bundler -v 2.5.18 + gem install bundler -v 2.5.23 ;; *) diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..0d8799c6 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,17 @@ +inherit_gem: + rubocop-lts: config/rubygem_rspec.yml + +RSpec/ExampleLength: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/DescribeClass: + Enabled: false + +# TODO: We would need to implement Mutexes in order to make violations thread safe. +# But even then they would still trigger the violation. +# See: https://coderscat.com/ruby-change-current-working-directory/ +ThreadSafety/DirChdir: + Enabled: false diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock new file mode 100644 index 00000000..94dc799e --- /dev/null +++ b/.rubocop_gradual.lock @@ -0,0 +1,111 @@ +{ + "Gemfile:3311641552": [ + [19, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [21, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [23, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] + ], + "bin/bundle:3123891436": [ + [66, 5, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2485198147] + ], + "lib/appraisal/appraisal_file.rb:3486777149": [ + [13, 5, 52, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 946226050] + ], + "lib/appraisal/cli.rb:435288507": [ + [116, 5, 410, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 1969529734] + ], + "lib/appraisal/customize.rb:190316824": [ + [10, 5, 138, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2682968747], + [17, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720], + [21, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929] + ], + "lib/appraisal/utils.rb:2308689703": [ + [6, 5, 129, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 733338411], + [13, 5, 354, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 119295155], + [35, 5, 152, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1306460482], + [42, 5, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1120325158], + [48, 5, 97, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2744794681], + [52, 5, 244, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1461524090], + [61, 5, 111, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1909626476] + ], + "spec/acceptance/cli/clean_spec.rb:1398207731": [ + [5, 23, 17, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 1606893221] + ], + "spec/acceptance/cli/generate_spec.rb:1599585127": [ + [5, 23, 20, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3905826443] + ], + "spec/acceptance/cli/help_spec.rb:3832542771": [ + [5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2148351217] + ], + "spec/acceptance/cli/install_spec.rb:2827187127": [ + [5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3284642881] + ], + "spec/acceptance/cli/list_spec.rb:1943273700": [ + [5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2152687586] + ], + "spec/acceptance/cli/update_spec.rb:2524405540": [ + [5, 23, 18, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3752509585] + ], + "spec/acceptance/cli/version_spec.rb:4076882072": [ + [5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 316256858] + ], + "spec/appraisal/appraisal_file_spec.rb:1896479557": [ + [28, 18, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], + [33, 7, 57, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 511689843], + [41, 20, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], + [41, 33, 39, "RSpec/ExpectChange: Prefer `change(Appraisal::Customize, :heading)`.", 513325635], + [45, 7, 63, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 1527582647], + [53, 20, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], + [53, 33, 45, "RSpec/ExpectChange: Prefer `change(Appraisal::Customize, :single_quotes)`.", 627072007], + [57, 7, 77, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 1960750461], + [65, 11, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441] + ], + "spec/appraisal/appraisal_spec.rb:1242607413": [ + [33, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2511581329], + [90, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1120511218], + [95, 7, 83, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [96].", 1453890366], + [95, 13, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], + [96, 7, 82, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [95].", 1614459968], + [96, 13, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], + [97, 61, 20, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 2281802167], + [104, 9, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], + [114, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], + [120, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], + [126, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192] + ], + "spec/appraisal/customize_spec.rb:1577209079": [ + [7, 1, 4439, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3030165271], + [17, 3, 13, "RSpec/SubjectDeclaration: Use subject explicitly rather than using let", 3282510975], + [25, 3, 564, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3336288078], + [27, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], + [43, 3, 286, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 4222920637], + [45, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], + [55, 3, 2985, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [13/5]", 1576524985], + [65, 7, 62, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [66, 67, 68].", 123979604], + [66, 7, 72, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 67, 68].", 3240119264], + [67, 7, 74, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 68].", 3701550880], + [68, 7, 85, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 67].", 3874694796], + [72, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441] + ], + "spec/appraisal/gemfile_spec.rb:3323881535": [ + [227, 11, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3608128140], + [228, 13, 13, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 420381022], + [235, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3511037132], + [245, 13, 12, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3100155342], + [255, 11, 24, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3242693747], + [258, 13, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 105800534], + [281, 13, 16, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 179066369], + [312, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3912615366], + [356, 13, 14, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2832187185], + [414, 13, 22, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 772581599], + [424, 11, 20, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1076107314] + ], + "spec/appraisal/utils_spec.rb:2286225770": [ + [62, 17, 58, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 1573223692] + ], + "spec/support/acceptance_test_helpers.rb:1261310616": [ + [133, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264] + ], + "spec/support/stream_helpers.rb:3273310040": [ + [9, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] + ] +} diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..ae5ecdb2 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.4.2 diff --git a/Gemfile b/Gemfile index a0dda8f5..e73905ca 100644 --- a/Gemfile +++ b/Gemfile @@ -2,10 +2,30 @@ source "https://rubygems.org" gemspec +platform :mri do + # Debugging + gem "byebug", ">= 11" + + # Dev Console - Binding.pry - Irb replacement + gem "pry", "~> 0.14" # ruby >= 2.0 +end + # This here to make sure appraisal works with Rails 3.0.0. gem "thor", "~> 0.14.0" -group :development, :test do - gem "activesupport", ">= 3.2.21" - gem "rspec", "~> 3.0" +# Ruby version specific dependencies +ruby_version = Gem::Version.new(RUBY_VERSION) +if ruby_version < Gem::Version.new("1.9") + eval File.read("Gemfile-1.8") +elsif ruby_version < Gem::Version.new("2.1") + eval File.read("Gemfile-2.0") +elsif ruby_version < Gem::Version.new("2.2") + eval File.read("Gemfile-2.1") +elsif ruby_version < Gem::Version.new("2.7") + # Std Lib extractions + gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5 +else + # Ruby >= 2.7 we can run style / lint checks via rubocop-gradual with rubocop-lts rules for Ruby 1.8+. + # This means we can develop on modern Ruby but remain compatible with ancient Ruby. + eval_gemfile "gemfiles/modular/style.gemfile" end diff --git a/Gemfile-1.8 b/Gemfile-1.8 new file mode 100644 index 00000000..976c8496 --- /dev/null +++ b/Gemfile-1.8 @@ -0,0 +1,6 @@ +# These gems are locked for Ruby 1.8.7 compatibility +gem "i18n", "~> 0.6.0" +gem "activesupport", "~> 3.2.21" +gem "rake", "~> 10.5" +gem "rack", "~> 1.6.5" +gem "benchmark", "~> 0.3" # Removed from Std Lib in Ruby 3.5 diff --git a/Gemfile-2.0 b/Gemfile-2.0 new file mode 100644 index 00000000..75ff4f5d --- /dev/null +++ b/Gemfile-2.0 @@ -0,0 +1,4 @@ +# These gems are locked for Ruby 1.9 & 2.0 compatibility +gem "activesupport", "~> 4.2.7" +gem "rack", "~> 1.6.5" +gem "benchmark", "~> 0.3" # Removed from Std Lib in Ruby 3.5 diff --git a/Gemfile-2.1 b/Gemfile-2.1 new file mode 100644 index 00000000..71901a8d --- /dev/null +++ b/Gemfile-2.1 @@ -0,0 +1,4 @@ +# These gems are locked for Ruby 2.1 compatibility +gem "activesupport", "~> 4.2.7" +gem "rack", "~> 1.6.5" +gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5 diff --git a/README.md b/README.md index 464f9165..aa2cfda0 100644 --- a/README.md +++ b/README.md @@ -122,31 +122,31 @@ To do this, use the `remove_gem` declaration within the necessary `appraise` blo **Gemfile** ```ruby -gem 'rails', '~> 4.2' +gem "rails", "~> 4.2" group :test do - gem 'rspec', '~> 4.0' - gem 'test_after_commit' + gem "rspec", "~> 4.0" + gem "test_after_commit" end ``` **Appraisals** ```ruby -appraise 'rails-5' do - gem 'rails', '~> 5.2' +appraise "rails-5" do + gem "rails", "~> 5.2" group :test do - remove_gem 'test_after_commit' + remove_gem "test_after_commit" end end ``` Using the `Appraisals` file defined above, this is what the resulting `Gemfile` will look like: ```ruby -gem 'rails', '~> 5.2' +gem "rails", "~> 5.2" group :test do - gem 'rspec', '~> 4.0' + gem "rspec", "~> 4.0" end ``` @@ -174,12 +174,12 @@ You can also provide variables for substitution in the heading, based on each ap ```ruby customize_gemfiles do { - single_quotes: true, - heading: <<~HEADING - frozen_string_literal: true + :single_quotes => true, + :heading => <<-HEADING, +frozen_string_literal: true - `%{gemfile}` has been generated by Appraisal, do NOT modify it or `%{lockfile}` directly! - Make the changes to the "%{appraisal}" block in `Appraisals` instead. See the conventions at https://example.com/ +`%{gemfile}` has been generated by Appraisal, do NOT modify it or `%{lockfile}` directly! +Make the changes to the "%{appraisal}" block in `Appraisals` instead. See the conventions at https://example.com/ HEADING } end @@ -196,7 +196,7 @@ Using the `Appraisals` file defined above, this is what the resulting `Gemfile` # `rails-3.gemfile` has been generated by Appraisal, do NOT modify it or `rails-3.gemfile.lock` directly! # Make the changes to the "rails-3" block in `Appraisals` instead. See the conventions at https://example.com/ -gem 'rails', '3.2.14' +gem "rails", "3.2.14" ``` Version Control diff --git a/Rakefile b/Rakefile index f8d79dbc..44f0463b 100644 --- a/Rakefile +++ b/Rakefile @@ -10,5 +10,14 @@ RSpec::Core::RakeTask.new do |t| t.verbose = false end -desc "Default: run the rspec examples" -task default: [:spec] +begin + require "rubocop/lts" + Rubocop::Lts.install_tasks +rescue LoadError + task(:rubocop_gradual) do + warn("RuboCop (Gradual) is disabled") + end +end + +desc "Default: rubocop_gradual's autocorrect and run the rspec examples" +task :default => ["rubocop_gradual:autocorrect", :spec] diff --git a/appraisal.gemspec b/appraisal.gemspec index d136a37f..6a037762 100644 --- a/appraisal.gemspec +++ b/appraisal.gemspec @@ -1,26 +1,51 @@ # frozen_string_literal: true -require_relative "lib/appraisal/version" +# TODO: Switch to require_relative once support for Ruby < 2 is dropped. +# require_relative "lib/appraisal/version" + +$:.push(File.expand_path("lib", __dir__)) +require "appraisal/version" Gem::Specification.new do |s| - s.name = "appraisal" - s.version = Appraisal::VERSION.dup - s.platform = Gem::Platform::RUBY - s.authors = ["Joe Ferris", "Prem Sichanugrist"] - s.email = ["jferris@thoughtbot.com", "prem@thoughtbot.com"] - s.homepage = "http://github.com/thoughtbot/appraisal" - s.summary = "Find out what your Ruby gems are worth" + s.name = "appraisal" + s.version = Appraisal::VERSION.dup + s.platform = Gem::Platform::RUBY + s.authors = ["Joe Ferris", "Prem Sichanugrist"] + s.email = ["jferris@thoughtbot.com", "prem@thoughtbot.com"] + s.homepage = "http://github.com/thoughtbot/appraisal" + s.summary = "Find out what your Ruby gems are worth" s.description = 'Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."' - s.license = "MIT" + s.license = "MIT" + + # specify which files should be added to the gem when it is released. + s.files = Dir[ + # Splats (keep alphabetical) + "lib/**/*.rb", + ] + + # automatically included with gem package, no need to list twice (i.e. do not list in files above). + s.extra_rdoc_files = Dir[ + # Files (keep alphabetical) + "CONTRIBUTING.md", + "MIT-LICENSE", + "README.md", + "SECURITY.md", + ] + + # bin/ is scripts, in any available language, for development of this specific gem + # exe/ is for ruby scripts that will ship with this gem to be used by other tools + s.bindir = "exe" + # files listed are relative paths from bindir above. + s.executables = [ + "appraisal", + ] - s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) } - s.bindir = "exe" + s.required_ruby_version = ">= 1.8.7" - s.required_ruby_version = ">= 2.3.0" + s.add_runtime_dependency("bundler", ">= 1.17.3") # Last version supporting Ruby 1.8.7 + s.add_runtime_dependency("rake", ">= 10") # Last version supporting Ruby 1.8.7 + s.add_runtime_dependency("thor", ">= 0.14.0") - s.add_dependency("rake") - s.add_dependency("bundler") - s.add_dependency("thor", ">= 0.14.0") + s.add_development_dependency("activesupport", ">= 3.2.21") + s.add_development_dependency("rspec", "~> 3.0") end diff --git a/bin/bundle b/bin/bundle index 50da5fdf..8f20a586 100755 --- a/bin/bundle +++ b/bin/bundle @@ -24,14 +24,14 @@ m = Module.new do def cli_arg_version return unless invoked_as_script? # don't want to hijack other binstubs return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil update_index = nil ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN) - bundler_version = a - end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 + bundler_version = a if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN) + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o + + bundler_version = Regexp.last_match(1) update_index = i end bundler_version @@ -55,8 +55,10 @@ m = Module.new do def lockfile_version return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o + Regexp.last_match(1) end @@ -83,15 +85,19 @@ m = Module.new do def activate_bundler gem_error = activation_error_handling do - gem "bundler", bundler_requirement + gem("bundler", bundler_requirement) end return if gem_error.nil? + require_error = activation_error_handling do require "bundler/version" end - return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" - exit 42 + if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + return + end + + warn("Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`") + exit(42) end def activation_error_handling @@ -104,6 +110,4 @@ end m.load_bundler! -if m.invoked_as_script? - load Gem.bin_path("bundler", "bundle") -end +load Gem.bin_path("bundler", "bundle") if m.invoked_as_script? diff --git a/exe/appraisal b/exe/appraisal index 4e963840..16e4087a 100755 --- a/exe/appraisal +++ b/exe/appraisal @@ -10,5 +10,5 @@ begin Appraisal::CLI.start rescue Appraisal::AppraisalsNotFound => e puts e.message - exit 127 + exit(127) end diff --git a/gemfiles/modular/style.gemfile b/gemfiles/modular/style.gemfile new file mode 100644 index 00000000..c9cf8473 --- /dev/null +++ b/gemfiles/modular/style.gemfile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# We run rubocop on the latest version of Ruby, +# but in support of the oldest supported version of Ruby + +gem "rubocop-lts", "~> 0.1", ">= 0.1.1" # Style and Linting support for Ruby >= 1.8 +gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" +gem "rubocop-rspec", "~> 3.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" + +# Std Lib extractions +gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5 diff --git a/lib/appraisal/appraisal.rb b/lib/appraisal/appraisal.rb index 86f2c3eb..3d76c5a4 100644 --- a/lib/appraisal/appraisal.rb +++ b/lib/appraisal/appraisal.rb @@ -10,7 +10,7 @@ module Appraisal # Represents one appraisal and its dependencies class Appraisal - DEFAULT_INSTALL_OPTIONS = { "jobs" => 1 }.freeze + DEFAULT_INSTALL_OPTIONS = {"jobs" => 1}.freeze attr_reader :name, :gemfile @@ -74,28 +74,24 @@ def write_gemfile def install(options = {}) commands = [install_command(options).join(" ")] - if options["without"].nil? || options["without"].empty? - commands.unshift(check_command.join(" ")) - end + commands.unshift(check_command.join(" ")) if options["without"].nil? || options["without"].empty? command = commands.join(" || ") if Bundler.settings[:path] - env = { "BUNDLE_DISABLE_SHARED_GEMS" => "1" } - Command.new(command, env: env).run + env = {"BUNDLE_DISABLE_SHARED_GEMS" => "1"} + Command.new(command, :env => env).run else Command.new(command).run end end def update(gems = []) - Command.new(update_command(gems), gemfile: gemfile_path).run + Command.new(update_command(gems), :gemfile => gemfile_path).run end def gemfile_path - unless gemfile_root.exist? - gemfile_root.mkdir - end + gemfile_root.mkdir unless gemfile_root.exist? gemfile_root.join(gemfile_name).to_s end @@ -110,10 +106,10 @@ def relativize lockfile_content = File.read(lockfile_path) File.open(lockfile_path, "w") do |file| - file.write lockfile_content.gsub( + file.write(lockfile_content.gsub( / #{current_directory}/, - " #{relative_path}" - ) + " #{relative_path}", + )) end end @@ -150,7 +146,7 @@ def lockfile_path end def clean_name - name.gsub(/[^\w\.]/, "_") + name.gsub(/[^\w.]/, "_") end def bundle_options(options) @@ -161,8 +157,8 @@ def bundle_options(options) if Utils.support_parallel_installation? options_strings << "--jobs=#{jobs}" else - warn "Your current version of Bundler does not support parallel installation. Please " + - "upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option." + warn("Your current version of Bundler does not support parallel installation. Please " \ + "upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option.") end end diff --git a/lib/appraisal/appraisal_file.rb b/lib/appraisal/appraisal_file.rb index 2d182038..316673fb 100644 --- a/lib/appraisal/appraisal_file.rb +++ b/lib/appraisal/appraisal_file.rb @@ -19,11 +19,9 @@ def initialize @gemfile = Gemfile.new @gemfile.load(ENV["BUNDLE_GEMFILE"] || "Gemfile") - if File.exist? path - run IO.read(path) - else - raise AppraisalsNotFound - end + raise AppraisalsNotFound unless File.exist?(path) + + run(File.read(path)) end def each(&block) diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index e102f4cd..b3c87042 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -1,24 +1,35 @@ # frozen_string_literal: true require "appraisal/dependency_list" +require "appraisal/ordered_hash" module Appraisal class BundlerDSL attr_reader :dependencies - PARTS = %w[source ruby_version gits paths dependencies groups - platforms source_blocks install_if gemspec] + PARTS = %w[ + source + ruby_version + gits + paths + dependencies + groups + platforms + source_blocks + install_if + gemspec + ] def initialize @sources = [] @ruby_version = nil @dependencies = DependencyList.new @gemspecs = [] - @groups = {} - @platforms = {} - @gits = {} - @paths = {} - @source_blocks = {} + @groups = OrderedHash.new + @platforms = OrderedHash.new + @gits = OrderedHash.new + @paths = OrderedHash.new + @source_blocks = OrderedHash.new @git_sources = {} @install_if = {} end @@ -82,11 +93,11 @@ def path(source, options = {}, &block) end def to_s - Utils.join_parts(PARTS.map { |part| send("#{part}_entry") }) + Utils.join_parts(PARTS.map { |part| send(:"#{part}_entry") }) end def for_dup - Utils.join_parts(PARTS.map { |part| send("#{part}_entry_for_dup") }) + Utils.join_parts(PARTS.map { |part| send(:"#{part}_entry_for_dup") }) end def gemspec(options = {}) @@ -114,7 +125,7 @@ def ruby_version_entry case @ruby_version when String then "ruby #{@ruby_version.inspect}" - else "ruby(#{@ruby_version.inspect})" + else "ruby(#{Utils.format_string(@ruby_version)})" end end @@ -137,7 +148,7 @@ def dependencies_entry_for_dup end %i[gits paths platforms groups source_blocks install_if].each do |method_name| - class_eval <<-METHODS, __FILE__, __LINE__ + class_eval <<-METHODS, __FILE__, __LINE__ + 1 private def #{method_name}_entry @@ -156,11 +167,11 @@ def indent(string) def substitute_git_source(requirements) requirements.each do |requirement| - if requirement.is_a?(Hash) - (requirement.keys & @git_sources.keys).each do |matching_source| - value = requirement.delete(matching_source) - requirement[:git] = @git_sources[matching_source].call(value) - end + next unless requirement.is_a?(Hash) + + (requirement.keys & @git_sources.keys).each do |matching_source| + value = requirement.delete(matching_source) + requirement[:git] = @git_sources[matching_source].call(value) end end end diff --git a/lib/appraisal/cli.rb b/lib/appraisal/cli.rb index 3c8a56f1..f5a966a2 100644 --- a/lib/appraisal/cli.rb +++ b/lib/appraisal/cli.rb @@ -11,7 +11,7 @@ class CLI < Thor class << self # Override help command to print out usage def help(shell, subcommand = false) - shell.say strip_heredoc(<<-HELP) + shell.say(strip_heredoc(<<-HELP)) Appraisal: Find out what your Ruby gems are worth. Usage: @@ -23,10 +23,10 @@ def help(shell, subcommand = false) if File.exist?("Appraisals") shell.say - shell.say "Available Appraisal(s):" + shell.say("Available Appraisal(s):") AppraisalFile.each do |appraisal| - shell.say " - #{appraisal.name}" + shell.say(" - #{appraisal.name}") end end @@ -48,23 +48,31 @@ def strip_heredoc(string) end desc "install", "Resolve and install dependencies for each appraisal" - method_option "jobs", aliases: "j", type: :numeric, default: 1, - banner: "SIZE", - desc: "Install gems in parallel using the given number of workers." - method_option "retry", type: :numeric, default: 1, - desc: "Retry network and git requests that have failed" - method_option "without", banner: "GROUP_NAMES", - desc: "A space-separated list of groups referencing gems to skip " + + method_option "jobs", + :aliases => "j", + :type => :numeric, + :default => 1, + :banner => "SIZE", + :desc => "Install gems in parallel using the given number of workers." + method_option "retry", + :type => :numeric, + :default => 1, + :desc => "Retry network and git requests that have failed" + method_option "without", + :banner => "GROUP_NAMES", + :desc => "A space-separated list of groups referencing gems to skip " \ "during installation. Bundler will remember this option." - method_option "full-index", type: :boolean, - desc: "Run bundle install with the " \ - "full-index argument." - method_option "path", type: :string, - desc: "Install gems in the specified directory. " \ - "Bundler will remember this option." + method_option "full-index", + :type => :boolean, + :desc => "Run bundle install with the " \ + "full-index argument." + method_option "path", + :type => :string, + :desc => "Install gems in the specified directory. " \ + "Bundler will remember this option." def install - invoke :generate, [], {} + invoke(:generate, [], {}) AppraisalFile.each do |appraisal| appraisal.install(options) @@ -81,12 +89,12 @@ def generate desc "clean", "Remove all generated gemfiles and lockfiles from gemfiles folder" def clean - FileUtils.rm_f Dir["gemfiles/*.{gemfile,gemfile.lock}"] + FileUtils.rm_f(Dir["gemfiles/*.{gemfile,gemfile.lock}"]) end desc "update [LIST_OF_GEMS]", "Remove all generated gemfiles and lockfiles, resolve, and install dependencies again" def update(*gems) - invoke :generate, [] + invoke(:generate, []) AppraisalFile.each do |appraisal| appraisal.update(gems) @@ -105,16 +113,16 @@ def version private - def method_missing(name, *args, &block) + def method_missing(name, *args) matching_appraisal = AppraisalFile.new.appraisals.detect do |appraisal| appraisal.name == name.to_s end if matching_appraisal - Command.new(args, gemfile: matching_appraisal.gemfile_path).run + Command.new(args, :gemfile => matching_appraisal.gemfile_path).run else AppraisalFile.each do |appraisal| - Command.new(ARGV, gemfile: appraisal.gemfile_path).run + Command.new(ARGV, :gemfile => appraisal.gemfile_path).run end end end diff --git a/lib/appraisal/command.rb b/lib/appraisal/command.rb index facadfd9..76ac69f2 100644 --- a/lib/appraisal/command.rb +++ b/lib/appraisal/command.rb @@ -26,9 +26,7 @@ def run ENV[key] = value end - unless Kernel.system(command_as_string) - exit(1) - end + exit(1) unless Kernel.system(command_as_string) end end @@ -36,20 +34,20 @@ def run def ensure_bundler_is_available version = Utils.bundler_version - unless system %(gem list --silent -i bundler -v #{version}) - puts ">> Reinstall Bundler into #{ENV["GEM_HOME"]}" + return if system(%(gem list --silent -i bundler -v #{version})) + + puts ">> Reinstall Bundler into #{ENV["GEM_HOME"]}" + + return if system("gem install bundler --version #{version}") - unless system "gem install bundler --version #{version}" - puts - puts <<-ERROR.strip.gsub(/\s+/, " ") + puts + puts <<-ERROR.strip.gsub(/\s+/, " ") Bundler installation failed. Please try running: `GEM_HOME="#{ENV["GEM_HOME"]}" gem install bundler --version #{version}` manually. - ERROR - exit(1) - end - end + ERROR + exit(1) end def announce diff --git a/lib/appraisal/customize.rb b/lib/appraisal/customize.rb index 20cb99ac..8d9e4a75 100644 --- a/lib/appraisal/customize.rb +++ b/lib/appraisal/customize.rb @@ -3,12 +3,14 @@ module Appraisal class Customize def initialize(heading: nil, single_quotes: false) - @@heading = heading&.chomp + @@heading = !heading.nil? && heading.chomp @@single_quotes = single_quotes end - def self.heading(gemfile) + def self.heading(gemfile = nil) @@heading ||= nil + return @@heading unless gemfile + customize(@@heading, gemfile) end @@ -16,18 +18,18 @@ def self.single_quotes @@single_quotes ||= false end - def self.customize(heading, gemfile) - return nil unless heading + def self.customize(topper, gemfile) + return unless topper format( - heading.to_s, - appraisal: gemfile.send("clean_name"), - gemfile: gemfile.send("gemfile_name"), - gemfile_path: gemfile.gemfile_path, - lockfile: "#{gemfile.send('gemfile_name')}.lock", - lockfile_path: gemfile.send("lockfile_path"), - relative_gemfile_path: gemfile.relative_gemfile_path, - relative_lockfile_path: "#{gemfile.relative_gemfile_path}.lock" + topper.to_s, + :appraisal => gemfile.send(:clean_name), + :gemfile => gemfile.send(:gemfile_name), + :gemfile_path => gemfile.gemfile_path, + :lockfile => "#{gemfile.send(:gemfile_name)}.lock", + :lockfile_path => gemfile.send(:lockfile_path), + :relative_gemfile_path => gemfile.relative_gemfile_path, + :relative_lockfile_path => "#{gemfile.relative_gemfile_path}.lock", ) end diff --git a/lib/appraisal/dependency.rb b/lib/appraisal/dependency.rb index 37302ab8..367749df 100644 --- a/lib/appraisal/dependency.rb +++ b/lib/appraisal/dependency.rb @@ -14,12 +14,12 @@ def initialize(name, requirements) end def to_s - formatted_output Utils.format_arguments(path_prefixed_requirements) + formatted_output(Utils.format_arguments(path_prefixed_requirements)) end # :nodoc: def for_dup - formatted_output Utils.format_arguments(requirements) + formatted_output(Utils.format_arguments(requirements)) end private @@ -27,13 +27,9 @@ def for_dup def path_prefixed_requirements requirements.map do |requirement| if requirement.is_a?(Hash) - if requirement[:path] - requirement[:path] = Utils.prefix_path(requirement[:path]) - end + requirement[:path] = Utils.prefix_path(requirement[:path]) if requirement[:path] - if requirement[:git] - requirement[:git] = Utils.prefix_path(requirement[:git]) - end + requirement[:git] = Utils.prefix_path(requirement[:git]) if requirement[:git] end requirement diff --git a/lib/appraisal/dependency_list.rb b/lib/appraisal/dependency_list.rb index 9b6fb8d9..8a42c938 100644 --- a/lib/appraisal/dependency_list.rb +++ b/lib/appraisal/dependency_list.rb @@ -1,25 +1,26 @@ # frozen_string_literal: true require "appraisal/dependency" +require "appraisal/ordered_hash" require "set" module Appraisal class DependencyList def initialize - @dependencies = {} + @dependencies = OrderedHash.new @removed_dependencies = Set.new end def add(name, requirements) - unless @removed_dependencies.include?(name) - @dependencies[name] = Dependency.new(name, requirements) - end + return if @removed_dependencies.include?(name) + + @dependencies[name] = Dependency.new(name, requirements) end def remove(name) - if @removed_dependencies.add?(name) - @dependencies.delete(name) - end + return unless @removed_dependencies.add?(name) + + @dependencies.delete(name) end def to_s diff --git a/lib/appraisal/gemfile.rb b/lib/appraisal/gemfile.rb index bfbb4580..93911b57 100644 --- a/lib/appraisal/gemfile.rb +++ b/lib/appraisal/gemfile.rb @@ -14,7 +14,7 @@ module Appraisal # Load bundler Gemfiles and merge dependencies class Gemfile < BundlerDSL def load(path) - run(IO.read(path), path) if File.exist?(path) + run(File.read(path), path) if File.exist?(path) end def run(definitions, path, line = 1) diff --git a/lib/appraisal/gemspec.rb b/lib/appraisal/gemspec.rb index 8c4d6a0a..dfdef6de 100644 --- a/lib/appraisal/gemspec.rb +++ b/lib/appraisal/gemspec.rb @@ -24,7 +24,7 @@ def for_dup def exported_options @options.merge( - path: Utils.prefix_path(@options[:path]) + :path => Utils.prefix_path(@options[:path]), ) end end diff --git a/lib/appraisal/git.rb b/lib/appraisal/git.rb index 5849cca1..791429df 100644 --- a/lib/appraisal/git.rb +++ b/lib/appraisal/git.rb @@ -15,7 +15,7 @@ def to_s if @options.empty? "git #{Utils.prefix_path(@source).inspect} do\n#{indent(super)}\nend" else - "git #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" + + "git #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" \ "#{indent(super)}\nend" end end @@ -25,7 +25,7 @@ def for_dup if @options.empty? "git #{@source.inspect} do\n#{indent(super)}\nend" else - "git #{@source.inspect}, #{Utils.format_string(@options)} do\n" + + "git #{@source.inspect}, #{Utils.format_string(@options)} do\n" \ "#{indent(super)}\nend" end end diff --git a/lib/appraisal/group.rb b/lib/appraisal/group.rb index 2327298c..50351a88 100644 --- a/lib/appraisal/group.rb +++ b/lib/appraisal/group.rb @@ -11,21 +11,21 @@ def initialize(group_names) end def to_s - formatted_output indent(super) + formatted_output(indent(super)) end # :nodoc: def for_dup - formatted_output indent(super) + formatted_output(indent(super)) end private def formatted_output(output_dependencies) - <<~OUTPUT.strip - group #{Utils.format_arguments(@group_names)} do - #{output_dependencies} - end + <<-OUTPUT.strip +group #{Utils.format_arguments(@group_names)} do +#{output_dependencies} +end OUTPUT end end diff --git a/lib/appraisal/ordered_hash.rb b/lib/appraisal/ordered_hash.rb new file mode 100644 index 00000000..b460f9d5 --- /dev/null +++ b/lib/appraisal/ordered_hash.rb @@ -0,0 +1,22 @@ +module Appraisal + # An ordered hash implementation for Ruby 1.8.7 compatibility. This is not + # a complete implementation, but it covers Appraisal's specific needs. + class OrderedHash < ::Hash + # Hashes are ordered in Ruby 1.9. + if RUBY_VERSION < "1.9" + def initialize(*args, &block) + super + @keys = [] + end + + def []=(key, value) + @keys << key unless has_key?(key) + super + end + + def values + @keys.collect { |key| self[key] } + end + end + end +end diff --git a/lib/appraisal/path.rb b/lib/appraisal/path.rb index f06d2737..c33b60c6 100644 --- a/lib/appraisal/path.rb +++ b/lib/appraisal/path.rb @@ -15,7 +15,7 @@ def to_s if @options.empty? "path #{Utils.prefix_path(@source).inspect} do\n#{indent(super)}\nend" else - "path #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" + + "path #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" \ "#{indent(super)}\nend" end end @@ -25,7 +25,7 @@ def for_dup if @options.empty? "path #{@source.inspect} do\n#{indent(super)}\nend" else - "path #{@source.inspect}, #{Utils.format_string(@options)} do\n" + + "path #{@source.inspect}, #{Utils.format_string(@options)} do\n" \ "#{indent(super)}\nend" end end diff --git a/lib/appraisal/platform.rb b/lib/appraisal/platform.rb index ad98ce1f..ae0e0849 100644 --- a/lib/appraisal/platform.rb +++ b/lib/appraisal/platform.rb @@ -11,21 +11,21 @@ def initialize(platform_names) end def to_s - formatted_output indent(super) + formatted_output(indent(super)) end # :nodoc: def for_dup - formatted_output indent(super) + formatted_output(indent(super)) end private def formatted_output(output_dependencies) - <<~OUTPUT.strip - platforms #{Utils.format_arguments(@platform_names)} do - #{output_dependencies} - end + <<-OUTPUT.strip +platforms #{Utils.format_arguments(@platform_names)} do +#{output_dependencies} +end OUTPUT end end diff --git a/lib/appraisal/source.rb b/lib/appraisal/source.rb index c5905617..ebbe71e9 100644 --- a/lib/appraisal/source.rb +++ b/lib/appraisal/source.rb @@ -11,21 +11,21 @@ def initialize(source) end def to_s - formatted_output indent(super) + formatted_output(indent(super)) end # :nodoc: def for_dup - formatted_output indent(super) + formatted_output(indent(super)) end private def formatted_output(output_dependencies) - <<~OUTPUT.strip - source #{@source.inspect} do - #{output_dependencies} - end + <<-OUTPUT.strip +source #{@source.inspect} do +#{output_dependencies} +end OUTPUT end end diff --git a/lib/appraisal/task.rb b/lib/appraisal/task.rb index 5c649925..cdca7b3d 100644 --- a/lib/appraisal/task.rb +++ b/lib/appraisal/task.rb @@ -8,49 +8,49 @@ module Appraisal # for a given appraisal. class Task < Rake::TaskLib def initialize - namespace :appraisal do - desc "DEPRECATED: Generate a Gemfile for each appraisal" - task :gemfiles do - warn "`rake appraisal:gemfile` task is deprecated and will be removed soon. " + - "Please use `appraisal generate`." - exec "bundle exec appraisal generate" + namespace(:appraisal) do + desc("DEPRECATED: Generate a Gemfile for each appraisal") + task(:gemfiles) do + warn("`rake appraisal:gemfile` task is deprecated and will be removed soon. " \ + "Please use `appraisal generate`.") + exec("bundle exec appraisal generate") end - desc "DEPRECATED: Resolve and install dependencies for each appraisal" - task :install do - warn "`rake appraisal:install` task is deprecated and will be removed soon. " + - "Please use `appraisal install`." - exec "bundle exec appraisal install" + desc("DEPRECATED: Resolve and install dependencies for each appraisal") + task(:install) do + warn("`rake appraisal:install` task is deprecated and will be removed soon. " \ + "Please use `appraisal install`.") + exec("bundle exec appraisal install") end - desc "DEPRECATED: Remove all generated gemfiles from gemfiles/ folder" - task :cleanup do - warn "`rake appraisal:cleanup` task is deprecated and will be removed soon. " + - "Please use `appraisal clean`." - exec "bundle exec appraisal clean" + desc("DEPRECATED: Remove all generated gemfiles from gemfiles/ folder") + task(:cleanup) do + warn("`rake appraisal:cleanup` task is deprecated and will be removed soon. " \ + "Please use `appraisal clean`.") + exec("bundle exec appraisal clean") end begin AppraisalFile.each do |appraisal| - desc "DEPRECATED: Run the given task for appraisal #{appraisal.name}" - task appraisal.name do + desc("DEPRECATED: Run the given task for appraisal #{appraisal.name}") + task(appraisal.name) do ARGV.shift - warn "`rake appraisal:#{appraisal.name}` task is deprecated and will be removed soon. " + - "Please use `appraisal #{appraisal.name} rake #{ARGV.join(' ')}`." - exec "bundle exec appraisal #{appraisal.name} rake #{ARGV.join(' ')}" + warn("`rake appraisal:#{appraisal.name}` task is deprecated and will be removed soon. " \ + "Please use `appraisal #{appraisal.name} rake #{ARGV.join(" ")}`.") + exec("bundle exec appraisal #{appraisal.name} rake #{ARGV.join(" ")}") end end rescue AppraisalsNotFound end - task :all do + task(:all) do ARGV.shift - exec "bundle exec appraisal rake #{ARGV.join(' ')}" + exec("bundle exec appraisal rake #{ARGV.join(" ")}") end end - desc "Run the given task for all appraisals" - task appraisal: "appraisal:all" + desc("Run the given task for all appraisals") + task(:appraisal => "appraisal:all") end end end diff --git a/lib/appraisal/utils.rb b/lib/appraisal/utils.rb index 40e6c31e..a9cf68e0 100644 --- a/lib/appraisal/utils.rb +++ b/lib/appraisal/utils.rb @@ -7,6 +7,9 @@ def self.support_parallel_installation? Gem::Version.create(Bundler::VERSION) >= Gem::Version.create("1.4.0.pre.1") end + # Appraisal needs to print Gemfiles in the oldest Ruby syntax that is supported by Appraisal. + # Otherwise, a project would not be able to use Appraisal to test compatibility + # with older versions of Ruby, which is a core use case for Appraisal. def self.format_string(object, enclosing_object = false) case object when Hash @@ -15,7 +18,7 @@ def self.format_string(object, enclosing_object = false) end if enclosing_object - "{ #{items.join(', ')} }" + "{ #{items.join(", ")} }" else items.join(", ") end @@ -24,21 +27,22 @@ def self.format_string(object, enclosing_object = false) end end + # Appraisal needs to print Gemfiles in the oldest Ruby syntax that is supported by Appraisal. + # This means formatting Hashes as Rockets, until support for Ruby 1.8 is dropped. + # Regardless of what Ruby is used to generate appraisals, + # generated appraisals may need to run on a different Ruby version. + # Generated appraisals should use a syntax compliant with the oldest supported Ruby version. def self.format_hash_value(key, value) key = format_string(key, true) value = format_string(value, true) - if key.start_with?(":") - "#{key.sub(/^:/, "")}: #{value}" - else - "#{key} => #{value}" - end + "#{key} => #{value}" end def self.format_arguments(arguments) - unless arguments.empty? - arguments.map { |object| format_string(object, false) }.join(", ") - end + return if arguments.empty? + + arguments.map { |object| format_string(object, false) }.join(", ") end def self.join_parts(parts) @@ -46,8 +50,8 @@ def self.join_parts(parts) end def self.prefix_path(path) - if path !~ /^(?:\/|\S:)/ && path !~ /^\S+:\/\// && path !~ /^\S+@\S+:/ - cleaned_path = path.gsub(/(^|\/)\.(?:\/|$)/, "\\1") + if path !~ %r{^(?:/|\S:)} && path !~ %r{^\S+://} && path !~ /^\S+@\S+:/ + cleaned_path = path.gsub(%r{(^|/)\.(?:/|$)}, '\\1') File.join("..", cleaned_path) else path diff --git a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb index 41e6cdd6..b5a46e6b 100644 --- a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +++ b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb @@ -4,8 +4,18 @@ RSpec.describe "Appraisals file Bundler DSL compatibility" do it "supports all Bundler DSL in Appraisals file" do - build_gems %w[bagel orange_juice milk waffle coffee ham - sausage pancake rotten_egg mayonnaise] + build_gems %w[ + bagel + orange_juice + milk + waffle + coffee + ham + sausage + pancake + rotten_egg + mayonnaise + ] build_git_gems %w[egg croissant pain_au_chocolat omelette] build_gemfile <<-GEMFILE @@ -52,7 +62,7 @@ build_appraisal_file <<-APPRAISALS appraise 'breakfast' do source 'http://some-other-source.com' - ruby "2.3.0" + ruby "1.8.7" gem 'bread' gem "pain_au_chocolat", :custom_git_source => "pain_au_chocolat" @@ -100,7 +110,7 @@ source "https://rubygems.org" source "http://some-other-source.com" - ruby "2.3.0" + ruby "1.8.7" git "../../build/egg" do gem "egg" @@ -163,7 +173,7 @@ build_appraisal_file <<-APPRAISALS appraise 'ruby-version' do - ruby file: ".ruby-version" + ruby({:file => ".ruby-version"}) end APPRAISALS @@ -175,7 +185,7 @@ source "https://rubygems.org" - ruby({:file=>".ruby-version"}) + ruby(:file => ".ruby-version") gem "appraisal", :path => #{PROJECT_ROOT.inspect} GEMFILE diff --git a/spec/acceptance/bundle_with_custom_path_spec.rb b/spec/acceptance/bundle_with_custom_path_spec.rb index b0d2157b..cdb92c0a 100644 --- a/spec/acceptance/bundle_with_custom_path_spec.rb +++ b/spec/acceptance/bundle_with_custom_path_spec.rb @@ -6,12 +6,18 @@ let(:gem_name) { "rack" } let(:path) { "vendor/bundle" } - shared_examples :gemfile_dependencies_are_satisfied do + shared_examples "gemfile dependencies are satisfied" do it "installs gems in the --path directory" do build_gemfile <<-GEMFILE source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} + + if RUBY_VERSION < "1.9" + #{File.read(File.join(PROJECT_ROOT, "Gemfile-1.8"))} + elsif RUBY_VERSION < "2.2" + #{File.read(File.join(PROJECT_ROOT, "Gemfile-2.1"))} + end GEMFILE build_appraisal_file <<-APPRAISALS @@ -25,8 +31,8 @@ run "bundle exec appraisal install" installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*") - .map { |path| path.split("/").last } - .select { |gem| gem.include?(gem_name) } + .map { |path| path.split("/").last } + .select { |gem| gem.include?(gem_name) } expect(installed_gem).not_to be_empty bundle_output = run "bundle check" @@ -39,14 +45,18 @@ end end - include_examples :gemfile_dependencies_are_satisfied + include_examples "gemfile dependencies are satisfied" context "when already installed in vendor/another" do before do build_gemfile <<-GEMFILE source "https://rubygems.org" - gem '#{gem_name}' + if RUBY_VERSION <= "1.9" + gem '#{gem_name}', '~> 1.6.5' + else + gem '#{gem_name}' + end GEMFILE run "bundle config set --local path vendor/another" @@ -54,6 +64,6 @@ run "bundle config unset --local path" end - include_examples :gemfile_dependencies_are_satisfied + include_examples "gemfile dependencies are satisfied" end end diff --git a/spec/acceptance/bundle_without_spec.rb b/spec/acceptance/bundle_without_spec.rb index 7eb1b71f..9ee14737 100644 --- a/spec/acceptance/bundle_without_spec.rb +++ b/spec/acceptance/bundle_without_spec.rb @@ -2,8 +2,9 @@ require "spec_helper" -RSpec.describe "Bundler without flag" do - it "passes --without flag to Bundler on install" do +RSpec.describe "Bundle without group" do + it "config set --local without group is honored by Bundler" do + pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" build_gems %w[pancake orange_juice waffle coffee sausage soda] build_gemfile <<-GEMFILE diff --git a/spec/acceptance/cli/install_spec.rb b/spec/acceptance/cli/install_spec.rb index 09dcc106..1e93029f 100644 --- a/spec/acceptance/cli/install_spec.rb +++ b/spec/acceptance/cli/install_spec.rb @@ -60,7 +60,7 @@ expect(content_of("gemfiles/1.0.0.gemfile.lock")).to include("file://#{uri_dummy_path}") end - context "with job size", parallel: true do + context "with job size", :parallel do before do build_appraisal_file <<-APPRAISAL appraise '1.0.0' do @@ -72,15 +72,15 @@ it "accepts --jobs option to set job size" do output = run "appraisal install --jobs=2" - expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=2") + expect(output).to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}' --jobs=2") end it "ignores --jobs option if the job size is less than or equal to 1" do output = run "appraisal install --jobs=0" - expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}'") - expect(output).not_to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=0") - expect(output).not_to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1") + expect(output).to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}'") + expect(output).not_to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}' --jobs=0") + expect(output).not_to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}' --jobs=1") end end @@ -96,7 +96,7 @@ it "accepts --full-index option to pull the full RubyGems index" do output = run("appraisal install --full-index") - expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --retry 1 --full-index true") + expect(output).to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}' --retry 1 --full-index true") end end @@ -112,7 +112,7 @@ it "accepts --path option to specify the location to install gems into" do output = run("appraisal install --path vendor/appraisal") - expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --path #{file('vendor/appraisal')} --retry 1") + expect(output).to include("bundle install --gemfile='#{file("gemfiles/1.0.0.gemfile")}' --path #{file("vendor/appraisal")} --retry 1") end end end diff --git a/spec/acceptance/cli/update_spec.rb b/spec/acceptance/cli/update_spec.rb index 8929c89c..3819a81c 100644 --- a/spec/acceptance/cli/update_spec.rb +++ b/spec/acceptance/cli/update_spec.rb @@ -20,8 +20,8 @@ after do in_test_directory do - `gem uninstall dummy -v 1.0.1` - `gem uninstall dummy2 -a` + %x{gem uninstall dummy -v 1.0.1} + %x{gem uninstall dummy2 -a} end end diff --git a/spec/acceptance/gemspec_spec.rb b/spec/acceptance/gemspec_spec.rb index d85fdf08..fd93a11d 100644 --- a/spec/acceptance/gemspec_spec.rb +++ b/spec/acceptance/gemspec_spec.rb @@ -45,11 +45,12 @@ end def build_appraisal_file - super <<-APPRAISALS + appraisals = <<-APPRAISALS appraise 'stock' do gem 'rake' end APPRAISALS + super(appraisals) end def build_rakefile @@ -66,7 +67,11 @@ def build_rakefile end def build_gemspec(path = ".") - Dir.mkdir("tmp/stage/#{path}") rescue nil + begin + Dir.mkdir("tmp/stage/#{path}") + rescue StandardError + nil + end write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC Gem::Specification.new do |s| diff --git a/spec/appraisal/appraisal_file_spec.rb b/spec/appraisal/appraisal_file_spec.rb index 8b583ea8..c90a390a 100644 --- a/spec/appraisal/appraisal_file_spec.rb +++ b/spec/appraisal/appraisal_file_spec.rb @@ -16,7 +16,7 @@ end describe "#customize_gemfiles" do - before(:each) do + before do allow(File).to receive(:exist?).with(anything).and_return(true) allow(IO).to receive(:read).with(anything).and_return("") end @@ -33,13 +33,11 @@ context "when the block returns a hash with :heading key" do subject do described_class.new.customize_gemfiles do - { heading: "foo" } + {:heading => "foo"} end end it "sets the heading" do - pending("test is broken: wrong number of arguments (given 0, expected 1)") - expect { subject }.to change { Appraisal::Customize.heading }.to("foo") end end @@ -47,7 +45,7 @@ context "when the block returns a hash with :single_quotes key" do subject do described_class.new.customize_gemfiles do - { single_quotes: true } + {:single_quotes => true} end end @@ -59,16 +57,14 @@ context "when the block returns a hash with :heading and :single_quotes keys" do subject do described_class.new.customize_gemfiles do - { heading: "foo", single_quotes: true } + {:heading => "foo", :single_quotes => true} end end it "sets the heading and single_quotes" do - pending("test is broken: wrong number of arguments (given 0, expected 1)") - subject expect(Appraisal::Customize.heading).to eq("foo") - expect(Appraisal::Customize.single_quotes).to eq(true) + expect(Appraisal::Customize.single_quotes).to be(true) end end end diff --git a/spec/appraisal/appraisal_spec.rb b/spec/appraisal/appraisal_spec.rb index d68bfd57..031c871e 100644 --- a/spec/appraisal/appraisal_spec.rb +++ b/spec/appraisal/appraisal_spec.rb @@ -6,23 +6,23 @@ RSpec.describe Appraisal::Appraisal do it "converts spaces to underscores in the gemfile path" do - appraisal = Appraisal::Appraisal.new("one two", "Gemfile") + appraisal = described_class.new("one two", "Gemfile") expect(appraisal.gemfile_path).to match(/one_two\.gemfile$/) end - it "converts punctuation to underscores in the gemfile path" do - appraisal = Appraisal::Appraisal.new("o&ne!", "Gemfile") + it "converts punctuation to underscores in the gemfile path" do + appraisal = described_class.new("o&ne!", "Gemfile") expect(appraisal.gemfile_path).to match(/o_ne_\.gemfile$/) end it "keeps dots in the gemfile path" do - appraisal = Appraisal::Appraisal.new("rails3.0", "Gemfile") + appraisal = described_class.new("rails3.0", "Gemfile") expect(appraisal.gemfile_path).to match(/rails3\.0\.gemfile$/) end it "generates a gemfile with a newline at the end of file" do output_file = Tempfile.new("gemfile") - appraisal = Appraisal::Appraisal.new("fake", "fake") + appraisal = described_class.new("fake", "fake") allow(appraisal).to receive(:gemfile_path).and_return(output_file.path) appraisal.write_gemfile @@ -33,9 +33,9 @@ context "gemfile customization" do it "generates a gemfile with a custom heading" do heading = "This file was generated with a custom heading!" - Appraisal::Customize.new(heading: heading) + Appraisal::Customize.new(:heading => heading) output_file = Tempfile.new("gemfile") - appraisal = Appraisal::Appraisal.new("custom", "Gemfile") + appraisal = described_class.new("custom", "Gemfile") allow(appraisal).to receive(:gemfile_path).and_return(output_file.path) appraisal.write_gemfile @@ -45,28 +45,28 @@ end it "generates a gemfile with multiple lines of custom heading" do - heading = <<~HEADING - frozen_string_literal: true\n - This file was generated with a custom heading! + heading = <<-HEADING +frozen_string_literal: true\n +This file was generated with a custom heading! HEADING - Appraisal::Customize.new(heading: heading) + Appraisal::Customize.new(:heading => heading) output_file = Tempfile.new("gemfile") - appraisal = Appraisal::Appraisal.new("custom", "Gemfile") + appraisal = described_class.new("custom", "Gemfile") allow(appraisal).to receive(:gemfile_path).and_return(output_file.path) appraisal.write_gemfile - expected_output = <<~HEADING - # frozen_string_literal: true\n - # This file was generated with a custom heading! + expected_output = <<-HEADING +# frozen_string_literal: true\n +# This file was generated with a custom heading! HEADING expect(output_file.read).to start_with(expected_output) end it "generates a gemfile with single quotes rather than doubles" do - Appraisal::Customize.new(single_quotes: true) + Appraisal::Customize.new(:single_quotes => true) output_file = Tempfile.new("gemfile") - appraisal = Appraisal::Appraisal.new("quotes", 'gem "foo"') + appraisal = described_class.new("quotes", 'gem "foo"') allow(appraisal).to receive(:gemfile_path).and_return(output_file.path) appraisal.write_gemfile @@ -77,7 +77,7 @@ it "does not customize anything by default" do Appraisal::Customize.new output_file = Tempfile.new("gemfile") - appraisal = Appraisal::Appraisal.new("fake", 'gem "foo"') + appraisal = described_class.new("fake", 'gem "foo"') allow(appraisal).to receive(:gemfile_path).and_return(output_file.path) appraisal.write_gemfile @@ -91,10 +91,10 @@ include StreamHelpers before do - @appraisal = Appraisal::Appraisal.new("fake", "fake") + @appraisal = described_class.new("fake", "fake") allow(@appraisal).to receive(:gemfile_path).and_return("/home/test/test directory") allow(@appraisal).to receive(:project_root).and_return(Pathname.new("/home/test")) - allow(Appraisal::Command).to receive(:new).and_return(double(run: true)) + allow(Appraisal::Command).to receive(:new).and_return(double(:run => true)) end it "runs single install command on Bundler < 1.4.0" do diff --git a/spec/appraisal/customize_spec.rb b/spec/appraisal/customize_spec.rb index 98e77f36..cc9e50f8 100644 --- a/spec/appraisal/customize_spec.rb +++ b/spec/appraisal/customize_spec.rb @@ -8,24 +8,24 @@ let(:appraisal) { Appraisal::Appraisal.new("test", "Gemfile") } let(:single_line_heading) { "This file was generated with a custom heading!" } let(:multi_line_heading) do - <<~HEADING - frozen_string_literal: true + <<-HEADING +frozen_string_literal: true - This file was generated with a custom heading! +This file was generated with a custom heading! HEADING end let(:subject) { described_class.new } let(:single_line_subject) do - described_class.new(heading: single_line_heading) + described_class.new(:heading => single_line_heading) end let(:multi_line_single_quotes_subject) do - described_class.new(heading: multi_line_heading, single_quotes: true) + described_class.new(:heading => multi_line_heading, :single_quotes => true) end describe ".heading" do it "returns nil if no heading is set" do subject - expect(described_class.heading(appraisal)).to eq(nil) + expect(described_class.heading(appraisal)).to be_nil end it "returns the heading if set" do @@ -36,19 +36,19 @@ it "returns the heading without an trailing newline" do multi_line_single_quotes_subject expect(described_class.heading(appraisal)).to eq(multi_line_heading.chomp) - expect(described_class.heading(appraisal)).to_not end_with("\n") + expect(described_class.heading(appraisal)).not_to end_with("\n") end end describe ".single_quotes" do it "returns false if not set" do subject - expect(described_class.single_quotes).to eq(false) + expect(described_class.single_quotes).to be(false) end it "returns true if set" do multi_line_single_quotes_subject - expect(described_class.single_quotes).to eq(true) + expect(described_class.single_quotes).to be(true) end end @@ -60,6 +60,7 @@ let(:lockfile_relative_path) { "gemfiles/#{lockfile}" } let(:gemfile_full_path) { "/path/to/project/#{gemfile_relative_path}" } let(:lockfile_full_path) { "/path/to/project/#{lockfile_relative_path}" } + before do allow(appraisal).to receive(:gemfile_name).and_return(gemfile) allow(appraisal).to receive(:gemfile_path).and_return(gemfile_full_path) @@ -69,72 +70,72 @@ it "returns nil if no heading is set" do subject - expect(described_class.send(:customize, nil, appraisal)).to eq(nil) + expect(described_class.send(:customize, nil, appraisal)).to be_nil end it "returns the heading unchanged" do single_line_subject expect(described_class.send( - :customize, - single_line_heading, - appraisal - )).to eq(single_line_heading) + :customize, + single_line_heading, + appraisal, + )).to eq(single_line_heading) end it "returns the heading with the appraisal name" do expect(described_class.send( - :customize, - "Appraisal: %{appraisal}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Appraisal: #{appraisal_name}") + :customize, + "Appraisal: %{appraisal}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Appraisal: #{appraisal_name}") end it "returns the heading with the gemfile name" do expect(described_class.send( - :customize, - "Gemfile: %{gemfile}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Gemfile: #{gemfile}") + :customize, + "Gemfile: %{gemfile}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Gemfile: #{gemfile}") end it "returns the heading with the gemfile path" do expect(described_class.send( - :customize, - "Gemfile: %{gemfile_path}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Gemfile: #{gemfile_full_path}") + :customize, + "Gemfile: %{gemfile_path}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Gemfile: #{gemfile_full_path}") end it "returns the heading with the lockfile name" do expect(described_class.send( - :customize, - "Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Lockfile: #{lockfile}") + :customize, + "Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Lockfile: #{lockfile}") end it "returns the heading with the lockfile path" do expect(described_class.send( - :customize, - "Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Lockfile: #{lockfile_full_path}") + :customize, + "Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Lockfile: #{lockfile_full_path}") end it "returns the heading with the relative gemfile path" do expect(described_class.send( - :customize, - "Gemfile: %{relative_gemfile_path}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Gemfile: #{gemfile_relative_path}") + :customize, + "Gemfile: %{relative_gemfile_path}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Gemfile: #{gemfile_relative_path}") end it "returns the heading with the relative lockfile path" do expect(described_class.send( - :customize, - "Gemfile: %{relative_lockfile_path}", # rubocop:disable Style/FormatStringToken - appraisal - )).to eq("Gemfile: #{lockfile_relative_path}") + :customize, + "Gemfile: %{relative_lockfile_path}", # rubocop:disable Style/FormatStringToken + appraisal, + )).to eq("Gemfile: #{lockfile_relative_path}") end end end diff --git a/spec/appraisal/dependency_list_spec.rb b/spec/appraisal/dependency_list_spec.rb index 8b322984..7aa0c4a2 100644 --- a/spec/appraisal/dependency_list_spec.rb +++ b/spec/appraisal/dependency_list_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Appraisal::DependencyList do describe "#add" do - let(:dependency_list) { Appraisal::DependencyList.new } + let(:dependency_list) { described_class.new } it "adds dependency to the list" do dependency_list.add("rails", ["4.1.4"]) @@ -32,7 +32,7 @@ end describe "#remove" do - let(:dependency_list) { Appraisal::DependencyList.new } + let(:dependency_list) { described_class.new } before do dependency_list.add("rails", ["4.1.4"]) diff --git a/spec/appraisal/gemfile_spec.rb b/spec/appraisal/gemfile_spec.rb index 666c07ba..2e88f728 100644 --- a/spec/appraisal/gemfile_spec.rb +++ b/spec/appraisal/gemfile_spec.rb @@ -8,26 +8,26 @@ include StreamHelpers it "supports gemfiles without sources" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new expect(gemfile.to_s.strip).to eq "" end it "supports multiple sources" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.source "one" gemfile.source "two" expect(gemfile.to_s.strip).to eq %(source "one"\nsource "two") end it "ignores duplicate sources" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.source "one" gemfile.source "one" expect(gemfile.to_s.strip).to eq %(source "one") end it "preserves dependency order" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.gem "one" gemfile.gem "two" gemfile.gem "three" @@ -35,13 +35,13 @@ end it "supports symbol sources" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.source :one expect(gemfile.to_s.strip).to eq %(source :one) end it "supports group syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.group :development, :test do gem "one" @@ -55,7 +55,7 @@ end it "supports nested DSL within group syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.group :development, :test do platforms :jruby do @@ -87,7 +87,7 @@ end it "supports platform syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.platform :jruby do gem "one" @@ -101,7 +101,7 @@ end it "supports nested DSL within platform syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.platform :jruby do group :development, :test do @@ -133,7 +133,7 @@ end it "supports git syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "git://example.com/repo.git" do gem "one" @@ -147,7 +147,7 @@ end it "supports nested DSL within git syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "git://example.com/repo.git" do group :development, :test do @@ -179,7 +179,7 @@ end it "supports path syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.path "../path" do gem "one" @@ -193,7 +193,7 @@ end it "supports nested DSL within path syntax" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.path "../path" do group :development, :test do @@ -227,14 +227,14 @@ context "excess new line" do context "no contents" do it "shows empty string" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new expect(gemfile.to_s).to eq "" end end context "full contents" do it "does not show newline at end" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.source "source" gemfile.gem "gem" gemfile.gemspec @@ -244,7 +244,7 @@ context "no gemspec" do it "does not show newline at end" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.source "source" gemfile.gem "gem" expect(gemfile.to_s).to match(/[^\n]\z/m) @@ -253,64 +253,65 @@ end context "relative path handling" do - before { stub_const("RUBY_VERSION", "2.3.0") } + before { stub_const("RUBY_VERSION", "1.8.7") } context "in :path option" do it "handles dot path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", path: "." + gemfile = described_class.new + gemfile.gem "bacon", :path => "." - expect(gemfile.to_s).to eq %(gem "bacon", path: "../") + expect(gemfile.to_s).to eq %(gem "bacon", :path => "../") end it "handles relative path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", path: "../bacon" + gemfile = described_class.new + gemfile.gem "bacon", :path => "../bacon" - expect(gemfile.to_s).to eq %(gem "bacon", path: "../../bacon") + expect(gemfile.to_s).to eq %(gem "bacon", :path => "../../bacon") end it "handles absolute path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", path: "/tmp" + gemfile = described_class.new + gemfile.gem "bacon", :path => "/tmp" - expect(gemfile.to_s).to eq %(gem "bacon", path: "/tmp") + expect(gemfile.to_s).to eq %(gem "bacon", :path => "/tmp") end end context "in :git option" do it "handles dot git path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", git: "." + gemfile = described_class.new + gemfile.gem "bacon", :git => "." - expect(gemfile.to_s).to eq %(gem "bacon", git: "../") + expect(gemfile.to_s).to eq %(gem "bacon", :git => "../") end it "handles relative git path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", git: "../bacon" + gemfile = described_class.new + gemfile.gem "bacon", :git => "../bacon" - expect(gemfile.to_s).to eq %(gem "bacon", git: "../../bacon") + expect(gemfile.to_s).to eq %(gem "bacon", :git => "../../bacon") end it "handles absolute git path" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", git: "/tmp" + gemfile = described_class.new + gemfile.gem "bacon", :git => "/tmp" - expect(gemfile.to_s).to eq %(gem "bacon", git: "/tmp") + expect(gemfile.to_s).to eq %(gem "bacon", :git => "/tmp") end it "handles git uri" do - gemfile = Appraisal::Gemfile.new - gemfile.gem "bacon", git: "git@github.com:bacon/bacon.git" + gemfile = described_class.new + gemfile.gem "bacon", :git => "git@github.com:bacon/bacon.git" - expect(gemfile.to_s).to eq %(gem "bacon", git: "git@github.com:bacon/bacon.git") + expect(gemfile.to_s) + .to eq %(gem "bacon", :git => "git@github.com:bacon/bacon.git") end end context "in path block" do it "handles dot path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.path "." do gem "bacon" @@ -324,7 +325,7 @@ end it "handles relative path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.path "../bacon" do gem "bacon" @@ -338,7 +339,7 @@ end it "handles absolute path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.path "/tmp" do gem "bacon" @@ -354,7 +355,7 @@ context "in git block" do it "handles dot git path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "." do gem "bacon" @@ -368,7 +369,7 @@ end it "handles relative git path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "../bacon" do gem "bacon" @@ -382,7 +383,7 @@ end it "handles absolute git path" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "/tmp" do gem "bacon" @@ -396,7 +397,7 @@ end it "handles git uri" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git "git@github.com:bacon/bacon.git" do gem "bacon" @@ -412,28 +413,28 @@ context "in gemspec directive" do it "handles gemspec path" do - gemfile = Appraisal::Gemfile.new - gemfile.gemspec path: "." + gemfile = described_class.new + gemfile.gemspec :path => "." - expect(gemfile.to_s).to eq %(gemspec path: "../") + expect(gemfile.to_s).to eq %(gemspec :path => "../") end end end context "git_source support" do - before { stub_const("RUBY_VERSION", "2.3.0") } + before { stub_const("RUBY_VERSION", "1.8.7") } it "stores git_source declaration and apply it as git option" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new gemfile.git_source(:custom_source) { |repo| "path/#{repo}" } - gemfile.gem "bacon", custom_source: "bacon_pancake" + gemfile.gem "bacon", :custom_source => "bacon_pancake" - expect(gemfile.to_s).to eq %(gem "bacon", git: "../path/bacon_pancake") + expect(gemfile.to_s).to eq %(gem "bacon", :git => "../path/bacon_pancake") end end it "preserves the Gemfile's __FILE__" do - gemfile = Appraisal::Gemfile.new + gemfile = described_class.new Tempfile.open do |tmpfile| tmpfile.write "__FILE__" tmpfile.rewind diff --git a/spec/appraisal/utils_spec.rb b/spec/appraisal/utils_spec.rb index 04dfe910..743f8683 100644 --- a/spec/appraisal/utils_spec.rb +++ b/spec/appraisal/utils_spec.rb @@ -5,61 +5,64 @@ RSpec.describe Appraisal::Utils do describe ".format_string" do - it "prints out a nice looking hash without brackets with new syntax" do - hash = { foo: "bar" } - expect(Appraisal::Utils.format_string(hash)).to eq('foo: "bar"') + it "prints out a nice looking hash without brackets with old syntax" do + hash = {:foo => "bar"} + expect(described_class.format_string(hash)).to eq(':foo => "bar"') - hash = { "baz" => { ball: "boo" } } - expect(Appraisal::Utils.format_string(hash)).to eq('"baz" => { ball: "boo" }') + hash = {"baz" => {:ball => "boo"}} + expect(described_class.format_string(hash)) + .to eq('"baz" => { :ball => "boo" }') end end describe ".format_arguments" do - before { stub_const("RUBY_VERSION", "2.3.0") } + before { stub_const("RUBY_VERSION", "1.8.7") } it "prints out arguments without enclosing square brackets" do - arguments = [:foo, { bar: { baz: "ball" } }] + arguments = [:foo, {:bar => {:baz => "ball"}}] - expect(Appraisal::Utils.format_arguments(arguments)).to eq(':foo, bar: { baz: "ball" }') + expect(described_class.format_arguments(arguments)).to eq( + ':foo, :bar => { :baz => "ball" }', + ) end it "returns nil if arguments is empty" do arguments = [] - expect(Appraisal::Utils.format_arguments(arguments)).to eq(nil) + expect(described_class.format_arguments(arguments)).to be_nil end end describe ".prefix_path" do it "prepends two dots in front of relative path" do - expect(Appraisal::Utils.prefix_path("test")).to eq "../test" + expect(described_class.prefix_path("test")).to eq "../test" end it "replaces single dot with two dots" do - expect(Appraisal::Utils.prefix_path(".")).to eq "../" + expect(described_class.prefix_path(".")).to eq "../" end it "ignores absolute path" do - expect(Appraisal::Utils.prefix_path("/tmp")).to eq "/tmp" + expect(described_class.prefix_path("/tmp")).to eq "/tmp" end it "strips out './' from path" do - expect(Appraisal::Utils.prefix_path("./tmp/./appraisal././")).to eq "../tmp/appraisal./" + expect(described_class.prefix_path("./tmp/./appraisal././")).to eq "../tmp/appraisal./" end it "does not prefix Git uri" do - expect(Appraisal::Utils.prefix_path("git@github.com:bacon/bacon.git")).to eq "git@github.com:bacon/bacon.git" - expect(Appraisal::Utils.prefix_path("git://github.com/bacon/bacon.git")).to eq "git://github.com/bacon/bacon.git" - expect(Appraisal::Utils.prefix_path("https://github.com/bacon/bacon.git")).to eq("https://github.com/bacon/bacon.git") + expect(described_class.prefix_path("git@github.com:bacon/bacon.git")).to eq "git@github.com:bacon/bacon.git" + expect(described_class.prefix_path("git://github.com/bacon/bacon.git")).to eq "git://github.com/bacon/bacon.git" + expect(described_class.prefix_path("https://github.com/bacon/bacon.git")).to eq("https://github.com/bacon/bacon.git") end end describe ".bundler_version" do it "returns the bundler version" do - bundler = double("Bundler", name: "bundler", version: "a.b.c") + bundler = double("Bundler", :name => "bundler", :version => "a.b.c") allow(Gem::Specification).to receive(:detect).and_return(bundler) - version = Appraisal::Utils.bundler_version + version = described_class.bundler_version expect(version).to eq "a.b.c" expect(Gem::Specification).to have_received(:detect) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 20b036de..24416362 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rubygems" -require "bundler/setup" +require "byebug" if ENV["CI"].nil? && ENV["DEBUG"] == "true" require "./spec/support/acceptance_test_helpers" require "./spec/support/stream_helpers" @@ -13,11 +13,11 @@ RSpec.configure do |config| config.raise_errors_for_deprecations! - config.define_derived_metadata(file_path: %r{spec\/acceptance\/}) do |metadata| + config.define_derived_metadata(:file_path => %r{spec/acceptance/}) do |metadata| metadata[:type] = :acceptance end - config.include AcceptanceTestHelpers, type: :acceptance + config.include AcceptanceTestHelpers, :type => :acceptance # disable monkey patching # see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index 52e0c60a..038f7b3f 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -22,7 +22,7 @@ module AcceptanceTestHelpers included do metadata[:type] = :acceptance - before parallel: true do + before :parallel => true do unless Appraisal::Utils.support_parallel_installation? pending "This Bundler version does not support --jobs flag." end @@ -58,7 +58,7 @@ def unset_bundler_environment_variables end def add_binstub_path - ENV["PATH"] = "bin:#{ENV['PATH']}" + ENV["PATH"] = "bin:#{ENV["PATH"]}" end def restore_environment_variables @@ -94,7 +94,7 @@ def build_gemspec def content_of(path) file(path).read.tap do |content| - content.gsub!(/(\S+): /, ":\\1 => ") + content.gsub!(/(\S+): /, ':\\1 => ') end end @@ -130,15 +130,15 @@ def build_default_dummy_gems def ensure_bundler_is_available run "bundle -v 2>&1", false - if $?.exitstatus != 0 - puts <<-WARNING.squish.strip_heredoc + return unless $?.exitstatus != 0 + + puts <<-WARNING.squish.strip_heredoc Reinstall Bundler to #{TMP_GEM_ROOT} as `BUNDLE_DISABLE_SHARED_GEMS` is enabled. - WARNING - version = Utils.bundler_version + WARNING + version = Utils.bundler_version - run "gem install bundler --version #{version} --install-dir '#{TMP_GEM_ROOT}'" - end + run "gem install bundler --version #{version} --install-dir '#{TMP_GEM_ROOT}'" end def build_default_gemfile @@ -146,9 +146,20 @@ def build_default_gemfile source 'https://rubygems.org' gem 'appraisal', :path => '#{PROJECT_ROOT}' + + if RUBY_VERSION < "1.9" + #{File.read(File.join(PROJECT_ROOT, "Gemfile-1.8"))} + elsif RUBY_VERSION < "2.2" + #{File.read(File.join(PROJECT_ROOT, "Gemfile-2.1"))} + end GEMFILE run "bundle install --local" + # Support for binstubs --all was added to bundler's 1-17-stable branch + # and released with bundler v1.17.0.pre.2 (2018-10-13) + # See: + # - https://github.com/rubygems/bundler/pull/6450 + # - https://github.com/rubygems/bundler/commit/9d59fa41ef43aaccc6cf867a69a49648510c4df7#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR10 run "bundle binstubs --all" end @@ -159,17 +170,15 @@ def in_test_directory(&block) def run(command, raise_on_error = true) in_test_directory do - `#{command}`.tap do |output| + %x(#{command}).tap do |output| exitstatus = $?.exitstatus - if ENV["VERBOSE"] - puts output - end + puts output if ENV["VERBOSE"] if raise_on_error && exitstatus != 0 - raise RuntimeError, <<-ERROR_MESSAGE.strip_heredoc + raise <<-ERROR_MESSAGE.strip_heredoc.to_s Command #{command.inspect} exited with status #{exitstatus}. Output: - #{output.gsub(/^/, ' ')} + #{output.gsub(/^/, " ")} ERROR_MESSAGE end end diff --git a/spec/support/dependency_helpers.rb b/spec/support/dependency_helpers.rb index 54752d20..c8d21793 100644 --- a/spec/support/dependency_helpers.rb +++ b/spec/support/dependency_helpers.rb @@ -4,15 +4,16 @@ module DependencyHelpers def build_gem(gem_name, version = "1.0.0") ENV["GEM_HOME"] = TMP_GEM_ROOT - unless File.exist? "#{TMP_GEM_ROOT}/gems/#{gem_name}-#{version}" - FileUtils.mkdir_p "#{TMP_GEM_BUILD}/#{gem_name}/lib" + return if File.exist? "#{TMP_GEM_ROOT}/gems/#{gem_name}-#{version}" - FileUtils.cd "#{TMP_GEM_BUILD}/#{gem_name}" do - gemspec = "#{gem_name}.gemspec" - lib_file = "lib/#{gem_name}.rb" + FileUtils.mkdir_p "#{TMP_GEM_BUILD}/#{gem_name}/lib" - File.open gemspec, "w" do |file| - file.puts <<-GEMSPEC + FileUtils.cd "#{TMP_GEM_BUILD}/#{gem_name}" do + gemspec = "#{gem_name}.gemspec" + lib_file = "lib/#{gem_name}.rb" + + File.open gemspec, "w" do |file| + file.puts <<-GEMSPEC Gem::Specification.new do |s| s.name = #{gem_name.inspect} s.version = #{version.inspect} @@ -23,23 +24,22 @@ def build_gem(gem_name, version = "1.0.0") s.homepage = 'http://github.com/thoughtbot/#{gem_name}' s.required_ruby_version = '>= 2.3.0' end - GEMSPEC - end + GEMSPEC + end - File.open lib_file, "w" do |file| - file.puts "$#{gem_name}_version = '#{version}'" - end + File.open lib_file, "w" do |file| + file.puts "$#{gem_name}_version = '#{version}'" + end - redirect = ENV["VERBOSE"] ? "" : "2>&1" + redirect = ENV["VERBOSE"] ? "" : "2>&1" - puts "building gem: #{gem_name} #{version}" if ENV["VERBOSE"] - `gem build #{gemspec} #{redirect}` + puts "building gem: #{gem_name} #{version}" if ENV["VERBOSE"] + %x(gem build #{gemspec} #{redirect}) - puts "installing gem: #{gem_name} #{version}" if ENV["VERBOSE"] - `gem install -lN #{gem_name}-#{version}.gem -v #{version} #{redirect}` + puts "installing gem: #{gem_name} #{version}" if ENV["VERBOSE"] + %x(gem install -lN #{gem_name}-#{version}.gem -v #{version} #{redirect}) - puts "" if ENV["VERBOSE"] - end + puts "" if ENV["VERBOSE"] end end @@ -52,11 +52,12 @@ def build_git_gem(gem_name, version = "1.0.0") build_gem gem_name, version Dir.chdir "#{TMP_GEM_BUILD}/#{gem_name}" do - `git init . --initial-branch=master` - `git config user.email "appraisal@thoughtbot.com"` - `git config user.name "Appraisal"` - `git add .` - `git commit --all --no-verify --message "initial commit"` + %x(git init . --initial-branch=master) + %x(git config user.email "appraisal@thoughtbot.com") + %x(git config user.name "Appraisal") + %x(git config commit.gpgsign false) + %x(git add .) + %x(git commit --all --no-verify --message "initial commit") end # Cleanup Bundler cache path manually for now diff --git a/spec/support/stream_helpers.rb b/spec/support/stream_helpers.rb index ca0eb436..97c0240d 100644 --- a/spec/support/stream_helpers.rb +++ b/spec/support/stream_helpers.rb @@ -13,7 +13,7 @@ def capture(stream) yield stream_io.rewind - return captured_stream.read + captured_stream.read ensure captured_stream.close captured_stream.unlink From 14f36cd74767904146ab7f902101faff64451e70 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 04:39:18 +0700 Subject: [PATCH 02/29] =?UTF-8?q?=F0=9F=92=9A=20Fix=20bundler=20versions?= =?UTF-8?q?=20per=20Ruby=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://dev.to/galtzo/matrix-ruby-gem-bundler-etc-4kk7 --- .github/workflows/main.yml | 1 + Gemfile | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e5742e3..1d390315 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,7 @@ jobs: - name: Update bundler env: RUBY_VERSION: ${{ matrix.ruby }} + # See: https://dev.to/galtzo/matrix-ruby-gem-bundler-etc-4kk7 run: | case ${RUBY_VERSION} in 1.8|1.9|2.0|2.1|2.2) diff --git a/Gemfile b/Gemfile index e73905ca..1f4f2868 100644 --- a/Gemfile +++ b/Gemfile @@ -27,5 +27,15 @@ elsif ruby_version < Gem::Version.new("2.7") else # Ruby >= 2.7 we can run style / lint checks via rubocop-gradual with rubocop-lts rules for Ruby 1.8+. # This means we can develop on modern Ruby but remain compatible with ancient Ruby. - eval_gemfile "gemfiles/modular/style.gemfile" + # TODO: Replace individual style gems below with modular gemfile, once eval_gemfile support is added to appraisal. + # eval_gemfile "gemfiles/modular/style.gemfile" + # We run rubocop on the latest version of Ruby, + # but in support of the oldest supported version of Ruby + gem "rubocop-lts", "~> 0.1", ">= 0.1.1" # Style and Linting support for Ruby >= 1.8 + gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" + gem "rubocop-rspec", "~> 3.2" + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" + + # Std Lib extractions + gem "benchmark", "~> 0.4" # Removed from Std Lib in Ruby 3.5 end From 79a6de1a0829d409a9d53ece16a5f8dc82b1a4cc Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 05:34:03 +0700 Subject: [PATCH 03/29] =?UTF-8?q?=F0=9F=92=9A=20Fix=20ruby=20declaration?= =?UTF-8?q?=20in=20Gemfile=20when=20on=20ruby-head?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Support debug for debugging with Ruby >= 2.7 - Support byebug for debugging with Ruby < 2.7 --- .tool-versions | 2 +- Gemfile | 13 ++++++++++--- ...ppraisals_file_bundler_dsl_compatibility_spec.rb | 4 ++-- spec/acceptance/gemfile_dsl_compatibility_spec.rb | 6 +++--- spec/spec_helper.rb | 11 ++++++++++- spec/support/acceptance_test_helpers.rb | 9 +++++++++ 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.tool-versions b/.tool-versions index ae5ecdb2..0964b2a6 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.4.2 +ruby 3.5-dev diff --git a/Gemfile b/Gemfile index 1f4f2868..d90a1616 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,18 @@ source "https://rubygems.org" gemspec +# For Ruby version specific dependencies +ruby_version = Gem::Version.new(RUBY_VERSION) + platform :mri do # Debugging - gem "byebug", ">= 11" + if ruby_version < Gem::Version.new("2.7") + # Use byebug in code + gem "byebug", ">= 11" + else + # Use binding.break, binding.b, or debugger in code + gem "debug", ">= 1.0.0" + end # Dev Console - Binding.pry - Irb replacement gem "pry", "~> 0.14" # ruby >= 2.0 @@ -13,8 +22,6 @@ end # This here to make sure appraisal works with Rails 3.0.0. gem "thor", "~> 0.14.0" -# Ruby version specific dependencies -ruby_version = Gem::Version.new(RUBY_VERSION) if ruby_version < Gem::Version.new("1.9") eval File.read("Gemfile-1.8") elsif ruby_version < Gem::Version.new("2.1") diff --git a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb index b5a46e6b..885eedb8 100644 --- a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +++ b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb @@ -21,7 +21,7 @@ build_gemfile <<-GEMFILE source 'https://rubygems.org' git_source(:custom_git_source) { |repo| "../build/\#{repo}" } - ruby RUBY_VERSION + ruby "#{RUBY_VERSION}#{ruby_dev_append}" gem 'bagel' gem "croissant", :custom_git_source => "croissant" @@ -166,7 +166,7 @@ build_gemfile <<-GEMFILE source 'https://rubygems.org' - ruby RUBY_VERSION + ruby "#{RUBY_VERSION}#{ruby_dev_append}" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} GEMFILE diff --git a/spec/acceptance/gemfile_dsl_compatibility_spec.rb b/spec/acceptance/gemfile_dsl_compatibility_spec.rb index 2a9dcac3..d01751e3 100644 --- a/spec/acceptance/gemfile_dsl_compatibility_spec.rb +++ b/spec/acceptance/gemfile_dsl_compatibility_spec.rb @@ -10,7 +10,7 @@ build_gemfile <<-GEMFILE source "https://rubygems.org" - ruby RUBY_VERSION + ruby "#{RUBY_VERSION}#{ruby_dev_append}" git "../build/egg" do gem "egg" @@ -52,7 +52,7 @@ source "https://rubygems.org" - ruby "#{RUBY_VERSION}" + ruby "#{RUBY_VERSION}#{ruby_dev_append}" git "../../build/egg" do gem "egg" @@ -82,7 +82,7 @@ source "https://rubygems.org" - ruby "#{RUBY_VERSION}" + ruby "#{RUBY_VERSION}#{ruby_dev_append}" git "../../build/egg" do gem "egg" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 24416362..62de10b9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,16 @@ # frozen_string_literal: true require "rubygems" -require "byebug" if ENV["CI"].nil? && ENV["DEBUG"] == "true" +if ENV["CI"].nil? && ENV["DEBUG"] == "true" + ruby_version = Gem::Version.new(RUBY_VERSION) + if ruby_version < Gem::Version.new("2.7") + # Use byebug in code + require "byebug" + else + # Use binding.break, binding.b, or debugger in code + require "debug" + end +end require "./spec/support/acceptance_test_helpers" require "./spec/support/stream_helpers" diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index 038f7b3f..d577580d 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -43,6 +43,15 @@ module AcceptanceTestHelpers end end + # A head version of MRI ruby will require the -dev appended to the ruby string in the gemfile. + # Unfortunately, there is no ENV variable that has access to the "dev" concept directly. + # Perhaps the best we can do is parse RUBY_DESCRIPTION? + # > RUBY_DESCRIPTION + # "ruby 3.5.0dev (2025-02-20T18:14:37Z master b2cf48f406) +PRISM [arm64-darwin24]" + def ruby_dev_append + RUBY_DESCRIPTION.include?("dev") ? "-dev" : "" + end + def save_environment_variables @original_environment_variables = {} From 2d022fcbd3f0404f07e570ca78d7e256eaddebcb Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 05:37:13 +0700 Subject: [PATCH 04/29] =?UTF-8?q?=F0=9F=9A=A8=20Address=20code=20review=20?= =?UTF-8?q?from=20@n-rodriguez?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://github.com/thoughtbot/appraisal/pull/250#discussion_r1964410061 --- spec/acceptance/cli/update_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/cli/update_spec.rb b/spec/acceptance/cli/update_spec.rb index 3819a81c..40d93be0 100644 --- a/spec/acceptance/cli/update_spec.rb +++ b/spec/acceptance/cli/update_spec.rb @@ -20,8 +20,8 @@ after do in_test_directory do - %x{gem uninstall dummy -v 1.0.1} - %x{gem uninstall dummy2 -a} + %x(gem uninstall dummy -v 1.0.1) + %x(gem uninstall dummy2 -a) end end From df41df2bddb5214baa4467024f0c3475114e86a5 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 05:50:25 +0700 Subject: [PATCH 05/29] =?UTF-8?q?=F0=9F=91=B7=20Add=20Rubies=202.7,=202.6,?= =?UTF-8?q?=202.5,=202.4,=202.3,=202.2,=202.1,=202.0,=201.9,=201.8=20to=20?= =?UTF-8?q?build=20matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - all current jruby and truffleruby are compatible with Ruby 3.1 at minimum, thus are supported by latest bundler --- .github/workflows/main.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d390315..42377a64 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,16 @@ jobs: - '3.2' - '3.1' - '3.0' + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' + - '2.2' + - '2.1' + - '2.0' + - '1.9' + - '1.8' - 'head' - jruby - jruby-head @@ -57,10 +67,6 @@ jobs: gem install bundler -v 2.5.23 ;; - truffleruby|truffleruby-head) - gem install bundler -v 2.5.23 - ;; - *) gem update --system ;; From 1a5b85d9caa1a537f4e6412f0636ec784231ca0f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 06:59:12 +0700 Subject: [PATCH 06/29] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Use=20.rspec=20to=20?= =?UTF-8?q?dry=20spec=20file=20headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use strip_heredoc uniformly in acceptance tests --- .rspec | 3 ++ .tool-versions | 2 +- lib/appraisal/command.rb | 10 +++---- lib/appraisal/group.rb | 8 ++--- ...als_file_bundler_dsl_compatibility_spec.rb | 10 +++---- .../bundle_with_custom_path_spec.rb | 8 ++--- spec/acceptance/bundle_without_spec.rb | 6 ++-- spec/acceptance/cli/clean_spec.rb | 4 +-- spec/acceptance/cli/generate_spec.rb | 6 ++-- spec/acceptance/cli/help_spec.rb | 4 +-- spec/acceptance/cli/install_spec.rb | 14 ++++----- spec/acceptance/cli/list_spec.rb | 4 +-- spec/acceptance/cli/run_spec.rb | 4 +-- spec/acceptance/cli/update_spec.rb | 4 +-- spec/acceptance/cli/version_spec.rb | 2 -- spec/acceptance/cli/with_no_arguments_spec.rb | 4 +-- .../gemfile_dsl_compatibility_spec.rb | 14 ++++----- spec/acceptance/gemspec_spec.rb | 12 ++++---- spec/appraisal/appraisal_spec.rb | 12 ++++---- spec/appraisal/customize_spec.rb | 6 ++-- spec/appraisal/dependency_list_spec.rb | 2 +- spec/appraisal/gemfile_spec.rb | 30 +++++++++---------- spec/spec_helper.rb | 13 ++++++-- spec/support/acceptance_test_helpers.rb | 23 ++++++-------- spec/support/dependency_helpers.rb | 2 +- spec/support/stream_helpers.rb | 1 + 26 files changed, 94 insertions(+), 114 deletions(-) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..bd5e0288 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format progress +--color +--require spec_helper diff --git a/.tool-versions b/.tool-versions index 0964b2a6..59511e1d 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.5-dev +ruby 2.7.8 diff --git a/lib/appraisal/command.rb b/lib/appraisal/command.rb index 76ac69f2..dd29ea44 100644 --- a/lib/appraisal/command.rb +++ b/lib/appraisal/command.rb @@ -41,11 +41,11 @@ def ensure_bundler_is_available return if system("gem install bundler --version #{version}") puts - puts <<-ERROR.strip.gsub(/\s+/, " ") - Bundler installation failed. - Please try running: - `GEM_HOME="#{ENV["GEM_HOME"]}" gem install bundler --version #{version}` - manually. + puts <<-ERROR.strip_heredoc + Bundler installation failed. + Please try running: + `GEM_HOME="#{ENV["GEM_HOME"]}" gem install bundler --version #{version}` + manually. ERROR exit(1) end diff --git a/lib/appraisal/group.rb b/lib/appraisal/group.rb index 50351a88..f1f82314 100644 --- a/lib/appraisal/group.rb +++ b/lib/appraisal/group.rb @@ -22,10 +22,10 @@ def for_dup private def formatted_output(output_dependencies) - <<-OUTPUT.strip -group #{Utils.format_arguments(@group_names)} do -#{output_dependencies} -end + <<-OUTPUT.strip_heredoc + group #{Utils.format_arguments(@group_names)} do + #{output_dependencies} + end OUTPUT end end diff --git a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb index 885eedb8..41e669ee 100644 --- a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +++ b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "Appraisals file Bundler DSL compatibility" do it "supports all Bundler DSL in Appraisals file" do build_gems %w[ @@ -18,7 +16,7 @@ ] build_git_gems %w[egg croissant pain_au_chocolat omelette] - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source 'https://rubygems.org' git_source(:custom_git_source) { |repo| "../build/\#{repo}" } ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -59,7 +57,7 @@ gem 'appraisal', :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise 'breakfast' do source 'http://some-other-source.com' ruby "1.8.7" @@ -163,7 +161,7 @@ end it 'supports ruby file: ".ruby-version" DSL' do - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source 'https://rubygems.org' ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -171,7 +169,7 @@ gem 'appraisal', :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise 'ruby-version' do ruby({:file => ".ruby-version"}) end diff --git a/spec/acceptance/bundle_with_custom_path_spec.rb b/spec/acceptance/bundle_with_custom_path_spec.rb index cdb92c0a..bb6fca1b 100644 --- a/spec/acceptance/bundle_with_custom_path_spec.rb +++ b/spec/acceptance/bundle_with_custom_path_spec.rb @@ -1,14 +1,12 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "Bundle with custom path" do let(:gem_name) { "rack" } let(:path) { "vendor/bundle" } shared_examples "gemfile dependencies are satisfied" do it "installs gems in the --path directory" do - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -20,7 +18,7 @@ end GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise "#{gem_name}" do gem '#{gem_name}' end @@ -49,7 +47,7 @@ context "when already installed in vendor/another" do before do - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" if RUBY_VERSION <= "1.9" diff --git a/spec/acceptance/bundle_without_spec.rb b/spec/acceptance/bundle_without_spec.rb index 9ee14737..8960e031 100644 --- a/spec/acceptance/bundle_without_spec.rb +++ b/spec/acceptance/bundle_without_spec.rb @@ -1,13 +1,11 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "Bundle without group" do it "config set --local without group is honored by Bundler" do pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" build_gems %w[pancake orange_juice waffle coffee sausage soda] - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem "pancake" @@ -20,7 +18,7 @@ gem "appraisal", :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise "breakfast" do gem "waffle" diff --git a/spec/acceptance/cli/clean_spec.rb b/spec/acceptance/cli/clean_spec.rb index 7eed158c..164dc3f4 100644 --- a/spec/acceptance/cli/clean_spec.rb +++ b/spec/acceptance/cli/clean_spec.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal clean" do it "remove all gemfiles from gemfiles directory" do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/generate_spec.rb b/spec/acceptance/cli/generate_spec.rb index 285fc215..0c7eb454 100644 --- a/spec/acceptance/cli/generate_spec.rb +++ b/spec/acceptance/cli/generate_spec.rb @@ -1,16 +1,14 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal generate" do it "generates the gemfiles" do - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem "appraisal", :path => "#{PROJECT_ROOT}" GEMFILE - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/help_spec.rb b/spec/acceptance/cli/help_spec.rb index da99f7a3..45bc1e03 100644 --- a/spec/acceptance/cli/help_spec.rb +++ b/spec/acceptance/cli/help_spec.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal help" do it "prints usage along with commands, and list of appraisals" do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/install_spec.rb b/spec/acceptance/cli/install_spec.rb index 1e93029f..f92405ce 100644 --- a/spec/acceptance/cli/install_spec.rb +++ b/spec/acceptance/cli/install_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal install" do it "raises error when there is no Appraisals file" do output = run "appraisal install 2>&1", false @@ -10,7 +8,7 @@ end it "installs the dependencies" do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -30,7 +28,7 @@ build_gemspec add_gemspec_to_gemfile - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -49,7 +47,7 @@ uri_dummy_path = "#{current_directory}/uri_dummy" FileUtils.symlink(File.absolute_path("tmp/build/uri_dummy"), uri_dummy_path) - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'uri_dummy', git: 'file://#{uri_dummy_path}' end @@ -62,7 +60,7 @@ context "with job size", :parallel do before do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -86,7 +84,7 @@ context "with full-index", :parallel do before do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -102,7 +100,7 @@ context "with path", :parallel do before do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/list_spec.rb b/spec/acceptance/cli/list_spec.rb index 917712ee..e2777e17 100644 --- a/spec/acceptance/cli/list_spec.rb +++ b/spec/acceptance/cli/list_spec.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal list" do it "prints list of appraisals" do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/run_spec.rb b/spec/acceptance/cli/run_spec.rb index 6bfcfd8c..d0fd1ab9 100644 --- a/spec/acceptance/cli/run_spec.rb +++ b/spec/acceptance/cli/run_spec.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI appraisal (with arguments)" do before do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/update_spec.rb b/spec/acceptance/cli/update_spec.rb index 40d93be0..be66063b 100644 --- a/spec/acceptance/cli/update_spec.rb +++ b/spec/acceptance/cli/update_spec.rb @@ -1,12 +1,10 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal update" do before do build_gem "dummy2", "1.0.0" - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise 'dummy' do gem 'dummy', '~> 1.0.0' gem 'dummy2', '~> 1.0.0' diff --git a/spec/acceptance/cli/version_spec.rb b/spec/acceptance/cli/version_spec.rb index e47a6548..ab313df9 100644 --- a/spec/acceptance/cli/version_spec.rb +++ b/spec/acceptance/cli/version_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI", "appraisal version" do context "with version subcommand" do it "prints out version string" do diff --git a/spec/acceptance/cli/with_no_arguments_spec.rb b/spec/acceptance/cli/with_no_arguments_spec.rb index 4a04e64a..962a9bb1 100644 --- a/spec/acceptance/cli/with_no_arguments_spec.rb +++ b/spec/acceptance/cli/with_no_arguments_spec.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "CLI appraisal (with no arguments)" do it "runs install command" do - build_appraisal_file <<-APPRAISAL + build_appraisal_file <<-APPRAISAL.strip_heredoc appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/gemfile_dsl_compatibility_spec.rb b/spec/acceptance/gemfile_dsl_compatibility_spec.rb index d01751e3..c2987251 100644 --- a/spec/acceptance/gemfile_dsl_compatibility_spec.rb +++ b/spec/acceptance/gemfile_dsl_compatibility_spec.rb @@ -1,14 +1,12 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "Gemfile DSL compatibility" do it "supports all Bundler DSL in Gemfile" do build_gems %w[bacon orange_juice waffle] build_git_gem "egg" build_gemspec - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -33,7 +31,7 @@ gemspec GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise "japanese" do gem "rice" gem "miso_soup" @@ -112,14 +110,14 @@ build_gem "bacon", "1.1.0" build_gem "bacon", "1.2.0" - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem "appraisal", :path => #{PROJECT_ROOT.inspect} gem "bacon", "1.2.0" GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise "1.0.0" do gem "bacon", "1.0.0" end @@ -145,7 +143,7 @@ build_gem "bacon", "1.0.0" build_gemspec - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem "appraisal", :path => #{PROJECT_ROOT.inspect} @@ -155,7 +153,7 @@ end GEMFILE - build_appraisal_file <<-APPRAISALS + build_appraisal_file <<-APPRAISALS.strip_heredoc appraise "1.0.0" do gem "bacon", "1.0.0" end diff --git a/spec/acceptance/gemspec_spec.rb b/spec/acceptance/gemspec_spec.rb index fd93a11d..034ec1e4 100644 --- a/spec/acceptance/gemspec_spec.rb +++ b/spec/acceptance/gemspec_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe "Gemspec" do before do build_appraisal_file @@ -11,7 +9,7 @@ it "supports gemspec syntax with default options" do build_gemspec - write_file "Gemfile", <<-GEMFILE + write_file "Gemfile", <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -29,7 +27,7 @@ it "supports gemspec syntax with path option" do build_gemspec "specdir" - write_file "Gemfile", <<-GEMFILE + write_file "Gemfile", <<-GEMFILE.strip_heredoc source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -45,7 +43,7 @@ end def build_appraisal_file - appraisals = <<-APPRAISALS + appraisals = <<-APPRAISALS.strip_heredoc appraise 'stock' do gem 'rake' end @@ -54,7 +52,7 @@ def build_appraisal_file end def build_rakefile - write_file "Rakefile", <<-RAKEFILE + write_file "Rakefile", <<-RAKEFILE.strip_heredoc require 'rubygems' require 'bundler/setup' require 'appraisal' @@ -73,7 +71,7 @@ def build_gemspec(path = ".") nil end - write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC + write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC.strip_heredoc Gem::Specification.new do |s| s.name = 'gemspec_project' s.version = '0.1' diff --git a/spec/appraisal/appraisal_spec.rb b/spec/appraisal/appraisal_spec.rb index 031c871e..545ec8cf 100644 --- a/spec/appraisal/appraisal_spec.rb +++ b/spec/appraisal/appraisal_spec.rb @@ -45,9 +45,9 @@ end it "generates a gemfile with multiple lines of custom heading" do - heading = <<-HEADING -frozen_string_literal: true\n -This file was generated with a custom heading! + heading = <<-HEADING.strip_heredoc + frozen_string_literal: true\n + This file was generated with a custom heading! HEADING Appraisal::Customize.new(:heading => heading) output_file = Tempfile.new("gemfile") @@ -56,9 +56,9 @@ appraisal.write_gemfile - expected_output = <<-HEADING -# frozen_string_literal: true\n -# This file was generated with a custom heading! + expected_output = <<-HEADING.strip_heredoc + # frozen_string_literal: true\n + # This file was generated with a custom heading! HEADING expect(output_file.read).to start_with(expected_output) end diff --git a/spec/appraisal/customize_spec.rb b/spec/appraisal/customize_spec.rb index cc9e50f8..d3687a13 100644 --- a/spec/appraisal/customize_spec.rb +++ b/spec/appraisal/customize_spec.rb @@ -8,10 +8,10 @@ let(:appraisal) { Appraisal::Appraisal.new("test", "Gemfile") } let(:single_line_heading) { "This file was generated with a custom heading!" } let(:multi_line_heading) do - <<-HEADING -frozen_string_literal: true + <<-HEADING.strip_heredoc + frozen_string_literal: true -This file was generated with a custom heading! + This file was generated with a custom heading! HEADING end let(:subject) { described_class.new } diff --git a/spec/appraisal/dependency_list_spec.rb b/spec/appraisal/dependency_list_spec.rb index 7aa0c4a2..6d2b4def 100644 --- a/spec/appraisal/dependency_list_spec.rb +++ b/spec/appraisal/dependency_list_spec.rb @@ -17,7 +17,7 @@ dependency_list.add("rails", ["4.1.4"]) dependency_list.add("bundler", ["1.7.2"]) - expect(dependency_list.to_s).to eq <<-GEMS.strip_heredoc.strip + expect(dependency_list.to_s).to eq <<-GEMS.strip_heredoc gem "rails", "4.1.4" gem "bundler", "1.7.2" GEMS diff --git a/spec/appraisal/gemfile_spec.rb b/spec/appraisal/gemfile_spec.rb index 2e88f728..51b967ba 100644 --- a/spec/appraisal/gemfile_spec.rb +++ b/spec/appraisal/gemfile_spec.rb @@ -47,7 +47,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc group :development, :test do gem "one" end @@ -69,7 +69,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc group :development, :test do git "git://example.com/repo.git" do gem "two" @@ -93,7 +93,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc platforms :jruby do gem "one" end @@ -115,7 +115,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc platforms :jruby do git "git://example.com/repo.git" do gem "two" @@ -139,7 +139,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "git://example.com/repo.git" do gem "one" end @@ -161,7 +161,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "git://example.com/repo.git" do path "../.." do gem "three" @@ -185,7 +185,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc path "../../path" do gem "one" end @@ -207,7 +207,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc path "../../path" do git "git://example.com/repo.git" do gem "three" @@ -317,7 +317,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc path "../" do gem "bacon" end @@ -331,7 +331,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc path "../../bacon" do gem "bacon" end @@ -345,7 +345,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc path "/tmp" do gem "bacon" end @@ -361,7 +361,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "../" do gem "bacon" end @@ -375,7 +375,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "../../bacon" do gem "bacon" end @@ -389,7 +389,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "/tmp" do gem "bacon" end @@ -403,7 +403,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc git "git@github.com:bacon/bacon.git" do gem "bacon" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 62de10b9..d9313f5c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true require "rubygems" + if ENV["CI"].nil? && ENV["DEBUG"] == "true" + ENV["VERBOSE"] = "true" ruby_version = Gem::Version.new(RUBY_VERSION) if ruby_version < Gem::Version.new("2.7") # Use byebug in code @@ -11,8 +13,15 @@ require "debug" end end -require "./spec/support/acceptance_test_helpers" -require "./spec/support/stream_helpers" + +# External Libraries +require "active_support/core_ext/string/strip" + +# This library +require "support/dependency_helpers" +require "support/acceptance_test_helpers" +require "support/stream_helpers" + PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")).freeze TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "bundler") diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index d577580d..6db7fbc1 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true +# External Libraries require "rspec/expectations/expectation_target" -require "active_support/core_ext/string/strip" require "active_support/core_ext/string/filters" require "active_support/concern" + +# This library require "appraisal/utils" -require "./spec/support/dependency_helpers" module AcceptanceTestHelpers extend ActiveSupport::Concern @@ -91,7 +92,7 @@ def add_gemspec_to_gemfile end def build_gemspec - write_file "stage.gemspec", <<-GEMSPEC + write_file "stage.gemspec", <<-GEMSPEC.strip_heredoc Gem::Specification.new do |s| s.name = 'stage' s.version = '0.1' @@ -141,9 +142,9 @@ def ensure_bundler_is_available return unless $?.exitstatus != 0 - puts <<-WARNING.squish.strip_heredoc - Reinstall Bundler to #{TMP_GEM_ROOT} as `BUNDLE_DISABLE_SHARED_GEMS` - is enabled. + puts <<-WARNING.strip_heredoc + Reinstall Bundler to #{TMP_GEM_ROOT} as `BUNDLE_DISABLE_SHARED_GEMS` + is enabled. WARNING version = Utils.bundler_version @@ -151,16 +152,10 @@ def ensure_bundler_is_available end def build_default_gemfile - build_gemfile <<-GEMFILE + build_gemfile <<-GEMFILE.strip_heredoc source 'https://rubygems.org' gem 'appraisal', :path => '#{PROJECT_ROOT}' - - if RUBY_VERSION < "1.9" - #{File.read(File.join(PROJECT_ROOT, "Gemfile-1.8"))} - elsif RUBY_VERSION < "2.2" - #{File.read(File.join(PROJECT_ROOT, "Gemfile-2.1"))} - end GEMFILE run "bundle install --local" @@ -185,7 +180,7 @@ def run(command, raise_on_error = true) puts output if ENV["VERBOSE"] if raise_on_error && exitstatus != 0 - raise <<-ERROR_MESSAGE.strip_heredoc.to_s + raise <<-ERROR_MESSAGE.strip_heredoc Command #{command.inspect} exited with status #{exitstatus}. Output: #{output.gsub(/^/, " ")} ERROR_MESSAGE diff --git a/spec/support/dependency_helpers.rb b/spec/support/dependency_helpers.rb index c8d21793..6dfbd3a8 100644 --- a/spec/support/dependency_helpers.rb +++ b/spec/support/dependency_helpers.rb @@ -13,7 +13,7 @@ def build_gem(gem_name, version = "1.0.0") lib_file = "lib/#{gem_name}.rb" File.open gemspec, "w" do |file| - file.puts <<-GEMSPEC + file.puts <<-GEMSPEC.strip_heredoc Gem::Specification.new do |s| s.name = #{gem_name.inspect} s.version = #{version.inspect} diff --git a/spec/support/stream_helpers.rb b/spec/support/stream_helpers.rb index 97c0240d..021dcc9f 100644 --- a/spec/support/stream_helpers.rb +++ b/spec/support/stream_helpers.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# External Libraries require "tempfile" module StreamHelpers From a19e70746cce6bdab027e914c62a497033af181c Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 14:27:15 +0700 Subject: [PATCH 07/29] =?UTF-8?q?=F0=9F=9A=A8=20Address=20code=20review=20?= =?UTF-8?q?from=20@n-rodriguez?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://github.com/thoughtbot/appraisal/pull/250#discussion_r1964532654 --- .rspec | 1 + 1 file changed, 1 insertion(+) diff --git a/.rspec b/.rspec index bd5e0288..78b7894f 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,4 @@ --format progress --color --require spec_helper +--warnings From e1673bc68efa29746e979c763fa84d8460972b5f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 15:13:38 +0700 Subject: [PATCH 08/29] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20for=20Ruby=202.7?= =?UTF-8?q?=20compat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Differences in handling of whitespace between versions of Ruby are often seen as minor, and go unnoticed unless tests explicitly test white space as appraisal's test suite does. --- .github/workflows/main.yml | 9 - .rubocop_gradual.lock | 444 ++++++++++++++++-- .tool-versions | 2 +- lib/appraisal/bundler_dsl.rb | 16 +- lib/appraisal/command.rb | 10 +- lib/appraisal/conditional.rb | 12 +- lib/appraisal/git.rb | 26 +- lib/appraisal/group.rb | 12 +- lib/appraisal/path.rb | 26 +- lib/appraisal/platform.rb | 8 +- lib/appraisal/source.rb | 8 +- lib/appraisal/utils.rb | 6 +- ...als_file_bundler_dsl_compatibility_spec.rb | 18 +- .../bundle_with_custom_path_spec.rb | 6 +- spec/acceptance/bundle_without_spec.rb | 4 +- spec/acceptance/cli/clean_spec.rb | 2 +- spec/acceptance/cli/generate_spec.rb | 6 +- spec/acceptance/cli/help_spec.rb | 2 +- spec/acceptance/cli/install_spec.rb | 14 +- spec/acceptance/cli/list_spec.rb | 2 +- spec/acceptance/cli/run_spec.rb | 4 +- spec/acceptance/cli/update_spec.rb | 2 +- spec/acceptance/cli/with_no_arguments_spec.rb | 2 +- .../gemfile_dsl_compatibility_spec.rb | 20 +- spec/acceptance/gemspec_spec.rb | 10 +- spec/appraisal/appraisal_spec.rb | 4 +- spec/appraisal/customize_spec.rb | 2 +- spec/appraisal/dependency_list_spec.rb | 2 +- spec/appraisal/gemfile_spec.rb | 37 +- spec/spec_helper.rb | 1 - spec/support/acceptance_test_helpers.rb | 18 +- spec/support/dependency_helpers.rb | 96 ++-- 32 files changed, 642 insertions(+), 189 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 42377a64..f6743f86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,15 +22,6 @@ jobs: - '3.1' - '3.0' - '2.7' - - '2.6' - - '2.5' - - '2.4' - - '2.3' - - '2.2' - - '2.1' - - '2.0' - - '1.9' - - '1.8' - 'head' - jruby - jruby-head diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index 94dc799e..9629a5ec 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -1,8 +1,8 @@ { - "Gemfile:3311641552": [ - [19, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], - [21, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], - [23, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] + "Gemfile:2720967286": [ + [26, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [28, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [30, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] ], "bin/bundle:3123891436": [ [66, 5, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2485198147] @@ -18,35 +18,35 @@ [17, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720], [21, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929] ], - "lib/appraisal/utils.rb:2308689703": [ + "lib/appraisal/utils.rb:3242656341": [ [6, 5, 129, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 733338411], [13, 5, 354, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 119295155], [35, 5, 152, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1306460482], [42, 5, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1120325158], - [48, 5, 97, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2744794681], + [48, 5, 98, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 714993131], [52, 5, 244, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1461524090], [61, 5, 111, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1909626476] ], - "spec/acceptance/cli/clean_spec.rb:1398207731": [ - [5, 23, 17, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 1606893221] + "spec/acceptance/cli/clean_spec.rb:1564995421": [ + [3, 23, 17, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 1606893221] ], - "spec/acceptance/cli/generate_spec.rb:1599585127": [ - [5, 23, 20, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3905826443] + "spec/acceptance/cli/generate_spec.rb:245350726": [ + [3, 23, 20, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3905826443] ], - "spec/acceptance/cli/help_spec.rb:3832542771": [ - [5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2148351217] + "spec/acceptance/cli/help_spec.rb:3569358941": [ + [3, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2148351217] ], - "spec/acceptance/cli/install_spec.rb:2827187127": [ - [5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3284642881] + "spec/acceptance/cli/install_spec.rb:1306756550": [ + [3, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3284642881] ], - "spec/acceptance/cli/list_spec.rb:1943273700": [ - [5, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2152687586] + "spec/acceptance/cli/list_spec.rb:36921834": [ + [3, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2152687586] ], - "spec/acceptance/cli/update_spec.rb:2524405540": [ - [5, 23, 18, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3752509585] + "spec/acceptance/cli/update_spec.rb:3754424074": [ + [3, 23, 18, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3752509585] ], - "spec/acceptance/cli/version_spec.rb:4076882072": [ - [5, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 316256858] + "spec/acceptance/cli/version_spec.rb:2850459497": [ + [3, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 316256858] ], "spec/appraisal/appraisal_file_spec.rb:1896479557": [ [28, 18, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], @@ -59,7 +59,7 @@ [57, 7, 77, "RSpec/NestedGroups: Maximum example group nesting exceeded [4/3].", 1960750461], [65, 11, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441] ], - "spec/appraisal/appraisal_spec.rb:1242607413": [ + "spec/appraisal/appraisal_spec.rb:3939376245": [ [33, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2511581329], [90, 11, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1120511218], [95, 7, 83, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [96].", 1453890366], @@ -72,8 +72,8 @@ [120, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192], [126, 7, 10, "RSpec/InstanceVariable: Avoid instance variables - use let, a method call, or a local variable (if possible).", 4097172192] ], - "spec/appraisal/customize_spec.rb:1577209079": [ - [7, 1, 4439, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3030165271], + "spec/appraisal/customize_spec.rb:3636242792": [ + [7, 1, 4472, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 194570577], [17, 3, 13, "RSpec/SubjectDeclaration: Use subject explicitly rather than using let", 3282510975], [25, 3, 564, "RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5]", 3336288078], [27, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441], @@ -86,26 +86,392 @@ [68, 7, 85, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 67].", 3874694796], [72, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441] ], - "spec/appraisal/gemfile_spec.rb:3323881535": [ - [227, 11, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3608128140], - [228, 13, 13, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 420381022], - [235, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3511037132], - [245, 13, 12, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3100155342], - [255, 11, 24, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3242693747], - [258, 13, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 105800534], - [281, 13, 16, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 179066369], - [312, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3912615366], - [356, 13, 14, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2832187185], - [414, 13, 22, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 772581599], - [424, 11, 20, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1076107314] + "spec/appraisal/gemfile_spec.rb:2644921119": [ + [228, 11, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3608128140], + [229, 13, 13, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 420381022], + [236, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3511037132], + [246, 13, 12, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3100155342], + [256, 11, 24, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3242693747], + [259, 13, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 105800534], + [282, 13, 16, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 179066369], + [313, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3912615366], + [357, 13, 14, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 2832187185], + [415, 13, 22, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 772581599], + [425, 11, 20, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1076107314] ], "spec/appraisal/utils_spec.rb:2286225770": [ [62, 17, 58, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 1573223692] ], - "spec/support/acceptance_test_helpers.rb:1261310616": [ - [133, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264] + "spec/support/acceptance_test_helpers.rb:293636491": [ + [143, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264] ], - "spec/support/stream_helpers.rb:3273310040": [ - [9, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] + "spec/support/stream_helpers.rb:3654818709": [ + [10, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] + ], + "spec/tmp/build/bagel/lib/bagel.rb:817034159": [ + [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 93522089] + ], + "spec/tmp/build/coffee/lib/coffee.rb:3015295950": [ + [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 1715453096] + ], + "spec/tmp/build/croissant/lib/croissant.rb:4104237646": [ + [1, 1, 18, "Style/GlobalVars: Do not introduce global variables.", 2226371368] + ], + "spec/tmp/build/dummy/lib/dummy.rb:1807990539": [ + [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] + ], + "spec/tmp/build/egg/lib/egg.rb:3130854087": [ + [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 4028848065] + ], + "spec/tmp/build/ham/lib/ham.rb:557050406": [ + [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 1287500928] + ], + "spec/tmp/build/mayonnaise/lib/mayonnaise.rb:604109062": [ + [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 3499390688] + ], + "spec/tmp/build/milk/lib/milk.rb:2694353217": [ + [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 3069591303] + ], + "spec/tmp/build/omelette/lib/omelette.rb:3378185993": [ + [1, 1, 17, "Style/GlobalVars: Do not introduce global variables.", 576262095] + ], + "spec/tmp/build/orange_juice/lib/orange_juice.rb:3578149981": [ + [1, 1, 21, "Style/GlobalVars: Do not introduce global variables.", 1923934619] + ], + "spec/tmp/build/pain_au_chocolat/lib/pain_au_chocolat.rb:2551039889": [ + [1, 1, 25, "Style/GlobalVars: Do not introduce global variables.", 2391071575] + ], + "spec/tmp/build/pancake/lib/pancake.rb:284512849": [ + [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 451124759] + ], + "spec/tmp/build/rotten_egg/lib/rotten_egg.rb:2010666510": [ + [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 2573678312] + ], + "spec/tmp/build/sausage/lib/sausage.rb:1728262677": [ + [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 619820115] + ], + "spec/tmp/build/soda/lib/soda.rb:1990629979": [ + [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 198441437] + ], + "spec/tmp/build/waffle/lib/waffle.rb:2896717917": [ + [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 2356319643] + ], + "spec/tmp/bundler/bin/appraisal:662174372": [ + [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] + ], + "spec/tmp/bundler/bin/rake:3146010916": [ + [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] + ], + "spec/tmp/bundler/bin/thor:4227855012": [ + [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] + ], + "spec/tmp/bundler/gems/bagel-1.0.0/lib/bagel.rb:817034159": [ + [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 93522089] + ], + "spec/tmp/bundler/gems/coffee-1.0.0/lib/coffee.rb:3015295950": [ + [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 1715453096] + ], + "spec/tmp/bundler/gems/dummy-1.0.0/lib/dummy.rb:1804502538": [ + [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] + ], + "spec/tmp/bundler/gems/dummy-1.1.0/lib/dummy.rb:1807990539": [ + [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] + ], + "spec/tmp/bundler/gems/ham-1.0.0/lib/ham.rb:557050406": [ + [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 1287500928] + ], + "spec/tmp/bundler/gems/mayonnaise-1.0.0/lib/mayonnaise.rb:604109062": [ + [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 3499390688] + ], + "spec/tmp/bundler/gems/milk-1.0.0/lib/milk.rb:2694353217": [ + [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 3069591303] + ], + "spec/tmp/bundler/gems/orange_juice-1.0.0/lib/orange_juice.rb:3578149981": [ + [1, 1, 21, "Style/GlobalVars: Do not introduce global variables.", 1923934619] + ], + "spec/tmp/bundler/gems/pancake-1.0.0/lib/pancake.rb:284512849": [ + [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 451124759] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake.rb:3015112320": [ + [64, 1, 6, "Style/GlobalVars: Do not introduce global variables.", 3075757472] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/application.rb:3305321773": [ + [63, 21, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952], + [113, 13, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163], + [222, 11, 5, "Lint/Loop: Use `Kernel#loop` with `break` rather than `begin/end/until`(or `while`).", 191284826], + [236, 5, 122, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3552754902], + [305, 65, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [306, 50, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [514, 15, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [523, 20, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [530, 40, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [532, 30, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], + [537, 78, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [553, 40, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [608, 59, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [638, 54, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [647, 66, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [656, 53, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [664, 60, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [671, 62, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [672, 46, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [681, 71, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [798, 24, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240], + [889, 16, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], + [895, 20, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], + [895, 33, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/backtrace.rb:2947413644": [ + [16, 43, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], + [20, 5, 182, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 684235907] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/clean.rb:597197225": [ + [47, 18, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/cpu_counter.rb:114869078": [ + [7, 5, 51, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1633217579] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/ext/core.rb:37720573": [ + [21, 71, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/file_utils.rb:1092133475": [ + [67, 68, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/file_utils_ext.rb:1080867503": [ + [15, 7, 42, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 598600538] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/invocation_chain.rb:2990720762": [ + [27, 5, 73, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 669377266] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/linked_list.rb:3208307164": [ + [59, 5, 439, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3263738083], + [73, 5, 55, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2265797213], + [78, 5, 40, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 201197260], + [105, 7, 68, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1829672226], + [106, 9, 7, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1309332345] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/private_reader.rb:670493723": [ + [6, 5, 63, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2901108034] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/promise.rb:910582": [ + [65, 7, 40, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3824424681] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/rake_module.rb:4177774778": [ + [9, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4135892607], + [13, 5, 24, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 2330715366], + [16, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063727135], + [17, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063727135] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task.rb:825529577": [ + [220, 9, 116, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3582047834], + [278, 15, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], + [278, 40, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], + [373, 5, 137, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2016900957] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task_arguments.rb:2422589739": [ + [66, 5, 63, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 2216682504] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task_manager.rb:988246897": [ + [27, 31, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], + [136, 9, 18, "Style/IdenticalConditionalBranches: Move `deps = value || []` out of the conditional.", 3582664887], + [140, 9, 18, "Style/IdenticalConditionalBranches: Move `deps = value || []` out of the conditional.", 3582664887], + [278, 22, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], + [326, 7, 35, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 402700679] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/testtask.rb:431563537": [ + [112, 48, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [121, 51, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/thread_pool.rb:12277952": [ + [48, 9, 530, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 228964421], + [51, 65, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [53, 70, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [116, 9, 48, "Style/InvertibleUnlessCondition: Prefer `if @threads.count >= @max_active_threads` over `unless @threads.count < @max_active_threads`.", 2403143961], + [118, 13, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361] + ], + "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/win32.rb:4149036273": [ + [40, 36, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240] + ], + "spec/tmp/bundler/gems/rake-13.2.1/rake.gemspec:2780653655": [ + [12, 19, 2, "Lint/Syntax: unexpected token tLSHFT\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859461], + [13, 25, 7, "Lint/Syntax: unexpected token tIDENTIFIER\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 1804902097], + [14, 15, 2, "Lint/Syntax: unexpected token kIN\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5861154], + [16, 7, 1, "Lint/Syntax: unexpected token tSTAR\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 177551], + [16, 24, 1, "Lint/Syntax: unterminated string meets end of file\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 177538] + ], + "spec/tmp/bundler/gems/rotten_egg-1.0.0/lib/rotten_egg.rb:2010666510": [ + [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 2573678312] + ], + "spec/tmp/bundler/gems/sausage-1.0.0/lib/sausage.rb:1728262677": [ + [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 619820115] + ], + "spec/tmp/bundler/gems/soda-1.0.0/lib/soda.rb:1990629979": [ + [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 198441437] + ], + "spec/tmp/bundler/gems/thor-1.3.2/bin/thor:1678810035": [ + [5, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor.rb:333295015": [ + [4, 3, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895], + [13, 7, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], + [23, 9, 16, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 580261046], + [25, 9, 16, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 580261046], + [39, 9, 32, "Style/IdenticalConditionalBranches: Move `desc usage, description, options` out of the conditional.", 4209929479], + [42, 9, 32, "Style/IdenticalConditionalBranches: Move `desc usage, description, options` out of the conditional.", 4209929479], + [60, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], + [61, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [62, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], + [83, 9, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], + [84, 9, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], + [102, 7, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], + [112, 33, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], + [114, 13, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], + [119, 7, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], + [130, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], + [131, 30, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], + [132, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], + [303, 19, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], + [303, 37, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], + [304, 22, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], + [329, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3952225397], + [334, 7, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063673473], + [359, 7, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [362, 11, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [364, 11, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [367, 7, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [429, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 288545224], + [443, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2342089118], + [458, 7, 60, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 675081132], + [469, 7, 30, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 747165948], + [478, 7, 33, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2836932844], + [482, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 288545224], + [487, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2342089118], + [555, 37, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895], + [569, 7, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], + [570, 7, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [571, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], + [572, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], + [573, 7, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], + [575, 10, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], + [575, 20, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [576, 22, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], + [581, 47, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [581, 54, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], + [581, 66, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], + [581, 83, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], + [582, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], + [582, 17, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [582, 24, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], + [582, 36, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], + [582, 53, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], + [582, 70, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], + [583, 9, 30, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 747165948], + [583, 41, 33, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2836932844], + [598, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/actions.rb:1169132954": [ + [12, 5, 84, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3488611255], + [23, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3359610630], + [28, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3225348734], + [29, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3225348734], + [238, 13, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/base.rb:1396078371": [ + [42, 50, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [143, 9, 11, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3739410329], + [152, 9, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 510344549], + [183, 9, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [187, 9, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], + [198, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], + [204, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], + [208, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], + [208, 89, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], + [209, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], + [229, 9, 21, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3536149808], + [233, 9, 21, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3536149808], + [308, 9, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4021964389], + [321, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], + [322, 32, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], + [323, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], + [425, 9, 29, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2816325805], + [434, 9, 32, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 20048093], + [481, 11, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2748649178], + [483, 11, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2748649178], + [494, 9, 9, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 941479953], + [505, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 461316431], + [506, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 461316431], + [559, 9, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1160282543], + [590, 11, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2076032070], + [592, 11, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2076032070], + [635, 60, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/core_ext/hash_with_indifferent_access.rb:1816584307": [ + [93, 7, 265, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 3153843738] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/group.rb:919076424": [ + [18, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [20, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], + [40, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2641829910], + [46, 7, 18, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1958067488], + [222, 7, 36, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 1233002216] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/invocation.rb:15277192": [ + [3, 5, 84, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3488611255], + [113, 7, 68, "Style/InvertibleUnlessCondition: Prefer `if klass > Thor::Base` over `unless klass <= Thor::Base`.", 323464394] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor.rb:445051654": [ + [6, 5, 98, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1722966001], + [10, 5, 137, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3807720162] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor/basic.rb:2990814377": [ + [6, 7, 42, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2226661248] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor/readline.rb:2639491563": [ + [4, 7, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1555432841], + [17, 23, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/argument.rb:1757849163": [ + [28, 26, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/arguments.rb:2060486072": [ + [8, 5, 220, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3264205835], + [19, 5, 88, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 64145645] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/option.rb:3720922756": [ + [45, 5, 707, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4238798220], + [153, 48, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], + [154, 118, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/options.rb:1590095627": [ + [11, 5, 417, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1097829481] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/rake_compat.rb:2680359318": [ + [23, 5, 56, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 120645003], + [24, 7, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 514624543], + [27, 5, 291, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 289349924] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/runner.rb:1283721011": [ + [11, 3, 124, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1462699376], + [15, 3, 40, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3579960], + [35, 3, 308, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 2830630606], + [56, 24, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481], + [72, 26, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481], + [227, 64, 60, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 552387362] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/shell.rb:4091723221": [ + [6, 7, 18, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 3758912994], + [12, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2772268155] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/shell/terminal.rb:3147912038": [ + [28, 11, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3528096361] + ], + "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/util.rb:1633474373": [ + [222, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4258999585] + ], + "spec/tmp/bundler/gems/waffle-1.0.0/lib/waffle.rb:2896717917": [ + [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 2356319643] + ], + "spec/tmp/bundler/specifications/thor-1.3.2.gemspec:4209767878": [ + [24, 3, 79, "Gemspec/DependencyVersion: Dependency version specification is required.", 2841802434] ] } diff --git a/.tool-versions b/.tool-versions index 59511e1d..973bb631 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.7.8 +`ruby 3.4.2 diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index b3c87042..1419e8ca 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -162,7 +162,21 @@ def #{method_name}_entry_for_dup end def indent(string) - string.strip.gsub(/^(.+)$/, ' \1') + indent_by = ENV.fetch("APPRAISAL_INDENTER", "lookahead") + if indent_by == "lookahead" + # Default indenter for Appraisal v3 + # Uses a look-ahead to indent lines that start with a "word" (as defined by RegExp) + # (optionally preceded by whitespace). + # First it finds the point where the white space ends / words starts, + # and inserts two spaces at that point, leaving any existing whitespace in place. + # In other words, retain existing indentation, and indent the line again. + string.gsub(/^(?=(\s*)\w)/, " ").rstrip + elsif indent_by == "capture" + # Original indentation regex for Appraisal < v3 + string.gsub(/^(.+)$/, ' \1').rstrip + else + string + end end def substitute_git_source(requirements) diff --git a/lib/appraisal/command.rb b/lib/appraisal/command.rb index dd29ea44..14c2718e 100644 --- a/lib/appraisal/command.rb +++ b/lib/appraisal/command.rb @@ -41,11 +41,11 @@ def ensure_bundler_is_available return if system("gem install bundler --version #{version}") puts - puts <<-ERROR.strip_heredoc - Bundler installation failed. - Please try running: - `GEM_HOME="#{ENV["GEM_HOME"]}" gem install bundler --version #{version}` - manually. + puts <<-ERROR.rstrip +Bundler installation failed. +Please try running: + `GEM_HOME="#{ENV["GEM_HOME"]}" gem install bundler --version #{version}` +manually. ERROR exit(1) end diff --git a/lib/appraisal/conditional.rb b/lib/appraisal/conditional.rb index ad2a8e1a..1056cded 100644 --- a/lib/appraisal/conditional.rb +++ b/lib/appraisal/conditional.rb @@ -11,14 +11,22 @@ def initialize(condition) end def to_s - "install_if #{@condition} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +install_if #{@condition} do +#{indent(super)} +end + OUTPUT end # :nodoc: def for_dup return unless @condition.is_a?(String) - "install_if #{@condition} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +install_if #{@condition} do +#{indent(super)} +end + OUTPUT end end end diff --git a/lib/appraisal/git.rb b/lib/appraisal/git.rb index 791429df..e7dd6aae 100644 --- a/lib/appraisal/git.rb +++ b/lib/appraisal/git.rb @@ -13,20 +13,34 @@ def initialize(source, options = {}) def to_s if @options.empty? - "git #{Utils.prefix_path(@source).inspect} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +git #{Utils.prefix_path(@source).inspect} do +#{indent(super)} +end + OUTPUT else - "git #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" \ - "#{indent(super)}\nend" + <<-OUTPUT.rstrip +git #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do +#{indent(super)} +end + OUTPUT end end # :nodoc: def for_dup if @options.empty? - "git #{@source.inspect} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +git #{@source.inspect} do +#{indent(super)} +end + OUTPUT else - "git #{@source.inspect}, #{Utils.format_string(@options)} do\n" \ - "#{indent(super)}\nend" + <<-OUTPUT.rstrip +git #{@source.inspect}, #{Utils.format_string(@options)} do +#{indent(super)} +end + OUTPUT end end end diff --git a/lib/appraisal/group.rb b/lib/appraisal/group.rb index f1f82314..6517d914 100644 --- a/lib/appraisal/group.rb +++ b/lib/appraisal/group.rb @@ -11,21 +11,21 @@ def initialize(group_names) end def to_s - formatted_output(indent(super)) + formatted_output(super) end # :nodoc: def for_dup - formatted_output(indent(super)) + formatted_output(super) end private def formatted_output(output_dependencies) - <<-OUTPUT.strip_heredoc - group #{Utils.format_arguments(@group_names)} do - #{output_dependencies} - end + <<-OUTPUT.rstrip +group #{Utils.format_arguments(@group_names)} do +#{indent(output_dependencies)} +end OUTPUT end end diff --git a/lib/appraisal/path.rb b/lib/appraisal/path.rb index c33b60c6..42be91b7 100644 --- a/lib/appraisal/path.rb +++ b/lib/appraisal/path.rb @@ -13,20 +13,34 @@ def initialize(source, options = {}) def to_s if @options.empty? - "path #{Utils.prefix_path(@source).inspect} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +path #{Utils.prefix_path(@source).inspect} do +#{indent(super)} +end + OUTPUT else - "path #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do\n" \ - "#{indent(super)}\nend" + <<-OUTPUT.rstrip +path #{Utils.prefix_path(@source).inspect}, #{Utils.format_string(@options)} do +#{indent(super)} +end" + OUTPUT end end # :nodoc: def for_dup if @options.empty? - "path #{@source.inspect} do\n#{indent(super)}\nend" + <<-OUTPUT.rstrip +path #{@source.inspect} do +#{indent(super)} +end + OUTPUT else - "path #{@source.inspect}, #{Utils.format_string(@options)} do\n" \ - "#{indent(super)}\nend" + <<-OUTPUT.rstrip +path #{@source.inspect}, #{Utils.format_string(@options)} do +#{indent(super)} +end + OUTPUT end end end diff --git a/lib/appraisal/platform.rb b/lib/appraisal/platform.rb index ae0e0849..9b8cc553 100644 --- a/lib/appraisal/platform.rb +++ b/lib/appraisal/platform.rb @@ -11,20 +11,20 @@ def initialize(platform_names) end def to_s - formatted_output(indent(super)) + formatted_output(super) end # :nodoc: def for_dup - formatted_output(indent(super)) + formatted_output(super) end private def formatted_output(output_dependencies) - <<-OUTPUT.strip + <<-OUTPUT.rstrip platforms #{Utils.format_arguments(@platform_names)} do -#{output_dependencies} +#{indent(output_dependencies)} end OUTPUT end diff --git a/lib/appraisal/source.rb b/lib/appraisal/source.rb index ebbe71e9..6c926a2d 100644 --- a/lib/appraisal/source.rb +++ b/lib/appraisal/source.rb @@ -11,20 +11,20 @@ def initialize(source) end def to_s - formatted_output(indent(super)) + formatted_output(super) end # :nodoc: def for_dup - formatted_output(indent(super)) + formatted_output(super) end private def formatted_output(output_dependencies) - <<-OUTPUT.strip + <<-OUTPUT.rstrip source #{@source.inspect} do -#{output_dependencies} +#{indent(output_dependencies)} end OUTPUT end diff --git a/lib/appraisal/utils.rb b/lib/appraisal/utils.rb index a9cf68e0..e0c455aa 100644 --- a/lib/appraisal/utils.rb +++ b/lib/appraisal/utils.rb @@ -7,6 +7,10 @@ def self.support_parallel_installation? Gem::Version.create(Bundler::VERSION) >= Gem::Version.create("1.4.0.pre.1") end + def self.support_git_local_installation? + Gem::Version.create(Bundler::VERSION) > Gem::Version.create("2.4.22") + end + # Appraisal needs to print Gemfiles in the oldest Ruby syntax that is supported by Appraisal. # Otherwise, a project would not be able to use Appraisal to test compatibility # with older versions of Ruby, which is a core use case for Appraisal. @@ -46,7 +50,7 @@ def self.format_arguments(arguments) end def self.join_parts(parts) - parts.reject(&:nil?).reject(&:empty?).join("\n\n").strip + parts.reject(&:nil?).reject(&:empty?).join("\n\n").rstrip end def self.prefix_path(path) diff --git a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb index 41e669ee..7112c55c 100644 --- a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +++ b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe "Appraisals file Bundler DSL compatibility" do - it "supports all Bundler DSL in Appraisals file" do + it "supports all Bundler DSL in Appraisals file", :git_local do build_gems %w[ bagel orange_juice @@ -16,7 +16,7 @@ ] build_git_gems %w[egg croissant pain_au_chocolat omelette] - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source 'https://rubygems.org' git_source(:custom_git_source) { |repo| "../build/\#{repo}" } ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -57,7 +57,7 @@ gem 'appraisal', :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise 'breakfast' do source 'http://some-other-source.com' ruby "1.8.7" @@ -102,7 +102,7 @@ run "bundle install --local" run "appraisal generate" - expect(content_of("gemfiles/breakfast.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/breakfast.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" @@ -130,7 +130,7 @@ gem "orange_juice" gem "omelette", :git => "../../build/omelette" gem "bacon" - + platforms :rbx do gem "ham" end @@ -139,7 +139,7 @@ platforms :ruby, :jruby do gem "milk" gem "yoghurt" - + group :lunch do gem "coffee" end @@ -161,7 +161,7 @@ end it 'supports ruby file: ".ruby-version" DSL' do - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source 'https://rubygems.org' ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -169,7 +169,7 @@ gem 'appraisal', :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise 'ruby-version' do ruby({:file => ".ruby-version"}) end @@ -178,7 +178,7 @@ run "bundle install --local" run "appraisal generate" - expect(content_of("gemfiles/ruby_version.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/ruby_version.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" diff --git a/spec/acceptance/bundle_with_custom_path_spec.rb b/spec/acceptance/bundle_with_custom_path_spec.rb index bb6fca1b..f459723c 100644 --- a/spec/acceptance/bundle_with_custom_path_spec.rb +++ b/spec/acceptance/bundle_with_custom_path_spec.rb @@ -6,7 +6,7 @@ shared_examples "gemfile dependencies are satisfied" do it "installs gems in the --path directory" do - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -18,7 +18,7 @@ end GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise "#{gem_name}" do gem '#{gem_name}' end @@ -47,7 +47,7 @@ context "when already installed in vendor/another" do before do - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" if RUBY_VERSION <= "1.9" diff --git a/spec/acceptance/bundle_without_spec.rb b/spec/acceptance/bundle_without_spec.rb index 8960e031..fbe5ad31 100644 --- a/spec/acceptance/bundle_without_spec.rb +++ b/spec/acceptance/bundle_without_spec.rb @@ -5,7 +5,7 @@ pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" build_gems %w[pancake orange_juice waffle coffee sausage soda] - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem "pancake" @@ -18,7 +18,7 @@ gem "appraisal", :path => #{PROJECT_ROOT.inspect} GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise "breakfast" do gem "waffle" diff --git a/spec/acceptance/cli/clean_spec.rb b/spec/acceptance/cli/clean_spec.rb index 164dc3f4..45742a1e 100644 --- a/spec/acceptance/cli/clean_spec.rb +++ b/spec/acceptance/cli/clean_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "CLI", "appraisal clean" do it "remove all gemfiles from gemfiles directory" do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/generate_spec.rb b/spec/acceptance/cli/generate_spec.rb index 0c7eb454..9c6fdb50 100644 --- a/spec/acceptance/cli/generate_spec.rb +++ b/spec/acceptance/cli/generate_spec.rb @@ -2,13 +2,13 @@ RSpec.describe "CLI", "appraisal generate" do it "generates the gemfiles" do - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem "appraisal", :path => "#{PROJECT_ROOT}" GEMFILE - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -22,7 +22,7 @@ expect(file("gemfiles/1.0.0.gemfile")).to be_exists expect(file("gemfiles/1.1.0.gemfile")).to be_exists - expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" diff --git a/spec/acceptance/cli/help_spec.rb b/spec/acceptance/cli/help_spec.rb index 45bc1e03..96524545 100644 --- a/spec/acceptance/cli/help_spec.rb +++ b/spec/acceptance/cli/help_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "CLI", "appraisal help" do it "prints usage along with commands, and list of appraisals" do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/install_spec.rb b/spec/acceptance/cli/install_spec.rb index f92405ce..3fad1102 100644 --- a/spec/acceptance/cli/install_spec.rb +++ b/spec/acceptance/cli/install_spec.rb @@ -8,7 +8,7 @@ end it "installs the dependencies" do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -28,7 +28,7 @@ build_gemspec add_gemspec_to_gemfile - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -39,7 +39,7 @@ expect(content_of("gemfiles/1.0.0.gemfile.lock")).not_to include(current_directory) end - it "does not relativize directory of uris in gemfile.lock" do + it "does not relativize directory of uris in gemfile.lock", :git_local do build_gemspec add_gemspec_to_gemfile @@ -47,7 +47,7 @@ uri_dummy_path = "#{current_directory}/uri_dummy" FileUtils.symlink(File.absolute_path("tmp/build/uri_dummy"), uri_dummy_path) - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'uri_dummy', git: 'file://#{uri_dummy_path}' end @@ -60,7 +60,7 @@ context "with job size", :parallel do before do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -84,7 +84,7 @@ context "with full-index", :parallel do before do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -100,7 +100,7 @@ context "with path", :parallel do before do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/list_spec.rb b/spec/acceptance/cli/list_spec.rb index e2777e17..7bf1379b 100644 --- a/spec/acceptance/cli/list_spec.rb +++ b/spec/acceptance/cli/list_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "CLI", "appraisal list" do it "prints list of appraisals" do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/cli/run_spec.rb b/spec/acceptance/cli/run_spec.rb index d0fd1ab9..19825462 100644 --- a/spec/acceptance/cli/run_spec.rb +++ b/spec/acceptance/cli/run_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "CLI appraisal (with arguments)" do before do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end @@ -18,7 +18,7 @@ end it "sets APPRAISAL_INITIALIZED environment variable" do - write_file "test.rb", <<-TEST_FILE.strip_heredoc + write_file "test.rb", <<-TEST_FILE.strip_heredoc.rstrip if ENV['APPRAISAL_INITIALIZED'] puts "Appraisal initialized!" end diff --git a/spec/acceptance/cli/update_spec.rb b/spec/acceptance/cli/update_spec.rb index be66063b..61fe1611 100644 --- a/spec/acceptance/cli/update_spec.rb +++ b/spec/acceptance/cli/update_spec.rb @@ -4,7 +4,7 @@ before do build_gem "dummy2", "1.0.0" - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise 'dummy' do gem 'dummy', '~> 1.0.0' gem 'dummy2', '~> 1.0.0' diff --git a/spec/acceptance/cli/with_no_arguments_spec.rb b/spec/acceptance/cli/with_no_arguments_spec.rb index 962a9bb1..5a5e9f4d 100644 --- a/spec/acceptance/cli/with_no_arguments_spec.rb +++ b/spec/acceptance/cli/with_no_arguments_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "CLI appraisal (with no arguments)" do it "runs install command" do - build_appraisal_file <<-APPRAISAL.strip_heredoc + build_appraisal_file <<-APPRAISAL.strip_heredoc.rstrip appraise '1.0.0' do gem 'dummy', '1.0.0' end diff --git a/spec/acceptance/gemfile_dsl_compatibility_spec.rb b/spec/acceptance/gemfile_dsl_compatibility_spec.rb index c2987251..6e802218 100644 --- a/spec/acceptance/gemfile_dsl_compatibility_spec.rb +++ b/spec/acceptance/gemfile_dsl_compatibility_spec.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true RSpec.describe "Gemfile DSL compatibility" do - it "supports all Bundler DSL in Gemfile" do + it "supports all Bundler DSL in Gemfile", :git_local do build_gems %w[bacon orange_juice waffle] build_git_gem "egg" build_gemspec - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" ruby "#{RUBY_VERSION}#{ruby_dev_append}" @@ -31,7 +31,7 @@ gemspec GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise "japanese" do gem "rice" gem "miso_soup" @@ -45,7 +45,7 @@ run "bundle install --local" run "appraisal generate" - expect(content_of("gemfiles/japanese.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/japanese.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" @@ -75,7 +75,7 @@ gemspec :path => "../" GEMFILE - expect(content_of("gemfiles/english.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/english.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" @@ -110,14 +110,14 @@ build_gem "bacon", "1.1.0" build_gem "bacon", "1.2.0" - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem "appraisal", :path => #{PROJECT_ROOT.inspect} gem "bacon", "1.2.0" GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise "1.0.0" do gem "bacon", "1.0.0" end @@ -143,7 +143,7 @@ build_gem "bacon", "1.0.0" build_gemspec - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem "appraisal", :path => #{PROJECT_ROOT.inspect} @@ -153,7 +153,7 @@ end GEMFILE - build_appraisal_file <<-APPRAISALS.strip_heredoc + build_appraisal_file <<-APPRAISALS.strip_heredoc.rstrip appraise "1.0.0" do gem "bacon", "1.0.0" end @@ -162,7 +162,7 @@ run "bundle install --local" run "appraisal generate" - expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc + expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc.rstrip # This file was generated by Appraisal source "https://rubygems.org" diff --git a/spec/acceptance/gemspec_spec.rb b/spec/acceptance/gemspec_spec.rb index 034ec1e4..1db139cc 100644 --- a/spec/acceptance/gemspec_spec.rb +++ b/spec/acceptance/gemspec_spec.rb @@ -9,7 +9,7 @@ it "supports gemspec syntax with default options" do build_gemspec - write_file "Gemfile", <<-GEMFILE.strip_heredoc + write_file "Gemfile", <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -27,7 +27,7 @@ it "supports gemspec syntax with path option" do build_gemspec "specdir" - write_file "Gemfile", <<-GEMFILE.strip_heredoc + write_file "Gemfile", <<-GEMFILE.strip_heredoc.rstrip source "https://rubygems.org" gem 'appraisal', :path => #{PROJECT_ROOT.inspect} @@ -43,7 +43,7 @@ end def build_appraisal_file - appraisals = <<-APPRAISALS.strip_heredoc + appraisals = <<-APPRAISALS.strip_heredoc.rstrip appraise 'stock' do gem 'rake' end @@ -52,7 +52,7 @@ def build_appraisal_file end def build_rakefile - write_file "Rakefile", <<-RAKEFILE.strip_heredoc + write_file "Rakefile", <<-RAKEFILE.strip_heredoc.rstrip require 'rubygems' require 'bundler/setup' require 'appraisal' @@ -71,7 +71,7 @@ def build_gemspec(path = ".") nil end - write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC.strip_heredoc + write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC.strip_heredoc.rstrip Gem::Specification.new do |s| s.name = 'gemspec_project' s.version = '0.1' diff --git a/spec/appraisal/appraisal_spec.rb b/spec/appraisal/appraisal_spec.rb index 545ec8cf..4a694411 100644 --- a/spec/appraisal/appraisal_spec.rb +++ b/spec/appraisal/appraisal_spec.rb @@ -45,7 +45,7 @@ end it "generates a gemfile with multiple lines of custom heading" do - heading = <<-HEADING.strip_heredoc + heading = <<-HEADING.strip_heredoc.rstrip frozen_string_literal: true\n This file was generated with a custom heading! HEADING @@ -56,7 +56,7 @@ appraisal.write_gemfile - expected_output = <<-HEADING.strip_heredoc + expected_output = <<-HEADING.strip_heredoc.rstrip # frozen_string_literal: true\n # This file was generated with a custom heading! HEADING diff --git a/spec/appraisal/customize_spec.rb b/spec/appraisal/customize_spec.rb index d3687a13..d833f8c4 100644 --- a/spec/appraisal/customize_spec.rb +++ b/spec/appraisal/customize_spec.rb @@ -8,7 +8,7 @@ let(:appraisal) { Appraisal::Appraisal.new("test", "Gemfile") } let(:single_line_heading) { "This file was generated with a custom heading!" } let(:multi_line_heading) do - <<-HEADING.strip_heredoc + <<-HEADING.strip_heredoc.rstrip frozen_string_literal: true This file was generated with a custom heading! diff --git a/spec/appraisal/dependency_list_spec.rb b/spec/appraisal/dependency_list_spec.rb index 6d2b4def..a9fac337 100644 --- a/spec/appraisal/dependency_list_spec.rb +++ b/spec/appraisal/dependency_list_spec.rb @@ -17,7 +17,7 @@ dependency_list.add("rails", ["4.1.4"]) dependency_list.add("bundler", ["1.7.2"]) - expect(dependency_list.to_s).to eq <<-GEMS.strip_heredoc + expect(dependency_list.to_s).to eq <<-GEMS.strip_heredoc.rstrip gem "rails", "4.1.4" gem "bundler", "1.7.2" GEMS diff --git a/spec/appraisal/gemfile_spec.rb b/spec/appraisal/gemfile_spec.rb index 51b967ba..d15f815d 100644 --- a/spec/appraisal/gemfile_spec.rb +++ b/spec/appraisal/gemfile_spec.rb @@ -47,7 +47,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip group :development, :test do gem "one" end @@ -69,7 +69,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip group :development, :test do git "git://example.com/repo.git" do gem "two" @@ -93,7 +93,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip platforms :jruby do gem "one" end @@ -115,7 +115,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip platforms :jruby do git "git://example.com/repo.git" do gem "two" @@ -139,7 +139,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "git://example.com/repo.git" do gem "one" end @@ -161,7 +161,7 @@ end end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "git://example.com/repo.git" do path "../.." do gem "three" @@ -185,7 +185,7 @@ gem "one" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip path "../../path" do gem "one" end @@ -195,6 +195,7 @@ it "supports nested DSL within path syntax" do gemfile = described_class.new + # TODO: Small bug: order in a Gemfile can be important for certain gems, but order is not preserved. gemfile.path "../path" do group :development, :test do gem "one" @@ -206,22 +207,22 @@ gem "three" end end - - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + fixture_gemfile = <<-GEMFILE.strip_heredoc.rstrip path "../../path" do git "git://example.com/repo.git" do gem "three" end - + group :development, :test do gem "one" end - + platforms :jruby do gem "two" end end GEMFILE + expect(gemfile.to_s).to eq fixture_gemfile end context "excess new line" do @@ -317,7 +318,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip path "../" do gem "bacon" end @@ -331,7 +332,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip path "../../bacon" do gem "bacon" end @@ -345,7 +346,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip path "/tmp" do gem "bacon" end @@ -361,7 +362,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "../" do gem "bacon" end @@ -375,7 +376,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "../../bacon" do gem "bacon" end @@ -389,7 +390,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "/tmp" do gem "bacon" end @@ -403,7 +404,7 @@ gem "bacon" end - expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc + expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.rstrip git "git@github.com:bacon/bacon.git" do gem "bacon" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d9313f5c..8eb8a448 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,7 +22,6 @@ require "support/acceptance_test_helpers" require "support/stream_helpers" - PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")).freeze TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "bundler") TMP_GEM_BUILD = File.join(PROJECT_ROOT, "tmp", "build") diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index 6db7fbc1..c20ba153 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -29,6 +29,12 @@ module AcceptanceTestHelpers end end + before :git_local => true do + unless Appraisal::Utils.support_git_local_installation? + pending "This Bundler version does not support sourcing gems from git repos on local filesystem." + end + end + before do cleanup_artifacts save_environment_variables @@ -48,7 +54,7 @@ module AcceptanceTestHelpers # Unfortunately, there is no ENV variable that has access to the "dev" concept directly. # Perhaps the best we can do is parse RUBY_DESCRIPTION? # > RUBY_DESCRIPTION - # "ruby 3.5.0dev (2025-02-20T18:14:37Z master b2cf48f406) +PRISM [arm64-darwin24]" + # "ruby 3.5.0dev (2025-02-20T18:14:37Z ... etc) def ruby_dev_append RUBY_DESCRIPTION.include?("dev") ? "-dev" : "" end @@ -92,7 +98,7 @@ def add_gemspec_to_gemfile end def build_gemspec - write_file "stage.gemspec", <<-GEMSPEC.strip_heredoc + write_file "stage.gemspec", <<-GEMSPEC.strip_heredoc.rstrip Gem::Specification.new do |s| s.name = 'stage' s.version = '0.1' @@ -105,7 +111,7 @@ def build_gemspec def content_of(path) file(path).read.tap do |content| content.gsub!(/(\S+): /, ':\\1 => ') - end + end.strip end def file(path) @@ -142,7 +148,7 @@ def ensure_bundler_is_available return unless $?.exitstatus != 0 - puts <<-WARNING.strip_heredoc + puts <<-WARNING.strip_heredoc.rstrip Reinstall Bundler to #{TMP_GEM_ROOT} as `BUNDLE_DISABLE_SHARED_GEMS` is enabled. WARNING @@ -152,7 +158,7 @@ def ensure_bundler_is_available end def build_default_gemfile - build_gemfile <<-GEMFILE.strip_heredoc + build_gemfile <<-GEMFILE.strip_heredoc.rstrip source 'https://rubygems.org' gem 'appraisal', :path => '#{PROJECT_ROOT}' @@ -180,7 +186,7 @@ def run(command, raise_on_error = true) puts output if ENV["VERBOSE"] if raise_on_error && exitstatus != 0 - raise <<-ERROR_MESSAGE.strip_heredoc + raise <<-ERROR_MESSAGE.strip_heredoc.rstrip Command #{command.inspect} exited with status #{exitstatus}. Output: #{output.gsub(/^/, " ")} ERROR_MESSAGE diff --git a/spec/support/dependency_helpers.rb b/spec/support/dependency_helpers.rb index 6dfbd3a8..c3ff63bc 100644 --- a/spec/support/dependency_helpers.rb +++ b/spec/support/dependency_helpers.rb @@ -1,29 +1,55 @@ # frozen_string_literal: true module DependencyHelpers - def build_gem(gem_name, version = "1.0.0") + DEFAULT_OPTS = { + :skip_build => false, + :skip_install => false, + }.freeze + # @param opts [String, Hash] version string, or options hash + # @option :skip_build [Boolean, nil] skip running gem build, default is false + # @option :skip_install [Boolean, nil] skip running gem install, default is value of skip_build + # @option :version [String, nil] version for the gem, default is "1.0.0" + # @return void + def build_gem(gem_name, opts = {}) ENV["GEM_HOME"] = TMP_GEM_ROOT - + version = "1.0.0" # default + + if opts.respond_to?(:has_key?) + version = opts[:version] if opts.has_key?(:version) + opts[:skip_build] = false unless opts.has_key?(:skip_build) + opts[:skip_install] = opts[:skip_build] unless opts.has_key?(:skip_install) + else + version = case opts + when String then opts + when nil then "1.0.0" + else + raise ArgumentError, "Unexpected value for opts (must be version string or options Hash): #{opts}" + end + opts = DEFAULT_OPTS.dup + end + skip_build = opts[:skip_build] + skip_install = opts[:skip_install] return if File.exist? "#{TMP_GEM_ROOT}/gems/#{gem_name}-#{version}" - FileUtils.mkdir_p "#{TMP_GEM_BUILD}/#{gem_name}/lib" + build_dir = "#{TMP_GEM_BUILD}/#{gem_name}" + FileUtils.mkdir_p "#{build_dir}/lib" - FileUtils.cd "#{TMP_GEM_BUILD}/#{gem_name}" do + FileUtils.cd build_dir do gemspec = "#{gem_name}.gemspec" lib_file = "lib/#{gem_name}.rb" File.open gemspec, "w" do |file| - file.puts <<-GEMSPEC.strip_heredoc - Gem::Specification.new do |s| - s.name = #{gem_name.inspect} - s.version = #{version.inspect} - s.authors = 'Mr. Smith' - s.summary = 'summary' - s.files = #{lib_file.inspect} - s.license = 'MIT' - s.homepage = 'http://github.com/thoughtbot/#{gem_name}' - s.required_ruby_version = '>= 2.3.0' - end + file.puts <<-GEMSPEC.strip_heredoc.rstrip + Gem::Specification.new do |s| + s.name = #{gem_name.inspect} + s.version = #{version.inspect} + s.authors = 'Mr. Smith' + s.summary = 'summary' + s.files = #{lib_file.inspect} + s.license = 'MIT' + s.homepage = 'http://github.com/thoughtbot/#{gem_name}' + s.required_ruby_version = '>= 1.8.7' + end GEMSPEC end @@ -33,14 +59,23 @@ def build_gem(gem_name, version = "1.0.0") redirect = ENV["VERBOSE"] ? "" : "2>&1" - puts "building gem: #{gem_name} #{version}" if ENV["VERBOSE"] - %x(gem build #{gemspec} #{redirect}) + # Caller may turn it into a git repo here + yield build_dir, redirect if block_given? - puts "installing gem: #{gem_name} #{version}" if ENV["VERBOSE"] - %x(gem install -lN #{gem_name}-#{version}.gem -v #{version} #{redirect}) + unless skip_build + puts "building gem: #{gem_name} #{version}" if ENV["VERBOSE"] + %x(gem build #{gemspec} #{redirect}) + end + + unless skip_install + puts "installing gem: #{gem_name} #{version}" if ENV["VERBOSE"] + %x(gem install -lN #{gem_name}-#{version}.gem -v #{version} #{redirect}) + end puts "" if ENV["VERBOSE"] end + + nil end def build_gems(gems) @@ -48,23 +83,24 @@ def build_gems(gems) end def build_git_gem(gem_name, version = "1.0.0") - puts "building git gem: #{gem_name} #{version}" if ENV["VERBOSE"] - build_gem gem_name, version - - Dir.chdir "#{TMP_GEM_BUILD}/#{gem_name}" do - %x(git init . --initial-branch=master) - %x(git config user.email "appraisal@thoughtbot.com") - %x(git config user.name "Appraisal") - %x(git config commit.gpgsign false) - %x(git add .) - %x(git commit --all --no-verify --message "initial commit") + build_gem(gem_name, {:version => version, :skip_build => true, :skip_install => true}) do |_gem_dir, redirect| + # At this point we have a gem file structure on disk inside `_gem_dir`. + # Since we are already inside _gem_dir, we do not need to chdir. + puts "initializing git repo for gem: #{gem_name} #{version}" if ENV["VERBOSE"] + # Set up our clone of the bare git repository, and push our gem into it + %x(git init . --initial-branch=main #{redirect}) + %x(git config user.email "appraisal@thoughtbot.com" #{redirect}) + %x(git config user.name "Appraisal" #{redirect}) + %x(git config commit.gpgsign false #{redirect}) + %x(git add . #{redirect}) + %x(git commit --all --no-verify --message "initial commit" #{redirect}) end # Cleanup Bundler cache path manually for now git_cache_path = File.join(ENV["GEM_HOME"], "cache", "bundler", "git") Dir[File.join(git_cache_path, "#{gem_name}-*")].each do |path| - puts "deleting: #{path}" if ENV["VERBOSE"] + puts "cleaning up bundler git cache: #{path}" if ENV["VERBOSE"] FileUtils.rm_r(path) end end From 4ec2725663185ca7c70f956a17b3e401300a283a Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 21 Feb 2025 18:21:25 +0700 Subject: [PATCH 09/29] =?UTF-8?q?=F0=9F=91=B7=20add=20Ruby=203.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f6743f86..6cbf79e8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,7 @@ jobs: fail-fast: false matrix: ruby: + - '3.4' - '3.3' - '3.2' - '3.1' From 594690df38ab344c0ab0e6eb6ef1c36e03f578dd Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 01:41:17 +0700 Subject: [PATCH 10/29] =?UTF-8?q?=F0=9F=90=9B=20Fix=20inconsistent=20inden?= =?UTF-8?q?tation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tool-versions | 1 + lib/appraisal/bundler_dsl.rb | 15 +++++++++------ spec/appraisal/gemfile_spec.rb | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.tool-versions b/.tool-versions index 973bb631..0e646452 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ `ruby 3.4.2 +ruby 3.3.7 diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index 1419e8ca..0881c4a7 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -165,12 +165,15 @@ def indent(string) indent_by = ENV.fetch("APPRAISAL_INDENTER", "lookahead") if indent_by == "lookahead" # Default indenter for Appraisal v3 - # Uses a look-ahead to indent lines that start with a "word" (as defined by RegExp) - # (optionally preceded by whitespace). - # First it finds the point where the white space ends / words starts, - # and inserts two spaces at that point, leaving any existing whitespace in place. - # In other words, retain existing indentation, and indent the line again. - string.gsub(/^(?=(\s*)\w)/, " ").rstrip + # Uses a look-behind to indent lines are more than just empty space. + # In other words, retain existing indentation, and indent the line again, but not on empty lines. + string. + # NOTES: + # (?![\r\n]) - Negative Look Behind which requires that the following pattern, + # which is (\s*) in this case, *not* be followed by a new line character + # (\s*) - Captures whitespace at beginning of the line + gsub(/^(?![\r\n])(\s*)/, ' \0'). + rstrip elsif indent_by == "capture" # Original indentation regex for Appraisal < v3 string.gsub(/^(.+)$/, ' \1').rstrip diff --git a/spec/appraisal/gemfile_spec.rb b/spec/appraisal/gemfile_spec.rb index d15f815d..07c02f6f 100644 --- a/spec/appraisal/gemfile_spec.rb +++ b/spec/appraisal/gemfile_spec.rb @@ -212,11 +212,11 @@ git "git://example.com/repo.git" do gem "three" end - + group :development, :test do gem "one" end - + platforms :jruby do gem "two" end From 386ddb679796ababc317356ddb5ff1d64ff4c83f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 01:42:33 +0700 Subject: [PATCH 11/29] =?UTF-8?q?=F0=9F=93=9D=20Documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal/bundler_dsl.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index 0881c4a7..e39d0356 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -172,6 +172,7 @@ def indent(string) # (?![\r\n]) - Negative Look Behind which requires that the following pattern, # which is (\s*) in this case, *not* be followed by a new line character # (\s*) - Captures whitespace at beginning of the line + # Learn more here: https://learnbyexample.github.io/Ruby_Regexp/lookarounds.html gsub(/^(?![\r\n])(\s*)/, ' \0'). rstrip elsif indent_by == "capture" From 7a2ec8e62b5d0bfd66161dd0e48f4d9c8a3eed5e Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 01:49:49 +0700 Subject: [PATCH 12/29] =?UTF-8?q?=F0=9F=92=9A=20Fix=20inconsistent=20inden?= =?UTF-8?q?tation=20in=20spec=20fixtures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tool-versions | 3 +-- .../appraisals_file_bundler_dsl_compatibility_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.tool-versions b/.tool-versions index 0e646452..ae5ecdb2 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1 @@ -`ruby 3.4.2 -ruby 3.3.7 +ruby 3.4.2 diff --git a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb index 7112c55c..084b9984 100644 --- a/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +++ b/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb @@ -130,7 +130,7 @@ gem "orange_juice" gem "omelette", :git => "../../build/omelette" gem "bacon" - + platforms :rbx do gem "ham" end @@ -139,7 +139,7 @@ platforms :ruby, :jruby do gem "milk" gem "yoghurt" - + group :lunch do gem "coffee" end From f7225612a64adb3fb9d55c49d665db9d37add98f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 01:53:46 +0700 Subject: [PATCH 13/29] =?UTF-8?q?=F0=9F=9A=A8=20Lint=20lock=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop_gradual.lock | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index 9629a5ec..0ea364bf 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -18,14 +18,15 @@ [17, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720], [21, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929] ], - "lib/appraisal/utils.rb:3242656341": [ + "lib/appraisal/utils.rb:3706894031": [ [6, 5, 129, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 733338411], - [13, 5, 354, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 119295155], - [35, 5, 152, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1306460482], - [42, 5, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1120325158], - [48, 5, 98, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 714993131], - [52, 5, 244, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1461524090], - [61, 5, 111, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1909626476] + [10, 5, 124, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 222857520], + [17, 5, 354, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 119295155], + [39, 5, 152, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1306460482], + [46, 5, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1120325158], + [52, 5, 98, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 714993131], + [56, 5, 244, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1461524090], + [65, 5, 111, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1909626476] ], "spec/acceptance/cli/clean_spec.rb:1564995421": [ [3, 23, 17, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 1606893221] @@ -36,7 +37,7 @@ "spec/acceptance/cli/help_spec.rb:3569358941": [ [3, 23, 16, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 2148351217] ], - "spec/acceptance/cli/install_spec.rb:1306756550": [ + "spec/acceptance/cli/install_spec.rb:3249736824": [ [3, 23, 19, "RSpec/DescribeMethod: The second argument to describe should be the method being tested. '#instance' or '.class'.", 3284642881] ], "spec/acceptance/cli/list_spec.rb:36921834": [ @@ -86,7 +87,7 @@ [68, 7, 85, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [65, 66, 67].", 3874694796], [72, 7, 7, "RSpec/NamedSubject: Name your test subject if you need to reference it explicitly.", 1892732441] ], - "spec/appraisal/gemfile_spec.rb:2644921119": [ + "spec/appraisal/gemfile_spec.rb:3969538335": [ [228, 11, 17, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3608128140], [229, 13, 13, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 420381022], [236, 13, 15, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3511037132], @@ -102,8 +103,8 @@ "spec/appraisal/utils_spec.rb:2286225770": [ [62, 17, 58, "RSpec/VerifiedDoubles: Prefer using verifying doubles over normal doubles.", 1573223692] ], - "spec/support/acceptance_test_helpers.rb:293636491": [ - [143, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264] + "spec/support/acceptance_test_helpers.rb:3072478660": [ + [149, 5, 32, "Style/InvertibleUnlessCondition: Prefer `if $?.exitstatus == 0` over `unless $?.exitstatus != 0`.", 4187517264] ], "spec/support/stream_helpers.rb:3654818709": [ [10, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] From 12002dac9760519072a17b3f9c2df213286fb98b Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 01:54:47 +0700 Subject: [PATCH 14/29] =?UTF-8?q?=F0=9F=91=B7=20Add=20Ruby=202.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cbf79e8..17c5d310 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,6 +23,7 @@ jobs: - '3.1' - '3.0' - '2.7' + - '2.6' - 'head' - jruby - jruby-head From df71fbbc79904e6d19c36c1dba87cc212fdd6b14 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 05:12:09 +0700 Subject: [PATCH 15/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Lookahead=20!=3D=20L?= =?UTF-8?q?ookbehind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal/bundler_dsl.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index e39d0356..f0c38ef5 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -162,10 +162,10 @@ def #{method_name}_entry_for_dup end def indent(string) - indent_by = ENV.fetch("APPRAISAL_INDENTER", "lookahead") - if indent_by == "lookahead" + indent_by = ENV.fetch("APPRAISAL_INDENTER", "lookaround") + if indent_by == "lookaround" # Default indenter for Appraisal v3 - # Uses a look-behind to indent lines are more than just empty space. + # Uses a "look-around" of the "look-behind" variety to indent lines are more than just empty space. # In other words, retain existing indentation, and indent the line again, but not on empty lines. string. # NOTES: From 5fcfb4352ed8e53f66986c697230fd18e9dd6db3 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 05:22:17 +0700 Subject: [PATCH 16/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20typo=20in=20do?= =?UTF-8?q?cumentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal/bundler_dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index f0c38ef5..cf52d422 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -165,7 +165,7 @@ def indent(string) indent_by = ENV.fetch("APPRAISAL_INDENTER", "lookaround") if indent_by == "lookaround" # Default indenter for Appraisal v3 - # Uses a "look-around" of the "look-behind" variety to indent lines are more than just empty space. + # Uses a "look-around" of the "look-behind" variety to indent lines that are more than just empty space. # In other words, retain existing indentation, and indent the line again, but not on empty lines. string. # NOTES: From 975ded0af5ff67b984393166290b34d64b322d72 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Sat, 22 Feb 2025 05:23:38 +0700 Subject: [PATCH 17/29] =?UTF-8?q?=F0=9F=91=B7=20Remove=20Ruby=202.6=20from?= =?UTF-8?q?=20CI=20(to=20be=20added=20back=20in=20another=20PR)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17c5d310..6cbf79e8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,6 @@ jobs: - '3.1' - '3.0' - '2.7' - - '2.6' - 'head' - jruby - jruby-head From 46d71e67e523e8add8d8e55e879df89aaa1927c9 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Mon, 3 Feb 2025 22:12:21 +0700 Subject: [PATCH 18/29] =?UTF-8?q?=F0=9F=93=9D=20Documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d90a1616..eecd1d1c 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gemspec ruby_version = Gem::Version.new(RUBY_VERSION) platform :mri do - # Debugging + # Debugging - Ensure ENV["DEBUG"] == "true" to use debuggers within spec suite if ruby_version < Gem::Version.new("2.7") # Use byebug in code gem "byebug", ">= 11" From c07c0c9e336e277d6a5d2e16cac7bc518319d74c Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:13:38 +0700 Subject: [PATCH 19/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=201.8=20compat:=20Rep?= =?UTF-8?q?lace=20=5F=5Fdir=5F=5F=20with=20File.dirname(=5F=5FFILE=5F=5F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ .rubocop_gradual.lock | 8 ++------ .tool-versions | 2 +- appraisal.gemspec | 11 ++++++----- bin/bundle | 2 +- bin/rspec | 4 ++-- spec/acceptance/bundle_without_spec.rb | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index acc12f06..46fa9b6b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ pkg Gemfile.lock .bundle .DS_Store + +spec/tmp diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index 0ea364bf..4b32d2d7 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -1,5 +1,5 @@ { - "Gemfile:2720967286": [ + "Gemfile:3872962921": [ [26, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], [28, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], [30, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] @@ -294,11 +294,7 @@ [40, 36, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240] ], "spec/tmp/bundler/gems/rake-13.2.1/rake.gemspec:2780653655": [ - [12, 19, 2, "Lint/Syntax: unexpected token tLSHFT\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859461], - [13, 25, 7, "Lint/Syntax: unexpected token tIDENTIFIER\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 1804902097], - [14, 15, 2, "Lint/Syntax: unexpected token kIN\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5861154], - [16, 7, 1, "Lint/Syntax: unexpected token tSTAR\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 177551], - [16, 24, 1, "Lint/Syntax: unterminated string meets end of file\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 177538] + [12, 19, 2, "Lint/Syntax: unexpected token tLSHFT\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859461] ], "spec/tmp/bundler/gems/rotten_egg-1.0.0/lib/rotten_egg.rb:2010666510": [ [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 2573678312] diff --git a/.tool-versions b/.tool-versions index ae5ecdb2..aba173c5 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.4.2 +ruby truffleruby-24.1.2 diff --git a/appraisal.gemspec b/appraisal.gemspec index 6a037762..67da5627 100644 --- a/appraisal.gemspec +++ b/appraisal.gemspec @@ -3,7 +3,8 @@ # TODO: Switch to require_relative once support for Ruby < 2 is dropped. # require_relative "lib/appraisal/version" -$:.push(File.expand_path("lib", __dir__)) +lib = File.expand_path("../lib", __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "appraisal/version" Gem::Specification.new do |s| @@ -42,10 +43,10 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 1.8.7" - s.add_runtime_dependency("bundler", ">= 1.17.3") # Last version supporting Ruby 1.8.7 - s.add_runtime_dependency("rake", ">= 10") # Last version supporting Ruby 1.8.7 - s.add_runtime_dependency("thor", ">= 0.14.0") + s.add_runtime_dependency("bundler", ">= 1.17.3") # Last version supporting Ruby 1.8.7 + s.add_runtime_dependency("rake", ">= 10") # Last version supporting Ruby 1.8.7 + s.add_runtime_dependency("thor", ">= 0.14") # Last version supporting Ruby 1.8.7 && Rails 3 s.add_development_dependency("activesupport", ">= 3.2.21") - s.add_development_dependency("rspec", "~> 3.0") + s.add_development_dependency("rspec", "~> 3.13") end diff --git a/bin/bundle b/bin/bundle index 8f20a586..fcf376ea 100755 --- a/bin/bundle +++ b/bin/bundle @@ -41,7 +41,7 @@ m = Module.new do gemfile = ENV["BUNDLE_GEMFILE"] return gemfile if gemfile && !gemfile.empty? - File.expand_path("../Gemfile", __dir__) + File.expand_path("../Gemfile", File.dirname(__FILE__)) end def lockfile diff --git a/bin/rspec b/bin/rspec index cb53ebe5..d6b5fc6e 100755 --- a/bin/rspec +++ b/bin/rspec @@ -8,9 +8,9 @@ # this file is here to facilitate running it. # -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", File.dirname(__FILE__)) -bundle_binstub = File.expand_path("bundle", __dir__) +bundle_binstub = File.expand_path("bundle", File.dirname(__FILE__)) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") diff --git a/spec/acceptance/bundle_without_spec.rb b/spec/acceptance/bundle_without_spec.rb index fbe5ad31..4194071e 100644 --- a/spec/acceptance/bundle_without_spec.rb +++ b/spec/acceptance/bundle_without_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "Bundle without group" do it "config set --local without group is honored by Bundler" do - pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" + # pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" build_gems %w[pancake orange_juice waffle coffee sausage soda] build_gemfile <<-GEMFILE.strip_heredoc.rstrip From 1ceb8ab5eac363b905c5026dbba5d9145a031590 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:17:23 +0700 Subject: [PATCH 20/29] =?UTF-8?q?=F0=9F=9A=A8=20Lint=20lock=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop_gradual.lock | 364 +----------------------------------------- 1 file changed, 1 insertion(+), 363 deletions(-) diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index 4b32d2d7..fc654a0e 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -4,7 +4,7 @@ [28, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], [30, 3, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] ], - "bin/bundle:3123891436": [ + "bin/bundle:41466308": [ [66, 5, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2485198147] ], "lib/appraisal/appraisal_file.rb:3486777149": [ @@ -108,367 +108,5 @@ ], "spec/support/stream_helpers.rb:3654818709": [ [10, 17, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787] - ], - "spec/tmp/build/bagel/lib/bagel.rb:817034159": [ - [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 93522089] - ], - "spec/tmp/build/coffee/lib/coffee.rb:3015295950": [ - [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 1715453096] - ], - "spec/tmp/build/croissant/lib/croissant.rb:4104237646": [ - [1, 1, 18, "Style/GlobalVars: Do not introduce global variables.", 2226371368] - ], - "spec/tmp/build/dummy/lib/dummy.rb:1807990539": [ - [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] - ], - "spec/tmp/build/egg/lib/egg.rb:3130854087": [ - [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 4028848065] - ], - "spec/tmp/build/ham/lib/ham.rb:557050406": [ - [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 1287500928] - ], - "spec/tmp/build/mayonnaise/lib/mayonnaise.rb:604109062": [ - [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 3499390688] - ], - "spec/tmp/build/milk/lib/milk.rb:2694353217": [ - [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 3069591303] - ], - "spec/tmp/build/omelette/lib/omelette.rb:3378185993": [ - [1, 1, 17, "Style/GlobalVars: Do not introduce global variables.", 576262095] - ], - "spec/tmp/build/orange_juice/lib/orange_juice.rb:3578149981": [ - [1, 1, 21, "Style/GlobalVars: Do not introduce global variables.", 1923934619] - ], - "spec/tmp/build/pain_au_chocolat/lib/pain_au_chocolat.rb:2551039889": [ - [1, 1, 25, "Style/GlobalVars: Do not introduce global variables.", 2391071575] - ], - "spec/tmp/build/pancake/lib/pancake.rb:284512849": [ - [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 451124759] - ], - "spec/tmp/build/rotten_egg/lib/rotten_egg.rb:2010666510": [ - [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 2573678312] - ], - "spec/tmp/build/sausage/lib/sausage.rb:1728262677": [ - [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 619820115] - ], - "spec/tmp/build/soda/lib/soda.rb:1990629979": [ - [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 198441437] - ], - "spec/tmp/build/waffle/lib/waffle.rb:2896717917": [ - [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 2356319643] - ], - "spec/tmp/bundler/bin/appraisal:662174372": [ - [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] - ], - "spec/tmp/bundler/bin/rake:3146010916": [ - [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] - ], - "spec/tmp/bundler/bin/thor:4227855012": [ - [18, 10, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] - ], - "spec/tmp/bundler/gems/bagel-1.0.0/lib/bagel.rb:817034159": [ - [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 93522089] - ], - "spec/tmp/bundler/gems/coffee-1.0.0/lib/coffee.rb:3015295950": [ - [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 1715453096] - ], - "spec/tmp/bundler/gems/dummy-1.0.0/lib/dummy.rb:1804502538": [ - [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] - ], - "spec/tmp/bundler/gems/dummy-1.1.0/lib/dummy.rb:1807990539": [ - [1, 1, 14, "Style/GlobalVars: Do not introduce global variables.", 2877655148] - ], - "spec/tmp/bundler/gems/ham-1.0.0/lib/ham.rb:557050406": [ - [1, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 1287500928] - ], - "spec/tmp/bundler/gems/mayonnaise-1.0.0/lib/mayonnaise.rb:604109062": [ - [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 3499390688] - ], - "spec/tmp/bundler/gems/milk-1.0.0/lib/milk.rb:2694353217": [ - [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 3069591303] - ], - "spec/tmp/bundler/gems/orange_juice-1.0.0/lib/orange_juice.rb:3578149981": [ - [1, 1, 21, "Style/GlobalVars: Do not introduce global variables.", 1923934619] - ], - "spec/tmp/bundler/gems/pancake-1.0.0/lib/pancake.rb:284512849": [ - [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 451124759] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake.rb:3015112320": [ - [64, 1, 6, "Style/GlobalVars: Do not introduce global variables.", 3075757472] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/application.rb:3305321773": [ - [63, 21, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952], - [113, 13, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163], - [222, 11, 5, "Lint/Loop: Use `Kernel#loop` with `break` rather than `begin/end/until`(or `while`).", 191284826], - [236, 5, 122, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3552754902], - [305, 65, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [306, 50, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [514, 15, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], - [523, 20, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], - [530, 40, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [532, 30, 4, "Security/Eval: The use of `eval` is a serious security risk.", 2087429787], - [537, 78, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [553, 40, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [608, 59, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [638, 54, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [647, 66, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [656, 53, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [664, 60, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [671, 62, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [672, 46, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [681, 71, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [798, 24, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240], - [889, 16, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], - [895, 20, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], - [895, 33, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/backtrace.rb:2947413644": [ - [16, 43, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], - [20, 5, 182, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 684235907] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/clean.rb:597197225": [ - [47, 18, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/cpu_counter.rb:114869078": [ - [7, 5, 51, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1633217579] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/ext/core.rb:37720573": [ - [21, 71, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/file_utils.rb:1092133475": [ - [67, 68, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/file_utils_ext.rb:1080867503": [ - [15, 7, 42, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 598600538] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/invocation_chain.rb:2990720762": [ - [27, 5, 73, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 669377266] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/linked_list.rb:3208307164": [ - [59, 5, 439, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3263738083], - [73, 5, 55, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2265797213], - [78, 5, 40, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 201197260], - [105, 7, 68, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1829672226], - [106, 9, 7, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1309332345] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/private_reader.rb:670493723": [ - [6, 5, 63, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2901108034] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/promise.rb:910582": [ - [65, 7, 40, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3824424681] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/rake_module.rb:4177774778": [ - [9, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4135892607], - [13, 5, 24, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 2330715366], - [16, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063727135], - [17, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063727135] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task.rb:825529577": [ - [220, 9, 116, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 3582047834], - [278, 15, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], - [278, 40, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], - [373, 5, 137, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2016900957] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task_arguments.rb:2422589739": [ - [66, 5, 63, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 2216682504] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/task_manager.rb:988246897": [ - [27, 31, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806], - [136, 9, 18, "Style/IdenticalConditionalBranches: Move `deps = value || []` out of the conditional.", 3582664887], - [140, 9, 18, "Style/IdenticalConditionalBranches: Move `deps = value || []` out of the conditional.", 3582664887], - [278, 22, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560], - [326, 7, 35, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 402700679] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/testtask.rb:431563537": [ - [112, 48, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [121, 51, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/thread_pool.rb:12277952": [ - [48, 9, 530, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 228964421], - [51, 65, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [53, 70, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [116, 9, 48, "Style/InvertibleUnlessCondition: Prefer `if @threads.count >= @max_active_threads` over `unless @threads.count < @max_active_threads`.", 2403143961], - [118, 13, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361] - ], - "spec/tmp/bundler/gems/rake-13.2.1/lib/rake/win32.rb:4149036273": [ - [40, 36, 2, "Style/AndOr: Use `||` instead of `or`.", 5861240] - ], - "spec/tmp/bundler/gems/rake-13.2.1/rake.gemspec:2780653655": [ - [12, 19, 2, "Lint/Syntax: unexpected token tLSHFT\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859461] - ], - "spec/tmp/bundler/gems/rotten_egg-1.0.0/lib/rotten_egg.rb:2010666510": [ - [1, 1, 19, "Style/GlobalVars: Do not introduce global variables.", 2573678312] - ], - "spec/tmp/bundler/gems/sausage-1.0.0/lib/sausage.rb:1728262677": [ - [1, 1, 16, "Style/GlobalVars: Do not introduce global variables.", 619820115] - ], - "spec/tmp/bundler/gems/soda-1.0.0/lib/soda.rb:1990629979": [ - [1, 1, 13, "Style/GlobalVars: Do not introduce global variables.", 198441437] - ], - "spec/tmp/bundler/gems/thor-1.3.2/bin/thor:1678810035": [ - [5, 1, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor.rb:333295015": [ - [4, 3, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895], - [13, 7, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], - [23, 9, 16, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 580261046], - [25, 9, 16, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 580261046], - [39, 9, 32, "Style/IdenticalConditionalBranches: Move `desc usage, description, options` out of the conditional.", 4209929479], - [42, 9, 32, "Style/IdenticalConditionalBranches: Move `desc usage, description, options` out of the conditional.", 4209929479], - [60, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], - [61, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [62, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], - [83, 9, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], - [84, 9, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], - [102, 7, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], - [112, 33, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], - [114, 13, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], - [119, 7, 4, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2088878297], - [130, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], - [131, 30, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], - [132, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], - [303, 19, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], - [303, 37, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], - [304, 22, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 551240135], - [329, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3952225397], - [334, 7, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2063673473], - [359, 7, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [362, 11, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [364, 11, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [367, 7, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [429, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 288545224], - [443, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2342089118], - [458, 7, 60, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 675081132], - [469, 7, 30, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 747165948], - [478, 7, 33, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2836932844], - [482, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 288545224], - [487, 7, 23, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2342089118], - [555, 37, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895], - [569, 7, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], - [570, 7, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [571, 7, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], - [572, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], - [573, 7, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], - [575, 10, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], - [575, 20, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [576, 22, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], - [581, 47, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [581, 54, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], - [581, 66, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], - [581, 83, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], - [582, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2759591200], - [582, 17, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [582, 24, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2420967073], - [582, 36, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1012447818], - [582, 53, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797], - [582, 70, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213880165], - [583, 9, 30, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 747165948], - [583, 41, 33, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2836932844], - [598, 7, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1888203797] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/actions.rb:1169132954": [ - [12, 5, 84, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3488611255], - [23, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3359610630], - [28, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3225348734], - [29, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3225348734], - [238, 13, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/base.rb:1396078371": [ - [42, 50, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [143, 9, 11, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3739410329], - [152, 9, 15, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 510344549], - [183, 9, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [187, 9, 22, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 500407963], - [198, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], - [204, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], - [208, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], - [208, 89, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], - [209, 9, 19, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2373381424], - [229, 9, 21, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3536149808], - [233, 9, 21, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3536149808], - [308, 9, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4021964389], - [321, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], - [322, 32, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], - [323, 9, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1127210468], - [425, 9, 29, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2816325805], - [434, 9, 32, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 20048093], - [481, 11, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2748649178], - [483, 11, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2748649178], - [494, 9, 9, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 941479953], - [505, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 461316431], - [506, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 461316431], - [559, 9, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1160282543], - [590, 11, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2076032070], - [592, 11, 10, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2076032070], - [635, 60, 12, "Style/GlobalVars: Do not introduce global variables.", 2230010895] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/core_ext/hash_with_indifferent_access.rb:1816584307": [ - [93, 7, 265, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 3153843738] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/group.rb:919076424": [ - [18, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [20, 9, 5, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 213462548], - [40, 7, 12, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2641829910], - [46, 7, 18, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 1958067488], - [222, 7, 36, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 1233002216] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/invocation.rb:15277192": [ - [3, 5, 84, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3488611255], - [113, 7, 68, "Style/InvertibleUnlessCondition: Prefer `if klass > Thor::Base` over `unless klass <= Thor::Base`.", 323464394] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor.rb:445051654": [ - [6, 5, 98, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1722966001], - [10, 5, 137, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3807720162] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor/basic.rb:2990814377": [ - [6, 7, 42, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2226661248] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/line_editor/readline.rb:2639491563": [ - [4, 7, 151, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1555432841], - [17, 23, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/argument.rb:1757849163": [ - [28, 26, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/arguments.rb:2060486072": [ - [8, 5, 220, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3264205835], - [19, 5, 88, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 64145645] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/option.rb:3720922756": [ - [45, 5, 707, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4238798220], - [153, 48, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550], - [154, 118, 1, "Style/LineEndConcatenation: Use `\\` instead of `+` or `<<` to concatenate those strings.", 177550] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/parser/options.rb:1590095627": [ - [11, 5, 417, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1097829481] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/rake_compat.rb:2680359318": [ - [23, 5, 56, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 120645003], - [24, 7, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 514624543], - [27, 5, 291, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 289349924] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/runner.rb:1283721011": [ - [11, 3, 124, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1462699376], - [15, 3, 40, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3579960], - [35, 3, 308, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 2830630606], - [56, 24, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481], - [72, 26, 4, "Security/Open: The use of `URI.open` is a serious security risk.", 2087926481], - [227, 64, 60, "Performance/InefficientHashSearch: Use `#key?` instead of `#keys.include?`.", 552387362] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/shell.rb:4091723221": [ - [6, 7, 18, "ThreadSafety/ClassAndModuleAttributes: Avoid mutating class and module attributes.", 3758912994], - [12, 9, 6, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2772268155] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/shell/terminal.rb:3147912038": [ - [28, 11, 14, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 3528096361] - ], - "spec/tmp/bundler/gems/thor-1.3.2/lib/thor/util.rb:1633474373": [ - [222, 9, 13, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 4258999585] - ], - "spec/tmp/bundler/gems/waffle-1.0.0/lib/waffle.rb:2896717917": [ - [1, 1, 15, "Style/GlobalVars: Do not introduce global variables.", 2356319643] - ], - "spec/tmp/bundler/specifications/thor-1.3.2.gemspec:4209767878": [ - [24, 3, 79, "Gemspec/DependencyVersion: Dependency version specification is required.", 2841802434] ] } From 8bffc9d85edef9d1ba2674787f4f3f46ed8b92f7 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:30:51 +0700 Subject: [PATCH 21/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=20<=203.0=20compat:?= =?UTF-8?q?=20Bifurcate=20the=20Modern=20Double=20Splat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal/appraisal_file.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/appraisal/appraisal_file.rb b/lib/appraisal/appraisal_file.rb index 316673fb..db6f763f 100644 --- a/lib/appraisal/appraisal_file.rb +++ b/lib/appraisal/appraisal_file.rb @@ -8,6 +8,8 @@ module Appraisal # Loads and parses Appraisals file class AppraisalFile + MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') + attr_reader :appraisals, :gemfile def self.each(&block) @@ -35,7 +37,11 @@ def appraise(name, &block) end def customize_gemfiles(&_block) - Customize.new(**yield) + if MODERN_DOUBLE_SPLAT + Customize.new(**yield) + else + Customize.new(yield) + end end private From f3595ab6f22601bede54c6dc569e6b1d3f177ed6 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:37:46 +0700 Subject: [PATCH 22/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=20<=203.0=20compat:?= =?UTF-8?q?=20Bifurcate=20the=20Modern=20Double=20Splat=20(redux)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal/appraisal.rb | 2 ++ lib/appraisal/appraisal_file.rb | 4 +--- lib/appraisal/customize.rb | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/appraisal/appraisal.rb b/lib/appraisal/appraisal.rb index 3d76c5a4..760de92e 100644 --- a/lib/appraisal/appraisal.rb +++ b/lib/appraisal/appraisal.rb @@ -8,6 +8,8 @@ require "pathname" module Appraisal + MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') + # Represents one appraisal and its dependencies class Appraisal DEFAULT_INSTALL_OPTIONS = {"jobs" => 1}.freeze diff --git a/lib/appraisal/appraisal_file.rb b/lib/appraisal/appraisal_file.rb index db6f763f..43a1b98b 100644 --- a/lib/appraisal/appraisal_file.rb +++ b/lib/appraisal/appraisal_file.rb @@ -8,8 +8,6 @@ module Appraisal # Loads and parses Appraisals file class AppraisalFile - MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') - attr_reader :appraisals, :gemfile def self.each(&block) @@ -37,7 +35,7 @@ def appraise(name, &block) end def customize_gemfiles(&_block) - if MODERN_DOUBLE_SPLAT + if Appraisal::MODERN_DOUBLE_SPLAT Customize.new(**yield) else Customize.new(yield) diff --git a/lib/appraisal/customize.rb b/lib/appraisal/customize.rb index 8d9e4a75..cc8e08de 100644 --- a/lib/appraisal/customize.rb +++ b/lib/appraisal/customize.rb @@ -2,7 +2,9 @@ module Appraisal class Customize - def initialize(heading: nil, single_quotes: false) + def initialize(options = {}) + heading = options.fetch(:heading, nil) + single_quotes = options.fetch(:single_quotes, false) @@heading = !heading.nil? && heading.chomp @@single_quotes = single_quotes end From f5827405f89cb5f255eef61b71354c6fdefecd41 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:41:54 +0700 Subject: [PATCH 23/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=20<=203.0=20compat:?= =?UTF-8?q?=20Bifurcate=20the=20Modern=20Double=20Splat=20(redux=20deux)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal.rb | 4 ++++ lib/appraisal/appraisal.rb | 2 -- lib/appraisal/appraisal_file.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/appraisal.rb b/lib/appraisal.rb index 3f5c8aa5..4d00b8b7 100644 --- a/lib/appraisal.rb +++ b/lib/appraisal.rb @@ -3,4 +3,8 @@ require "appraisal/version" require "appraisal/task" +module Appraisal + MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') +end + Appraisal::Task.new diff --git a/lib/appraisal/appraisal.rb b/lib/appraisal/appraisal.rb index 760de92e..3d76c5a4 100644 --- a/lib/appraisal/appraisal.rb +++ b/lib/appraisal/appraisal.rb @@ -8,8 +8,6 @@ require "pathname" module Appraisal - MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') - # Represents one appraisal and its dependencies class Appraisal DEFAULT_INSTALL_OPTIONS = {"jobs" => 1}.freeze diff --git a/lib/appraisal/appraisal_file.rb b/lib/appraisal/appraisal_file.rb index 43a1b98b..746431b9 100644 --- a/lib/appraisal/appraisal_file.rb +++ b/lib/appraisal/appraisal_file.rb @@ -35,7 +35,7 @@ def appraise(name, &block) end def customize_gemfiles(&_block) - if Appraisal::MODERN_DOUBLE_SPLAT + if ::Appraisal::MODERN_DOUBLE_SPLAT Customize.new(**yield) else Customize.new(yield) From 1579ad01b9f6d22574bb84ac57fcb89cf2dea2d8 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:46:08 +0700 Subject: [PATCH 24/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=20<=203.0=20compat:?= =?UTF-8?q?=20Bifurcate=20the=20Modern=20Double=20Splat=20(tiga)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/appraisal.rb b/lib/appraisal.rb index 4d00b8b7..b9fa3d42 100644 --- a/lib/appraisal.rb +++ b/lib/appraisal.rb @@ -1,10 +1,12 @@ # frozen_string_literal: true -require "appraisal/version" -require "appraisal/task" - +# Define the namespace of this library! module Appraisal + # Define constants that should be available throughout the library. MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') end +require "appraisal/version" +require "appraisal/task" + Appraisal::Task.new From a524eadd703046220190b6f444c80de9f0d8f1b1 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 00:51:49 +0700 Subject: [PATCH 25/29] =?UTF-8?q?=F0=9F=90=9B=20Ruby=20<=203.0=20compat:?= =?UTF-8?q?=20Bifurcate=20the=20Modern=20Double=20Splat=20(empat)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appraisal.rb | 6 ------ lib/appraisal/appraisal_file.rb | 7 ++----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/appraisal.rb b/lib/appraisal.rb index b9fa3d42..3f5c8aa5 100644 --- a/lib/appraisal.rb +++ b/lib/appraisal.rb @@ -1,11 +1,5 @@ # frozen_string_literal: true -# Define the namespace of this library! -module Appraisal - # Define constants that should be available throughout the library. - MODERN_DOUBLE_SPLAT = Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0') -end - require "appraisal/version" require "appraisal/task" diff --git a/lib/appraisal/appraisal_file.rb b/lib/appraisal/appraisal_file.rb index 746431b9..1d7b9ec6 100644 --- a/lib/appraisal/appraisal_file.rb +++ b/lib/appraisal/appraisal_file.rb @@ -35,11 +35,8 @@ def appraise(name, &block) end def customize_gemfiles(&_block) - if ::Appraisal::MODERN_DOUBLE_SPLAT - Customize.new(**yield) - else - Customize.new(yield) - end + args = yield + Customize.new(args) end private From df2a1e920e6933c1c4fc96153a19193f319d0e61 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 01:09:03 +0700 Subject: [PATCH 26/29] =?UTF-8?q?=F0=9F=9A=A8=20Style/SymbolArray:=20Enfor?= =?UTF-8?q?cedStyle:=20brackets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ruby < 2 compat --- .rubocop.yml | 3 +++ .rubocop_gradual.lock | 10 +++++----- lib/appraisal/bundler_dsl.rb | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0d8799c6..4f80d90f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,3 +15,6 @@ RSpec/DescribeClass: # See: https://coderscat.com/ruby-change-current-working-directory/ ThreadSafety/DirChdir: Enabled: false + +Style/SymbolArray: + EnforcedStyle: brackets diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index fc654a0e..cffcf805 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -7,16 +7,16 @@ "bin/bundle:41466308": [ [66, 5, 20, "ThreadSafety/ClassInstanceVariable: Avoid class instance variables.", 2485198147] ], - "lib/appraisal/appraisal_file.rb:3486777149": [ + "lib/appraisal/appraisal_file.rb:3950440874": [ [13, 5, 52, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 946226050] ], "lib/appraisal/cli.rb:435288507": [ [116, 5, 410, "Style/MissingRespondToMissing: When using `method_missing`, define `respond_to_missing?`.", 1969529734] ], - "lib/appraisal/customize.rb:190316824": [ - [10, 5, 138, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2682968747], - [17, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720], - [21, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929] + "lib/appraisal/customize.rb:473220891": [ + [12, 5, 138, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2682968747], + [19, 5, 62, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 4082816720], + [23, 5, 516, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2780620929] ], "lib/appraisal/utils.rb:3706894031": [ [6, 5, 129, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 733338411], diff --git a/lib/appraisal/bundler_dsl.rb b/lib/appraisal/bundler_dsl.rb index cf52d422..8f474b5e 100644 --- a/lib/appraisal/bundler_dsl.rb +++ b/lib/appraisal/bundler_dsl.rb @@ -147,7 +147,7 @@ def dependencies_entry_for_dup @dependencies.for_dup end - %i[gits paths platforms groups source_blocks install_if].each do |method_name| + [:gits, :paths, :platforms, :groups, :source_blocks, :install_if].each do |method_name| class_eval <<-METHODS, __FILE__, __LINE__ + 1 private From 0a02c867b4cfe0094bcdb054753c8c722c36727e Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 01:54:44 +0700 Subject: [PATCH 27/29] =?UTF-8?q?=F0=9F=92=9A=20Pend=20spec=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Possibly due to bundler issue on MRI and JRuby engines - https://github.com/rubygems/rubygems/issues/8518 --- appraisal.gemspec | 1 + spec/acceptance/bundle_without_spec.rb | 5 ++++- spec/spec_helper.rb | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/appraisal.gemspec b/appraisal.gemspec index 67da5627..533b12e0 100644 --- a/appraisal.gemspec +++ b/appraisal.gemspec @@ -49,4 +49,5 @@ Gem::Specification.new do |s| s.add_development_dependency("activesupport", ">= 3.2.21") s.add_development_dependency("rspec", "~> 3.13") + s.add_development_dependency("rspec-pending_for", "~> 0.1", ">= 0.1.17") end diff --git a/spec/acceptance/bundle_without_spec.rb b/spec/acceptance/bundle_without_spec.rb index 4194071e..b454adf1 100644 --- a/spec/acceptance/bundle_without_spec.rb +++ b/spec/acceptance/bundle_without_spec.rb @@ -2,7 +2,10 @@ RSpec.describe "Bundle without group" do it "config set --local without group is honored by Bundler" do - # pending "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" + reason = "config set --local without group support seems broken, see: https://github.com/rubygems/rubygems/issues/8518" + # Somehow this spec passes on truffleruby *only*!! + pending_for(:engine => "ruby", :reason => reason) + pending_for(:engine => "jruby", :reason => reason) build_gems %w[pancake orange_juice waffle coffee sausage soda] build_gemfile <<-GEMFILE.strip_heredoc.rstrip diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8eb8a448..1d9f7366 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,7 @@ # External Libraries require "active_support/core_ext/string/strip" +require "rspec/pending_for" # This library require "support/dependency_helpers" From be18441834a580f43a1a79ca35b9cc32fcfe25a4 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 02:07:07 +0700 Subject: [PATCH 28/29] =?UTF-8?q?=F0=9F=92=9A=20skip=20tests=20that=20are?= =?UTF-8?q?=20known=20to=20fail=20on=20old=20bundler=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/support/acceptance_test_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/support/acceptance_test_helpers.rb b/spec/support/acceptance_test_helpers.rb index c20ba153..78ce6751 100644 --- a/spec/support/acceptance_test_helpers.rb +++ b/spec/support/acceptance_test_helpers.rb @@ -25,13 +25,13 @@ module AcceptanceTestHelpers before :parallel => true do unless Appraisal::Utils.support_parallel_installation? - pending "This Bundler version does not support --jobs flag." + skip "This Bundler version does not support --jobs flag." end end before :git_local => true do unless Appraisal::Utils.support_git_local_installation? - pending "This Bundler version does not support sourcing gems from git repos on local filesystem." + skip "This Bundler version does not support sourcing gems from git repos on local filesystem." end end From 198a32448333fc930c32396b6684967f78c3f313 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 25 Feb 2025 02:27:40 +0700 Subject: [PATCH 29/29] =?UTF-8?q?=F0=9F=92=9A=20turn=20off=20truffleruby-h?= =?UTF-8?q?ead=20for=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cbf79e8..e02a9068 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,9 @@ jobs: - jruby - jruby-head - truffleruby - - truffleruby-head + # truffleruby-head is failing. + # TODO: Turn this back on once more important MRI Rubies are validated. + # - truffleruby-head steps: - uses: actions/checkout@v4