lock_jar 0.10.5 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d68df5093efbd081f06914ee57b4e5156dd781d
4
- data.tar.gz: 79765d881efd41291a17b3e92a9425bf0ea4cd3a
3
+ metadata.gz: 890e8f58de1d05c870ec1254fd8922e1f3d300c7
4
+ data.tar.gz: 79eee178effcfbcf2da3cc50345e1fd23f31d93c
5
5
  SHA512:
6
- metadata.gz: a62084efdb888edc8f91e0e0f499184c5db5fd34a672c35b2136fa7ed078d821171b6e8df408c9296416277130898f7dd8c3187265de5a27c829ca89f30466f2
7
- data.tar.gz: fee22c9c5e96e51f90ee1f225d5d21e58e70275d88be8f014f1bb1634bb1013ef82c61330222ab225c5f632d8fb261cd5e1f197e9b6547d20b0e02f265d1f668
6
+ metadata.gz: 5d64ba05c2d2c4ee3ef4bb99b8d10437e91c16050ac060f76a70a3a2ed78b4780c2eb36b41e5e777b7ce7eba6322df39d99f1918dcf7c87d53d8d86cdf342395
7
+ data.tar.gz: 59ae69cb059f46c198f7336a30b01b9535bdfb53b37739c36d2aa1da8e6f90941179480da427703c1ecaceb0ab8c9e4ccb5211665f2d78c47fabae1d9a2cf123
data/.gitignore CHANGED
@@ -1,7 +1,4 @@
1
- # Dont save the Gemfile since JRuby and CRuby have incompatiable deps
2
- Gemfile.lock
3
1
  Jarfile.lock
4
-
5
2
  .*
6
3
 
7
4
  tmp
@@ -19,41 +16,4 @@ doc
19
16
  # bundler
20
17
  .bundle
21
18
 
22
- # jeweler generated
23
- pkg
24
-
25
- # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
26
- #
27
- # * Create a file at ~/.gitignore
28
- # * Include files you want ignored
29
- # * Run: git config --global core.excludesfile ~/.gitignore
30
- #
31
- # After doing this, these files will be ignored in all your git projects,
32
- # saving you from having to 'pollute' every project you touch with them
33
- #
34
- # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
35
- #
36
- # For MacOS:
37
- #
38
- #.DS_Store
39
-
40
- # For TextMate
41
- #*.tmproj
42
- #tmtags
43
-
44
- # For emacs:
45
- #*~
46
- #\#*
47
- #.\#*
48
-
49
- # For vim:
50
- #*.swp
51
-
52
- # ides:
53
- .redcar
54
- *.iml
55
-
56
- # For rubinius:
57
- #*.rbc
58
-
59
19
  autotest
data/.travis.yml CHANGED
@@ -3,6 +3,8 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.0
6
- - jruby-19mode
6
+ - jruby-19mode
7
+ - jruby-20mode
8
+ - jruby-21mode
7
9
 
8
10
  script: bundle exec rspec spec
data/CHANGELOG.md CHANGED
@@ -1,26 +1,34 @@
1
1
  ## LockJar Changelog
2
2
 
3
- ### 0.10.4 (Feburary 11, 2015)
3
+ ### 0.12.0 (Feburary 23, 2015)
4
+
5
+ * Add support for `without_default_maven_repo`
6
+
7
+ ### 0.10.0 (June 27, 2014)
8
+
9
+ * Extract Bundler out to own Gem - https://github.com/mguymon/lock_jar_bundler
10
+
11
+ #### 0.10.5 (Feburary 13, 2015)
12
+
13
+ * Use Naether 0.14.0, with support for NAETHER_MIRROR env
14
+
15
+ #### 0.10.4 (Feburary 11, 2015)
4
16
 
