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 b967a15
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ module Appraisal
class BundlerDSL
attr_reader :dependencies

PARTS = %w[source ruby_version gits paths dependencies groups
PARTS = %w[source ruby_version ruby_kwargs gits paths dependencies groups
platforms source_blocks install_if gemspec]

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 > 0
"ruby #{@ruby_kwargs.to_s}"
end
end

Expand Down

0 comments on commit b967a15

Please sign in to comment.