naether 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
data/lib/naether.rb CHANGED
@@ -85,6 +85,10 @@ class Naether
85
85
  @resolver.addDependency( notation, scope )
86
86
  end
87
87
 
88
+ def add_pom_dependencies( pom_path, scopes=['compile'] )
89
+ @resolver.addDependencies( pom_path, scopes )
90
+ end
91
+
88
92
  # Add a dependency Java object
89
93
  def add_dependency( dependency )
90
94
  #@resolver.addDependency( dependency )
@@ -95,18 +99,35 @@ class Naether
95
99
  end
96
100
  end
97
101
 
98
- # Set array of dependencies in the notation: groupId:artifactId:type:version
102
+ # Array of mixed dependencies
99
103
  def dependencies=(dependencies)
100
104
  @resolver.clearDependencies()
101
105
  dependencies.each do |dependent|
102
106
  # Hash of notation => scope
103
107
  if dependent.is_a? Hash
104
108
  key = dependent.keys.first
105
- add_notation_dependency( key, dependent[key] )
106
109
 
107
- # String notation with compile scope
110
+ # Add pom dependencies with scopes
111
+ if key =~ /\.xml$/i
112
+ add_pom_dependencies( key, dependeny[key] )
113
+
114
+ # Add a dependency notation with scopes
115
+ else
116
+ add_notation_dependency( key, dependent[key] )
117
+ end
118
+
108
119
  elsif dependent.is_a? String
109
- add_notation_dependency( dependent, 'compile' )
120
+
121
+ # Add pom dependencies with default scopes
122
+ if dependent =~ /\.xml$/i
123
+ add_pom_dependencies( dependent )
124
+
125
+ # Add a dependency notation with compile scope
126
+ else
127
+ add_notation_dependency( dependent, 'compile' )
128
+ end
129
+
130
+ # Add an Aether dependency
110
131
  else
111
132
  add_dependency( dependent )
112
133
  end
@@ -170,18 +191,17 @@ class Naether
170
191
  end
171
192
 
172
193
  def load_pom( file_path )
173
- @project_instance = Naether::Java.create_maven_project
174
- @project_instance.loadPOM( file_path )
194
+ @project_instance = Naether::Java.create_maven_project( file_path )
175
195
  end
176
196
 
177
- # filePath to read the pom
178
- #
179
- def pom_dependencies( file_path=nil, scopes = nil )
197
+ def pom_dependencies( file_path=nil, scopes = nil)
180
198
  if file_path
181
199
  load_pom( file_path )
182
200
  end
201
+
202
+ deps = Naether::Java.maven_project_dependencies_notation( @project_instance, scopes )
183
203
 
184
- Naether::Java.convert_to_ruby_array( @project_instance.getDependenciesNotation(scopes, true), true )
204
+ Naether::Java.convert_to_ruby_array( deps, true )
185
205
  end
186
206
 
187
207
  def pom_version( file_path=nil )
data/lib/naether/java.rb CHANGED
@@ -45,12 +45,26 @@ class Naether
45
45
  end
46
46
  end
47
47
 
48
- def self.create_maven_project
48
+ def self.create_maven_project(path = nil)
49
+ projectClass = nil
49
50
  if Naether.platform == 'java'
50
- return com.slackworks.naether.maven.Project.new
51
+ projectClass = com.slackworks.naether.maven.Project
51
52
  else
52
53
  projectClass = Rjb::import('com.slackworks.naether.maven.Project')
53
- return projectClass.new
54
+ end
55
+
56
+ unless path.nil?
57
+ projectClass.new( path )
58
+ else
59
+ projectClass.new
60
+ end
61
+ end
62
+
63
+ def self.maven_project_dependencies_notation( instance, scopes = nil )
64
+ if Naether.platform == 'java'
65
+ instance.getDependenciesNotation(scopes, true)
66
+ else
67
+ instance._invoke('getDependenciesNotation', 'Ljava.util.List;boolean;', scopes, true)
54
68
  end
55
69
  end
56
70
 
data/pom.xml CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <groupId>com.slackworks</groupId>
6
6
  <artifactId>naether</artifactId>
7
- <version>0.4.1</version>
7
+ <version>0.4.2</version>
8
8
  <packaging>jar</packaging>
9
9
  <name>naether</name>
10
10
  <url>https://github.com/mguymon/naether</url>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naether
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Guymon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-21 00:00:00 -04:00
18
+ date: 2011-09-22 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -99,7 +99,6 @@ files:
99
99
  - lib/naether.rb
100
100
  - lib/naether/bootstrap.rb
101
101
  - lib/naether/java.rb
102
- - naether-0.4.1.jar
103
102
  - pom.xml
104
103
  has_rdoc: true
105
104
  homepage: http://github.com/mguymon/naether
data/naether-0.4.1.jar DELETED
Binary file