lock_jar 0.5.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "naether", "~> 0.8.6"
3
+ gem "naether", "~> 0.9.0"
4
4
  gem "thor", "> 0.14.0"
5
5
 
6
6
  # Add dependencies to develop your gem here.
data/README.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  LockJar manages Java Jars for Ruby. Powered by [Naether](https://github.com/mguymon/naether) to create a frankenstein of Bundler and Maven. A Jarfile ([example](https://github.com/mguymon/lock_jar/blob/master/spec/Jarfile)) is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test. The Jarfile.lock can be used to populate the classpath.
4
4
 
5
- LockJar can be used directly or integrates with Buildr.
5
+ LockJar can be used directly, from the [command line](https://github.com/mguymon/lock_jar/blob/master/README.md#command-line), [triggered from a Gem install](https://github.com/mguymon/lock_jar/blob/master/README.md#gem-integration), and [integrates with Buildr](https://github.com/mguymon/lock_jar/blob/master/README.md#buildr-integration).
6
6
 
7
7
  https://github.com/mguymon/lock_jar
8
8
 
9
- [RDoc](http://rubydoc.info/github/mguymon/lock_jar/master/frames)
9
+ [RDoc](http://rubydoc.info/gems/lock_jar/frames)
10
10
 
11
11
  ## Install
12
12
 
13
13
  gem install lock_jar
14
14
 
15
- ## Usage
15
+ ## Ruby Usage
16
16
 
17
17
  ### Jarfile
18
18
 
@@ -21,7 +21,6 @@ methods:
21
21
 
22
22
  * **local( path )**: Set the local Maven repository, this were dependencies are downloaded to.
23
23
  * **repository( url )**: Add additional urlr of remote Maven repository.
24
- * **map( notation, paths )**: Map local compiled class paths to a notation. The map is applied when loading or listing jar. This is useful for local development that overrides an artifact. A single or Array of paths can be set.
25
24
  * **exclude( excludes )**: Add a artifact:group that will be excluded from resolved dependencies. A single or Array of excludes can be set.
26
25
  * **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 scope is _compile_, can be specified by setting _opts = { :scope => ['new_scope'] }_
27
26
  * **pom( pom_path, opts = {} )**: Add a local Maven pom, default is to load dependencies for all scopes. To select the scopes to be loaded from the pom, set the _opts = { :scopes => ['new_scope'] }_
@@ -38,19 +37,17 @@ methods:
38
37
  jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
39
38
  end
40
39
 
41
- scope 'test' do
42
- jar 'junit:junit:jar:4.10'
43
- end
40
+ jar 'junit:junit:jar:4.10', :scope => 'test'
44
41
 
45
42
 
46
43
  ### Resolving dependencies
47
44
 
48
- * **LockJar.lock( *args )**: Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
49
- * An arg of a String will set the Jarfile path, e.g. _'/somewhere/Jarfile.different'_. Default jarfile is _'Jarfile'_
50
- * An arg of a Hash will set the options, e.g. _{ :local_repo => 'path' }_
51
- * **:download** if true, will download jars to local repo. Defaults to true.
52
- * **:local_repo** sets the local repo path
53
- * **:lockfile** sets the Jarfile.lock path. Default lockfile is _Jarfile.lock_.
45
+ **LockJar.lock( *args )**: Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
46
+ * _[String]_ will set the Jarfile path, e.g. `'/somewhere/Jarfile.different'`. Default jarfile is `'Jarfile'`
47
+ * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
48
+ * **:download** _[Boolean]_ if true, will download jars to local repo. Defaults to true.
49
+ * **:local_repo** _[String]_ sets the local repo path. Defaults to `ENV['M2_REPO']` or `'~/.m2/repository'`
50
+ * **:lockfile** _[String]_ sets the Jarfile.lock path. Default lockfile is `'Jarfile.lock'`.
54
51
 
55
52
  When the Jarfile is locked, the transitive dependencies are resolved and saved to the Jarfile.lock file.
56
53
 
@@ -98,21 +95,26 @@ The _Jarfile.lock_ generated is a YAML file containing the scoped dependencies,
98
95
 
99
96
 
100
97
  ### Accessing Jars
101
-
102
- * **LockJar.list(*args)**: Lists all dependencies as notations for scopes from the Jarfile.lock. Depending on the type of arg, a different configuration is set.
103
- * An arg of a String will set the Jarfile.lock path, e.g. _Better.lock_. Default lock file is _Jarfile.lock_.
104
- * An arg of an Array will set the scopes, e.g. _['compile','test']_. Defaults scopes are _compile_ and _runtime_.
105
- * An arg of a Hash will set the options, e.g. _{ :local_repo => 'path' }_
106
- * **:local_repo** sets the local repo path
107
- * **:local_paths** converts the notations to paths of jars in the local repo
108
- * **:resolve** to true will make transitive dependences resolve before returning list of jars
109
-
110
- * **LockJar.load(*args)**: Loads all dependencies to the classpath for scopes from the Jarfile.lock. Defaults scopes are _compile_ and _runtime_. Default lock file is _Jarfile.lock_.
111
- * An arg of a String will set the Jarfile.lock, e.g. _'Better.lock'_
112
- * An arg of an Array will set the scopes, e.g. _['compile','test']_
113
- * An arg of a Hash will set the options, e.g. _{ :local_repo => 'path' }_
114
- * **:local_repo** sets the local repo path
115
- * **:resolve** to true will make transitive dependences resolve before loading to classpath
98
+ **LockJar.install(*args)**: Download Jars in the Jarfile.lock
99
+ * _[String]_ will set the Jarfile.lock path, e.g. `'Better.lock'`. Default lock file is `'Jarfile.lock'`.
100
+ * _[Array<String>]_ will set the scopes, e.g. `['compile','test']`. Defaults scopes are _compile_ and _runtime_.
101
+ * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
102
+ * **:local_repo** _[String]_ sets the local repo path. Defaults to `ENV['M2_REPO']` or `'~/.m2/repository'`
103
+
104
+ **LockJar.list(*args)**: Lists all dependencies as notations for scopes from the Jarfile.lock. Depending on the type of arg, a different configuration is set.
105
+ * _[String]_ will set the Jarfile.lock path, e.g. `'Better.lock'`. Default lock file is `'Jarfile.lock'`.
106
+ * _[Array<String>]_ will set the scopes, e.g. `['compile','test']`. Defaults scopes are _compile_ and _runtime_.
107
+ * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
108
+ * **:local_repo** _[String]_ sets the local repo path. Defaults to `ENV['M2_REPO']` or `'~/.m2/repository'`
109
+ * **:local_paths** _[Boolean]_ converts the notations to paths of jars in the local repo
110
+ * **:resolve** _[Boolean]_ to true will make transitive dependences resolve before returning list of jars
111
+
112
+ **LockJar.load(*args)**: Loads all dependencies to the classpath for scopes from the Jarfile.lock. Defaults scopes are _compile_ and _runtime_. Default lock file is _Jarfile.lock_.
113
+ * _[String]_ will set the Jarfile.lock, e.g. `'Better.lock'`
114
+ * _[Array<String>]_ will set the scopes, e.g. `['compile','test']`
115
+ * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
116
+ * **:local_repo** _[String]_ sets the local repo path
117
+ * **:resolve** _[Boolean]_ to true will make transitive dependences resolve before loading to classpath
116
118
 
117
119
  Once a _Jarfile.lock_ is generated, you can list all resolved jars by
118
120
 
@@ -170,10 +172,49 @@ Download all jars in a _Jarfile.lock_ with
170
172
 
171
173
  _lockjar_ _--help_ will give you list of all commands and their options.
172
174
 
173
- ## Bundler Integration
175
+ ## Gem Integration
176
+
177
+ ### Installing
178
+
179
+ LockJar can be triggered when a Gem is installed by using a [Gem extension](http://docs.rubygems.org/read/chapter/20#extensions)
180
+ of type _Rakefile_. The cavaet is the task to install the jars must be the default for the Rakefile.
181
+
182
+ A Gem spec with _Rakefile_ extension:
183
+
184
+ Gem::Specification.new do |s|
185
+ s.extensions = ["Rakefile"]
186
+ end
187
+
188
+ Rakefile with default to install Jars using LockJar:
189
+
190
+ task :default => :prepare
191
+
192
+ task :prepare do
193
+ require 'lock_jar'
194
+
195
+ # get jarfile relative the gem dir
196
+ lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
197
+
198
+ LockJar.install( :lockfile => lockfile )
199
+ end
200
+
201
+ #### Work around for Rakefile default
202
+
203
+ The downside of using the Gem extension Rakefile is it requires the default to
204
+ point at the task to download the jars (from the example Rakefile,
205
+ `task :default => :prepare`). To get around this, I used a Rakefile called
206
+ _PostInstallRakefile_ to handle the `task :prepare`. When packaging the gem, _PostInstallRakefile_ is
207
+ renamed to `Rakefile`.
208
+
209
+ ### Loading
210
+
211
+ With the Jars already installed, loading the classpath for the Gem is simple. As part of the load process for the Gem add (entry file that is required, etc):
212
+
213
+ #get jarfile relative the gem dir
214
+ lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
215
+
216
+ LockJar.load( :lockfile => lockfile )
174
217
 
175
- Has been deprecated to https://github.com/mguymon/lock_jar/tree/bundler_support
176
-
177
218
  ## Buildr Integration
178
219
 
179
220
  LockJar integrates with [Buildr](http://buildr.apache.org/) using an [Addon](https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/buildr.rb). This allows the Jarfile to be defined directly into a _buildfile_. A global LockJar definition can be set and is inherited to all projects. Each project may have its own LockJar definition. A lock file is generated per project based on the project name.
@@ -226,9 +267,13 @@ Sample buildfile with LockJar
226
267
 
227
268
  Generated the following lock files using **lock_jar:lock**
228
269
 
229
- * project1.lock - contains _junit_ and _mina_ jars.
230
- * project2.lock - contains _junit_ and _pom.xml_ jars.
270
+ * _project1.lock_ - contains _junit_ and _mina_ jars.
271
+ * _project2.lock_ - contains _junit_ and _pom.xml_ jars.
231
272
 
273
+ ## Bundler Integration
274
+
275
+ Direct Bundler integration has been deprecated to https://github.com/mguymon/lock_jar/tree/bundler_support.
276
+ Waiting for [Bundler plugin support](https://github.com/carlhuda/bundler/issues/1945)
232
277
 
233
278
  ## License
234
279
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.6.0
@@ -14,6 +14,7 @@
14
14
  # the License.
15
15
 
16
16
  require 'lock_jar/runtime'
17
+ require 'naether/maven'
17
18
 
18
19
  module LockJar
19
20
 
@@ -33,18 +34,42 @@ module LockJar
33
34
  #
34
35
  # @return [String] version of POM
35
36
  #
36
- def pom_version( pom_path, opts = {} )
37
- Runtime.instance.resolver(opts).naether.pom_version( pom_path )
37
+ def pom_version( pom_path )
38
+ maven = Naether::Maven.create_from_pom( pom_path )
39
+ maven.version()
38
40
  end
39
41
 
40
42
  #
41
43
  # Write a POM from list of notations
42
44
  #
43
- # @param [Array] notations
45
+ # @param [String] pom notation
44
46
  # @param [String] file_path path of new pom
45
- # @param [Hash] options
46
- def write_pom( notations, file_path, opts = {} )
47
- Runtime.instance.resolver(opts).naether.write_pom( notations, file_path )
47
+ # @param [Hash] opts
48
+ # @option opts [Boolean] :include_resolved to add dependencies of resolve dependencies from Jarfile.lock. Default is true.
49
+ # @option opts [Array] :dependencies Array of of mixed dependencies:
50
+ # * [String] Artifact notation, such as groupId:artifactId:version, e.g. 'junit:junit:4.7'
51
+ # * [Hash] of a single artifaction notation => scope - { 'junit:junit:4.7' => 'test' }
52
+ #
53
+ def write_pom( notation, file_path, opts = {} )
54
+ opts = {:include_resolved => true}.merge( opts )
55
+
56
+ maven = Naether::Maven.create_from_notataion( notation )
57
+
58
+ if opts[:include_resolved]
59
+ # Passes in nil to the resolver to get the cache
60
+ maven.load_naether( Runtime.instance.resolver.naether )
61
+ end
62
+
63
+ if opts[:dependencies]
64
+ opts[:dependencies].each do |dep|
65
+ if dep.is_a? Array
66
+ maven.add_dependency(dep[0], dep[1])
67
+ else
68
+ maven.add_dependency(dep)
69
+ end
70
+ end
71
+ end
72
+ maven.write_pom( file_path )
48
73
  end
49
74
 
50
75
  #
@@ -24,44 +24,17 @@ module LockJar
24
24
  attr_reader :naether
25
25
 
26
26
  def initialize( opts = {} )
27
+
27
28
  @opts = opts
28
29
  local_repo = opts[:local_repo] || Naether::Bootstrap.default_local_repo
29
30
 
30
31
  # Bootstrap Naether
31
- jars = []
32
- temp_jar_dir = File.join(local_repo, '.lock_jar', 'naether' )
33
- deps = Naether::Bootstrap.check_local_repo_for_deps( local_repo )
34
- if deps[:missing].size > 0
35
- deps = Naether::Bootstrap.download_dependencies( temp_jar_dir, deps.merge( :local_repo => local_repo ) )
36
- if deps[:downloaded].size > 0
37
-
38
- unless File.directory?( temp_jar_dir )
39
- FileUtils.mkdir_p jar_dir
40
- end
41
-
42
- @naether = Naether::Bootstrap.install_dependencies_to_local_repo( temp_jar_dir, :local_repo => local_repo )
43
- jars = jars + deps[:downloaded].map{ |jar| jar.values[0] }
44
- else
45
- # XXX: download failed?
46
- end
47
-
48
- # Remove bootstrap jars, they have been installed to the local repo
49
- elsif File.exists?( temp_jar_dir )
50
- FileUtils.rm_rf temp_jar_dir
51
- end
32
+ Naether::Bootstrap.bootstrap_local_repo( local_repo, opts )
52
33
 
53
- jars = jars + deps[:exists].map{ |jar| jar.values[0] }
54
-
55
34
  # Bootstrapping naether will create an instance from downloaded jars.
56
35
  # If jars exist locally already, create manually
57
- if @naether.nil?
58
- jars << Naether::JAR_PATH
59
- @naether = Naether.create_from_jars( jars )
60
- end
61
-
62
- @naether.local_repo_path = opts[:local_repo].to_s if opts[:local_repo]
63
-
64
-
36
+ @naether = Naether.new
37
+ @naether.local_repo_path = local_repo if local_repo
65
38
  @naether.clear_remote_repositories if opts[:offline]
66
39
  end
67
40
 
@@ -77,7 +50,7 @@ module LockJar
77
50
  def resolve( dependencies, download_artifacts = true )
78
51
  @naether.dependencies = dependencies
79
52
  @naether.resolve_dependencies( download_artifacts )
80
- @naether.dependenciesNotation
53
+ @naether.dependencies_notation
81
54
  end
82
55
 
83
56
  def download( dependencies )
@@ -112,7 +85,7 @@ module LockJar
112
85
  Naether::Java.load_paths( dirs )
113
86
 
114
87
  jars = @naether.to_local_paths( jars )
115
- Naether::Java.load_jars( jars )
88
+ Naether::Java.load_paths( jars )
116
89
 
117
90
  dirs + jars
118
91
  end
@@ -31,8 +31,9 @@ module LockJar
31
31
  opts[:local_repo] = File.expand_path(opts[:local_repo])
32
32
  end
33
33
 
34
- # XXX: opts for a method will cause resolver to reload
35
- if @current_resolver.nil? || opts != @current_resolver.opts
34
+ # XXX: Caches the resolver by the options. Passing in nil opts will replay
35
+ # from the cache. This need to change.
36
+ if @current_resolver.nil? || (!opts.nil? && opts != @current_resolver.opts)
36
37
  @current_resolver = LockJar::Resolver.new( opts )
37
38
  end
38
39
 
data/lock_jar.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lock_jar"
8
- s.version = "0.5.6"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Guymon"]
12
- s.date = "2012-09-01"
12
+ s.date = "2012-09-19"
13
13
  s.description = "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate the classpath"
14
14
  s.email = "michael@tobedevoured.com"
15
15
  s.executables = ["lockjar"]
@@ -53,14 +53,14 @@ Gem::Specification.new do |s|
53
53
  s.specification_version = 3
54
54
 
55
55
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
- s.add_runtime_dependency(%q<naether>, ["~> 0.8.6"])
56
+ s.add_runtime_dependency(%q<naether>, ["~> 0.9.0"])
57
57
  s.add_runtime_dependency(%q<thor>, ["> 0.14.0"])
58
58
  s.add_development_dependency(%q<rspec>, ["~> 2.9.0"])
59
59
  s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
60
60
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
61
61
  s.add_development_dependency(%q<yard>, ["~> 0.8.0"])
62
62
  else
63
- s.add_dependency(%q<naether>, ["~> 0.8.6"])
63
+ s.add_dependency(%q<naether>, ["~> 0.9.0"])
64
64
  s.add_dependency(%q<thor>, ["> 0.14.0"])
65
65
  s.add_dependency(%q<rspec>, ["~> 2.9.0"])
66
66
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  s.add_dependency(%q<yard>, ["~> 0.8.0"])
69
69
  end
70
70
  else
71
- s.add_dependency(%q<naether>, ["~> 0.8.6"])
71
+ s.add_dependency(%q<naether>, ["~> 0.9.0"])
72
72
  s.add_dependency(%q<thor>, ["> 0.14.0"])
73
73
  s.add_dependency(%q<rspec>, ["~> 2.9.0"])
74
74
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
data/spec/Jarfile CHANGED
@@ -1,4 +1,4 @@
1
- local '~/.m2'
1
+ local '~/.m2/repository'
2
2
  repository 'http://mirrors.ibiblio.org/pub/mirrors/maven2'
3
3
 
4
4
  jar "org.apache.mina:mina-core:2.0.4"
@@ -5,7 +5,7 @@ describe LockJar::Dsl do
5
5
  it "should load a Jarfile" do
6
6
  jarfile = LockJar::Dsl.evaluate( "spec/Jarfile" )
7
7
 
8
- jarfile.local_repository.should eql '~/.m2'
8
+ jarfile.local_repository.should eql '~/.m2/repository'
9
9
  jarfile.notations.should eql( {"compile"=>["org.apache.mina:mina-core:2.0.4", "spec/pom.xml"], "runtime"=>["spec/pom.xml", "org.apache.tomcat:servlet-api:jar:6.0.35"], "test"=>["spec/pom.xml", "junit:junit:jar:4.10"]} )
10
10
  jarfile.repositories.should eql( ['http://mirrors.ibiblio.org/pub/mirrors/maven2'] )
11
11
  end
@@ -4,6 +4,11 @@ require 'lib/lock_jar/maven'
4
4
  require 'naether'
5
5
 
6
6
  describe LockJar::Maven do
7
+ before do
8
+ # Bootstrap Naether
9
+ Naether::Bootstrap.bootstrap_local_repo
10
+ end
11
+
7
12
  context "Class" do
8
13
  it "should get pom version" do
9
14
  LockJar::Maven.pom_version( "spec/pom.xml" ).should eql( "3" )
@@ -16,23 +16,26 @@ describe LockJar, "#lock" do
16
16
 
17
17
  lockfile = LockJar.read('tmp/Jarfile.lock')
18
18
  lockfile.should eql( {
19
- "local_repository" => "~/.m2",
20
- "repositories" => ["http://repo1.maven.org/maven2/", 'http://mirrors.ibiblio.org/pub/mirrors/maven2', "http://repository.jboss.org/nexus/content/groups/public-jboss"],
21
- "scopes" => {
22
- "compile"=>{
23
- "dependencies"=>["org.apache.mina:mina-core:2.0.4", "spec/pom.xml"],
24
- "resolved_dependencies"=>["org.apache.mina:mina-core:jar:2.0.4",
25
- "org.slf4j:slf4j-api:jar:1.6.1", "com.slackworks:modelcitizen:jar:0.2.2",
26
- "commons-lang:commons-lang:jar:2.6", "commons-beanutils:commons-beanutils:jar:1.8.3",
27
- "commons-logging:commons-logging:jar:1.1.1", "ch.qos.logback:logback-classic:jar:0.9.24",
28
- "ch.qos.logback:logback-core:jar:0.9.24", "com.metapossum:metapossum-scanner:jar:1.0",
29
- "commons-io:commons-io:jar:1.4", "junit:junit:jar:4.7"]},
30
- "runtime"=>{
31
- "dependencies"=>["spec/pom.xml", "org.apache.tomcat:servlet-api:jar:6.0.35"],
32
- "resolved_dependencies"=>["org.apache.tomcat:servlet-api:jar:6.0.35"]},
33
- "test"=>{
34
- "dependencies"=>["spec/pom.xml", "junit:junit:jar:4.10"],
35
- "resolved_dependencies"=>["org.jboss.unit:jboss-unit:jar:1.2.4", "junit:junit:jar:4.10", "org.hamcrest:hamcrest-core:jar:1.1"]} } } )
19
+ "local_repository"=>"~/.m2/repository",
20
+ "scopes"=>{
21
+ "compile"=>{
22
+ "dependencies"=>["org.apache.mina:mina-core:2.0.4", "spec/pom.xml"],
23
+ "resolved_dependencies"=>["com.metapossum:metapossum-scanner:jar:1.0",
24
+ "org.apache.mina:mina-core:jar:2.0.4", "commons-beanutils:commons-beanutils:jar:1.8.3",
25
+ "ch.qos.logback:logback-classic:jar:0.9.24",
26
+ "commons-logging:commons-logging:jar:1.1.1", "junit:junit:jar:4.7",
27
+ "ch.qos.logback:logback-core:jar:0.9.24", "commons-lang:commons-lang:jar:2.6",
28
+ "com.slackworks:modelcitizen:jar:0.2.2", "org.slf4j:slf4j-api:jar:1.6.1",
29
+ "commons-io:commons-io:jar:1.4"]},
30
+ "runtime"=>{
31
+ "dependencies"=>["spec/pom.xml", "org.apache.tomcat:servlet-api:jar:6.0.35"],
32
+ "resolved_dependencies"=>["org.apache.tomcat:servlet-api:jar:6.0.35"]},
33
+ "test"=>{
34
+ "dependencies"=>["spec/pom.xml", "junit:junit:jar:4.10"],
35
+ "resolved_dependencies"=>["junit:junit:jar:4.10", "org.jboss.unit:jboss-unit:jar:1.2.4",
36
+ "org.hamcrest:hamcrest-core:jar:1.1"]}},
37
+ "repositories"=>["http://repo1.maven.org/maven2/", "http://mirrors.ibiblio.org/pub/mirrors/maven2", "http://repository.jboss.org/nexus/content/groups/public-jboss"]
38
+ })
36
39
  end
37
40
 
38
41
  it "should not replace dependencies with maps" do
@@ -61,12 +64,17 @@ describe LockJar, "#lock" do
61
64
  File.exists?( 'tmp/Jarfile.lock' ).should be_true
62
65
  lockfile = LockJar.read('tmp/Jarfile.lock')
63
66
  lockfile.should eql( {
64
- "repositories" => ["http://repo1.maven.org/maven2/", 'http://mirrors.ibiblio.org/pub/mirrors/maven2', "http://repository.jboss.org/nexus/content/groups/public-jboss"],
65
67
  "excludes"=>["commons-logging", "logkit"],
66
68
  "scopes"=>{
67
- "compile"=>{
68
- "dependencies"=>["opensymphony:oscache:jar:2.4.1"],
69
- "resolved_dependencies"=>["opensymphony:oscache:jar:2.4.1", "log4j:log4j:jar:1.2.12", "avalon-framework:avalon-framework:jar:4.1.3", "javax.jms:jms:jar:1.1", "javax.servlet:servlet-api:jar:2.3"]}}} )
69
+ "compile"=>{
70
+ "dependencies"=>["opensymphony:oscache:jar:2.4.1"],
71
+ "resolved_dependencies"=>["log4j:log4j:jar:1.2.12", "javax.jms:jms:jar:1.1",
72
+ "opensymphony:oscache:jar:2.4.1", "javax.servlet:servlet-api:jar:2.3",
73
+ "avalon-framework:avalon-framework:jar:4.1.3"]}},
74
+ "repositories"=>["http://repo1.maven.org/maven2/",
75
+ "http://mirrors.ibiblio.org/pub/mirrors/maven2",
76
+ "http://repository.jboss.org/nexus/content/groups/public-jboss"]
77
+ })
70
78
 
71
79
  end
72
80
 
@@ -80,11 +88,18 @@ describe LockJar, "#lock" do
80
88
 
81
89
  lockfile = LockJar.read('tmp/NoRepoJarfile.lock')
82
90
  lockfile.should eql( {
83
- "repositories" => ["http://repo1.maven.org/maven2/"],
84
91
  "scopes"=>{
85
92
  "compile"=>{
86
- "dependencies"=>["org.eclipse.jetty:jetty-servlet:8.1.3.v20120416"],
87
- "resolved_dependencies"=>["org.eclipse.jetty:jetty-servlet:jar:8.1.3.v20120416", "org.eclipse.jetty:jetty-security:jar:8.1.3.v20120416", "org.eclipse.jetty:jetty-server:jar:8.1.3.v20120416", "org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016", "org.eclipse.jetty:jetty-continuation:jar:8.1.3.v20120416", "org.eclipse.jetty:jetty-http:jar:8.1.3.v20120416", "org.eclipse.jetty:jetty-io:jar:8.1.3.v20120416", "org.eclipse.jetty:jetty-util:jar:8.1.3.v20120416"]}}} )
93
+ "dependencies"=>["org.eclipse.jetty:jetty-servlet:8.1.3.v20120416"],
94
+ "resolved_dependencies"=>["org.eclipse.jetty:jetty-util:jar:8.1.3.v20120416",
95
+ "org.eclipse.jetty:jetty-io:jar:8.1.3.v20120416",
96
+ "org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016",
97
+ "org.eclipse.jetty:jetty-security:jar:8.1.3.v20120416",
98
+ "org.eclipse.jetty:jetty-continuation:jar:8.1.3.v20120416",
99
+ "org.eclipse.jetty:jetty-servlet:jar:8.1.3.v20120416",
100
+ "org.eclipse.jetty:jetty-server:jar:8.1.3.v20120416",
101
+ "org.eclipse.jetty:jetty-http:jar:8.1.3.v20120416"]}},
102
+ "repositories"=>["http://repo1.maven.org/maven2/"]})
88
103
  end
