ivy-resolver 0.0.1 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ Usage
2
+ =====
3
+
4
+ 1\. Create a file called `Jarfile` in the root of your project. One example based on the [Ivy Quick Start](http://ant.apache.org/ivy/history/latest-milestone/tutorial/start.html) guide.
5
+
6
+ ```ruby
7
+ project 'org.apache', 'hello-ivy', '0.0.1'
8
+
9
+ source 'http://repo1.maven.org/maven2'
10
+
11
+ jar 'commons-lang', 'commons-lang', '2.0'
12
+ jar 'commons-cli', 'commons-cli', '2.0'
13
+ ```
14
+
15
+ 2\. Add `ivy-resolver` to your `Gemfile`
16
+
17
+ ```ruby
18
+ gem 'ivy-resolver'
19
+ ```
20
+
21
+ 3\. Load the JARs at init / runtime
22
+
23
+ ```ruby
24
+ Ivy::Resolver.require
25
+ ```
26
+
27
+
28
+ Changelog
29
+ =========
30
+
31
+ 0.1
32
+ - Fixed to work with ibilio repositories, so transitive dependencies will work.
33
+
34
+ 0.0.1
35
+ - Initial version
36
+
37
+
38
+ Bugs
39
+ ====
40
+
41
+ None known at the moment.
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib", "jars"]
20
+ s.require_paths = ["lib"]
21
21
 
22
22
  # specify any dependencies here; for example:
23
23
  s.add_development_dependency "rspec", '~> 2.8.0'
@@ -1,6 +1,6 @@
1
1
  # Released under the MIT license. See the MIT-LICENSE file for details
2
2
 
3
3
  require "ivy/resolver/version"
4
- require "ivy-#{Ivy::Resolver::IVY_VERSION}.jar"
4
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'jars', "ivy-#{Ivy::Resolver::IVY_VERSION}.jar"))
5
5
 
6
6
  require "ivy/resolver"
@@ -101,6 +101,7 @@ module Ivy
101
101
  :output_report => false,
102
102
  :refresh => false,
103
103
  :use_cache_only => false,
104
+ :transitive => true,
104
105
  :validate => false
105
106
  }.merge(opts).inject(ResolveOptions.new) do |resolve_options, (option, value)|
106
107
  resolve_options.send :"set_#{option}", value
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Ivy::Resolver
4
4
  class DSL
5
+ java_import Java::org.apache.ivy.plugins.resolver.IBiblioResolver
5
6
  java_import Java::org.apache.ivy.plugins.resolver.URLResolver
6
7
  java_import Java::org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor
7
8
  java_import Java::org.apache.ivy.core.module.id.ModuleRevisionId
@@ -18,11 +19,15 @@ class Ivy::Resolver
18
19
 
19
20
  def source(url, opts={})
20
21
  opts = default_source_opts(url).merge(opts)
22
+ tidy_opts opts
21
23
 
22
- URLResolver.new.tap do |resolver|
24
+ klass = decide_resolver_type opts
25
+
26
+ klass.new.tap do |resolver|
23
27
  resolver.m2compatible = opts[:maven]
24
28
  resolver.name = opts[:name]
25
- resolver.add_artifact_pattern opts[:pattern]
29
+ resolver.add_artifact_pattern opts[:pattern] if opts[:pattern]
30
+ resolver.root = url if resolver.respond_to? :root=
26
31
 
27
32
  yield resolver if block_given?
28
33
 
@@ -66,5 +71,13 @@ class Ivy::Resolver
66
71
  :configurations => ['*']
67
72
  }
68
73
  end
74
+
75
+ def tidy_opts(opts)
76
+ opts.delete :pattern if opts[:maven]
77
+ end
78
+
79
+ def decide_resolver_type(opts)
80
+ opts[:maven] ? IBiblioResolver : URLResolver
81
+ end
69
82
  end
70
83
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ivy
4
4
  class Resolver
5
- VERSION = "0.0.1"
5
+ VERSION = "0.1"
6
6
  IVY_VERSION = "2.2.0"
7
7
  end
8
8
  end
@@ -12,6 +12,9 @@ describe Ivy::Resolver do
12
12
  @artifact_path = spec_files_path 'org/example/test/0.0.1'
13
13
  @artifact = "#{@name}-#{@revision}.jar"
