naether 0.13.8-java → 0.14.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd15752aba8345f4d4215f85d85829ad40e0cb46
4
- data.tar.gz: 9dbb75a05010c95036c6d36bd884f0d2328ea9cd
3
+ metadata.gz: 1cd1ed1e23f4e52c3e1e1e93e4ef8091ece93452
4
+ data.tar.gz: 08384da23232cd4f447dcd5d3ba5deed82e869ac
5
5
  SHA512:
6
- metadata.gz: 7a218ae070c8788198d95755fb746cb925480a03487709858e282f13a052cfb4f7c815da9373c7cc4454a5773938d87d2fba276a8132c24d21038fa6b520edc5
7
- data.tar.gz: 1ae603197f0f4f25f302eb45ae50953138aa50be35be61c80271deae58d16fa0dfa61a1f308cd2c81d9fbf0fb01651148537166abf41153cd978aac179b69433
6
+ metadata.gz: 22657bc947956d9d680ba140b39bb3a2cf815bfb35d3b890cc3e8c614b65c91b56a4b366f4310472ff7817a1a6817b788566cef2f38e68593f8bb7def240d23d
7
+ data.tar.gz: 2c516aa07254ceb8ec6f89e41cb66858369c3760ba8969505160130f41db65d6fbf52c47dba288d897a051df39196158996468f6940f014a9afeb02ea7e3e141
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gem 'httpclient'
4
+
3
5
  platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
4
6
  if platform != 'java'
5
7
  gem 'rjb', '~> 1.4.0'
data/Gemfile.lock CHANGED
@@ -2,7 +2,6 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.6)
5
- bouncy-castle-java (1.5.0147)
6
5
  builder (3.2.2)
7
6
  descendants_tracker (0.0.4)
8
7
  thread_safe (~> 0.3, >= 0.3.1)
@@ -20,6 +19,7 @@ GEM
20
19
  oauth2
21
20
  hashie (3.3.2)
22
21
  highline (1.6.21)
22
+ httpclient (2.6.0.1)
23
23
  jeweler (2.0.1)
24
24
  builder
25
25
  bundler (>= 1.0)
@@ -29,8 +29,7 @@ GEM
29
29
  nokogiri (>= 1.5.10)
30
30
  rake
31
31
  rdoc
32
- jruby-openssl (0.9.0)
33
- bouncy-castle-java (>= 1.5.0147)
32
+ jruby-openssl (0.9.6-java)
34
33
  json (1.8.2)
35
34
  json (1.8.2-java)
36
35
  jwt (1.2.0)
@@ -69,6 +68,7 @@ PLATFORMS
69
68
  ruby
70
69
 
71
70
  DEPENDENCIES
71
+ httpclient
72
72
  jeweler (~> 2.0.0)
73
73
  jruby-openssl
74
74
  kramdown