89
104
  end
90
105
 
@@ -95,17 +110,17 @@ describe LockJar, "#install" do
95
110
 
96
111
  jars = LockJar.install( 'tmp/Jarfile.lock', ['compile'], :local_repo => 'tmp/test-repo-install' )
97
112
  jars.should eql(
98
- [ File.expand_path( "tmp/test-repo-install/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"),
99
- File.expand_path( "tmp/test-repo-install/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"),
113
+ [ File.expand_path( "tmp/test-repo-install/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar"),
114
+ File.expand_path( "tmp/test-repo-install/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar"),
115
+ File.expand_path( "tmp/test-repo-install/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"),
116
+ File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar" ),
117
+ File.expand_path( "tmp/test-repo-install/junit/junit/4.7/junit-4.7.jar"),
118
+ File.expand_path( "tmp/test-repo-install/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"),
119
+ File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar"),
100
120
  File.expand_path( "tmp/test-repo-install/com/slackworks/modelcitizen/0.2.2/modelcitizen-0.2.2.jar"),
101
121
  File.expand_path( "tmp/test-repo-install/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"),
102
- File.expand_path( "tmp/test-repo-install/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar" ),
103
- File.expand_path( "tmp/test-repo-install/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" ),
104
- File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar" ),
105
- File.expand_path( "tmp/test-repo-install/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar" ),
106
- File.expand_path( "tmp/test-repo-install/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar" ),
107
- File.expand_path( "tmp/test-repo-install/commons-io/commons-io/1.4/commons-io-1.4.jar" ),
108
- File.expand_path( "tmp/test-repo-install/junit/junit/4.7/junit-4.7.jar" ) ] )
122
+ File.expand_path( "tmp/test-repo-install/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"),
123
+ File.expand_path( "tmp/test-repo-install/commons-io/commons-io/1.4/commons-io-1.4.jar")] )
109
124
  end
