File tree 2 files changed +53
-2
lines changed
2 files changed +53
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class Group
6
6
def initialize ( group_names )
7
7
@dependencies = DependencyList . new
8
8
@group_names = group_names
9
+ @gemspec = nil
9
10
end
10
11
11
12
def run ( &block )
@@ -16,9 +17,26 @@ def gem(name, *requirements)
16
17
@dependencies . add ( name , requirements )
17
18
end
18
19
20
+ def gemspec ( options = { } )
21
+ @gemspec = Gemspec . new ( options )
22
+ end
23
+
19
24
def to_s
20
- "group #{ Utils . format_arguments ( @group_names ) } do\n " +
21
- @dependencies . to_s . strip . gsub ( /^/ , ' ' ) + "\n end"
25
+ <<-OUTPUT . strip
26
+ group #{ Utils . format_arguments ( @group_names ) } do
27
+ #{ dependencies_list }
28
+ end
29
+ OUTPUT
30
+ end
31
+
32
+ private
33
+
34
+ def dependencies_list
35
+ [ @dependencies . to_s , @gemspec . to_s ] .
36
+ reject ( &:empty? ) .
37
+ join ( "\n \n " ) .
38
+ gsub ( /^/ , " " ) .
39
+ strip
22
40
end
23
41
end
24
42
end
Original file line number Diff line number Diff line change 136
136
expect ( content_of "gemfiles/1.1.0.gemfile" ) . to include ( 'gem "bacon", "1.1.0"' )
137
137
expect ( content_of "gemfiles/1.2.0.gemfile" ) . to include ( 'gem "bacon", "1.2.0"' )
138
138
end
139
+
140
+ it "supports gemspec in the group block" do
141
+ build_gem "bacon" , "1.0.0"
142
+ build_gemspec
143
+
144
+ build_gemfile <<-Gemfile
145
+ gem "appraisal", path: #{ PROJECT_ROOT . inspect }
146
+
147
+ group :plugin do
148
+ gemspec
149
+ end
150
+ Gemfile
151
+
152
+ build_appraisal_file <<-Appraisals
153
+ appraise "1.0.0" do
154
+ gem "bacon", "1.0.0"
155
+ end
156
+ Appraisals
157
+
158
+ run "bundle install --local"
159
+ run "appraisal generate"
160
+
161
+ expect ( content_of "gemfiles/1.0.0.gemfile" ) . to eq <<-gemfile . strip_heredoc
162
+ # This file was generated by Appraisal
163
+
164
+ gem "appraisal", :path => #{ PROJECT_ROOT . inspect }
165
+ gem "bacon", "1.0.0"
166
+
167
+ group :plugin do
168
+ gemspec :path => "../"
169
+ end
170
+ gemfile
171
+ end
139
172
end
You can’t perform that action at this time.
0 commit comments