5
17
  * Fix bug with excludes in Jarfiles (<a href="https://github.com/mguymon/lock_jar/pull/25">Pull #20</a>) [<a href="https://github.com/pangloss">pangloss</a>]
6
18
 
7
- ### 0.10.3 (Januaray 13, 2015)
19
+ #### 0.10.3 (Januaray 13, 2015)
8
20
 
9
21
  * Control the logging of Naether from LockJar::Logging
10
22
 
11
- ### 0.10.2 (November 20, 2014)
23
+ #### 0.10.2 (November 20, 2014)
12
24
 
13
25
  * Default to the correct file, based on desired type (<a href="https://github.com/mguymon/lock_jar/pull/22">Pull #20</a>) [<a href="https://github.com/pangloss">pangloss</a>]
14
26
 
15
- ### 0.10.1 (November 19, 2014)
27
+ #### 0.10.1 (November 19, 2014)
16
28
 
17
29
  * Use local_repository from Jarfile.lock in install() if none has been passed in (<a href="https://github.com/mguymon/lock_jar/pull/20">Pull #20</a>) [<a href="https://github.com/stewi2">stewi2</a>]
18
30
  * Add support for merging and locking multiple Jarfiles (<a href="https://github.com/mguymon/lock_jar/pull/21">Pull #21</a>) [<a href="https://github.com/pangloss">pangloss</a>]
19
31
 
20
- ### 0.10.0 (June 27, 2014)
21
-
22
- * Extract Bundler out to own Gem - https://github.com/mguymon/lock_jar_bundler
23
-
24
32
  ### 0.9.0 (March 6, 2014)
25
33
 
26
34
  * Update to Naether 0.13.1 to fight the chatty log (<a href="https://github.com/mguymon/lock_jar/issues/14">Issue #14</a>)
@@ -29,14 +37,14 @@
29
37
 
30
38
  * Added `local` to DSL for adding local jars (<a href="https://github.com/mguymon/lock_jar/issues/6">Issue #6</a>)
31
39
 
32
- ### 0.7.5 (August 23, 2013)
40
+ ### 0.7.0
33
41
 
34
- * Update Thor dep, improve specs (<a href="https://github.com/mguymon/lock_jar/pull/10">Pull #10</a>) [<a href="https://github.com/yokolet">yokolet</a>]
42
+ * Sort dependences for Jarfile.lock (<a href="https://github.com/mguymon/lock_jar/pull/3">Pull #3</a>) [<a href="https://github.com/chetan">chetan</a>]
35
43
 
36
- ### 0.7.4 (April 17, 2013)
44
+ #### 0.7.5 (August 23, 2013)
37
45
 
38
- * Fixed Buildr integration (<a href="https://github.com/mguymon/lock_jar/issues/6">Issue #6</a>) [<a href="https://github.com/tobsch">tobsch</a>]
46
+ * Update Thor dep, improve specs (<a href="https://github.com/mguymon/lock_jar/pull/10">Pull #10</a>) [<a href="https://github.com/yokolet">yokolet</a>]
39
47
 
40
- ### 0.7.0
48
+ #### 0.7.4 (April 17, 2013)
41
49
 
42
- * Sort dependences for Jarfile.lock (<a href="https://github.com/mguymon/lock_jar/pull/3">Pull #3</a>) [<a href="https://github.com/chetan">chetan</a>]
50
+ * Fixed Buildr integration (<a href="https://github.com/mguymon/lock_jar/issues/6">Issue #6</a>) [<a href="https://github.com/tobsch">tobsch</a>]
data/Gemfile.lock ADDED
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lock_jar (0.12.0)
5
+ naether (~> 0.14.0)
6
+ thor (>= 0.18.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ celluloid (0.15.2)
12
+ timers (~> 1.1.0)
13
+ coderay (1.1.0)
14
+ diff-lcs (1.2.5)
15
+ ffi (1.9.3)
16
+ ffi (1.9.3-java)
17
+ formatador (0.2.5)
18
+ guard (2.6.1)
19
+ formatador (>= 0.2.4)
20
+ listen (~> 2.7)
21
+ lumberjack (~> 1.0)
22
+ pry (>= 0.9.12)
23
+ thor (>= 0.18.1)
24
+ guard-rspec (4.2.10)
25
+ guard (~> 2.1)
26
+ rspec (>= 2.14, < 4.0)
27
+ httpclient (2.6.0.1)
28
+ jruby-openssl (0.9.5-java)
29
+ listen (2.7.9)
30
+ celluloid (>= 0.15.2)
31
+ rb-fsevent (>= 0.9.3)
32
+ rb-inotify (>= 0.9)
33
+ lumberjack (1.0.7)
34
+ method_source (0.8.2)
35
+ naether (0.14.0)
36
+ httpclient
37
+ rjb (~> 1.4.0)
38
+ naether (0.14.0-java)
39
+ httpclient
40
+ pry (0.10.0)
41
+ coderay (~> 1.1.0)
42
+ method_source (~> 0.8.1)
43
+ slop (~> 3.4)
44
+ pry (0.10.0-java)
45
+ coderay (~> 1.1.0)
46
+ method_source (~> 0.8.1)
47
+ slop (~> 3.4)
48
+ spoon (~> 0.0)
49
+ rb-fsevent (0.9.4)
50
+ rb-inotify (0.9.5)
51
+ ffi (>= 0.5.0)
52
+ rjb (1.4.9)
53
+ rspec (2.14.1)
54
+ rspec-core (~> 2.14.0)
55
+ rspec-expectations (~> 2.14.0)
56
+ rspec-mocks (~> 2.14.0)
57
+ rspec-core (2.14.8)
58
+ rspec-expectations (2.14.5)
59
+ diff-lcs (>= 1.1.3, < 2.0)
60
+ rspec-mocks (2.14.6)
61
+ slop (3.5.0)
62
+ spoon (0.0.4)
63
+ ffi
64
+ thor (0.19.1)
65
+ timers (1.1.0)
66
+ yard (0.8.7.4)
67
+
68
+ PLATFORMS
69
+ java
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ guard-rspec
74
+ jruby-openssl
75
+ lock_jar!
76
+ pry
77
+ rspec (~> 2.14.1)
78
+ yard
data/README.md CHANGED
@@ -26,20 +26,21 @@ JRuby is natively supported. Ruby 1.9.3 and 2.1 uses [Rjb](http://rjb.rubyforge.
26
26
 
27
27
  ### Jarfile
28
28
 
29
- A Jarfile is a simple file using a Ruby DSL for defining a project's dependencies using the following
29
+ A Jarfile is a simple file using a Ruby DSL for defining a project's dependencies using the following
30
30
  methods:
31
31
 
32
- * **local_repo( path )**: Set the local Maven repository, this were dependencies are downloaded to.
32
+ * **local_repo( path )**: Set the local Maven repository, this were dependencies are downloaded to.
33
33
  * **remote_repo( url )**: Add additional url of remote Maven repository.
34
34
  * **group( groups )**: Set the group for nested jar or pom. A single or Array of groups can be set.
35
35
  * **jar( notations, opts = {} )**: Add Jar dependency in artifact notation, artifact:group:version as the bare minimum. A single or Array of notations can be passed. Default group is _default_, can be specified by setting _opts = { :group => ['group_name'] }_
36
36
  * **local( path )**: Add a local path to a Jar
37
37
  * **pom( pom_path, opts = {} )**: Add a local Maven pom, default is to load dependencies for `runtime` and `compile` scopes. To select the scopes to be loaded from the pom, set the _opts = { :scopes => ['test'] }_
38
+ * **without_default_maven_repo**: Do not use the default maven repo.
38
39
 
39
40
  #### Example Jarfile
40
41
 
41
42
  repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
42
-
43
+
43
44
  // Default group is default
44
45
  jar "org.apache.mina:mina-core:2.0.4"
45
46
  local 'spec/fixtures/naether-0.13.0.jar'
@@ -47,11 +48,11 @@ methods:
47
48
  group 'runtime' do
48
49
  jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
49
50
  end
50
-
51
+
51
52
  group 'test' do
52
53
  jar 'junit:junit:jar:4.10', :group => 'test'
53
54
  end
54
-
55
+
55
56
  ### Resolving dependencies
56
57
 
57
58
  **LockJar.lock( *args )**: Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
@@ -66,14 +67,20 @@ When the Jarfile is locked, the transitive dependencies are resolved and saved t
66
67
  Example of locking a Jarfile to a Jarfile.lock
67
68
 
68
69
  LockJar.lock
69
-
70
-
70
+
71
+ #### Default Remote Repository
72
+
73
+ LockJar uses Naether's default remote repository, http://repo1.maven.org/maven2/.
74
+
75
+ Jarfile.lock pior to _0.12.0_ did not write the default remote repository. As of version _0.12.0_, only repositories in the Jarfile.lock are used. This means older Jarfile.lock will need to be updated to include the default maven repo if they rely on it.
76
+
77
+
71
78
  ### Jarfile.lock
72
79
 
73
80
  The _Jarfile.lock_ generated is a YAML file containing information on how to handle the classpath for grouped dependencies and their nested transitive dependencies.
74
81
 
75
82
  #### The Jarfile.lock
76
-
83
+
77
84
  ---
78
85
  version: 0.7.0
79
86
  groups:
@@ -123,15 +130,15 @@ The _Jarfile.lock_ generated is a YAML file containing information on how to han
123
130
  org.hamcrest:hamcrest-core:jar:1.1: {}
124
131
  ...
125
132
 
126
-
127
-
133
+
134
+
128
135
  ### Accessing Jars
129
136
  **LockJar.install(*args)**: Download Jars in the Jarfile.lock
130
137
  * _[String]_ will set the Jarfile.lock path, e.g. `'Better.lock'`. Default lock file is `'Jarfile.lock'`.
131
138
  * _[Array<String>]_ will set the groups, e.g. `['compile','test']`. Defaults group is _default_.
132
139
  * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
133
140
  * **:local_repo** _[String]_ sets the local repo path. Defaults to `ENV['M2_REPO']` or `'~/.m2/repository'`
134
-
141
+
135
142
  **LockJar.list(*args)**: Lists all dependencies as notations for groups from the Jarfile.lock. Depending on the type of arg, a different configuration is set.
136
143
  * _[String]_ will set the Jarfile.lock path, e.g. `'Better.lock'`. Default lock file is `'Jarfile.lock'`.
137
144
  * _[Array<String>]_ will set the groups, e.g. `['default', 'runtime']`. Defaults group is _default_.
@@ -139,24 +146,24 @@ The _Jarfile.lock_ generated is a YAML file containing information on how to han
139
146
  * **:local_repo** _[String]_ sets the local repo path. Defaults to `ENV['M2_REPO']` or `'~/.m2/repository'`
140
147
  * **:local_paths** _[Boolean]_ converts the notations to paths of jars in the local repo
141
148
  * **:resolve** _[Boolean]_ to true will make transitive dependences resolve before returning list of jars
142
-
149
+
143
150
  **LockJar.load(*args)**: Loads all dependencies to the classpath for groups from the Jarfile.lock. Default group is _default_. Default lock file is _Jarfile.lock_.
144
151
  * _[String]_ will set the Jarfile.lock, e.g. `'Better.lock'`
145
152
  * _[Array<String>]_ will set the groups, e.g. `['default', 'runtime']`
146
153
  * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
147
154
  * **:local_repo** _[String]_ sets the local repo path
148
- * **:resolve** _[Boolean]_ to true will make transitive dependences resolve before loading to classpath
155
+ * **:resolve** _[Boolean]_ to true will make transitive dependences resolve before loading to classpath
149
156
 
150
157
  Once a _Jarfile.lock_ is generated, you can list all resolved jars by
151
-
158
+
152
159
  jars = LockJar.list
153
-
160
+
154
161
  or directly load all Jars into the classpath
155
-
162
+
156
163
  jars = LockJar.load
157
164
 
158
165
  Do not forget, if you change your _Jarfile_, you have to re-generate the _Jarfile.lock_.
159
-
166
+
160
167
  See also [loading Jars into a custom ClassLoader](https://github.com/mguymon/lock_jar/wiki/ClassLoader).
161
168
 
162
169
  ### Shortcuts
@@ -172,13 +179,13 @@ You can skip the _Jarfile_ and _Jarfile.lock_ to directly play with dependencies
172
179
  end
173
180
 
174
181
  #### List without a Jarfile.lock
175
-
182
+
176
183
  LockJar.list do
177
184
  jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
178
185
  end
179
186
 
180
187
  #### Load without a Jarfile.lock
181
-
188
+
182
189
  LockJar.load do
183
190
  jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
184
191
  end
@@ -195,14 +202,14 @@ There is a simple command line helper. You can lock a _Jarfile_ with the followi
195
202
 
196
203
  lockjar lock
197
204
 
198
- List jars in a _Jarfile.lock_ with
199
-
205
+ List jars in a _Jarfile.lock_ with
206
+
200
207
  lockjar list
201
-
208
+
202
209
  Download all jars in a _Jarfile.lock_ with
203
210
 
204
211
  lockjar install
205
-
212
+
206
213
  _lockjar_ _--help_ will give you list of all commands and their options.
207
214
 
208
215
  ## Gem Integration
@@ -224,18 +231,18 @@ Rakefile with default to install Jars using LockJar:
224
231
 
225
232
  task :prepare do
226
233
  require 'lock_jar'
227
-
234
+
228
235
  # get jarfile relative the gem dir
229
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
230
-
236
+ lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
237
+
231
238
  LockJar.install( lockfile )
232
239
  end
233
-
240
+
234
241
  #### Work around for Rakefile default
235
242
 
236
- The downside of using the Gem extension Rakefile is it requires the default to
237
- point at the task to download the jars (from the example Rakefile,
238
- `task :default => :prepare`). To get around this, I used a Rakefile called
243
+ The downside of using the Gem extension Rakefile is it requires the default to
244
+ point at the task to download the jars (from the example Rakefile,
245
+ `task :default => :prepare`). To get around this, I used a Rakefile called
239
246
  _PostInstallRakefile_ to handle the `task :prepare`. When packaging the gem, _PostInstallRakefile_ is
240
247
  renamed to `Rakefile`.
241
248
 
@@ -245,19 +252,19 @@ Instead of rely in a Rakefile to install Jars when the Gem is installed, Jars ca
245
252
  Ruby needs to be called before calling `LockJar.load`. Only Jars that are missing are downloaded.
246
253
 
247
254
  #get jarfile relative the gem dir
248
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
249
-
255
+ lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
256
+
250
257
  # Download any missing Jars
251
258
  LockJar.install( lockfile )
252
259
 
253
260
  ### Loading
254
261
 
255
- With the Jars installed, loading the classpath for the Gem is simple.
262
+ With the Jars installed, loading the classpath for the Gem is simple.
256
263
  As part of the load process for the Gem (an entry file that is required, etc) use the following:
257
264
 
258
265
  #get jarfile relative the gem dir
259
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
260
-
266
+ lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
267
+
261
268
  # Loads the ClassPath with Jars from the lockfile
262
269
  LockJar.load( lockfile )
263
270
 
@@ -270,7 +277,7 @@ LockJar integrates with [Buildr](http://buildr.apache.org/) using an [Addon](htt
270
277
  A new Buildr task is added to generate the lockfile for all projects
271
278
 
272
279
  buildr lock_jar:lock
273
-
280
+
274
281
  and a task per project to generate the lockfile for a single project
275
282
 
276
283
  buildr <app>:<project>:lock_jar:lock
@@ -288,7 +295,7 @@ The _default_ group dependencies are automatically added to the classpath for co
288
295
  Sample buildfile with LockJar
289
296
 
290
297
  require 'lock_jar/buildr'
291
-
298
+
292
299
  # app definition, inherited into all projects
293
300
  lock_jar do
294
301
 
@@ -317,10 +324,10 @@ Generated the following lock files using **lock_jar:lock**
317
324
 
318
325
  * _project1.lock_ - contains _junit_ and _mina_ jars.
319
326
  * _project2.lock_ - contains _junit_ and _pom.xml_ jars.
320
-
327
+
321
328
  ## Bundler Integration
322
329
 
323
- Bundler integration is **experimental** right now. [LockJar patches Bundler](https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/bundler.rb)
330
+ Bundler integration is **experimental** right now. [LockJar patches Bundler](https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/bundler.rb)
324
331
  to allow creation of a _Jarfile.lock_ when Bundler calls `install` and `update`. The dependencies from the _Jarfile.lock_ are automatically loaded when
325
332
  Bundler calls `setup` and `require`. To enable this support, add this require to your _Gemfile_
326
333
 
@@ -331,7 +338,7 @@ Gems with a Jarfile will be merge to generate a _Jarfile.lock_. The Jarfile.lock
331
338
 
332
339
  ### Bundler to LockJar groups
333
340
 
334
- LockJar will merge the dependencies from the `default` and `runtime` group of a Gem's _Jarfile_. These will be placed in the
341
+ LockJar will merge the dependencies from the `default` and `runtime` group of a Gem's _Jarfile_. These will be placed in the
335
342
  lockfile under Gem's corresponding Bundler group. For example, the following Gemfile:
336
343
 
337
344
  group :development do
@@ -355,7 +362,7 @@ Would produce the follow _Jarfile.lock_ excerpt:
355
362
  - com.google.guava:guava:jar:r05
356
363
 
357
364
  Since `solr_sail` is defined in the _Gemfile's_ `development` group, the corresponding _Jarfile.lock_ dependencies are also under the `development` group.
358
-
365
+
359
366
  ## License
360
367
 
361
368
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -372,4 +379,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
372
379
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
373
380
  License for the specific language governing permissions and limitations under
374
381
  the License.
375
-
@@ -20,71 +20,73 @@ require 'lock_jar/domain/artifact'
20
20
  module LockJar
21
21
  module Domain
22
22
  class Dsl
23
-
23
+
24
24
  DEFAULT_GROUP = ['default']
25
-
25
+
26
26
  attr_accessor :artifacts, :remote_repositories, :local_repository, :groups,
27
- :maps, :excludes, :merged
28
-
27
+ :maps, :excludes, :merged, :clear_repositories
28
+
29
29
  attr_reader :file_path
30
-
30
+
31
31
  class << self
32
-
32
+
33
33
  def create(jarfile = nil, &blk)
34
34
  builder = new
35
35
  evaluate(builder, jarfile, &blk)
36
36
  end
37
-
37
+
38
38
  def evaluate(builder, jarfile = nil, &blk)
39
39
  if jarfile.nil? && blk.nil?
40
40
  raise "jarfile or block must be set"
41
41
  end
42
-
42
+
43
43
  if jarfile
44
44
  builder.instance_eval(DslHelper.read_file(jarfile.to_s), jarfile.to_s, 1)
45
- end
46
-
45
+ end
46
+
47
47
  if blk
48
48
  builder.instance_eval(&blk)
49
- end
50
-
49
+ end
50
+
51
51
  builder
52
52
  end
53
-
53
+
54
54
  end
55
-
55
+
56
56
  def initialize
57
-
57
+
58
58
  @remote_repositories = []
59
59
  @artifacts = { 'default' => [] }
60
-
60
+
61
61
  @group_changed = false
62
-
62
+
63
63
  @present_group = 'default'
64
-
64
+
65
65
  @local_repository = nil
66
66
  @maps = {}
67
-
67
+
68
68
  @excludes = []
69
-
69
+
70
70
  @merged = []
71
+
72
+ @clear_repositories = false
71
73
  end
72
-
74
+
73
75
  def exclude(*notations)
74
76
  @excludes += notations
75
77
  end
76
-
78
+
77
79
  def jar(notation, *args)
78
80
  opts = {}
79
81
  if args.last.is_a? Hash
80
82
  opts.merge!( args.last )
81
83
  end
82
-
84
+
83
85
  artifact = Jar.new( notation )
84
-
86
+
85
87
  assign_groups( artifact, opts[:group] )
86
88
  end
87
-
89
+
88
90
  def local( *args )
89
91
  unless args.empty?
90
92
  if File.directory?( File.expand_path( args.first ) )
@@ -97,48 +99,48 @@ module LockJar
97
99
  if args.last.is_a? Hash
98
100
  opts.merge!( args.last )
99
101
  end
100
-
102
+
101
103
  artifact = Local.new( path )
102
-
104
+
103
105
  assign_groups( artifact, opts[:group] )
104
106
  end
105
107
  end
106
108
  end
107
-
109
+
108
110
  def local_repo( path )
109
111
  @local_repository = path
110
112
  end
111
-
113
+
112
114
  alias_method :name, :local_repository
113
-
115
+
114
116
  # Map a dependency to another dependency or local directory.
115
117
  def map( notation, *args )
116
118
  @maps[notation] = args
117
119
  end
118
-
119
- #
120
+
121
+ #
120
122
  def pom(path, *args)
121
123
  unless path =~ /\.xml$/i
122
- raise "#{path} is an invalid pom path"
124
+ raise "#{path} is an invalid pom path"
123
125
  end
124
-
126
+
125
127
  opts = { :scopes => ['runtime', 'compile'] }
126
-
128
+
127
129
  if args.last.is_a? Hash
128
130
  opts.merge! args.last
129
131
  end
130
-
132
+
131
133
  artifact = Pom.new( path, opts[:scopes] )
132
-
134
+
133
135
  assign_groups( artifact, opts[:groups] )
134
136
  end
135
-
137
+
136
138
  def remote_repo( url, opts = {} )
137
139
  @remote_repositories << url
138
140
  end
139
141
  alias_method :remote_repository, :remote_repo
140
142
  alias_method :repository, :remote_repo
141
-
143
+
142
144
  def group(*groups, &blk)
143
145
  @group_changed = true
144
146
  groups.each do |group|
@@ -147,32 +149,36 @@ module LockJar
147
149
  end
148
150
  @group_changed = false
149
151
  @present_group = 'default'
150
- end
151
-
152
+ end
153
+
152
154
  # @deprecated Please use {#group} instead
153
155
  def scope(*scopes, &blk)
154
156
  warn "[DEPRECATION] `scope` is deprecated. Please use `group` instead."
155
157
  group(*scopes,&blk)
156
158
  end
157
-
158
- private
159
+
160
+ def without_default_maven_repo
161
+ @clear_repositories = true
162
+ end
163
+
164
+ private
159
165
  def assign_groups(artifact, groups=nil)
160
-
166
+
161
167
  if groups
162
-
168
+
163
169
  unless groups.is_a? Array
164
170
  groups = [groups]
165
171
  end
166
-
172
+
167
173
  # include present group if within a group block
168
174
  if @group_changed
169
175
  groups << @present_group
170
176
  end
171
-
177
+
172
178
  else
173
179
  groups = [@present_group]
174
180
  end
175
-
181
+
176
182
  if artifact
177
183
  groups.uniq.each do |group|
178
184
  group_key = group.to_s
@@ -180,9 +186,9 @@ module LockJar
180
186
  @artifacts[group_key] << artifact
181
187
  end
182
188
  end
183
-
189
+
184
190
  end
185
-
191
+
186
192
  end
187
193
  end
188
- end
194
+ end