110
125
 
111
126
  end
@@ -116,8 +131,13 @@ describe LockJar, "#list" do
116
131
  LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
117
132
 
118
133
  jars = LockJar.list( 'tmp/Jarfile.lock', ['compile', 'runtime', 'bad scope'], :local_repo => 'tmp/test-repo' )
119
- jars.should eql( ["org.apache.mina:mina-core:jar:2.0.4", "org.slf4j:slf4j-api:jar:1.6.1", "com.slackworks:modelcitizen:jar:0.2.2", "commons-lang:commons-lang:jar:2.6", "commons-beanutils:commons-beanutils:jar:1.8.3", "commons-logging:commons-logging:jar:1.1.1", "ch.qos.logback:logback-classic:jar:0.9.24", "ch.qos.logback:logback-core:jar:0.9.24", "com.metapossum:metapossum-scanner:jar:1.0", "commons-io:commons-io:jar:1.4", "junit:junit:jar:4.7", "org.apache.tomcat:servlet-api:jar:6.0.35"] )
120
-
134
+ jars.should eql([
135
+ "com.metapossum:metapossum-scanner:jar:1.0", "org.apache.mina:mina-core:jar:2.0.4",
136
+ "commons-beanutils:commons-beanutils:jar:1.8.3", "ch.qos.logback:logback-classic:jar:0.9.24",
137
+ "commons-logging:commons-logging:jar:1.1.1", "junit:junit:jar:4.7",
138
+ "ch.qos.logback:logback-core:jar:0.9.24", "commons-lang:commons-lang:jar:2.6",
139
+ "com.slackworks:modelcitizen:jar:0.2.2", "org.slf4j:slf4j-api:jar:1.6.1",
140
+ "commons-io:commons-io:jar:1.4", "org.apache.tomcat:servlet-api:jar:6.0.35" ])
121
141
  end
