Skip to content

Commit dfa9b27

Browse files
committed
allow nested gem of source block in Gemfile
1 parent 91c1001 commit dfa9b27

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/maven/tools/dsl.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def artifact( a )
8686
self.send a[:type].to_sym, a
8787
end
8888

89-
def source(*args)
89+
def source(*args, &block)
9090
url = args[0].to_s
9191
url = 'https://rubygems.org' if url == :rubygems
9292
id = url.gsub( /[\/:"<>|?*]/, '_').gsub(/_+/, '_') unless url == 'https://rubygems.org'
@@ -100,6 +100,8 @@ def source(*args)
100100
repository :id => id || 'mavengems', :url => "mavengem:#{url}"
101101
extension! 'org.torquebox.mojo:mavengem-wagon', '${mavengem.wagon.version}'
102102
@current = current if current
103+
104+
block.call if block
103105
end
104106

105107
def ruby( *args )

spec/gemfile_with_source/Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
source 'https://rubygems.org'
22

33
gemspec
4+
5+
source 'https://example.com' do
6+
gem 'paseserver', '~>1.3'
7+
end

spec/gemfile_with_source/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
<mavengem.wagon.version>0.2.0</mavengem.wagon.version>
3535
</properties>
3636
<dependencies>
37+
<dependency>
38+
<groupId>rubygems</groupId>
39+
<artifactId>paseserver</artifactId>
40+
<version>[1.3,1.99999]</version>
41+
<type>gem</type>
42+
</dependency>
3743
<dependency>
3844
<groupId>org.bouncycastle</groupId>
3945
<artifactId>bcpkix-jdk15on</artifactId>
@@ -50,6 +56,10 @@
5056
<id>mavengems</id>
5157
<url>mavengem:https://rubygems.org</url>
5258
</repository>
59+
<repository>
60+
<id>https_example.com</id>
61+
<url>mavengem:https://example.com</url>
62+
</repository>
5363
</repositories>
5464
<build>
5565
<extensions>

0 commit comments

Comments
 (0)