lock_jar 0.0.1 → 0.0.2

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/README.rdoc CHANGED
@@ -15,7 +15,7 @@ gem install lock_jar
15
15
  === Using a Jarfile
16
16
 
17
17
  ==== Jarfile
18
- A Jarfile is a simple Ruby DSL for defining a project's Jar dependencies using the following
18
+ A Jarfile is a simple file using a Ruby DSL for defining a project's Jar dependencies using the following
19
19
  methods:
20
20
 
21
21
  * repository: url of additional Maven repository to use.
@@ -25,18 +25,19 @@ methods:
25
25
 
26
26
  Example Jarfile
27
27
 
28
- repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
29
-
30
- // Default scope is compile
31
- jar "org.apache.mina:mina-core:2.0.4"
32
-
33
- scope 'runtime' do
34
- jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
35
- end
36
-
37
- scope 'test' do
38
- jar 'junit:junit:jar:4.10'
39
- end
28
+ repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
29
+
30
+ // Default scope is compile
31
+ jar "org.apache.mina:mina-core:2.0.4"
32
+
33
+ scope 'runtime' do
34
+ jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
35
+ end
36
+
37
+ scope 'test' do
38
+ jar 'junit:junit:jar:4.10'
39
+ end
40
+
40
41
 
41
42
  ==== Resolving dependencies
42
43
 
@@ -56,36 +57,37 @@ the additional Maven repositories.
56
57
 
57
58
  The Jarfile.lock
58
59
 
59
- ---
60
- scopes:
61
- compile:
62
- dependencies:
63
- - org.apache.mina:mina-core:2.0.4
64
- resolved_dependencies:
65
- - org.apache.mina:mina-core:jar:2.0.4
66
- - org.slf4j:slf4j-api:jar:1.6.1
67
- - com.slackworks:modelcitizen:jar:0.2.2
68
- - commons-lang:commons-lang:jar:2.6
69
- - commons-beanutils:commons-beanutils:jar:1.8.3
70
- - commons-logging:commons-logging:jar:1.1.1
71
- - ch.qos.logback:logback-classic:jar:0.9.24
72
- - ch.qos.logback:logback-core:jar:0.9.24
73
- - com.metapossum:metapossum-scanner:jar:1.0
74
- - commons-io:commons-io:jar:1.4
75
- - junit:junit:jar:4.7
76
- runtime:
77
- dependencies:
78
- - org.apache.tomcat:servlet-api:jar:6.0.35
79
- resolved_dependencies:
80
- - org.apache.tomcat:servlet-api:jar:6.0.35
81
- test:
82
- dependencies:
83
- - junit:junit:jar:4.10
84
- resolved_dependencies:
85
- - junit:junit:jar:4.10
86
- - org.hamcrest:hamcrest-core:jar:1.1
87
- repositories:
88
- - http://repository.jboss.org/nexus/content/groups/public-jboss
60
+ ---
61
+ scopes:
62
+ compile:
63
+ dependencies:
64
+ - org.apache.mina:mina-core:2.0.4
65
+ resolved_dependencies:
66
+ - org.apache.mina:mina-core:jar:2.0.4
67
+ - org.slf4j:slf4j-api:jar:1.6.1
68
+ - com.slackworks:modelcitizen:jar:0.2.2
69
+ - commons-lang:commons-lang:jar:2.6
70
+ - commons-beanutils:commons-beanutils:jar:1.8.3
71
+ - commons-logging:commons-logging:jar:1.1.1
72
+ - ch.qos.logback:logback-classic:jar:0.9.24
73
+ - ch.qos.logback:logback-core:jar:0.9.24
74
+ - com.metapossum:metapossum-scanner:jar:1.0
75
+ - commons-io:commons-io:jar:1.4
76
+ - junit:junit:jar:4.7
77
+ runtime:
78
+ dependencies:
79
+ - org.apache.tomcat:servlet-api:jar:6.0.35
80
+ resolved_dependencies:
81
+ - org.apache.tomcat:servlet-api:jar:6.0.35
82
+ test:
83
+ dependencies:
84
+ - junit:junit:jar:4.10
85
+ resolved_dependencies:
86
+ - junit:junit:jar:4.10
87
+ - org.hamcrest:hamcrest-core:jar:1.1
88
+ repositories:
89
+ - http://repository.jboss.org/nexus/content/groups/public-jboss
90
+
89
91
 