122
142
 
123
143
  it "should replace dependencies with maps" do
@@ -155,8 +175,20 @@ describe LockJar, "#load" do
155
175
  LockJar.lock( "spec/Jarfile", :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
156
176
 
157
177
  jars = LockJar.load( 'tmp/Jarfile.lock', ['compile', 'runtime'], :local_repo => 'tmp/test-repo' )
158
- jars.should eql( [File.expand_path("tmp/test-repo/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"), File.expand_path("tmp/test-repo/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"), File.expand_path("tmp/test-repo/com/slackworks/modelcitizen/0.2.2/modelcitizen-0.2.2.jar"), File.expand_path("tmp/test-repo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"), File.expand_path("tmp/test-repo/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar"), File.expand_path("tmp/test-repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"), File.expand_path("tmp/test-repo/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar"), File.expand_path("tmp/test-repo/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar"), File.expand_path("tmp/test-repo/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar"), File.expand_path("tmp/test-repo/commons-io/commons-io/1.4/commons-io-1.4.jar"), File.expand_path("tmp/test-repo/junit/junit/4.7/junit-4.7.jar"), File.expand_path("tmp/test-repo/org/apache/tomcat/servlet-api/6.0.35/servlet-api-6.0.35.jar")] )
159
-
178
+ jars.should eql( [
179
+ File.expand_path("tmp/test-repo/com/metapossum/metapossum-scanner/1.0/metapossum-scanner-1.0.jar"),
180
+ File.expand_path("tmp/test-repo/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar"),
181
+ File.expand_path("tmp/test-repo/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar"),
182
+ File.expand_path("tmp/test-repo/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar"),
183
+ File.expand_path("tmp/test-repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"),
184
+ File.expand_path("tmp/test-repo/junit/junit/4.7/junit-4.7.jar"),
185
+ File.expand_path("tmp/test-repo/ch/qos/logback/logback-core/0.9.24/logback-core-0.9.24.jar"),
186
+ File.expand_path("tmp/test-repo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"),
187
+ File.expand_path("tmp/test-repo/com/slackworks/modelcitizen/0.2.2/modelcitizen-0.2.2.jar"),
188
+ File.expand_path("tmp/test-repo/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"),
189
+ File.expand_path("tmp/test-repo/commons-io/commons-io/1.4/commons-io-1.4.jar"),
190
+ File.expand_path("tmp/test-repo/org/apache/tomcat/servlet-api/6.0.35/servlet-api-6.0.35.jar") ]
191
+ )
160
192
  if Naether.platform == 'java'
161
193
  lambda { include_class 'org.apache.mina.core.IoUtil' }.should_not raise_error
162
194
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock_jar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-01 00:00:00.000000000 Z
12
+ date: 2012-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: naether
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.8.6
21
+ version: 0.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.8.6
29
+ version: 0.9.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: thor
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: 3994584542198625779
161
+ hash: 3691790945900068517
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements: