naether 0.5.1-java → 0.5.2-java

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/lib/naether.rb CHANGED
@@ -12,7 +12,7 @@ class Naether
12
12
 
13
13
  # Naether jar path will default to packaged in the gem
14
14
  JAR_LIB = "#{File.dirname(__FILE__)}/.."
15
- JAR_PATH = "#{JAR_LIB}/naether-0.5.1.jar" #XXX: hardcoded, should be based on VERSION file
15
+ JAR_PATH = "#{JAR_LIB}/naether-0.5.2.jar" #XXX: hardcoded, should be based on VERSION file
16
16
 
17
17
  class << self
18
18
 
@@ -208,26 +208,13 @@ class Naether
208
208
  @resolver.deployArtifact(@instance)
209
209
  end
210
210
 
211
- # Install artifact to local repo
212
- def install_artifact( notation, file_path, opts = {} )
213
- if Naether.platform == 'java'
214
- @instance = com.slackworks.naether.deploy.DeployArtifact.new
215
- else
216
- deployArtifactClass = Rjb::import('com.slackworks.naether.deploy.DeployArtifact')
217
- @instance = deployArtifactClass.new
218
- end
219
-
220
- @instance.setNotation( notation )
221
- @instance.setFilePath( file_path )
222
- if opts[:pom_path]
223
- @instance.setPomPath( opts[:pom_path] )
224
- end
225
-
226
- @resolver.installArtifact(@instance)
211
+ # Install artifact or pom to local repo, must specify pom_path and/or jar_path
212
+ def install( notation, pom_path =nil, jar_path = nil )
213
+ @resolver.install(notation, pom_path, jar_path)
227
214
  end
228
215
 
229
216
  def load_pom( file_path )
230
- @project_instance = Naether::Java.create_maven_project( file_path )
217
+ @project_instance = Naether::Java.create("com.slackworks.naether.maven.Project", file_path )
231
218
  end
232
219
 
233
220
  def pom_dependencies( file_path=nil, scopes = nil)
@@ -264,7 +251,7 @@ class Naether
264
251
  #
265
252
  # loads all resolved dependencies into pom
266
253
  def write_pom( notation, file_path )
267
- @project_instance = Naether::Java.create_maven_project
254
+ @project_instance = Naether::Java.create("com.slackworks.naether.maven.Project")
268
255
  @project_instance.setProjectNotation( notation )
269
256
 
270
257
  dependencies().each do |notation|
@@ -160,7 +160,7 @@ class Naether
160
160
  jar = jars.select { |x| x =~ /#{name}/ }
161
161
  if jar.size > 0
162
162
  jar = jar[0]
163
- @naether.install_artifact( dep, jar )
163
+ @naether.install( dep, nil, jar )
164
164
  else
165
165
  puts "Could not find jar for #{dep}"
166
166
  end
data/lib/naether/java.rb CHANGED
@@ -45,19 +45,14 @@ class Naether
45
45
  end
46
46
  end
47
47
 
48
- def self.create_maven_project(path = nil)
49
- projectClass = nil
48
+ def self.create( java_class, *args )
50
49
  if Naether.platform == 'java'
51
- projectClass = com.slackworks.naether.maven.Project
50
+ java_class = eval(java_class)
52
51
  else
53
- projectClass = Rjb::import('com.slackworks.naether.maven.Project')
52
+ java_class = Rjb::import(java_class)
54
53
  end
55
54
 
56
- unless path.nil?
57
- projectClass.new( path )
58
- else
59
- projectClass.new
60
- end
55
+ java_class.new( *args )
61
56
  end
62
57
 
63
58
  def self.convert_to_ruby_array( java_array, to_string = false )
@@ -126,7 +121,7 @@ class Naether
126
121
  end
127
122
 
128
123
  def load_jars(jars)
129
- loaded_jars = []
124
+ loadable_jars = []
130
125
  unless jars.is_a?( Array )
131
126
  jars = [jars]
132
127
  end
@@ -134,16 +129,16 @@ class Naether
134
129
  jars.each do |jar|
135
130
  expanded_jar = File.expand_path(jar)
136
131
  if !@loaded_jars.include? expanded_jar
137
- loaded_jars << expanded_jar
132
+ loadable_jars << expanded_jar
138
133
  @loaded_jars << expanded_jar
139
134
  end
140
135
  end
141
136
 
142
- unless loaded_jars.empty?
143
- Rjb::add_jar( loaded_jars )
137
+ unless loadable_jars.empty?
138
+ Rjb::add_jar( loadable_jars )
144
139
  end
145
140
 
146
- loaded_jars
141
+ loadable_jars
147
142
  end
148
143
  end
149
144
  end
data/naether-0.5.2.jar ADDED
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.5.1</version>
7
+ <version>0.5.2</version>
8
8
  <packaging>jar</packaging>
9
9
  <name>naether</name>
10
10
  <url>https://github.com/mguymon/naether</url>
@@ -125,27 +125,28 @@
125
125
  </dependencies>
126
126
 
127
127
  <build>
128
- <plugins>
129
- <plugin>
130
- <groupId>org.apache.maven.plugins</groupId>
131
- <artifactId>maven-dependency-plugin</artifactId>
132
- <executions>
133
- <execution>
134
- <id>copy-dependencies</id>
135
- <phase>package</phase>
136
- <goals>
137
- <goal>copy-dependencies</goal>
138
- </goals>
139
- <configuration>
140
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
141
- <overWriteReleases>false</overWriteReleases>
142
- <overWriteSnapshots>false</overWriteSnapshots>
143
- <overWriteIfNewer>true</overWriteIfNewer>
144
- </configuration>
145
- </execution>
146
- </executions>
147
- </plugin>
148
- </plugins>
128
+
129
+ <plugins>
130
+ <plugin>
131
+ <groupId>org.apache.maven.plugins</groupId>
132
+ <artifactId>maven-dependency-plugin</artifactId>
133
+ <executions>
134
+ <execution>
135
+ <id>copy-dependencies</id>
136
+ <phase>package</phase>
137
+ <goals>
138
+ <goal>copy-dependencies</goal>
139
+ </goals>
140
+ <configuration>
141
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
142
+ <overWriteReleases>false</overWriteReleases>
143
+ <overWriteSnapshots>false</overWriteSnapshots>
144
+ <overWriteIfNewer>true</overWriteIfNewer>
145
+ </configuration>
146
+ </execution>
147
+ </executions>
148
+ </plugin>
149
+ </plugins>
149
150
  </build>
150
151
 
151
152
  <reporting>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: naether
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.1
5
+ version: 0.5.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-11-21 00:00:00 -05:00
13
+ date: 2011-12-08 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,7 @@ files:
74
74
  - lib/naether.rb
75
75
  - lib/naether/bootstrap.rb
76
76
  - lib/naether/java.rb
77
- - naether-0.5.1.jar
77
+ - naether-0.5.2.jar
78
78
  - pom.xml
79
79
  has_rdoc: true
80
80
  homepage: http://github.com/mguymon/naether
data/naether-0.5.1.jar DELETED
Binary file