Skip to content

Commit b967a15

Browse files
committed
Allow "ruby file:" syntax in Gemfile
1 parent d7cb6e7 commit b967a15

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/appraisal/bundler_dsl.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ module Appraisal
66
class BundlerDSL
77
attr_reader :dependencies
88

9-
PARTS = %w[source ruby_version gits paths dependencies groups
9+
PARTS = %w[source ruby_version ruby_kwargs gits paths dependencies groups
1010
platforms source_blocks install_if gemspec]
1111

1212
def initialize
1313
@sources = []
1414
@ruby_version = nil
15+
@ruby_kwargs = nil
1516
@dependencies = DependencyList.new
1617
@gemspecs = []
1718
@groups = {}
@@ -65,8 +66,9 @@ def source(source, &block)
6566
end
6667
end
6768

68-
def ruby(ruby_version)
69+
def ruby(ruby_version = nil, **kwargs)
6970
@ruby_version = ruby_version
71+
@ruby_kwargs = kwargs
7072
end
7173

7274
def git(source, options = {}, &block)
@@ -110,11 +112,15 @@ def source_entry
110112
alias_method :source_entry_for_dup, :source_entry
111113

112114
def ruby_version_entry
113-
return unless @ruby_version
115+
if @ruby_version
116+
case @ruby_version
117+
when String then return "ruby #{@ruby_version.inspect}"
118+
else return "ruby(#{@ruby_version.inspect})"
119+
end
120+
end
114121

115-
case @ruby_version
116-
when String then "ruby #{@ruby_version.inspect}"
117-
else "ruby(#{@ruby_version.inspect})"
122+
if @ruby_kwargs && @ruby_kwargs.keys.size > 0
123+
"ruby #{@ruby_kwargs.to_s}"
118124
end
119125
end
120126

0 commit comments

Comments
 (0)