javagems 0.4.8 → 0.4.9
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 +1 -1
- data/bin/jam +7 -0
- data/bin/jamc +7 -0
- data/javagems.gemspec +7 -4
- data/lib/javagems/jam.rb +12 -0
- data/lib/rubygems/commands/classpath_command.rb +9 -1
- data/test/jam_test.rb +90 -0
- metadata +8 -5
- data/bin/jem +0 -2
- data/bin/jemc +0 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.9
|
data/bin/jam
ADDED
data/bin/jamc
ADDED
data/javagems.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
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.9"
|
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
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 = ["
|
15
|
+
s.executables = ["jam", "jamc", "javagem", "javagem-exec"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README.rdoc"
|
@@ -23,14 +23,15 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.rdoc",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
+
"bin/jam",
|
27
|
+
"bin/jamc",
|
26
28
|
"bin/javagem",
|
27
29
|
"bin/javagem-exec",
|
28
|
-
"bin/jem",
|
29
|
-
"bin/jemc",
|
30
30
|
"javagems.gemspec",
|
31
31
|
"lib/javagems.rb",
|
32
32
|
"lib/javagems/classpath_builder.rb",
|
33
33
|
"lib/javagems/gem_overrides.rb",
|
34
|
+
"lib/javagems/jam.rb",
|
34
35
|
"lib/rubygems/commands/classpath_command.rb",
|
35
36
|
"test/classpath_command_test.rb",
|
36
37
|
"test/gem_overrides_test.rb",
|
@@ -69,6 +70,7 @@ Gem::Specification.new do |s|
|
|
69
70
|
"test/invalid_test_app/vendor/gems/specifications/test-gem-four-0.0.0.gemspec",
|
70
71
|
"test/invalid_test_app/vendor/gems/specifications/test-gem-one-0.0.0.gemspec",
|
71
72
|
"test/invalid_test_app/vendor/gems/specifications/test-gem-two-0.0.0.gemspec",
|
73
|
+
"test/jam_test.rb",
|
72
74
|
"test/test_helper.rb",
|
73
75
|
"test/valid_test_app/Gemfile",
|
74
76
|
"test/valid_test_app/vendor/gems/dirs/test-gem-four/.document",
|
@@ -140,6 +142,7 @@ variable for maximum-JavaGems-fun-times.
|
|
140
142
|
"test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb",
|
141
143
|
"test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb",
|
142
144
|
"test/invalid_test_app/vendor/gems/environment.rb",
|
145
|
+
"test/jam_test.rb",
|
143
146
|
"test/test_helper.rb",
|
144
147
|
"test/valid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb",
|
145
148
|
"test/valid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb",
|
data/lib/javagems/jam.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module JavaGems
|
2
|
+
module Jam
|
3
|
+
def self.classpath_from_options(options)
|
4
|
+
classpath = [ENV["CLASSPATH"]]
|
5
|
+
classpath += %w[-cp -classpath].map do |option|
|
6
|
+
idx = options.index(option)
|
7
|
+
options.slice!(idx..(idx + 1)).last if idx
|
8
|
+
end
|
9
|
+
[classpath.compact.join(File::PATH_SEPARATOR), options]
|
10
|
+
end
|
11
|
+
end # Jam
|
12
|
+
end # JamaGems
|
@@ -3,6 +3,14 @@ require 'bundler'
|
|
3
3
|
require 'javagems/classpath_builder'
|
4
4
|
require 'stringio'
|
5
5
|
|
6
|
+
class Gem::StreamUI
|
7
|
+
def print(str) @outs.print(str); end
|
8
|
+
end
|
9
|
+
|
10
|
+
Gem::UserInteraction.class_eval do
|
11
|
+
def print(str) ui.print(str); end
|
12
|
+
end
|
13
|
+
|
6
14
|
class Gem::Commands::ClasspathCommand < Gem::Command
|
7
15
|
attr_reader :cp_builder
|
8
16
|
|
@@ -16,7 +24,7 @@ class Gem::Commands::ClasspathCommand < Gem::Command
|
|
16
24
|
end
|
17
25
|
|
18
26
|
def execute
|
19
|
-
|
27
|
+
print(@cp_builder.classpath_for(options[:args].first))
|
20
28
|
rescue => e
|
21
29
|
alert_error(e.message)
|
22
30
|
exit 1
|
data/test/jam_test.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'javagems/jam'
|
3
|
+
|
4
|
+
context "Jam: classpath_from_options" do
|
5
|
+
context "with only -cp option" do
|
6
|
+
setup do
|
7
|
+
JavaGems::Jam.classpath_from_options(%w[-cp foo:bar])
|
8
|
+
end
|
9
|
+
|
10
|
+
should "include anything after -cp option" do
|
11
|
+
topic.first
|
12
|
+
end.equals("foo:bar")
|
13
|
+
|
14
|
+
should "remove -cp option and value from option array" do
|
15
|
+
topic.last
|
16
|
+
end.equals([])
|
17
|
+
end # with only -cp option
|
18
|
+
|
19
|
+
context "with only -classpath option" do
|
20
|
+
setup do
|
21
|
+
JavaGems::Jam.classpath_from_options(%w[-classpath bar:food])
|
22
|
+
end
|
23
|
+
|
24
|
+
should "include anything after option" do
|
25
|
+
topic.first
|
26
|
+
end.equals("bar:food")
|
27
|
+
|
28
|
+
should "remove option and value from option array" do
|
29
|
+
topic.last
|
30
|
+
end.equals([])
|
31
|
+
end # with only -classpath option
|
32
|
+
|
33
|
+
context "with -cp and -classpath options" do
|
34
|
+
setup do
|
35
|
+
JavaGems::Jam.classpath_from_options(%w[-cp foo:beard -classpath bar:food])
|
36
|
+
end
|
37
|
+
|
38
|
+
should "include anything after option" do
|
39
|
+
topic.first
|
40
|
+
end.equals("foo:beard:bar:food")
|
41
|
+
|
42
|
+
should "remove options and values from option array" do
|
43
|
+
topic.last
|
44
|
+
end.equals([])
|
45
|
+
end # with -cp and -classpath options
|
46
|
+
|
47
|
+
context "with -cp, -classpath and some other options" do
|
48
|
+
setup do
|
49
|
+
JavaGems::Jam.classpath_from_options(%w[your -cp foo:beard classy -classpath bar:food mom])
|
50
|
+
end
|
51
|
+
|
52
|
+
should "include anything after option" do
|
53
|
+
topic.first
|
54
|
+
end.equals("foo:beard:bar:food")
|
55
|
+
|
56
|
+
should "remove cp options and values but keep other stuff" do
|
57
|
+
topic.last
|
58
|
+
end.equals(%w[your classy mom])
|
59
|
+
end # with -cp, -classpath and some other options
|
60
|
+
|
61
|
+
context "when CLASSPATH defined but not the command line options" do
|
62
|
+
setup do
|
63
|
+
ENV["CLASSPATH"] = "bar:food"
|
64
|
+
JavaGems::Jam.classpath_from_options(%w[your classy mom])
|
65
|
+
end
|
66
|
+
|
67
|
+
should "include just the CLASSPATH value" do
|
68
|
+
topic.first
|
69
|
+
end.equals("bar:food")
|
70
|
+
|
71
|
+
should "leave command line options alone" do
|
72
|
+
topic.last
|
73
|
+
end.equals(%w[your classy mom])
|
74
|
+
end
|
75
|
+
|
76
|
+
context "when CLASSPATH , -cp, and -classpath are defined" do
|
77
|
+
setup do
|
78
|
+
ENV["CLASSPATH"] = "yum:juice"
|
79
|
+
JavaGems::Jam.classpath_from_options(%w[your -classpath food classy -cp bar mom])
|
80
|
+
end
|
81
|
+
|
82
|
+
should "include just CLASSPATH, -cp, and -classpath values" do
|
83
|
+
topic.first
|
84
|
+
end.equals("yum:juice:bar:food")
|
85
|
+
|
86
|
+
should "also keep the other command line options" do
|
87
|
+
topic.last
|
88
|
+
end.equals(%w[your classy mom])
|
89
|
+
end
|
90
|
+
end # Jam: classpath_from_options
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gabrielg
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
description: Provides gem-esque support to Java
|
57
57
|
email: gabriel.gironda@gmail.com
|
58
58
|
executables:
|
59
|
+
- jam
|
60
|
+
- jamc
|
59
61
|
- javagem
|
60
62
|
- javagem-exec
|
61
|
-
- jem
|
62
|
-
- jemc
|
63
63
|
extensions: []
|
64
64
|
|
65
65
|
extra_rdoc_files:
|
@@ -71,14 +71,15 @@ files:
|
|
71
71
|
- README.rdoc
|
72
72
|
- Rakefile
|
73
73
|
- VERSION
|
74
|
+
- bin/jam
|
75
|
+
- bin/jamc
|
74
76
|
- bin/javagem
|
75
77
|
- bin/javagem-exec
|
76
|
-
- bin/jem
|
77
|
-
- bin/jemc
|
78
78
|
- javagems.gemspec
|
79
79
|
- lib/javagems.rb
|
80
80
|
- lib/javagems/classpath_builder.rb
|
81
81
|
- lib/javagems/gem_overrides.rb
|
82
|
+
- lib/javagems/jam.rb
|
82
83
|
- lib/rubygems/commands/classpath_command.rb
|
83
84
|
- test/classpath_command_test.rb
|
84
85
|
- test/gem_overrides_test.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- test/invalid_test_app/vendor/gems/specifications/test-gem-four-0.0.0.gemspec
|
118
119
|
- test/invalid_test_app/vendor/gems/specifications/test-gem-one-0.0.0.gemspec
|
119
120
|
- test/invalid_test_app/vendor/gems/specifications/test-gem-two-0.0.0.gemspec
|
121
|
+
- test/jam_test.rb
|
120
122
|
- test/test_helper.rb
|
121
123
|
- test/valid_test_app/Gemfile
|
122
124
|
- test/valid_test_app/vendor/gems/dirs/test-gem-four/.document
|
@@ -210,6 +212,7 @@ test_files:
|
|
210
212
|
- test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/helper.rb
|
211
213
|
- test/invalid_test_app/vendor/gems/dirs/test-gem-two/test/test_test-gem-two.rb
|
212
214
|
- test/invalid_test_app/vendor/gems/environment.rb
|
215
|
+
- test/jam_test.rb
|
213
216
|
- test/test_helper.rb
|
214
217
|
- test/valid_test_app/vendor/gems/dirs/test-gem-four/lib/test-gem-four.rb
|
215
218
|
- test/valid_test_app/vendor/gems/dirs/test-gem-four/test/helper.rb
|
data/bin/jem
DELETED
data/bin/jemc
DELETED