90
92
  ==== Accessing Jars
91
93
 
@@ -101,6 +103,7 @@ or directly load all Jars into the classpath
101
103
 
102
104
  jars = LockJar.load
103
105
 
106
+
104
107
  === Buildr Integration
105
108
 
106
109
  LockJar integrates with {Buildr}[http://buildr.apache.org/] using an {Addon}[https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/buildr.rb].
@@ -108,8 +111,17 @@ This allows the Jarfile to be defined directly into a buildfile. A global app Lo
108
111
  is inherited to all projects. Each project may have its own LockJar definition. A lock file is generated per project based
109
112
  on the project name.
110
113
 
114
+ A new Buildr task is added to generate the lockfile for all projects
115
+
116
+ buildr lock_jar:lock
117
+
118
+ and a task per project to generate the lockfile for a single project
119
+
120
+ buildr <app>:<project>:lock_jar:lock
121
+
111
122
  The resolved dependencies are automatically added to the classpath for compiling and testing.
112
123
 
124
+
113
125
  ==== Example
114
126
 
115
127
  Sample buildfile with LockJar
@@ -141,7 +153,7 @@ Sample buildfile with LockJar
141
153
 
142
154
  end
143
155
 
144
- Generated lock files
156
+ Generated the following lock files using lock_jar:lock
145
157
 
146
158
  * project1.lock - contains junit and mina jars.
147
159
  * project2.lock - contains junit and pom.xml jars.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "lock_jar"
18
- gem.homepage = "http://github.com/mguymon/lockjar"
18
+ gem.homepage = "http://github.com/mguymon/lock_jar"
19
19
  gem.license = "Apache"
20
20
  gem.summary = "Manage Jar files for Ruby"
21
21
  gem.description = "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,28 @@
1
+
2
+
3
+ module LockJar
4
+ class Maven
5
+
6
+ class << self
7
+ def runtime( opts = {} )
8
+ Runtime.new( opts )
9
+ end
10
+
11
+ def pom_version( pom_path, opts = {} )
12
+ runtime(opts).resolver.naether.pom_version( pom_path )
13
+ end
14
+
15
+ def write_pom( notation, file_path, opts = {} )
16
+ runtime(opts).resolver.naether.write_pom( notation, file_path )
17
+ end
18
+
19
+ def deploy_artifact( notation, file_path, url, deploy_opts = {}, lockjar_opts = {} )
20
+ runtime(lockjar_opts).resolver.naether.deploy_artifact( notation, file_path, url, deploy_opts )
21
+ end
22
+
23
+ def install( notation, pom_path, jar_path, opts = {} )
24
+ runtime(opts).resolver.naether.install( notation, pom_path, jar_path )
25
+ end
26
+ end
27
+ end
28
+ end
@@ -21,6 +21,9 @@ require 'lock_jar/runtime'
21
21
 
22
22
  module LockJar
23
23
  class Runtime
24
+
25
+ attr_reader :resolver
26
+
24
27
  def initialize( opts = {} )
25
28
  @resolver = LockJar::Resolver.new( opts )
26
29
  end
data/lib/lock_jar.rb CHANGED
@@ -21,14 +21,23 @@ require 'lock_jar/runtime'
21
21
 
22
22
  module LockJar
23
23
 
24
+ # Lock a Jarfile and generate a Jarfile.lock
25
+ #
26
+ # Accepts path to the jarfile and hash of options to configure LockJar
24
27
  def self.lock( jarfile = 'Jarfile', opts = {} )
25
28
  Runtime.new( opts ).lock( jarfile, opts )
26
29
  end
27
30
 
31
+ # List jars for an array of scope in a lockfile
32
+ #
33
+ # Accepts path to the lockfile, array of scopes, and hash of options to configure LockJar
28
34
  def self.list( lockfile = 'Jarfile.lock', scopes = ['compile', 'runtime'], opts = {} )
29
35
  Runtime.new( opts ).list( lockfile, scopes )
30
36
  end
31
37
 
38
+ # Load jars for an array of scopes in a lockfile
39
+ #
40
+ # Accepts a path to the lockfile, array scopes, and hash of optiosn to configure LockJar
32
41
  def self.load( lockfile = 'Jarfile.lock', scopes = ['compile', 'runtime'], opts = {} )
33
42
  Runtime.new( opts ).load( lockfile, scopes )
34
43
  end
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.0.1"
8
+ s.version = "0.0.2"
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"]
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  "Gemfile",
21
- "Gemfile.lock",
22
21
  "LICENSE",
23
22
  "README.rdoc",
24
23
  "Rakefile",
@@ -26,16 +25,18 @@ Gem::Specification.new do |s|
26
25
  "lib/lock_jar.rb",
27
26
  "lib/lock_jar/buildr.rb",
28
27
  "lib/lock_jar/dsl.rb",
28
+ "lib/lock_jar/maven.rb",
29
29
  "lib/lock_jar/resolver.rb",
30
30
  "lib/lock_jar/runtime.rb",
31
31
  "lock_jar.gemspec",
32
32
  "spec/Jarfile",
33
33
  "spec/lock_jar/dsl_spec.rb",
34
+ "spec/lock_jar/maven_spec.rb",
34
35
  "spec/lock_jar/resolver_spec.rb",
35
36
  "spec/lock_jar_spec.rb",
36
37
  "spec/pom.xml"
37
38
  ]
