lock_jar 0.4.6 → 0.5.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/VERSION +1 -1
- data/bin/lockjar +2 -40
- data/lib/lock_jar/cli.rb +45 -0
- data/lib/lock_jar/runtime.rb +6 -0
- data/lock_jar.gemspec +3 -1
- data/spec/lock_jar/cli_spec.rb +17 -0
- data/spec/lock_jar_spec.rb +1 -1
- data/spec/pom.xml +6 -0
- data/spec/spec_helper.rb +7 -0
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/bin/lockjar
CHANGED
@@ -1,44 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
require 'commander/import'
|
4
3
|
require 'lock_jar'
|
4
|
+
require 'lock_jar/cli'
|
5
5
|
|
6
|
-
|
7
|
-
program :name, 'Lock Jar'
|
8
|
-
program :version, LockJar::VERSION
|
9
|
-
program :description, 'LockJar manages Java Jars for Ruby'
|
10
|
-
|
11
|
-
command :install do |c|
|
12
|
-
c.syntax = 'lockjar install'
|
13
|
-
c.description = 'Install Jars from a Jarfile.lock'
|
14
|
-
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
15
|
-
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
16
|
-
c.action do |args, options|
|
17
|
-
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
18
|
-
puts "Installing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
19
|
-
LockJar.install( options.lockfile, options.scopes )
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
command :list do |c|
|
24
|
-
c.syntax = 'lockjar list'
|
25
|
-
c.description = 'List Jars from a Jarfile.lock'
|
26
|
-
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
27
|
-
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
28
|
-
c.action do |args, options|
|
29
|
-
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
30
|
-
puts "Listing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
31
|
-
puts LockJar.list( options.lockfile, options.scopes ).inspect
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
command :lock do |c|
|
36
|
-
c.syntax = 'lockjar lock'
|
37
|
-
c.description = 'Lock Jars in a Jarfile'
|
38
|
-
c.option '--jarfile STRING', String, 'Path to Jarfile, defaults to Jarfile'
|
39
|
-
c.action do |args, options|
|
40
|
-
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
41
|
-
puts "Locking #{options.lockfile}"
|
42
|
-
LockJar.install( options.lockfile, options.scopes )
|
43
|
-
end
|
44
|
-
end
|
6
|
+
include LockJar::CLI
|
data/lib/lock_jar/cli.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'commander/import'
|
3
|
+
|
4
|
+
module LockJar::CLI
|
5
|
+
|
6
|
+
# :name is optional, otherwise uses the basename of this executable
|
7
|
+
program :name, 'Lock Jar'
|
8
|
+
program :version, LockJar::VERSION
|
9
|
+
program :description, 'LockJar manages Java Jars for Ruby'
|
10
|
+
|
11
|
+
command :install do |c|
|
12
|
+
c.syntax = 'lockjar install'
|
13
|
+
c.description = 'Install Jars from a Jarfile.lock'
|
14
|
+
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
15
|
+
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
16
|
+
c.action do |args, options|
|
17
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
18
|
+
puts "Installing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
19
|
+
LockJar.install( options.lockfile, options.scopes )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
command :list do |c|
|
24
|
+
c.syntax = 'lockjar list'
|
25
|
+
c.description = 'List Jars from a Jarfile.lock'
|
26
|
+
c.option '--lockfile STRING', String, 'Path to Jarfile.lock, defaults to Jarfile.lock'
|
27
|
+
c.option '--scopes ARRAY', Array, "Scopes to install from Jarfile.lock, defaults to 'compile, runtime'"
|
28
|
+
c.action do |args, options|
|
29
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
30
|
+
puts "Listing Jars from #{options.lockfile} for #{options.scopes.inspect}"
|
31
|
+
puts LockJar.list( options.lockfile, options.scopes ).inspect
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
command :lock do |c|
|
36
|
+
c.syntax = 'lockjar lock'
|
37
|
+
c.description = 'Lock Jars in a Jarfile'
|
38
|
+
c.option '--jarfile STRING', String, 'Path to Jarfile, defaults to Jarfile'
|
39
|
+
c.action do |args, options|
|
40
|
+
options.default :lockfile => 'Jarfile.lock', :scopes => ['compile', 'runtime']
|
41
|
+
puts "Locking #{options.lockfile}"
|
42
|
+
LockJar.lock( options.lockfile, options.scopes )
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/lock_jar/runtime.rb
CHANGED
@@ -41,6 +41,12 @@ module LockJar
|
|
41
41
|
|
42
42
|
def install( jarfile_lock, scopes = ['compile', 'runtime'], opts = {}, &blk )
|
43
43
|
deps = list( jarfile_lock, scopes, opts, &blk )
|
44
|
+
|
45
|
+
lock_data = read_lockfile( jarfile_lock )
|
46
|
+
lock_data['repositories'].each do |repo|
|
47
|
+
resolver(opts).add_remote_repository( repo )
|
48
|
+
end
|
49
|
+
|
44
50
|
files = resolver(opts).download( deps )
|
45
51
|
|
46
52
|
files
|
data/lock_jar.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lock_jar"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.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"]
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
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",
|
@@ -34,6 +35,7 @@ Gem::Specification.new do |s|
|
|
34
35
|
"lib/lock_jar/version.rb",
|
35
36
|
"lock_jar.gemspec",
|
36
37
|
"spec/Jarfile",
|
38
|
+
"spec/lock_jar/cli_spec.rb",
|
37
39
|
"spec/lock_jar/dsl_spec.rb",
|
38
40
|
"spec/lock_jar/maven_spec.rb",
|
39
41
|
"spec/lock_jar/resolver_spec.rb",
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper'))
|
2
|
+
require 'lib/lock_jar/cli'
|
3
|
+
|
4
|
+
describe LockJar::CLI do
|
5
|
+
before :each do
|
6
|
+
$stderr = StringIO.new
|
7
|
+
mock_terminal
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have commands" do
|
11
|
+
LockJar::CLI.commands.keys.should eql( ["help", "install", "list", "lock"] )
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should install" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/spec/lock_jar_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe LockJar, "#lock" do
|
|
32
32
|
"resolved_dependencies"=>["org.apache.tomcat:servlet-api:jar:6.0.35"]},
|
33
33
|
"test"=>{
|
34
34
|
"dependencies"=>["spec/pom.xml", "junit:junit:jar:4.10"],
|
35
|
-
"resolved_dependencies"=>["junit:junit:jar:4.10", "org.hamcrest:hamcrest-core:jar:1.1"]} } } )
|
35
|
+
"resolved_dependencies"=>["org.jboss.unit:jboss-unit:jar:1.2.4", "junit:junit:jar:4.10", "org.hamcrest:hamcrest-core:jar:1.1"]} } } )
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should not replace dependencies with maps" do
|
data/spec/pom.xml
CHANGED
@@ -18,6 +18,12 @@ ttp://maven.apache.org/maven-v4_0_0.xsd ">
|
|
18
18
|
<artifactId>modelcitizen</artifactId>
|
19
19
|
<version>0.2.2</version>
|
20
20
|
</dependency>
|
21
|
+
<dependency>
|
22
|
+
<groupId>org.jboss.unit</groupId>
|
23
|
+
<artifactId>jboss-unit</artifactId>
|
24
|
+
<version>1.2.4</version>
|
25
|
+
<scope>test</scope>
|
26
|
+
</dependency>
|
21
27
|
<dependency>
|
22
28
|
<groupId>junit</groupId>
|
23
29
|
<artifactId>junit</artifactId>
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,13 @@ $:.unshift File.expand_path(File.join('..', File.dirname(__FILE__), 'lib'))
|
|
5
5
|
require 'rubygems'
|
6
6
|
require 'rspec'
|
7
7
|
require 'lib/lock_jar'
|
8
|
+
require 'stringio'
|
9
|
+
|
10
|
+
def mock_terminal
|
11
|
+
@input = StringIO.new
|
12
|
+
@output = StringIO.new
|
13
|
+
$terminal = HighLine.new @input, @output
|
14
|
+
end
|
8
15
|
|
9
16
|
RSpec.configure do |config|
|
10
17
|
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- bin/lockjar
|
145
145
|
- lib/lock_jar.rb
|
146
146
|
- lib/lock_jar/buildr.rb
|
147
|
+
- lib/lock_jar/cli.rb
|
147
148
|
- lib/lock_jar/dsl.rb
|
148
149
|
- lib/lock_jar/maven.rb
|
149
150
|
- lib/lock_jar/resolver.rb
|
@@ -151,6 +152,7 @@ files:
|
|
151
152
|
- lib/lock_jar/version.rb
|
152
153
|
- lock_jar.gemspec
|
153
154
|
- spec/Jarfile
|
155
|
+
- spec/lock_jar/cli_spec.rb
|
154
156
|
- spec/lock_jar/dsl_spec.rb
|
155
157
|
- spec/lock_jar/maven_spec.rb
|
156
158
|
- spec/lock_jar/resolver_spec.rb
|
@@ -173,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
175
|
version: '0'
|
174
176
|
segments:
|
175
177
|
- 0
|
176
|
-
hash: -
|
178
|
+
hash: -2726763900128420909
|
177
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
180
|
none: false
|
179
181
|
requirements:
|