buildr-resolver 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "naether", "0.3.1"
3
+ gem "naether", "0.3.2"
4
4
  gem "buildr", ">= 1.4.4"
5
5
 
6
6
  group :development do
data/Gemfile.lock CHANGED
@@ -49,9 +49,9 @@ GEM
49
49
  bouncy-castle-java
50
50
  json_pure (1.4.3)
51
51
  minitar (0.5.3)
52
- naether (0.3.1)
52
+ naether (0.3.2)
53
53
  rjb (= 1.3.3)
54
- naether (0.3.1-java)
54
+ naether (0.3.2-java)
55
55
  net-sftp (2.0.4)
56
56
  net-ssh (>= 2.0.9)
57
57
  net-ssh (2.0.23)
@@ -71,5 +71,5 @@ DEPENDENCIES
71
71
  buildr (>= 1.4.4)
72
72
  bundler (~> 1.0.0)
73
73
  jeweler (~> 1.5.2)
74
- naether (= 0.3.1)
74
+ naether (= 0.3.2)
75
75
  rspec (~> 1.3.1)
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Buildr Resolver
2
2
 
3
- A Java Dependency Resolver for {Buildr}[https://github.com/apache/buildr] using Maven's {Aether}[https://github.com/sonatype/sonatype-aether] via the wrapper {Naether}[https://github.com/mguymon/naether].
3
+ A Java dependency resolver for {Buildr}[https://github.com/apache/buildr] using Maven's {Aether}[https://github.com/sonatype/sonatype-aether] via the wrapper {Naether}[https://github.com/mguymon/naether].
4
4
 
5
5
 
6
6
  https://github.com/mguymon/buildr-resolver
@@ -16,7 +16,7 @@ gem install buildr-resolver
16
16
  example +buildfile+
17
17
 
18
18
  require 'buildr/resolver'
19
- Java.load # must be called before Buildr::Resolver.resolve if using Ruby due to Rjb startup of JVM by Buildr
19
+ Java.load # must be called before Buildr::Resolver.resolve if not using JRuby due to Rjb startup of JVM by Buildr
20
20
  deps = ['org.apache.activemq:activemq-spring:jar:5.4.2']
21
21
  deps = Buildr::Resolver.resolve( deps )
22
22
  define 'example' do
@@ -25,8 +25,8 @@ example +buildfile+
25
25
  package :jar
26
26
  end
27
27
 
28
- The Buildr::Resolver.resolve( deps ) is what takes the activemq dependency and resolves
29
- all the additional dependencies for it. If you added a +puts+ +dep+ after Buildr::Resolver.resolve, it would output:
28
+ The <tt>Buildr::Resolver.resolve(deps)</tt> is what takes the activemq dependency and resolves
29
+ all the additional dependencies for it. If you added a <tt>puts dep</tt> after <tt>Buildr::Resolver.resolve</tt>, it would output:
30
30
 
31
31
  org.apache.activemq:activemq-spring:jar:5.4.2
32
32
  commons-logging:commons-logging-api:jar:1.1
@@ -62,6 +62,54 @@ all the additional dependencies for it. If you added a +puts+ +dep+ after Buildr
62
62
  org.springframework.osgi:spring-osgi-io:jar:1.2.1
63
63
 
64
64
 
65
+ You can also manually exclude dependencies as an optional parameter to <tt>Buildr::Resolver.resolve</tt>. The exclusions
66
+ are regex matched, so you can pass in only a groupId or the full dependency notation.
67
+
68
+ example +buildfile+ with exclusions
69
+
70
+ require 'buildr/resolver'
71
+ Java.load # must be called before Buildr::Resolver.resolve if using Ruby due to Rjb startup of JVM by Buildr
72
+ deps = ['org.apache.activemq:activemq-spring:jar:5.4.2']
73
+ excluded = ['commons-logging', 'log4j', 'logkit' ]
74
+ deps = Buildr::Resolver.resolve( deps, excluded )
75
+ define 'example' do
76
+ project.version = '0.1.0'
77
+ compile.with deps
78
+ package :jar
79
+ end
80
+
81
+ Will result in the following, excluding commons-logging:commons-logging-api:jar:1.1, commons-logging:commons-logging:jar:1.1
82
+ log4j:log4j:jar:1.2.12, and logkit:logkit:jar:1.0.1
83
+
84
+ org.apache.activemq:activemq-spring:jar:5.4.2
85
+ org.apache.activemq:activemq-core:jar:5.4.2
86
+ org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1
87
+ org.apache.activemq:activeio-core:jar:3.1.2
88
+ avalon-framework:avalon-framework:jar:4.1.3
89
+ javax.servlet:servlet-api:jar:2.3
90
+ org.apache.activemq:kahadb:jar:5.4.2
91
+ org.apache.activemq.protobuf:activemq-protobuf:jar:1.1
92
+ org.osgi:org.osgi.core:jar:4.1.0
93
+ org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1
94
+ org.springframework:spring-context:jar:3.0.3.RELEASE
95
+ org.springframework:spring-aop:jar:3.0.3.RELEASE
96
+ aopalliance:aopalliance:jar:1.0
97
+ org.springframework:spring-expression:jar:3.0.3.RELEASE
98
+ org.springframework:spring-asm:jar:3.0.3.RELEASE
99
+ commons-net:commons-net:jar:2.0
100
+ org.jasypt:jasypt:jar:1.6
101
+ commons-lang:commons-lang:jar:2.1
102
+ commons-codec:commons-codec:jar:1.1
103
+ com.ibm.icu:icu4j:jar:4.0.1
104
+ org.apache.activemq:activemq-pool:jar:5.4.2
105
+ org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1
106
+ commons-pool:commons-pool:jar:1.5.4
107
+ org.springframework:spring-beans:jar:3.0.3.RELEASE
108
+ org.springframework:spring-core:jar:3.0.3.RELEASE
109
+ org.springframework:spring-test:jar:3.0.3.RELEASE
110
+ org.springframework.osgi:spring-osgi-core:jar:1.2.1
111
+ org.springframework.osgi:spring-osgi-io:jar:1.2.1
112
+
65
113
  == License
66
114
 
67
115
  Licensed to the Apache Software Foundation (ASF) under one or more
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{buildr-resolver}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
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 = %q{2011-03-08}
12
+ s.date = %q{2011-03-10}
13
13
  s.description = %q{Java dependency resolver for Buildr using Maven's Aether}
14
14
  s.email = %q{michael.guymon@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,31 +32,30 @@ Gem::Specification.new do |s|
32
32
  s.licenses = ["Apache"]
33
33
  s.require_paths = ["lib"]
34
34
  s.rubyforge_project = %q{buildr-resolver}
35
- s.rubygems_version = %q{1.3.7}
35
+ s.rubygems_version = %q{1.5.2}
36
36
  s.summary = %q{Java dependency resolver for Buildr using Maven's Aether}
37
37
  s.test_files = [
38
38
  "spec/resolver_spec.rb"
39
39
  ]
40
40
 
41
41
  if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
42
  s.specification_version = 3
44
43
 
45
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_runtime_dependency(%q<naether>, ["= 0.3.1"])
45
+ s.add_runtime_dependency(%q<naether>, ["= 0.3.2"])
47
46
  s.add_runtime_dependency(%q<buildr>, [">= 1.4.4"])
48
47
  s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
49
48
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
49
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
51
50
  else
52
- s.add_dependency(%q<naether>, ["= 0.3.1"])
51
+ s.add_dependency(%q<naether>, ["= 0.3.2"])
53
52
  s.add_dependency(%q<buildr>, [">= 1.4.4"])
54
53
  s.add_dependency(%q<rspec>, ["~> 1.3.1"])
55
54
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
55
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
57
56
  end
58
57
  else
59
- s.add_dependency(%q<naether>, ["= 0.3.1"])
58
+ s.add_dependency(%q<naether>, ["= 0.3.2"])
60
59
  s.add_dependency(%q<buildr>, [">= 1.4.4"])
61
60
  s.add_dependency(%q<rspec>, ["~> 1.3.1"])
62
61
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -7,10 +7,15 @@ module Buildr
7
7
  class Java
8
8
  include Singleton
9
9
 
10
+ attr_reader :naether
11
+
10
12
  def initialize
13
+
11
14
  # Load Naether jar dependencies
12
15
  @naether_jars = [Naether::Bootstrap.naether_jar]
13
16
  @naether_jars = @naether_jars + Buildr.artifacts(Naether.bootstrap_dependencies).each(&:invoke).map(&:to_s)
17
+
18
+ @naether = Naether.create_from_jars( @naether_jars )
14
19
  end
15
20
 
16
21
  def jar_dependencies
@@ -6,13 +6,31 @@ module Buildr
6
6
  module Resolver
7
7
  class << self
8
8
 
9
- def resolve( dependencies, excludes=[] )
10
- naether = Naether.create_from_jars( Buildr::Resolver::Java.instance.jar_dependencies )
9
+ def naether
10
+ Buildr::Resolver::Java.instance.naether
11
+ end
12
+
13
+ # Resolve dependencies for an array of dependencies
14
+ #
15
+ # excludes is an array of dependencies to exclude
16
+ # repos is an array of {:url => '', :username => '', :password => '' } of additional remote repos
17
+ # with authentication
18
+ def resolve( dependencies, excludes=[], repos = [] )
11
19
  if Buildr.repositories.remote.size > 0
12
20
  naether.clear_remote_repositories
13
21
  Buildr.repositories.remote.each do |repo|
14
22
  naether.add_remote_repository( repo )
15
23
  end
24
+
25
+ unless repos.nil?
26
+ unless repos.is_a? Array
27
+ repos = [repos]
28
+ end
29
+
30
+ repos.each do |repo|
31
+ naether.add_remote_repository( repo[:url], repo[:username], repo[:password] )
32
+ end
33
+ end
16
34
  end
17
35
 
18
36
  naether.local_repo_path = Repositories.instance.local
@@ -34,8 +52,11 @@ module Buildr
34
52
  end
35
53
 
36
54
  def deploy_artifact( notation, file_path, url, opts = {} )
37
- naether = Naether.create_from_jars( Buildr::Resolver::Java.instance.jar_dependencies )
38
- naether.deploy_artifact( notation, file_path, url )
55
+ naether.deploy_artifact( notation, file_path, url, opts )
56
+ end
57
+
58
+ def write_pom( notation, file_path )
59
+ naether.write_pom( notation, file_path )
39
60
  end
40
61
  end
41
62
  end
@@ -31,5 +31,19 @@ describe Buildr::Resolver do
31
31
  Buildr::Resolver.deploy_artifact( "test:test:jar:1.12", Naether::Bootstrap.naether_jar, 'file:tmp/test-repo' )
32
32
  File.exists?('tmp/test-repo/test/test/1.12/test-1.12.jar').should be_true
33
33
  end
34
+
35
+ it "should write a pom" do
36
+ unless File.exists? 'tmp'
37
+ FileUtils::mkdir 'tmp'
38
+ end
39
+ Buildr::Resolver.resolve( ['ch.qos.logback:logback-classic:jar:0.9.24'] )
40
+ Buildr::Resolver.write_pom( "buildr-resolver:buildr-resolver:jar:45.45", "tmp/pom.xml" )
41
+ File.exists?( 'tmp/pom.xml' ).should be_true
42
+
43
+ xml = IO.read( 'tmp/pom.xml' )
44
+ xml.should match /.+ch.qos.logback<\/groupId>\s+<artifactId>logback-core<\/artifactId>\s+<version>0.9.24.+/
45
+ xml.should match /.+org.slf4j<\/groupId>\s+<artifactId>slf4j-api<\/artifactId>\s+<version>1.6.0.+/
46
+
47
+ end
34
48
  end
35
49
  end
metadata CHANGED
@@ -1,103 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-resolver
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
4
+ prerelease:
5
+ version: 0.3.3
11
6
  platform: ruby
12
7
  authors:
13
- - Michael Guymon
8
+ - Michael Guymon
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-08 00:00:00 -05:00
13
+ date: 2011-03-10 00:00:00 -05:00
19
14
  default_executable:
20
15
  dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- name: naether
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - "="
28
- - !ruby/object:Gem::Version
29
- hash: 17
30
- segments:
31
- - 0
32
- - 3
33
- - 1
34
- version: 0.3.1
35
- requirement: *id001
36
- type: :runtime
37
- - !ruby/object:Gem::Dependency
38
- prerelease: false
39
- name: buildr
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 15
46
- segments:
47
- - 1
48
- - 4
49
- - 4
50
- version: 1.4.4
51
- requirement: *id002
52
- type: :runtime
53
- - !ruby/object:Gem::Dependency
54
- prerelease: false
55
- name: rspec
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 25
62
- segments:
63
- - 1
64
- - 3
65
- - 1
66
- version: 1.3.1
67
- requirement: *id003
68
- type: :development
69
- - !ruby/object:Gem::Dependency
70
- prerelease: false
71
- name: bundler
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 23
78
- segments:
79
- - 1
80
- - 0
81
- - 0
82
- version: 1.0.0
83
- requirement: *id004
84
- type: :development
85
- - !ruby/object:Gem::Dependency
86
- prerelease: false
87
- name: jeweler
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 7
94
- segments:
95
- - 1
96
- - 5
97
- - 2
98
- version: 1.5.2
99
- requirement: *id005
100
- type: :development
16
+ - !ruby/object:Gem::Dependency
17
+ name: naether
18
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.3.2
24
+ requirement: *id001
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: buildr
29
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.4.4
35
+ requirement: *id002
36
+ prerelease: false
37
+ type: :runtime
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ version_requirements: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.1
46
+ requirement: *id003
47
+ prerelease: false
48
+ type: :development
49
+ - !ruby/object:Gem::Dependency
50
+ name: bundler
51
+ version_requirements: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 1.0.0
57
+ requirement: *id004
58
+ prerelease: false
59
+ type: :development
60
+ - !ruby/object:Gem::Dependency
61
+ name: jeweler
62
+ version_requirements: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 1.5.2
68
+ requirement: *id005
69
+ prerelease: false
70
+ type: :development
101
71
  description: Java dependency resolver for Buildr using Maven's Aether
102
72
  email: michael.guymon@gmail.com
103
73
  executables: []
@@ -105,52 +75,49 @@ executables: []
105
75
  extensions: []
106
76
 
107
77
  extra_rdoc_files:
108
- - LICENSE
109
- - README.rdoc
78
+ - LICENSE
79
+ - README.rdoc
110
80
  files:
111
- - Gemfile
112
- - Gemfile.lock
113
- - LICENSE
114
- - README.rdoc
115
- - Rakefile
116
- - VERSION
117
- - buildr-resolver.gemspec
118
- - lib/buildr/resolver.rb
119
- - lib/buildr/resolver/java.rb
120
- - spec/resolver_spec.rb
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE
84
+ - README.rdoc
85
+ - Rakefile
86
+ - VERSION
87
+ - buildr-resolver.gemspec
88
+ - lib/buildr/resolver.rb
89
+ - lib/buildr/resolver/java.rb
90
+ - spec/resolver_spec.rb
121
91
  has_rdoc: true
122
92
  homepage: http://github.com/mguymon/buildr-resolver
123
93
  licenses:
124
- - Apache
94
+ - Apache
125
95
  post_install_message:
126
96
  rdoc_options: []
127
97
 
128
98
  require_paths:
129
- - lib
99
+ - lib
130
100
  required_ruby_version: !ruby/object:Gem::Requirement
131
101
  none: false
132
102
  requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
137
- - 0
138
- version: "0"
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 2
106
+ segments:
107
+ - 0
108
+ version: "0"
139
109
  required_rubygems_version: !ruby/object:Gem::Requirement
140
110
  none: false
141
111
  requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
- version: "0"
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: "0"
148
115
  requirements: []
149
116
 
150
117
  rubyforge_project: buildr-resolver
151
- rubygems_version: 1.3.7
118
+ rubygems_version: 1.5.2
152
119
  signing_key:
153
120
  specification_version: 3
154
121
  summary: Java dependency resolver for Buildr using Maven's Aether
155
122
  test_files:
156
- - spec/resolver_spec.rb
123
+ - spec/resolver_spec.rb