Skip to content

Fix support for ruby file: … Gemfile syntax #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ def source_entry
alias_method :source_entry_for_dup, :source_entry

def ruby_version_entry
if @ruby_version
"ruby #{@ruby_version.inspect}"
return unless @ruby_version

case @ruby_version
when String then "ruby #{@ruby_version.inspect}"
else "ruby(#{@ruby_version.inspect})"
end
end

Expand Down
29 changes: 29 additions & 0 deletions spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,33 @@
gemspec :path => "../sitepress"
Gemfile
end

it 'supports ruby file: ".ruby-version" DSL' do
build_gemfile <<-Gemfile
source 'https://rubygems.org'

ruby RUBY_VERSION

gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
Gemfile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/HeredocDelimiterCase: Use uppercase heredoc delimiters.


build_appraisal_file <<-Appraisals
appraise 'ruby-version' do
ruby file: ".ruby-version"
end
Appraisals
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/HeredocDelimiterCase: Use uppercase heredoc delimiters.


run 'bundle install --local'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

run 'appraisal generate'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


expect(content_of 'gemfiles/ruby_version.gemfile').to eq <<-Gemfile.strip_heredoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NestedParenthesizedCalls: Add parentheses to nested method call content_of 'gemfiles/ruby_version.gemfile'.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [85/80]

# This file was generated by Appraisal

source "https://rubygems.org"

ruby({:file=>".ruby-version"})

gem "appraisal", :path => #{PROJECT_ROOT.inspect}
Gemfile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/HeredocDelimiterCase: Use uppercase heredoc delimiters.

end
end