javagems 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -18
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/bin/javagem +2 -4
- data/bin/javagem-exec +39 -0
- data/javagems.gemspec +38 -9
- data/lib/javagems/classpath_builder.rb +38 -0
- data/lib/javagems/gem_overrides.rb +3 -0
- data/lib/rubygems/commands/classpath_command.rb +4 -27
- data/test/classpath_command_test.rb +4 -2
- metadata +44 -6
- data/.document +0 -5
- data/lib/javagems/commands/javagem_command.rb +0 -2
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -6,6 +6,7 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "javagems"
|
8
8
|
gem.executables << "javagem"
|
9
|
+
gem.executables << "javagem-exec"
|
9
10
|
gem.summary = %Q{A gem for the javagems system}
|
10
11
|
gem.description = %Q{Provides gem-esque support to Java}
|
11
12
|
gem.email = "gabriel.gironda@gmail.com"
|
@@ -14,6 +15,7 @@ begin
|
|
14
15
|
gem.add_dependency "gemcutter"
|
15
16
|
gem.add_dependency "jeweler"
|
16
17
|
gem.add_dependency "bundler"
|
18
|
+
gem.add_dependency "cmdparse"
|
17
19
|
gem.add_development_dependency "riot"
|
18
20
|
end
|
19
21
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/bin/javagem
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'javagems/commands/javagem_command'
|
4
|
-
require 'rubygems/command_manager'
|
5
2
|
require 'pathname'
|
6
3
|
$: << (Pathname(__FILE__).parent.parent + "lib").expand_path.to_s
|
7
|
-
|
4
|
+
require 'javagems/gem_overrides'
|
5
|
+
require 'rubygems/command_manager'
|
8
6
|
require "rubygems/commands/jeweler_command"
|
9
7
|
require "rubygems/commands/classpath_command"
|
10
8
|
|
data/bin/javagem-exec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# NOT A GEM PLUGIN BECAUSE I'M CLEARLY TOO INEPT TO
|
3
|
+
# WORK WITH OPTPARSE AS IT IS USED IN A GEM PLUGIN.
|
4
|
+
require 'pathname'
|
5
|
+
$: << Pathname(__FILE__).parent.parent + "lib"
|
6
|
+
require 'javagems/gem_overrides'
|
7
|
+
require 'javagems/classpath_builder'
|
8
|
+
require 'optparse'
|
9
|
+
|
10
|
+
if sep = ARGV.index("--")
|
11
|
+
rest = ARGV[(sep + 1)..-1]
|
12
|
+
opts = ARGV.slice(0, sep)
|
13
|
+
else
|
14
|
+
rest = ARGV
|
15
|
+
opts = []
|
16
|
+
end
|
17
|
+
|
18
|
+
options = {}
|
19
|
+
parser = OptionParser.new do |opt_parse|
|
20
|
+
opt_parse.banner = <<EOU.gsub(/^\s+/, '')
|
21
|
+
Usage: #{$0} [options] -- command
|
22
|
+
The -- is unnecessary if no options are specified.
|
23
|
+
EOU
|
24
|
+
|
25
|
+
opt_parse.on("-m", "--manifest GEMFILE", "Gem manifest file to use") do |m|
|
26
|
+
options[:manifest] = m
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if ARGV.empty?
|
31
|
+
puts parser.to_s
|
32
|
+
exit 1
|
33
|
+
else
|
34
|
+
parser.parse(opts)
|
35
|
+
cp_builder = JavaGems::ClasspathBuilder.new
|
36
|
+
cp = cp_builder.classpath_for(options[:manifest])
|
37
|
+
ENV['CLASSPATH'] = ENV['CLASSPATH'] ? "#{cp}#{File::PATH_SEPARATOR}#{ENV['CLASSPATH']}" : cp
|
38
|
+
exec(*rest)
|
39
|
+
end
|
data/javagems.gemspec
CHANGED
@@ -5,32 +5,29 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{javagems}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["gabrielg", "jaknowlden"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-19}
|
13
13
|
s.description = %q{Provides gem-esque support to Java}
|
14
14
|
s.email = %q{gabriel.gironda@gmail.com}
|
15
|
-
s.executables = ["javagem", "javagem"]
|
15
|
+
s.executables = ["javagem", "javagem-exec", "javagem", "javagem-exec"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README.rdoc"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
|
-
".
|
22
|
-
".gitignore",
|
23
|
-
".gitignore",
|
24
|
-
"LICENSE",
|
21
|
+
".gitignore",
|
25
22
|
"LICENSE",
|
26
23
|
"README.rdoc",
|
27
24
|
"Rakefile",
|
28
|
-
"Rakefile",
|
29
25
|
"VERSION",
|
30
26
|
"bin/javagem",
|
27
|
+
"bin/javagem-exec",
|
31
28
|
"javagems.gemspec",
|
32
29
|
"lib/javagems.rb",
|
33
|
-
"lib/javagems/
|
30
|
+
"lib/javagems/classpath_builder.rb",
|
34
31
|
"lib/javagems/gem_overrides.rb",
|
35
32
|
"lib/rubygems/commands/classpath_command.rb",
|
36
33
|
"lib/rubygems/commands/jeweler_command.rb",
|
@@ -125,6 +122,35 @@ Gem::Specification.new do |s|
|
|
125
122
|
s.require_paths = ["lib"]
|
126
123
|
s.rubygems_version = %q{1.3.5}
|
127
124
|
s.summary = %q{A gem for the javagems system}
|
125
|
+
s.test_files = [
|
126
|
+
"test/classpath_command_test.rb",
|
127
|
+
"test/gem_overrides_test.rb",
|
128
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb",
|
129
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb",
|
130
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-four/test/test_test-gem-four.rb",
|
131
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-one/lib/test-gem-one.rb",
|
132
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-one/test/helper.rb",
|
133
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-one/test/test_test-gem-one.rb",
|
134
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-two/lib/test-gem-two.rb",
|
135
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb",
|
136
|
+
"test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb",
|
137
|
+
"test/invalid_test_app/vendor/gems/environment.rb",
|
138
|
+
"test/jeweler_command_test.rb",
|
139
|
+
"test/test_helper.rb",
|
140
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb",
|
141
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb",
|
142
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-four/test/test_test-gem-four.rb",
|
143
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-one/lib/test-gem-one.rb",
|
144
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-one/test/helper.rb",
|
145
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-one/test/test_test-gem-one.rb",
|
146
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-three/lib/test-gem-three.rb",
|
147
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-three/test/helper.rb",
|
148
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-three/test/test_test-gem-three.rb",
|
149
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-two/lib/test-gem-two.rb",
|
150
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb",
|
151
|
+
"test/valid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb",
|
152
|
+
"test/valid_test_app/vendor/gems/environment.rb"
|
153
|
+
]
|
128
154
|
|
129
155
|
if s.respond_to? :specification_version then
|
130
156
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
@@ -134,17 +160,20 @@ Gem::Specification.new do |s|
|
|
134
160
|
s.add_runtime_dependency(%q<gemcutter>, [">= 0"])
|
135
161
|
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
136
162
|
s.add_runtime_dependency(%q<bundler>, [">= 0"])
|
163
|
+
s.add_runtime_dependency(%q<cmdparse>, [">= 0"])
|
137
164
|
s.add_development_dependency(%q<riot>, [">= 0"])
|
138
165
|
else
|
139
166
|
s.add_dependency(%q<gemcutter>, [">= 0"])
|
140
167
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
141
168
|
s.add_dependency(%q<bundler>, [">= 0"])
|
169
|
+
s.add_dependency(%q<cmdparse>, [">= 0"])
|
142
170
|
s.add_dependency(%q<riot>, [">= 0"])
|
143
171
|
end
|
144
172
|
else
|
145
173
|
s.add_dependency(%q<gemcutter>, [">= 0"])
|
146
174
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
147
175
|
s.add_dependency(%q<bundler>, [">= 0"])
|
176
|
+
s.add_dependency(%q<cmdparse>, [">= 0"])
|
148
177
|
s.add_dependency(%q<riot>, [">= 0"])
|
149
178
|
end
|
150
179
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
module JavaGems
|
4
|
+
class ClasspathBuilder
|
5
|
+
class ClasspathError < RuntimeError; end
|
6
|
+
|
7
|
+
def classpath_for(gemfile)
|
8
|
+
with_hijacked_bundler_logging do
|
9
|
+
bundler_env = Bundler::Environment.load(gemfile)
|
10
|
+
deps = bundler_env.dependencies.map {|dep| dep.to_gem_dependency }
|
11
|
+
cp = Bundler::Resolver.resolve(deps, sources).collect do |spec|
|
12
|
+
(Pathname(spec.full_gem_path) + "lib").expand_path.to_s
|
13
|
+
end.join(File::PATH_SEPARATOR)
|
14
|
+
end
|
15
|
+
|
16
|
+
rescue => e
|
17
|
+
raise ClasspathError, "#{e.message} - #{@hijacked_out.read}"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def with_hijacked_bundler_logging
|
23
|
+
@hijacked_out = StringIO.new
|
24
|
+
real_logger, Bundler.logger = Bundler.logger, Logger.new(@hijacked_out, Logger::INFO)
|
25
|
+
Bundler.logger.formatter = real_logger.formatter
|
26
|
+
yield
|
27
|
+
ensure
|
28
|
+
@hijacked_out.rewind
|
29
|
+
Bundler.logger = real_logger
|
30
|
+
end
|
31
|
+
|
32
|
+
# FIXME - Until we have actual bundler support, use the Gem home source index.
|
33
|
+
def sources
|
34
|
+
[Bundler::DirectorySource.new(:location => Gem.configuration.home)]
|
35
|
+
end
|
36
|
+
|
37
|
+
end # ClasspathBuilder
|
38
|
+
end # JavaGems
|
@@ -3,6 +3,8 @@ require 'rubygems/gem_runner'
|
|
3
3
|
require 'rubygems/exceptions'
|
4
4
|
require 'bundler'
|
5
5
|
|
6
|
+
ENV['GEMCUTTER_URL'] = ENV['JAVAGEMS_URL'] || "https://gems.javagems.org/"
|
7
|
+
|
6
8
|
module Gem
|
7
9
|
DefaultGemConfigName = ".javagemrc"
|
8
10
|
|
@@ -18,6 +20,7 @@ module Gem
|
|
18
20
|
:gempath => [File.join(Gem.user_home, ".javagem/java")]
|
19
21
|
)
|
20
22
|
|
23
|
+
@configuration = nil # To force Gem to re-read the config
|
21
24
|
end
|
22
25
|
|
23
26
|
class Gem::AbstractCommand < Gem::Command
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'rubygems/command'
|
2
2
|
require 'bundler'
|
3
|
+
require 'javagems/classpath_builder'
|
3
4
|
require 'stringio'
|
4
5
|
|
5
6
|
class Gem::Commands::ClasspathCommand < Gem::Command
|
7
|
+
attr_reader :cp_builder
|
6
8
|
|
7
9
|
def initialize
|
8
10
|
super 'classpath', "Given a Gemfile, returns the classpath necessary to satisfy dependencies"
|
11
|
+
@cp_builder = JavaGems::ClasspathBuilder.new
|
9
12
|
end
|
10
13
|
|
11
14
|
def usage
|
@@ -13,37 +16,11 @@ class Gem::Commands::ClasspathCommand < Gem::Command
|
|
13
16
|
end
|
14
17
|
|
15
18
|
def execute
|
16
|
-
|
17
|
-
bundler_env = Bundler::Environment.load(options[:args].first)
|
18
|
-
deps = bundler_env.dependencies.map {|dep| dep.to_gem_dependency }
|
19
|
-
|
20
|
-
cp = Bundler::Resolver.resolve(deps, sources).collect do |spec|
|
21
|
-
(Pathname(spec.full_gem_path) + "lib").expand_path.to_s
|
22
|
-
end.join(File::PATH_SEPARATOR)
|
23
|
-
say(cp)
|
24
|
-
end
|
19
|
+
say(@cp_builder.classpath_for(options[:args].first))
|
25
20
|
rescue => e
|
26
21
|
alert_error(e.message)
|
27
|
-
@hijacked_out.readlines.each { |l| alert_error(l.strip) }
|
28
22
|
exit 1
|
29
23
|
end
|
30
24
|
|
31
|
-
private
|
32
|
-
|
33
|
-
def with_hijacked_bundler_logging
|
34
|
-
@hijacked_out = StringIO.new
|
35
|
-
real_logger, Bundler.logger = Bundler.logger, Logger.new(@hijacked_out, Logger::INFO)
|
36
|
-
Bundler.logger.formatter = real_logger.formatter
|
37
|
-
yield
|
38
|
-
ensure
|
39
|
-
@hijacked_out.rewind
|
40
|
-
Bundler.logger = real_logger
|
41
|
-
end
|
42
|
-
|
43
|
-
# FIXME - Until we have actual bundler support, use the system source index.
|
44
|
-
def sources
|
45
|
-
[Bundler::SystemGemSource.instance]
|
46
|
-
end
|
47
|
-
|
48
25
|
end
|
49
26
|
|
@@ -8,7 +8,8 @@ context "the classpath command" do
|
|
8
8
|
setup do
|
9
9
|
@command = Gem::Commands::ClasspathCommand.new
|
10
10
|
# FIXME - ghetto-mock
|
11
|
-
|
11
|
+
cp_builder = @command.cp_builder
|
12
|
+
def cp_builder.sources
|
12
13
|
[Bundler::DirectorySource.new(:location => (TestRoot + "valid_test_app/vendor").expand_path.to_s)]
|
13
14
|
end
|
14
15
|
end
|
@@ -27,7 +28,8 @@ context "the classpath command" do
|
|
27
28
|
setup do
|
28
29
|
@command = Gem::Commands::ClasspathCommand.new
|
29
30
|
# FIXME - ghetto-mock
|
30
|
-
|
31
|
+
cp_builder = @command.cp_builder
|
32
|
+
def cp_builder.sources
|
31
33
|
[Bundler::DirectorySource.new(:location => (TestRoot + "invalid_test_app/vendor").expand_path.to_s)]
|
32
34
|
end
|
33
35
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: javagems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gabrielg
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-11-
|
13
|
+
date: 2009-11-19 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,16 @@ dependencies:
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: "0"
|
45
45
|
version:
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: cmdparse
|
48
|
+
type: :runtime
|
49
|
+
version_requirement:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
46
56
|
- !ruby/object:Gem::Dependency
|
47
57
|
name: riot
|
48
58
|
type: :development
|
@@ -57,23 +67,25 @@ description: Provides gem-esque support to Java
|
|
57
67
|
email: gabriel.gironda@gmail.com
|
58
68
|
executables:
|
59
69
|
- javagem
|
70
|
+
- javagem-exec
|
60
71
|
- javagem
|
72
|
+
- javagem-exec
|
61
73
|
extensions: []
|
62
74
|
|
63
75
|
extra_rdoc_files:
|
64
76
|
- LICENSE
|
65
77
|
- README.rdoc
|
66
78
|
files:
|
67
|
-
- .document
|
68
79
|
- .gitignore
|
69
80
|
- LICENSE
|
70
81
|
- README.rdoc
|
71
82
|
- Rakefile
|
72
83
|
- VERSION
|
73
84
|
- bin/javagem
|
85
|
+
- bin/javagem-exec
|
74
86
|
- javagems.gemspec
|
75
87
|
- lib/javagems.rb
|
76
|
-
- lib/javagems/
|
88
|
+
- lib/javagems/classpath_builder.rb
|
77
89
|
- lib/javagems/gem_overrides.rb
|
78
90
|
- lib/rubygems/commands/classpath_command.rb
|
79
91
|
- lib/rubygems/commands/jeweler_command.rb
|
@@ -190,5 +202,31 @@ rubygems_version: 1.3.5
|
|
190
202
|
signing_key:
|
191
203
|
specification_version: 3
|
192
204
|
summary: A gem for the javagems system
|
193
|
-
test_files:
|
194
|
-
|
205
|
+
test_files:
|
206
|
+
- test/classpath_command_test.rb
|
207
|
+
- test/gem_overrides_test.rb
|
208
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb
|
209
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb
|
210
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-four/test/test_test-gem-four.rb
|
211
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-one/lib/test-gem-one.rb
|
212
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-one/test/helper.rb
|
213
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-one/test/test_test-gem-one.rb
|
214
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-two/lib/test-gem-two.rb
|
215
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb
|
216
|
+
- test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb
|
217
|
+
- test/invalid_test_app/vendor/gems/environment.rb
|
218
|
+
- test/jeweler_command_test.rb
|
219
|
+
- test/test_helper.rb
|
220
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb
|
221
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb
|
222
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-four/test/test_test-gem-four.rb
|
223
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-one/lib/test-gem-one.rb
|
224
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-one/test/helper.rb
|
225
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-one/test/test_test-gem-one.rb
|
226
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-three/lib/test-gem-three.rb
|
227
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-three/test/helper.rb
|
228
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-three/test/test_test-gem-three.rb
|
229
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-two/lib/test-gem-two.rb
|
230
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb
|
231
|
+
- test/valid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb
|
232
|
+
- test/valid_test_app/vendor/gems/environment.rb
|
data/.document
DELETED