14
14
  %x[cd #{@artifact_path}; rm -f #{@artifact}; javac *.java; zip #{@artifact} *.class]
15
+ @transitive_path = spec_files_path 'org/example/test2/0.0.1'
16
+ @transitive_artifact = "test2-#{@revision}.jar"
17
+ %x[cd #{@transitive_path}; rm -f #{@transitive_artifact}; javac *.java; zip #{@transitive_artifact} *.class]
15
18
  end
16
19
 
17
20
  it 'can be instantiated' do
@@ -84,6 +87,12 @@ describe Ivy::Resolver do
84
87
  result.first.require
85
88
  Java::IvyResolverTestClass.new.test_value.should be_a String
86
89
  end
90
+
91
+ it 'includes a transitive dependency' do
92
+ result = subject.resolve
93
+ result.each(&:require)
94
+ Java::TransitiveDependencyTestClass.new.test_value.should be_a String
95
+ end
87
96
  end
88
97
 
89
98
  context 'with a jruby project' do
@@ -108,5 +117,10 @@ describe Ivy::Resolver do
108
117
  Ivy::Resolver.require
109
118
  Java::IvyResolverTestClass.new.test_value.should be_a String
110
119
  end
120
+
121
+ it 'also requires the transitive artifact' do
122
+ Ivy::Resolver.require
123
+ Java::TransitiveDependencyTestClass.new.test_value.should be_a String
124
+ end
111
125
  end
112
126
  end
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+ <modelVersion>0.0.1</modelVersion>
4
+ <groupId>org.example</groupId>
5
+ <artifactId>test</artifactId>
6
+ <version>0.0.1</version>
7
+ <name>Test Artifact</name>
8
+ <description>
9
+ A test artifact
10
+ </description>
11
+ <dependencies>
12
+ <dependency>
13
+ <groupId>org.example</groupId>
14
+ <artifactId>test2</artifactId>
15
+ <version>0.0.1</version>
16
+ <type>jar</type>
17
+ <scope>runtime</scope>
18
+ </dependency>
19
+ </dependencies>
20
+ </project>
@@ -0,0 +1,8 @@
1
+ class TransitiveDependencyTestClass {
2
+ public TransitiveDependencyTestClass() {
3
+ }
4
+
5
+ public String getTestValue() {
6
+ return "A transitive string";
7
+ }
8
+ }
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+ <modelVersion>0.0.1</modelVersion>
4
+ <groupId>org.example</groupId>
5
+ <artifactId>test2</artifactId>
6
+ <version>0.0.1</version>
7
+ <name>Transitive Artifact</name>
8
+ <description>
9
+ A transitive artifact
10
+ </description>
11
+ </project>
metadata CHANGED
@@ -1,54 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ivy-resolver
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 9
4
5
  prerelease:
5
- version: 0.0.1
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
6
10
  platform: ruby
7
11
  authors:
8
- - Shaun Mangelsdorf
12
+ - Shaun Mangelsdorf
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2012-01-19 00:00:00 Z
17
+ date: 2012-01-24 00:00:00 Z
14
18
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rspec
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
23
- version: 2.8.0
24
- type: :development
25
- version_requirements: *id001
19
+ - !ruby/object:Gem::Dependency
20
+ name: rspec
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 47
28
+ segments:
29
+ - 2
30
+ - 8
31
+ - 0
32
+ version: 2.8.0
33
+ type: :development
34
+ version_requirements: *id001
26
35
  description: Provides a Bundler-like interface to resolve JARs with Ivy
27
36
  email:
28
- - s.mangelsdorf@gmail.com
37
+ - s.mangelsdorf@gmail.com
29
38
  executables: []
30
39
 
31
40
  extensions:
32
- - jars/Rakefile
41
+ - jars/Rakefile
33
42
  extra_rdoc_files: []
34
43
 
35
44
  files:
36
- - .gitignore
37
- - Gemfile
38
- - MIT-LICENSE
39
- - Rakefile
40
- - ivy-resolver.gemspec
41
- - jars/Rakefile
42
- - lib/ivy-resolver.rb
43
- - lib/ivy/resolver.rb
44
- - lib/ivy/resolver/artifact.rb
45
- - lib/ivy/resolver/dsl.rb
46
- - lib/ivy/resolver/version.rb
47
- - spec/ivy_resolver_spec.rb
48
- - spec/spec_helper.rb
49
- - spec_files/Jarfile
50
- - spec_files/org/example/test/0.0.1/.gitignore
51
- - spec_files/org/example/test/0.0.1/IvyResolverTestClass.java
45
+ - .gitignore
46
+ - Gemfile
47
+ - MIT-LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - ivy-resolver.gemspec
51
+ - jars/Rakefile
52
+ - lib/ivy-resolver.rb
53
+ - lib/ivy/resolver.rb
54
+ - lib/ivy/resolver/artifact.rb
55
+ - lib/ivy/resolver/dsl.rb
56
+ - lib/ivy/resolver/version.rb
57
+ - spec/ivy_resolver_spec.rb
58
+ - spec/spec_helper.rb
59
+ - spec_files/Jarfile
60
+ - spec_files/org/example/test/0.0.1/.gitignore
61
+ - spec_files/org/example/test/0.0.1/IvyResolverTestClass.java
62
+ - spec_files/org/example/test/0.0.1/test-0.0.1.pom
63
+ - spec_files/org/example/test2/0.0.1/TransitiveDependencyTestClass.class
64
+ - spec_files/org/example/test2/0.0.1/TransitiveDependencyTestClass.java
65
+ - spec_files/org/example/test2/0.0.1/test2-0.0.1.pom
52
66
  homepage: ""
53
67
  licenses: []
54
68
 
@@ -56,24 +70,29 @@ post_install_message:
56
70
  rdoc_options: []
57
71
 
58
72
  require_paths:
59
- - lib
60
- - jars
73
+ - lib
61
74
  required_ruby_version: !ruby/object:Gem::Requirement
62
75
  none: false
63
76
  requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
67
83
  required_rubygems_version: !ruby/object:Gem::Requirement
68
84
  none: false
69
85
  requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: "0"
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
73
92
  requirements: []
74
93
 
75
94
  rubyforge_project: ivy-resolver
76
- rubygems_version: 1.8.9
95
+ rubygems_version: 1.8.5
77
96
  signing_key:
78
97
  specification_version: 3
79
98
  summary: Resolve JAR files using Ivy under the covers