Skip to content

Commit

Permalink
Allow "ruby file:" syntax in Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
swelther committed Nov 14, 2024
1 parent d7cb6e7 commit dbcd772
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class BundlerDSL
def initialize
@sources = []
@ruby_version = nil
@ruby_kwargs = nil
@dependencies = DependencyList.new
@gemspecs = []
@groups = {}
Expand Down Expand Up @@ -65,8 +66,9 @@ def source(source, &block)
end
end

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

def git(source, options = {}, &block)
Expand Down Expand Up @@ -110,11 +112,15 @@ def source_entry
alias_method :source_entry_for_dup, :source_entry

def ruby_version_entry
return unless @ruby_version
if @ruby_version
case @ruby_version
when String then return "ruby #{@ruby_version.inspect}"
else return "ruby(#{@ruby_version.inspect})"
end
end

case @ruby_version
when String then "ruby #{@ruby_version.inspect}"
else "ruby(#{@ruby_version.inspect})"
if @ruby_kwargs && @ruby_kwargs.keys.size.positive?
"ruby #{@ruby_kwargs}"
end
end

Expand Down

0 comments on commit dbcd772

Please sign in to comment.