naether 0.4.1-java → 0.4.2-java

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 CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -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 )
@@ -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
@@ -2,7 +2,7 @@
2
2
  name: naether
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.1
5
+ version: 0.4.2
6
6
  platform: java
7
7
  authors:
8
8
  - Michael Guymon
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-21 00:00:00 -04:00
13
+ date: 2011-09-22 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,6 @@ files:
74
74
  - lib/naether.rb
75
75
  - lib/naether/bootstrap.rb
76
76
  - lib/naether/java.rb
77
- - naether-0.4.1.jar
78
77
  - pom.xml
79
78
  has_rdoc: true
80
79
  homepage: http://github.com/mguymon/naether
Binary file