data/README.md CHANGED
@@ -18,6 +18,12 @@ JRuby is natively supported. Vanilla Ruby uses [Rjb](http://rjb.rubyforge.org) t
18
18
  gem install naether
19
19
 
20
20
  The jar dependencies for Naether will automatically be downloaded when the gem installs.
21
+
22
+ #### Custom Maven Repo
23
+
24
+ You can override the default Maven Repo used to download jar dependencies by setting the _NAETHER_MIRROR_ environment variable.
25
+
26
+ NAETHER_MIRROR=http://my.local.repo/m2 gem install naether
21
27
 
22
28
  ### Java
23
29
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.8
1
+ 0.14.0
Binary file
@@ -4,27 +4,35 @@ require "#{File.dirname(__FILE__)}/configuration"
4
4
  require 'yaml'
5
5
  require 'open-uri'
6
6
  require 'fileutils'
7
+ require 'httpclient'
7
8
 
8
9
  module Naether
9
-
10
+
10
11
  #
11
12
  # Helper for bootstrapping Naether
12
13
  #
13
14
  # @author Michael Guymon
14
15
  #
15
16
  class Bootstrap
16
-
17
+
17
18
  @@dependencies = nil
18
-
19
+
19
20
  class << self
20
-
21
+
21
22
  # Default local repo of ENV['M2_REPO'] or ~/.m2/repository
22
23
  #
23
24
  # @return [String]
24
25
  def default_local_repo
25
26
  ENV['M2_REPO'] || File.expand_path('~/.m2/repository')
26
27
  end
27
-
28
+
29
+ # Maven URL to fetch jars from, ENV['NAETHER_MIRROR'] or
30
+ #
31
+ # @return [String]
32
+ def maven_url
33
+ ENV['NAETHER_MIRROR'] || 'http://repo1.maven.org/maven2'
34
+ end
35
+
28
36
  # Write bootstrap dependencies to yaml file
29
37
  def write_dependencies( dest = 'jar_dependencies.yml' )
30
38
  deps = {};
@@ -33,32 +41,32 @@ module Naether
33
41
  else
34
42
  bootstrap = Rjb::import('com.tobedevoured.naether.Bootstrap')
35
43
  deps[:dependencies] = bootstrap.dependencies.toArray().map{ |dep| dep.toString() }
36
- end
37
-
44
+ end
45
+
38
46
  File.open( dest, 'w' ) do |out|
39
47
  YAML.dump( deps, out )
40
48
  end
41
49
  end
42
-
50
+
43
51
  # List of Java dependencies for Naether from yaml dependency file. Caches
44
52
  # result after first run.
45
- #
53
+ #
46
54
  # @param [String] dep_file path, defaults to Naether::Configuration.dependencies_yml
47
55
  # @return [List]
48
56
  def dependencies( dep_file=nil )
49
-
57
+
50
58
  if @@dependencies
51
59
  return @@dependencies
52
60
  end
53
-
61
+
54
62
  if dep_file.nil?
55
63
  dep_file = Naether::Configuration.dependencies_yml
56
64
  end
57
-
58
- dep = YAML.load_file( dep_file )
65
+
66
+ dep = YAML.load_file( dep_file )
59
67
  @@dependencies = dep[:dependencies]
60
68
  end
61
-
69
+
62
70
 
63
71
  #
64
72
  # Bootstrap the local repo by downloading Naether's dependencies
@@ -67,26 +75,22 @@ module Naether
67
75
  #
68
76
  def bootstrap_local_repo(local_repo = nil, opts = {} )
69
77
  local_repo = local_repo || default_local_repo
70
-
78
+
71
79
  opts[:local_repo] = local_repo
72
-
80
+
73
81
  temp_naether_dir = File.join( local_repo, ".naether" )
74
-
75
-
82
+
76
83
  deps = download_dependencies( temp_naether_dir, opts )
77
-
84
+
78
85
  jars = (deps[:exists] + deps[:downloaded]).map {|jar| jar.values.first }
79
-
86
+
80
87
  jars = Naether::Java.internal_load_paths( jars )
81
-
88
+
82
89
  if ( deps[:downloaded].size > 0)
83
90
  install_dependencies_to_local_repo( deps[:downloaded], jars, opts )
84
91
  end
85
-
86
- #raise Naether::Java.internal_loaded_paths.inspect
87
-
88
92
  end
89
-
93
+
90
94
  #
91
95
  # Download Naether dependencies
92
96
  #
@@ -94,112 +98,119 @@ module Naether
94
98
  # @param [Hash] opts
95
99
  # @return [Hash] with status of missing, downloaded, exists dependencies
96
100
  def download_dependencies( dest, opts = {} )
97
-
101
+
98
102
  if !File.exists? dest
99
103
  FileUtils.mkdir_p( dest )
100
104
  end
101
-
105
+
102
106
  deps = {}
103
-
107
+
104
108
  if opts[:deps]
105
- deps[:missing] = opts[:deps]
109
+ deps[:missing] = opts[:deps]
106
110
  else
107
111
  deps = check_local_repo_for_deps( opts[:local_repo], opts )
108
112
  end
109
-
113
+
110
114
  deps[:downloaded] = []
111
-
115
+
112
116
  if deps[:missing].size > 0
113
-
117
+ http_client = HTTPClient.new
118
+
114
119
  deps[:missing].each do |dep|
115
120
  notation = dep.split(":")
116
121
  group = notation[0].gsub("\.", File::SEPARATOR)
117
122
  artifact = notation[1]
118
123
  type = notation[2]
119
124
  version = notation[3]
120
-
125
+
121
126
  jar = "#{artifact}-#{version}.#{type}"
122
-
127
+
123
128
  maven_path = "#{dest}#{File::SEPARATOR}#{jar}"
124
-
129
+
125
130
  if !File.exists? maven_path
126
- maven_mirror = "http://repo1.maven.org/maven2/#{group}/#{artifact}/#{version}/#{jar}"
127
-
128
- open(maven_path, 'wb') do |io|
129
- io.print open(maven_mirror).read
131
+ maven_jar_url = "#{maven_url}/#{group}/#{artifact}/#{version}/#{jar}"
132
+
133
+ data = http_client.get(maven_jar_url)
134
+
135
+ if data.ok?
136
+ open(maven_path, 'wb') do |io|
137
+ io.print data.content
138
+ end
139
+ else
140
+ raise "Failed to download #{maven_jar_url}"
130
141
  end
131
-
142
+
132
143
  deps[:downloaded] << { dep => maven_path }
133
144
  else
134
145
  deps[:downloaded] << { dep => maven_path }
135
146
  end
136
147
  end
137
148
  end
138
-
149
+
139
150
  deps
140
151
  end
141
-
152
+
142
153
  #
143
154
  # Check local_repo for Naether dependencies
144
- #
155
+ #
145
156
  # @param [String] local_repo
146
157
  # @param [Hash] opts
147
158
  # @return [Hash] with status of missing, downloaded, exists dependencies
148
159
  def check_local_repo_for_deps(local_repo = nil, opts = {} )
149
-
160
+
150
161
  local_repo = local_repo || default_local_repo
151
162
  local_repo = File.expand_path(local_repo)
152
-
163
+
153
164
  #puts "Checking #{local_repo} for jars to bootstrap Naether"
154
-
165
+
155
166
  deps = {:exists => [], :missing => [], :downloaded => [] }
156
-
167
+
157
168
  dependencies( opts[:dep_yaml] ).each do |dep|
158
169
  notation = dep.split(":")
159
170
  group = notation[0].gsub("\.", File::SEPARATOR)
160
171
  artifact = notation[1].gsub("\.", File::SEPARATOR)
161
172
  type = notation[2]
162
173
  version = notation[3]
163
-
174
+
164
175
  jar = "#{artifact}-#{version}.#{type}"
165
-
176
+
166
177
  maven_path = "#{local_repo}#{File::SEPARATOR}#{group}#{File::SEPARATOR}#{artifact}#{File::SEPARATOR}#{version}#{File::SEPARATOR}#{jar}"
167
-
178
+
168
179
  if File.exists? maven_path
169
180
  deps[:exists] << { dep => maven_path }
170
181
  else
171
182
  deps[:missing] << dep
172
183
  end
173
-
174
- end
184
+
185
+ end
175
186
  deps
176
187
  end
177
-
188
+
178
189
  #
179
190
  # Install Naether Dependencies to local_repo
180
- #
181
- # @param [Array<String>] install_jars
191
+ #
192
+ # @param [Array<String>] install_jars
182
193
  # @param [Array<String>] naether_jars to bootstrap Naether. These may overlap with install_jars.
183
194
  # @param [Hash] opts
184
195
  # @return [Naether]
185
196
  #
186
197
  def install_dependencies_to_local_repo( install_jars, naether_jars, opts = {} )
187
-
198
+
188
199
  require "#{File.dirname(__FILE__)}/../naether"
189
-
200
+
190
201
  @naether = Naether.create_from_jars( naether_jars )
191
-
202
+
192
203
  if opts[:local_repo]
193
204
  @naether.local_repo_path = opts[:local_repo]
194
205
  end
195
-
206
+
196
207
  install_jars.each do |dep|
197
208
  notation, path = dep.to_a.first
198
209
  @naether.install( notation, nil, path )
199
210
  end
200
-
211
+
201
212
  @naether
202
213
  end
203
214
  end
204
215
  end
205
- end
216
+ end
data/naether.gemspec ADDED
@@ -0,0 +1,77 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: naether 0.14.0 java lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "naether"
9
+ s.version = "0.14.0"
10
+ s.platform = "java"
11
+
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
+ s.authors = ["Michael Guymon"]
14
+ s.date = "2015-02-13"
15
+ s.description = "Java dependency resolver using Maven's Aether"
16
+ s.email = "michael@tobedevoured.com"
17
+ s.extensions = ["Rakefile"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE",
26
+ "README.md",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "core-0.14.0.jar",
30
+ "jar_dependencies.yml",
31
+ "lib/naether.rb",
32
+ "lib/naether/bootstrap.rb",
33
+ "lib/naether/configuration.rb",
34
+ "lib/naether/java.rb",
35
+ "lib/naether/java/jruby.rb",
36
+ "lib/naether/java/ruby.rb",
37
+ "lib/naether/maven.rb",
38
+ "lib/naether/notation.rb",
39
+ "lib/naether/runtime.rb",
40
+ "naether.gemspec",
41
+ "pom.xml"
42
+ ]
43
+ s.homepage = "http://github.com/mguymon/naether"
44
+ s.licenses = ["Apache"]
45
+ s.require_paths = ["lib"]
46
+ s.rubyforge_project = "naether"
47
+ s.rubygems_version = "2.1.9"
48
+ s.summary = "Java dependency resolver using Maven's Aether"
49
+
50
+ if s.respond_to? :specification_version then
51
+ s.specification_version = 4
52
+
53
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<httpclient>, [">= 0"])
55
+ s.add_development_dependency(%q<rspec>, ["> 2.9.0"])
56
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.0"])
57
+ s.add_development_dependency(%q<yard>, [">= 0"])
58
+ s.add_development_dependency(%q<kramdown>, [">= 0"])
59
+ s.add_development_dependency(%q<jruby-openssl>, [">= 0"])
60
+ else
61
+ s.add_dependency(%q<httpclient>, [">= 0"])
62
+ s.add_dependency(%q<rspec>, ["> 2.9.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
64
+ s.add_dependency(%q<yard>, [">= 0"])
65
+ s.add_dependency(%q<kramdown>, [">= 0"])
66
+ s.add_dependency(%q<jruby-openssl>, [">= 0"])
67
+ end
68
+ else
69
+ s.add_dependency(%q<httpclient>, [">= 0"])
70
+ s.add_dependency(%q<rspec>, ["> 2.9.0"])
71
+ s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
72
+ s.add_dependency(%q<yard>, [">= 0"])
73
+ s.add_dependency(%q<kramdown>, [">= 0"])
74
+ s.add_dependency(%q<jruby-openssl>, [">= 0"])
75
+ end
76
+ end
77
+
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naether
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.8
4
+ version: 0.14.0
5
5
  platform: java
6
6
  authors:
7
7
  - Michael Guymon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-13 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - '>='
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: httpclient
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  requirement: !ruby/object:Gem::Requirement
15
29
  requirements:
@@ -95,30 +109,7 @@ files:
95
109
  - README.md
96
110
  - Rakefile
97
111
  - VERSION
98
- - core-0.13.8.jar
99
- - doc/Naether.html
100
- - doc/Naether/Bootstrap.html
101
- - doc/Naether/Configurator.html
102
- - doc/Naether/Java.html
103
- - doc/Naether/Java/JRuby.html
104
- - doc/Naether/Java/Ruby.html
105
- - doc/Naether/Maven.html
106
- - doc/Naether/Notation.html
107
- - doc/Naether/Runtime.html
108
- - doc/_index.html
109
- - doc/class_list.html
110
- - doc/css/common.css
111
- - doc/css/full_list.css
112
- - doc/css/style.css
113
- - doc/file.README.html
114
- - doc/file_list.html
115
- - doc/frames.html
116
- - doc/index.html
117
- - doc/js/app.js
118
- - doc/js/full_list.js
119
- - doc/js/jquery.js
120
- - doc/method_list.html
121
- - doc/top-level-namespace.html
112
+ - core-0.14.0.jar
122
113
  - jar_dependencies.yml
123
114
  - lib/naether.rb
124
115
  - lib/naether/bootstrap.rb
@@ -129,6 +120,7 @@ files:
129
120
  - lib/naether/maven.rb
130
121
  - lib/naether/notation.rb
131
122
  - lib/naether/runtime.rb
123
+ - naether.gemspec
132
124
  - pom.xml
133
125
  homepage: http://github.com/mguymon/naether
134
126
  licenses: