Skip to content
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

Allow "ruby file:" syntax in gemfile #247

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def source(source, &block)
end
end

def ruby(ruby_version)
def ruby(ruby_version = nil, **kwargs)
@ruby_version = ruby_version
@ruby_version = kwargs unless ruby_version
end

def git(source, options = {}, &block)
Expand Down
13 changes: 13 additions & 0 deletions spec/appraisal/gemfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,17 @@
expect(gemfile.load(tmpfile.path)).to include(File.dirname(tmpfile.path))
end
end

it "supports the ruby file: syntax" do
gemfile = Appraisal::Gemfile.new

gemfile.ruby file: ".ruby-version"
gemfile.source "one"

expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip
source "one"

ruby {:file=>".ruby-version"}
GEMFILE
end
end