naether 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.4.0
@@ -3,7 +3,6 @@
3
3
  - com.jcraft:jsch:jar:0.1.38
4
4
  - com.ning:async-http-client:jar:1.6.1
5
5
  - org.apache.xbean:xbean-reflect:jar:3.4
6
- - org.jboss.netty:netty:jar:3.2.4.Final
7
6
  - com.google.collections:google-collections:jar:1.0
8
7
  - ch.qos.logback:logback-classic:jar:0.9.24
9
8
  - ch.qos.logback:logback-core:jar:0.9.24
@@ -69,11 +69,7 @@ class Naether
69
69
 
70
70
  # Array of remote repositories
71
71
  def remote_repositories
72
- if Naether.platform == 'java'
73
- return @resolver.getRemoteRepositories()
74
- else
75
- return @resolver.getRemoteRepositories().toArray()
76
- end
72
+ Naether::Java.convert_to_ruby_array(@resolver.getRemoteRepositories())
77
73
  end
78
74
 
79
75
  def local_repo_path
@@ -119,19 +115,11 @@ class Naether
119
115
 
120
116
  # Get dependencies
121
117
  def dependencies()
122
- if Naether.platform == 'java'
123
- return @resolver.getDependencies().to_a
124
- else
125
- return @resolver.getDependencies().toArray()
126
- end
118
+ Naether::Java.convert_to_ruby_array( @resolver.getDependencies() )
127
119
  end
128
120
 
129
121
  def dependenciesNotation()
130
- if Naether.platform == 'java'
131
- return @resolver.getDependenciesNotation().to_a
132
- else
133
- return @resolver.getDependenciesNotation().toArray().map{ |dep| dep.toString() }
134
- end
122
+ Naether::Java.convert_to_ruby_array(@resolver.getDependenciesNotation(), true)
135
123
  end
136
124
 
137
125
  # Resolve dependencies, finding related additional dependencies
@@ -181,18 +169,35 @@ class Naether
181
169
  @resolver.installArtifact(@instance)
182
170
  end
183
171
 
172
+ def load_pom( file_path )
173
+ @project_instance = Naether::Java.create_maven_project
174
+ @project_instance.loadPOM( file_path )
175
+ end
176
+
177
+ # filePath to read the pom
178
+ #
179
+ def pom_dependencies( file_path=nil )
180
+ if file_path
181
+ load_pom( file_path )
182
+ end
183
+
184
+ Naether::Java.convert_to_ruby_array( @project_instance.getDependenciesNotation(), true )
185
+ end
186
+
187
+ def pom_version( file_path=nil )
188
+ if file_path
189
+ load_pom( file_path )
190
+ end
191
+
192
+ return @project_instance.getVersion()
193
+ end
194
+
184
195
  # filePath to write the pom
185
196
  # notation of the pom, groupId:artifactId:type:version
186
197
  #
187
198
  # loads all resolved dependencies into pom
188
199
  def write_pom( notation, file_path )
189
- if Naether.platform == 'java'
190
- @project_instance = com.slackworks.naether.maven.Project.new
191
- else
192
- projectClass = Rjb::import('com.slackworks.naether.maven.Project')
193
- @project_instance = projectClass.new
194
- end
195
-
200
+ @project_instance = Naether::Java.create_maven_project
196
201
  @project_instance.setProjectNotation( notation )
197
202
 
198
203
  dependencies().each do |notation|
@@ -45,6 +45,29 @@ class Naether
45
45
  end
46
46
  end
47
47
 
48
+ def self.create_maven_project
49
+ if Naether.platform == 'java'
50
+ return com.slackworks.naether.maven.Project.new
51
+ else
52
+ projectClass = Rjb::import('com.slackworks.naether.maven.Project')
53
+ return projectClass.new
54
+ end
55
+ end
56
+
57
+ def self.convert_to_ruby_array( java_array, to_string = false )
58
+ if Naether.platform == 'java'
59
+ return java_array.to_a
60
+ else
61
+ ruby_array = java_array.toArray()
62
+
63
+ if to_string
64
+ ruby_array = ruby_array.map { |x| x.toString()}
65
+ end
66
+
67
+ return ruby_array
68
+ end
69
+ end
70
+
48
71
  #
49
72
  # Handle loading jars for JRuby
50
73
  #
Binary file
data/pom.xml CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <groupId>com.slackworks</groupId>
6
6
  <artifactId>naether</artifactId>
7
- <version>0.3.1</version>
7
+ <version>0.3.4</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: 27
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
8
  - 4
10
- version: 0.3.4
9
+ - 0
10
+ version: 0.4.0
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-03-30 00:00:00 -04:00
18
+ date: 2011-04-13 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -99,7 +99,7 @@ files:
99
99
  - lib/naether.rb
100
100
  - lib/naether/bootstrap.rb
101
101
  - lib/naether/java.rb
102
- - naether-0.3.1.jar
102
+ - naether-0.3.4.jar
103
103
  - pom.xml
104
104
  has_rdoc: true
105
105
  homepage: http://github.com/mguymon/naether
Binary file