lock_jar 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/README.md +249 -0
- data/VERSION +1 -1
- data/bin/lockjar +3 -61
- data/lib/lock_jar/cli.rb +64 -0
- data/lock_jar.gemspec +11 -10
- metadata +13 -12
- data/README.rdoc +0 -260
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
gem "naether", "~> 0.8.6"
|
4
|
-
gem "
|
4
|
+
gem "thor", "> 0.14.0"
|
5
5
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
9
|
gem "rspec", "~> 2.9.0"
|
10
10
|
gem "bundler", "~> 1.1.0"
|
11
|
-
gem "jeweler", "~> 1.
|
11
|
+
gem "jeweler", "~> 1.8.4"
|
12
12
|
gem "yard", "~> 0.8.0"
|
13
13
|
end
|
data/README.md
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
# LockJar
|
2
|
+
|
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
|
+
|
5
|
+
LockJar can be used directly or integrates with Buildr.
|
6
|
+
|
7
|
+
https://github.com/mguymon/lock_jar
|
8
|
+
|
9
|
+
[RDoc](http://rubydoc.info/github/mguymon/lock_jar/master/frames)
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
gem install lock_jar
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
### Jarfile
|
18
|
+
|
19
|
+
A Jarfile is a simple file using a Ruby DSL for defining a project's dependencies using the following
|
20
|
+
methods:
|
21
|
+
|
22
|
+
* **local( path )**: Set the local Maven repository, this were dependencies are downloaded to.
|
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
|
+
* **exclude( excludes )**: Add a artifact:group that will be excluded from resolved dependencies. A single or Array of excludes can be set.
|
26
|
+
* **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
|
+
* **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'] }_
|
28
|
+
* **scope( scopes )**: Set the scope for nested jar or pom. A single or Array of scopes can be set.
|
29
|
+
|
30
|
+
#### Example Jarfile
|
31
|
+
|
32
|
+
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
33
|
+
|
34
|
+
// Default scope is compile
|
35
|
+
jar "org.apache.mina:mina-core:2.0.4"
|
36
|
+
|
37
|
+
scope 'runtime' do
|
38
|
+
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
39
|
+
end
|
40
|
+
|
41
|
+
scope 'test' do
|
42
|
+
jar 'junit:junit:jar:4.10'
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
### Resolving dependencies
|
47
|
+
|
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_.
|
54
|
+
|
55
|
+
When the Jarfile is locked, the transitive dependencies are resolved and saved to the Jarfile.lock file.
|
56
|
+
|
57
|
+
Example of locking a Jarfile to a Jarfile.lock
|
58
|
+
|
59
|
+
LockJar.lock
|
60
|
+
|
61
|
+
|
62
|
+
### Jarfile.lock
|
63
|
+
|
64
|
+
The _Jarfile.lock_ generated is a YAML file containing the scoped dependencies, their resolved dependencies, and the additional Maven repositories.
|
65
|
+
|
66
|
+
#### The Jarfile.lock
|
67
|
+
|
68
|
+
---
|
69
|
+
repositories:
|
70
|
+
- http://repository.jboss.org/nexus/content/groups/public-jboss
|
71
|
+
scopes:
|
72
|
+
compile:
|
73
|
+
dependencies:
|
74
|
+
- org.apache.mina:mina-core:2.0.4
|
75
|
+
resolved_dependencies:
|
76
|
+
- org.apache.mina:mina-core:jar:2.0.4
|
77
|
+
- org.slf4j:slf4j-api:jar:1.6.1
|
78
|
+
- com.slackworks:modelcitizen:jar:0.2.2
|
79
|
+
- commons-lang:commons-lang:jar:2.6
|
80
|
+
- commons-beanutils:commons-beanutils:jar:1.8.3
|
81
|
+
- commons-logging:commons-logging:jar:1.1.1
|
82
|
+
- ch.qos.logback:logback-classic:jar:0.9.24
|
83
|
+
- ch.qos.logback:logback-core:jar:0.9.24
|
84
|
+
- com.metapossum:metapossum-scanner:jar:1.0
|
85
|
+
- commons-io:commons-io:jar:1.4
|
86
|
+
- junit:junit:jar:4.7
|
87
|
+
runtime:
|
88
|
+
dependencies:
|
89
|
+
- org.apache.tomcat:servlet-api:jar:6.0.35
|
90
|
+
resolved_dependencies:
|
91
|
+
- org.apache.tomcat:servlet-api:jar:6.0.35
|
92
|
+
test:
|
93
|
+
dependencies:
|
94
|
+
- junit:junit:jar:4.10
|
95
|
+
resolved_dependencies:
|
96
|
+
- junit:junit:jar:4.10
|
97
|
+
- org.hamcrest:hamcrest-core:jar:1.1
|
98
|
+
|
99
|
+
|
100
|
+
### 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
|
116
|
+
|
117
|
+
Once a _Jarfile.lock_ is generated, you can list all resolved jars by
|
118
|
+
|
119
|
+
jars = LockJar.list
|
120
|
+
|
121
|
+
or directly load all Jars into the classpath
|
122
|
+
|
123
|
+
jars = LockJar.load
|
124
|
+
|
125
|
+
Do not forget, if you change your _Jarfile_, you have to re-generate the _Jarfile.lock_.
|
126
|
+
|
127
|
+
### Shortcuts
|
128
|
+
|
129
|
+
#### Skipping the Jarfile
|
130
|
+
|
131
|
+
You can skip the _Jarfile_ and _Jarfile.lock_ to directly play with dependencies by passing a block to _LockJar.lock_, _LockJar.list_, and _LockJar.load_
|
132
|
+
|
133
|
+
#### Lock without a Jarfile
|
134
|
+
|
135
|
+
LockJar.lock do
|
136
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
137
|
+
end
|
138
|
+
|
139
|
+
#### List without a Jarfile.lock
|
140
|
+
|
141
|
+
LockJar.list do
|
142
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
143
|
+
end
|
144
|
+
|
145
|
+
#### Load without a Jarfile.lock
|
146
|
+
|
147
|
+
LockJar.load do
|
148
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
149
|
+
end
|
150
|
+
|
151
|
+
Since you skipped the locking part, mostly likely you will need to resolve the dependences in the block, just pass the _:resolve => true_ option to enable dependency resolution (also works for _LockJar.list_).
|
152
|
+
|
153
|
+
LockJar.load( :resolve => true ) do
|
154
|
+
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
155
|
+
end
|
156
|
+
|
157
|
+
## Command line
|
158
|
+
|
159
|
+
There is a simple command line helper. You can lock a _Jarfile_ with the following command
|
160
|
+
|
161
|
+
lockjar lock
|
162
|
+
|
163
|
+
List jars in a _Jarfile.lock_ with
|
164
|
+
|
165
|
+
lockjar list
|
166
|
+
|
167
|
+
Download all jars in a _Jarfile.lock_ with
|
168
|
+
|
169
|
+
lockjar install
|
170
|
+
|
171
|
+
_lockjar_ _--help_ will give you list of all commands and their options.
|
172
|
+
|
173
|
+
## Bundler Integration
|
174
|
+
|
175
|
+
Has been deprecated to https://github.com/mguymon/lock_jar/tree/bundler_support
|
176
|
+
|
177
|
+
## Buildr Integration
|
178
|
+
|
179
|
+
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.
|
180
|
+
|
181
|
+
A new Buildr task is added to generate the lockfile for all projects
|
182
|
+
|
183
|
+
buildr lock_jar:lock
|
184
|
+
|
185
|
+
and a task per project to generate the lockfile for a single project
|
186
|
+
|
187
|
+
buildr <app>:<project>:lock_jar:lock
|
188
|
+
|
189
|
+
In a project, you can access an Array of notations using the **lock_jars** method, accepts same parameters as [LockJar.list](https://github.com/mguymon/lock_jar#accessing-jars)
|
190
|
+
|
191
|
+
lock_jars()
|
192
|
+
|
193
|
+
|
194
|
+
The _compile_ scoped dependencies are automatically added to the classpath for compiling. The test scoped dependencies are automatically added to the classpath for tests. Do not forget, if you change the LockJar definitions, you have to rerun the **lock_jar:lock** task.
|
195
|
+
|
196
|
+
|
197
|
+
### Example
|
198
|
+
|
199
|
+
Sample buildfile with LockJar
|
200
|
+
|
201
|
+
require 'lock_jar/buildr'
|
202
|
+
|
203
|
+
# app definition, inherited into all projects
|
204
|
+
lock_jar do
|
205
|
+
|
206
|
+
scope 'test' do
|
207
|
+
jar 'junit:junit:jar:4.10'
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
define 'app' do
|
212
|
+
|
213
|
+
def 'project1' do
|
214
|
+
lock_jar do
|
215
|
+
jar "org.apache.mina:mina-core:2.0.4"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def 'project2' do
|
220
|
+
lock_jar do
|
221
|
+
pom 'pom.xml'
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
Generated the following lock files using **lock_jar:lock**
|
228
|
+
|
229
|
+
* project1.lock - contains _junit_ and _mina_ jars.
|
230
|
+
* project2.lock - contains _junit_ and _pom.xml_ jars.
|
231
|
+
|
232
|
+
|
233
|
+
## License
|
234
|
+
|
235
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
236
|
+
contributor license agreements. See the NOTICE file distributed with this
|
237
|
+
work for additional information regarding copyright ownership. The ASF
|
238
|
+
licenses this file to you under the Apache License, Version 2.0 (the
|
239
|
+
"License"); you may not use this file except in compliance with the License.
|
240
|
+
You may obtain a copy of the License at
|
241
|
+
|
242
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
243
|
+
|
244
|
+
Unless required by applicable law or agreed to in writing, software
|
245
|
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
246
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
247
|
+
License for the specific language governing permissions and limitations under
|
248
|
+
the License.
|
249
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
data/bin/lockjar
CHANGED
@@ -1,64 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
4
|
-
require 'lock_jar'
|
5
|
-
require 'lock_jar/version'
|
3
|
+
require 'thor'
|
4
|
+
require 'lock_jar/cli'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
program_desc 'LockJar manages Java Jars for Ruby'
|
10
|
-
|
11
|
-
version LockJar::VERSION
|
12
|
-
|
13
|
-
desc 'Install Jars from a Jarfile.lock'
|
14
|
-
command :install do |c|
|
15
|
-
c.desc 'Path to Jarfile.lock'
|
16
|
-
c.default_value 'Jarfile.lock'
|
17
|
-
c.flag :lockfile
|
18
|
-
|
19
|
-
c.desc "Scopes to install from Jarfile.lock"
|
20
|
-
c.default_value 'compile, runtime'
|
21
|
-
c.flag :scopes
|
22
|
-
|
23
|
-
c.action do |global_options,options,args|
|
24
|
-
scopes = options[:scopes].split(',').map{ |scope| scope.strip }
|
25
|
-
puts "Installing Jars from #{options[:lockfile]} for #{scopes.inspect}"
|
26
|
-
LockJar.install( options[:lockfile], scopes )
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
desc 'List Jars from a Jarfile.lock'
|
31
|
-
command :list do |c|
|
32
|
-
c.desc 'Path to Jarfile.lock'
|
33
|
-
c.default_value 'Jarfile.lock'
|
34
|
-
c.flag :lockfile
|
35
|
-
|
36
|
-
c.desc "Scopes to install from Jarfile.lock"
|
37
|
-
c.default_value 'compile, runtime'
|
38
|
-
c.flag :scopes
|
39
|
-
|
40
|
-
c.action do |global_options,options,args|
|
41
|
-
scopes = options[:scopes].split(',').map{ |scope| scope.strip }
|
42
|
-
puts "Listing Jars from #{options[:lockfile]} for #{scopes.inspect}"
|
43
|
-
puts LockJar.list( options[:lockfile], scopes ).inspect
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
desc 'Lock Jars in a Jarfile.lock'
|
48
|
-
command :lock do |c|
|
49
|
-
c.desc 'Path to Jarfile'
|
50
|
-
c.default_value 'Jarfile'
|
51
|
-
c.flag :jarfile
|
52
|
-
|
53
|
-
c.desc "Path to Jarfile.lock"
|
54
|
-
c.default_value 'Jarfile.lock'
|
55
|
-
c.flag :lockfile
|
56
|
-
|
57
|
-
c.action do |global_options,options,args|
|
58
|
-
puts "Locking #{options[:jarfile]} to #{options[:lockfile]}"
|
59
|
-
LockJar.lock( options[:jarfile], { :lockfile => options[:lockfile] } )
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
exit run(ARGV)
|
6
|
+
LockJar::CLI.start
|
data/lib/lock_jar/cli.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'thor'
|
3
|
+
require 'lock_jar'
|
4
|
+
|
5
|
+
module LockJar
|
6
|
+
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def generate_lockfile_option
|
11
|
+
method_option :lockfile,
|
12
|
+
:aliases => "-l",
|
13
|
+
:default => 'Jarfile.lock',
|
14
|
+
:desc => "Path to Jarfile.lock"
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_scopes_option
|
18
|
+
method_option :scopes,
|
19
|
+
:aliases => "-s",
|
20
|
+
:default => ['compile', 'runtime'],
|
21
|
+
:desc => "Scopes to install from Jarfile.lock",
|
22
|
+
:type => :array
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_jarfile_option
|
26
|
+
method_option :jarfile,
|
27
|
+
:aliases => "-j",
|
28
|
+
:default => 'Jarfile',
|
29
|
+
:desc => "Path to Jarfile"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
extend(ClassMethods)
|
33
|
+
|
34
|
+
desc "version", "LockJar version"
|
35
|
+
def version
|
36
|
+
puts LockJar::VERSION
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "install", "Install Jars from a Jarfile.lock"
|
40
|
+
generate_lockfile_option
|
41
|
+
generate_scopes_option
|
42
|
+
def install
|
43
|
+
puts "Installing Jars from #{options[:lockfile]} for #{options[:scopes].inspect}"
|
44
|
+
LockJar.install( options[:lockfile], options[:scopes] )
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "list", "List Jars from a Jarfile.lock"
|
48
|
+
generate_lockfile_option
|
49
|
+
generate_scopes_option
|
50
|
+
def list
|
51
|
+
puts "Listing Jars from #{options[:lockfile]} for #{options[:scopes].inspect}"
|
52
|
+
puts LockJar.list( options[:lockfile], options[:scopes] ).inspect
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'lock', 'Lock Jars in a Jarfile.lock'
|
56
|
+
generate_jarfile_option
|
57
|
+
generate_lockfile_option
|
58
|
+
def lock
|
59
|
+
puts "Locking #{options[:jarfile]} to #{options[:lockfile]}"
|
60
|
+
LockJar.lock( options[:jarfile], { :lockfile => options[:lockfile] } )
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
data/lock_jar.gemspec
CHANGED
@@ -5,28 +5,29 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lock_jar"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.6"
|
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-
|
12
|
+
s.date = "2012-09-01"
|
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"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
|
-
"README.
|
18
|
+
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".gitignore",
|
22
22
|
"Gemfile",
|
23
23
|
"LICENSE",
|
24
|
-
"README.
|
24
|
+
"README.md",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"bin/lockjar",
|
28
28
|
"lib/lock_jar.rb",
|
29
29
|
"lib/lock_jar/buildr.rb",
|
30
|
+
"lib/lock_jar/cli.rb",
|
30
31
|
"lib/lock_jar/dsl.rb",
|
31
32
|
"lib/lock_jar/maven.rb",
|
32
33
|
"lib/lock_jar/resolver.rb",
|
@@ -53,25 +54,25 @@ Gem::Specification.new do |s|
|
|
53
54
|
|
54
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
56
|
s.add_runtime_dependency(%q<naether>, ["~> 0.8.6"])
|
56
|
-
s.add_runtime_dependency(%q<
|
57
|
+
s.add_runtime_dependency(%q<thor>, ["> 0.14.0"])
|
57
58
|
s.add_development_dependency(%q<rspec>, ["~> 2.9.0"])
|
58
59
|
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
59
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
60
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
60
61
|
s.add_development_dependency(%q<yard>, ["~> 0.8.0"])
|
61
62
|
else
|
62
63
|
s.add_dependency(%q<naether>, ["~> 0.8.6"])
|
63
|
-
s.add_dependency(%q<
|
64
|
+
s.add_dependency(%q<thor>, ["> 0.14.0"])
|
64
65
|
s.add_dependency(%q<rspec>, ["~> 2.9.0"])
|
65
66
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
66
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
67
68
|
s.add_dependency(%q<yard>, ["~> 0.8.0"])
|
68
69
|
end
|
69
70
|
else
|
70
71
|
s.add_dependency(%q<naether>, ["~> 0.8.6"])
|
71
|
-
s.add_dependency(%q<
|
72
|
+
s.add_dependency(%q<thor>, ["> 0.14.0"])
|
72
73
|
s.add_dependency(%q<rspec>, ["~> 2.9.0"])
|
73
74
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
74
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
75
76
|
s.add_dependency(%q<yard>, ["~> 0.8.0"])
|
76
77
|
end
|
77
78
|
end
|
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.
|
4
|
+
version: 0.5.6
|
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-
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: naether
|
@@ -28,21 +28,21 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.8.6
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: thor
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ! '>'
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 0.14.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ! '>'
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.14.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
85
|
+
version: 1.8.4
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.
|
93
|
+
version: 1.8.4
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: yard
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,17 +117,18 @@ executables:
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files:
|
119
119
|
- LICENSE
|
120
|
-
- README.
|
120
|
+
- README.md
|
121
121
|
files:
|
122
122
|
- .gitignore
|
123
123
|
- Gemfile
|
124
124
|
- LICENSE
|
125
|
-
- README.
|
125
|
+
- README.md
|
126
126
|
- Rakefile
|
127
127
|
- VERSION
|
128
128
|
- bin/lockjar
|
129
129
|
- lib/lock_jar.rb
|
130
130
|
- lib/lock_jar/buildr.rb
|
131
|
+
- lib/lock_jar/cli.rb
|
131
132
|
- lib/lock_jar/dsl.rb
|
132
133
|
- lib/lock_jar/maven.rb
|
133
134
|
- lib/lock_jar/resolver.rb
|
@@ -157,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
158
|
version: '0'
|
158
159
|
segments:
|
159
160
|
- 0
|
160
|
-
hash:
|
161
|
+
hash: 3994584542198625779
|
161
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
163
|
none: false
|
163
164
|
requirements:
|
data/README.rdoc
DELETED
@@ -1,260 +0,0 @@
|
|
1
|
-
= LockJar
|
2
|
-
|
3
|
-
LockJar manages Java Jars for Ruby. Powered by {Naether}[https://github.com/mguymon/naether] to create a frankenstein of
|
4
|
-
Bundler and Maven. A Jarfile ({example}[https://github.com/mguymon/lock_jar/blob/master/spec/Jarfile]) is used to
|
5
|
-
generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.
|
6
|
-
The Jarfile.lock can be used to populate the classpath.
|
7
|
-
|
8
|
-
LockJar can be used directly or integrates directly with Bundler and Buildr.
|
9
|
-
|
10
|
-
https://github.com/mguymon/lock_jar
|
11
|
-
|
12
|
-
{RDoc}[http://rubydoc.info/github/mguymon/lock_jar/master/frames]
|
13
|
-
|
14
|
-
== Install
|
15
|
-
|
16
|
-
gem install lock_jar
|
17
|
-
|
18
|
-
== Usage
|
19
|
-
|
20
|
-
=== Using a Jarfile
|
21
|
-
|
22
|
-
==== Jarfile
|
23
|
-
|
24
|
-
A Jarfile is a simple file using a Ruby DSL for defining a project's dependencies using the following
|
25
|
-
methods:
|
26
|
-
|
27
|
-
* local( path ): Set the local Maven repository, this were dependencies are downloaded to.
|
28
|
-
* repository( url ): Add additional urlr of remote Maven repository.
|
29
|
-
* 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.
|
30
|
-
* exclude( excludes ): Add a artifact:group that will be excluded from resolved dependencies. A single or Array of excludes can be set.
|
31
|
-
* 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> }
|
32
|
-
* 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_scopes> }
|
33
|
-
* scope( scopes ): Set the scope for nested jar or pom. A single or Array of scopes can be set.
|
34
|
-
|
35
|
-
Example Jarfile
|
36
|
-
|
37
|
-
repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
|
38
|
-
|
39
|
-
// Default scope is compile
|
40
|
-
jar "org.apache.mina:mina-core:2.0.4"
|
41
|
-
|
42
|
-
scope 'runtime' do
|
43
|
-
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
|
44
|
-
end
|
45
|
-
|
46
|
-
scope 'test' do
|
47
|
-
jar 'junit:junit:jar:4.10'
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
==== Resolving dependencies
|
52
|
-
|
53
|
-
* LockJar.lock( *args ): Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
|
54
|
-
* An arg of a String will set the Jarfile path, e.g. '/somewhere/Jarfile.different'. Default jarfile is *Jarfile*
|
55
|
-
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
56
|
-
* *:download* if true, will download jars to local repo. Defaults to true.
|
57
|
-
* *:local_repo* sets the local repo path
|
58
|
-
* *:lockfile* sets the Jarfile.lock path. Default lockfile is *Jarfile.lock*.
|
59
|
-
|
60
|
-
When the Jarfile is locked, the transitive dependencies are resolved and saved to the Jarfile.lock file.
|
61
|
-
|
62
|
-
Example of locking a Jarfile to a Jarfile.lock
|
63
|
-
|
64
|
-
LockJar.lock
|
65
|
-
|
66
|
-
|
67
|
-
==== Jarfile.lock
|
68
|
-
|
69
|
-
The Jarfile.lock generated is a YAML file containing the scoped dependencies, their resolved dependencies, and
|
70
|
-
the additional Maven repositories.
|
71
|
-
|
72
|
-
The Jarfile.lock
|
73
|
-
|
74
|
-
---
|
75
|
-
repositories:
|
76
|
-
- http://repository.jboss.org/nexus/content/groups/public-jboss
|
77
|
-
scopes:
|
78
|
-
compile:
|
79
|
-
dependencies:
|
80
|
-
- org.apache.mina:mina-core:2.0.4
|
81
|
-
resolved_dependencies:
|
82
|
-
- org.apache.mina:mina-core:jar:2.0.4
|
83
|
-
- org.slf4j:slf4j-api:jar:1.6.1
|
84
|
-
- com.slackworks:modelcitizen:jar:0.2.2
|
85
|
-
- commons-lang:commons-lang:jar:2.6
|
86
|
-
- commons-beanutils:commons-beanutils:jar:1.8.3
|
87
|
-
- commons-logging:commons-logging:jar:1.1.1
|
88
|
-
- ch.qos.logback:logback-classic:jar:0.9.24
|
89
|
-
- ch.qos.logback:logback-core:jar:0.9.24
|
90
|
-
- com.metapossum:metapossum-scanner:jar:1.0
|
91
|
-
- commons-io:commons-io:jar:1.4
|
92
|
-
- junit:junit:jar:4.7
|
93
|
-
runtime:
|
94
|
-
dependencies:
|
95
|
-
- org.apache.tomcat:servlet-api:jar:6.0.35
|
96
|
-
resolved_dependencies:
|
97
|
-
- org.apache.tomcat:servlet-api:jar:6.0.35
|
98
|
-
test:
|
99
|
-
dependencies:
|
100
|
-
- junit:junit:jar:4.10
|
101
|
-
resolved_dependencies:
|
102
|
-
- junit:junit:jar:4.10
|
103
|
-
- org.hamcrest:hamcrest-core:jar:1.1
|
104
|
-
|
105
|
-
|
106
|
-
==== Accessing Jars
|
107
|
-
|
108
|
-
* 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.
|
109
|
-
* An arg of a String will set the Jarfile.lock path, e.g. 'Better.lock'. Default lock file is *Jarfile.lock*.
|
110
|
-
* An arg of an Array will set the scopes, e.g. ['compile','test']. Defaults scopes are *compile* and *runtime*.
|
111
|
-
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
112
|
-
* *:local_repo* sets the local repo path
|
113
|
-
* *:local_paths* converts the notations to paths of jars in the local repo
|
114
|
-
* *:resolve* to true will make transitive dependences resolve before returning list of jars
|
115
|
-
|
116
|
-
* 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*.
|
117
|
-
* An arg of a String will set the Jarfile.lock, e.g. 'Better.lock'
|
118
|
-
* An arg of an Array will set the scopes, e.g. ['compile','test']
|
119
|
-
* An arg of a Hash will set the options, e.g. { :local_repo => 'path' }
|
120
|
-
* *:local_repo* sets the local repo path
|
121
|
-
* *:resolve* to true will make transitive dependences resolve before loading to classpath
|
122
|
-
|
123
|
-
Once a Jarfile.lock is generated, you can list all resolved jars by
|
124
|
-
|
125
|
-
jars = LockJar.list
|
126
|
-
|
127
|
-
or directly load all Jars into the classpath
|
128
|
-
|
129
|
-
jars = LockJar.load
|
130
|
-
|
131
|
-
Do not forget, if you change your Jarfile, you have to re-generate the Jarfile.lock.
|
132
|
-
|
133
|
-
==== Skipping the Jarfile
|
134
|
-
|
135
|
-
You can skip the Jarfile and Jarfile.lock to directly play with dependencies by passing a block to LockJar.lock, LockJar.list, LockJar.load
|
136
|
-
|
137
|
-
===== Lock without a Jarfile
|
138
|
-
|
139
|
-
LockJar.lock do
|
140
|
-
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
141
|
-
end
|
142
|
-
|
143
|
-
===== List without a Jarfile.lock
|
144
|
-
|
145
|
-
LockJar.list do
|
146
|
-
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
147
|
-
end
|
148
|
-
|
149
|
-
===== Load without a Jarfile.lock
|
150
|
-
|
151
|
-
LockJar.load do
|
152
|
-
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
153
|
-
end
|
154
|
-
|
155
|
-
Since you skipped the locking part, mostly likely you will need to resolve the dependences in the block, just pass the
|
156
|
-
:resolve => true option to enable dependency resolution (also works for LockJar.list).
|
157
|
-
|
158
|
-
LockJar.load( :resolve => true ) do
|
159
|
-
jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
|
160
|
-
end
|
161
|
-
|
162
|
-
=== Command line
|
163
|
-
|
164
|
-
There is a simple command line helper. You can lock a Jarfile with the following command
|
165
|
-
|
166
|
-
lockjar lock
|
167
|
-
|
168
|
-
List jars in a Jarfile.lock with
|
169
|
-
|
170
|
-
lockjar list
|
171
|
-
|
172
|
-
Download all jars in a Jarfile.lock with
|
173
|
-
|
174
|
-
lockjar install
|
175
|
-
|
176
|
-
_lockjar_ _--help_ will give you list of all commands and their options.
|
177
|
-
|
178
|
-
=== Bundler Integration
|
179
|
-
|
180
|
-
Has been deprecated to https://github.com/mguymon/lock_jar/tree/bundler_support
|
181
|
-
|
182
|
-
=== Buildr Integration
|
183
|
-
|
184
|
-
LockJar integrates with {Buildr}[http://buildr.apache.org/] using an {Addon}[https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/buildr.rb].
|
185
|
-
This allows the Jarfile to be defined directly into a buildfile. A global LockJar definition can be set and
|
186
|
-
is inherited to all projects. Each project may have its own LockJar definition. A lock file is generated per project based
|
187
|
-
on the project name.
|
188
|
-
|
189
|
-
A new Buildr task is added to generate the lockfile for all projects
|
190
|
-
|
191
|
-
buildr lock_jar:lock
|
192
|
-
|
193
|
-
and a task per project to generate the lockfile for a single project
|
194
|
-
|
195
|
-
buildr <app>:<project>:lock_jar:lock
|
196
|
-
|
197
|
-
In a project, you can access an Array of notations using the *lock_jars* method, accepts same parameters as {LockJar.list}[https://github.com/mguymon/lock_jar#accessing-jars]
|
198
|
-
|
199
|
-
lock_jars()
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
The compile scoped dependencies are automatically added to the classpath for compiling. The test scoped dependencies are
|
204
|
-
automatically added to the classpath for tests. Do not forget, if you change the lock_jar
|
205
|
-
definitions, you have to rerun the *lock_jar:lock* task.
|
206
|
-
|
207
|
-
|
208
|
-
==== Example
|
209
|
-
|
210
|
-
Sample buildfile with LockJar
|
211
|
-
|
212
|
-
require 'lock_jar/buildr'
|
213
|
-
|
214
|
-
# app definition, inherited into all projects
|
215
|
-
lock_jar do
|
216
|
-
|
217
|
-
scope 'test' do
|
218
|
-
jar 'junit:junit:jar:4.10'
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
define 'app' do
|
223
|
-
|
224
|
-
def 'project1' do
|
225
|
-
lock_jar do
|
226
|
-
jar "org.apache.mina:mina-core:2.0.4"
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
def 'project2' do
|
231
|
-
lock_jar do
|
232
|
-
pom 'pom.xml'
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
237
|
-
|
238
|
-
Generated the following lock files using lock_jar:lock
|
239
|
-
|
240
|
-
* project1.lock - contains junit and mina jars.
|
241
|
-
* project2.lock - contains junit and pom.xml jars.
|
242
|
-
|
243
|
-
|
244
|
-
== License
|
245
|
-
|
246
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
247
|
-
contributor license agreements. See the NOTICE file distributed with this
|
248
|
-
work for additional information regarding copyright ownership. The ASF
|
249
|
-
licenses this file to you under the Apache License, Version 2.0 (the
|
250
|
-
"License"); you may not use this file except in compliance with the License.
|
251
|
-
You may obtain a copy of the License at
|
252
|
-
|
253
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
254
|
-
|
255
|
-
Unless required by applicable law or agreed to in writing, software
|
256
|
-
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
257
|
-
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
258
|
-
License for the specific language governing permissions and limitations under
|
259
|
-
the License.
|
260
|
-
|