38
- s.homepage = "http://github.com/mguymon/lockjar"
39
+ s.homepage = "http://github.com/mguymon/lock_jar"
39
40
  s.licenses = ["Apache"]
40
41
  s.require_paths = ["lib"]
41
42
  s.rubygems_version = "1.8.12"
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'lib/lock_jar'
3
+ require 'lib/lock_jar/maven'
4
+ require 'naether'
5
+
6
+ describe LockJar::Maven do
7
+ context "Class" do
8
+ it "should get pom version" do
9
+ LockJar::Maven.pom_version( "spec/pom.xml" ).should eql( "3" )
10
+ end
11
+
12
+ it "should install artifact" do
13
+ LockJar::Maven.install( "maven_spec:install:7", "spec/pom.xml", nil, :local_repo => 'tmp/test-repo' )
14
+
15
+ File.exists?( 'tmp/test-repo/maven_spec/install/7/install-7.pom' ).should be_true
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock_jar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Guymon
@@ -93,7 +93,6 @@ extra_rdoc_files:
93
93
  - README.rdoc
94
94
  files:
95
95
  - Gemfile
96
- - Gemfile.lock
97
96
  - LICENSE
98
97
  - README.rdoc
99
98
  - Rakefile
@@ -101,15 +100,17 @@ files:
101
100
  - lib/lock_jar.rb
102
101
  - lib/lock_jar/buildr.rb
103
102
  - lib/lock_jar/dsl.rb
103
+ - lib/lock_jar/maven.rb
104
104
  - lib/lock_jar/resolver.rb
105
105
  - lib/lock_jar/runtime.rb
106
106
  - lock_jar.gemspec
107
107
  - spec/Jarfile
108
108
  - spec/lock_jar/dsl_spec.rb
109
+ - spec/lock_jar/maven_spec.rb
109
110
  - spec/lock_jar/resolver_spec.rb
110
111
  - spec/lock_jar_spec.rb
111
112
  - spec/pom.xml
112
- homepage: http://github.com/mguymon/lockjar
113
+ homepage: http://github.com/mguymon/lock_jar
113
114
  licenses:
114
115
  - Apache
115
116
  post_install_message:
data/Gemfile.lock DELETED
@@ -1,30 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.6.4)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- naether (0.6.0)
11
- rjb (= 1.3.3)
12
- rake (0.9.2.2)
13
- rjb (1.3.3)
14
- rspec (2.9.0)
15
- rspec-core (~> 2.9.0)
16
- rspec-expectations (~> 2.9.0)
17
- rspec-mocks (~> 2.9.0)
18
- rspec-core (2.9.0)
19
- rspec-expectations (2.9.1)
20
- diff-lcs (~> 1.1.3)
21
- rspec-mocks (2.9.0)
22
-
23
- PLATFORMS
24
- ruby
25
-
26
- DEPENDENCIES
27
- bundler (> 1.0.0)
28
- jeweler (~> 1.6.4)
29
- naether (~> 0.6.0)
30
- rspec