javagems 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,8 +10,10 @@ begin
10
10
  gem.description = %Q{Provides gem-esque support to Java}
11
11
  gem.email = "gabriel.gironda@gmail.com"
12
12
  gem.homepage = "http://www.javagems.org/"
13
- gem.authors = ["ggironda", "jaknowlden"]
14
- gem.files = gem.files + FileList["jar/*"]
13
+ gem.authors = ["gabrielg", "jaknowlden"]
14
+ gem.add_dependency "gemcutter"
15
+ gem.add_dependency "jeweler"
16
+ gem.add_development_dependency "riot"
15
17
  end
16
18
  Jeweler::GemcutterTasks.new
17
19
  rescue LoadError
@@ -19,7 +21,6 @@ rescue LoadError
19
21
  end
20
22
 
21
23
  task :test => :check_dependencies
22
-
23
24
  task :default => :test
24
25
 
25
26
  require 'rake/rdoctask'
@@ -32,3 +33,9 @@ Rake::RDocTask.new do |rdoc|
32
33
  rdoc.rdoc_files.include('lib/**/*.rb')
33
34
  end
34
35
 
36
+ require 'rake/testtask'
37
+ Rake::TestTask.new(:test) do |test|
38
+ test.libs << 'lib' << 'test'
39
+ test.pattern = 'test/**/*_test.rb'
40
+ test.verbose = true
41
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/bin/javagem CHANGED
@@ -1,4 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
- jar = Pathname(__FILE__).parent.parent + "jar/javagems.jar"
4
- exec("java", "-jar", jar.expand_path.to_s, *ARGV)
2
+ require 'rubygems'
3
+ require 'javagems/commands/javagem_command'
4
+ require 'rubygems/command_manager'
5
+ $: << File.dirname(__FILE__)
6
+ require "rubygems/commands/jeweler_command"
7
+
8
+ Gem::CommandManager.instance.register_command :jeweler
9
+
10
+ required_version = Gem::Requirement.new "> 1.8.3"
11
+
12
+
13
+ unless required_version.satisfied_by? Gem.ruby_version then
14
+ abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
15
+ end
16
+
17
+ args = ARGV.clone
18
+
19
+ begin
20
+ Gem::GemRunner.new.run args
21
+ rescue Gem::SystemExitException => e
22
+ exit e.exit_code
23
+ end
data/javagems.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{javagems}
8
- s.version = "0.1.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["ggironda", "jaknowlden"]
12
- s.date = %q{2009-11-11}
11
+ s.authors = ["gabrielg", "jaknowlden"]
12
+ s.date = %q{2009-11-14}
13
13
  s.description = %q{Provides gem-esque support to Java}
14
14
  s.email = %q{gabriel.gironda@gmail.com}
15
15
  s.executables = ["javagem", "javagem"]
@@ -28,9 +28,14 @@ Gem::Specification.new do |s|
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "bin/javagem",
31
- "jar/.gitignore",
32
- "jar/javagems.jar",
33
- "lib/javagems.rb"
31
+ "javagems.gemspec",
32
+ "lib/javagems.rb",
33
+ "lib/javagems/commands/javagem_command.rb",
34
+ "lib/javagems/gem_overrides.rb",
35
+ "lib/rubygems/commands/jeweler_command.rb",
36
+ "test/gem_overrides_test.rb",
37
+ "test/jeweler_command_test.rb",
38
+ "test/test_helper.rb"
34
39
  ]
35
40
  s.homepage = %q{http://www.javagems.org/}
36
41
  s.rdoc_options = ["--charset=UTF-8"]
@@ -43,9 +48,18 @@ Gem::Specification.new do |s|
43
48
  s.specification_version = 3
44
49
 
45
50
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ s.add_runtime_dependency(%q<gemcutter>, [">= 0"])
52
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
53
+ s.add_development_dependency(%q<riot>, [">= 0"])
46
54
  else
55
+ s.add_dependency(%q<gemcutter>, [">= 0"])
56
+ s.add_dependency(%q<jeweler>, [">= 0"])
57
+ s.add_dependency(%q<riot>, [">= 0"])
47
58
  end
48
59
  else
60
+ s.add_dependency(%q<gemcutter>, [">= 0"])
61
+ s.add_dependency(%q<jeweler>, [">= 0"])
62
+ s.add_dependency(%q<riot>, [">= 0"])
49
63
  end
50
64
  end
51
65
 
@@ -0,0 +1,2 @@
1
+ ENV['GEMCUTTER_URL'] = ENV['JAVAGEMS_URL'] || "https://gems.javagems.org/"
2
+ require 'javagems/gem_overrides'
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'rubygems/gem_runner'
3
+ require 'rubygems/exceptions'
4
+
5
+ module Gem
6
+ DefaultGemConfigName = ".javagemrc"
7
+
8
+ def self.config_file
9
+ File.join Gem.user_home, DefaultGemConfigName
10
+ end
11
+
12
+ ConfigFile::PLATFORM_DEFAULTS.merge!(
13
+ "install" => "--no-env-shebang --no-wrappers",
14
+ "update" => "--no-env-shebang --no-wrappers",
15
+ :sources => %w[http://gems.javagems.org/],
16
+ :gemhome => File.join(Gem.user_home, ".javagem/java"),
17
+ :gempath => [File.join(Gem.user_home, ".javagem/java")]
18
+ )
19
+
20
+ end
21
+
22
+ class Gem::AbstractCommand < Gem::Command
23
+ remove_const :URL
24
+ URL = "http://javagems.org"
25
+
26
+ # FIXME - remove the check for this constant if my patches get
27
+ # pulled into the gemcutter gem.
28
+ if defined?(DESTINATION_NAME)
29
+ remove_const :DESTINATION_NAME
30
+ DESTINATION_NAME = "JavaGems"
31
+ end
32
+
33
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems/command'
2
+ require 'jeweler/generator'
3
+
4
+ class Gem::Commands::JewelerCommand < Gem::Command
5
+ def initialize
6
+ super 'jeweler', "Generates a shiny new gem for you using Jeweler"
7
+ end
8
+
9
+ def usage
10
+ Jeweler::Generator::Options.new([]).opts.to_s
11
+ end
12
+
13
+ def execute
14
+ Jeweler::Generator::Application.run!(*options[:args])
15
+ end
16
+
17
+ end
@@ -0,0 +1,69 @@
1
+ require 'test_helper'
2
+
3
+ # We fork here so we don't mess up the current Gem environment
4
+ # in the process of running our tests, because that's what
5
+ # the gem_overrides do.
6
+ pid = fork do
7
+ require 'javagems/gem_overrides'
8
+ require 'pathname'
9
+
10
+ context "the given gem overrides" do
11
+
12
+ setup do
13
+ # FIXME - we unset the @configuration variable so
14
+ # RubyGems re-reads its configuration. It's kind
15
+ # of a seedy hack.
16
+ Gem.instance_variable_set('@configuration', nil)
17
+ end
18
+
19
+ should "change the config file name to be named .javagemrc" do
20
+ File.basename Gem.configuration.config_file_name
21
+ end.equals(".javagemrc")
22
+
23
+ should "place the config file in the gem user_home" do
24
+ File.dirname Gem.configuration.config_file_name
25
+ end.equals(Gem.user_home)
26
+
27
+ should "set the gemhome to be at .javagem/java in the gem user_home" do
28
+ Pathname(Gem.configuration.home).relative_path_from(Pathname(Gem.user_home)).to_s
29
+ end.equals(".javagem/java")
30
+
31
+ should "only have one entry in the gem path" do
32
+ Gem.configuration.path.size
33
+ end.equals(1)
34
+
35
+ should "set the gempath to be at .javagem/java in the gem user_home" do
36
+ Pathname(Gem.configuration.path.first).relative_path_from(Pathname(Gem.user_home)).to_s
37
+ end.equals(".javagem/java")
38
+
39
+ should "only have one entry in the default sources" do
40
+ Gem.sources.size
41
+ end.equals(1)
42
+
43
+ should "set the default sources to be gems.javagems.org" do
44
+ Gem.sources.first
45
+ end.equals("http://gems.javagems.org/")
46
+
47
+ should "default to using no-env-shebang on install" do
48
+ Gem.configuration["install"]
49
+ end.matches("--no-env-shebang")
50
+
51
+ should "default to using no-wrappers on install" do
52
+ Gem.configuration["install"]
53
+ end.matches("--no-wrappers")
54
+
55
+ should "default to using no-env-shebang on update" do
56
+ Gem.configuration["update"]
57
+ end.matches("--no-env-shebang")
58
+
59
+ should "default to using no-wrappers on update" do
60
+ Gem.configuration["update"]
61
+ end.matches("--no-wrappers")
62
+
63
+ should "override the url gemcutter sets to be javagems.org" do
64
+ Gem::AbstractCommand::URL
65
+ end.equals("http://javagems.org")
66
+
67
+ end
68
+ end
69
+ Process.waitpid(pid)
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+ require 'rubygems/commands/jeweler_command'
3
+ require 'stringio'
4
+
5
+ context "the jeweler command" do
6
+ setup do
7
+ @command = Gem::Commands::JewelerCommand.new
8
+ end
9
+
10
+ should "return jeweler's usage information when asked for usage" do
11
+ @command.usage
12
+ end.equals(Jeweler::Generator::Options.new([]).opts.to_s)
13
+
14
+ should "invoke jeweler when invoked" do
15
+ begin
16
+ real_stderr, $stderr = $stderr, StringIO.new
17
+ @command.execute
18
+ ensure
19
+ $stderr = real_stderr
20
+ end
21
+ end.equals(1)
22
+
23
+ end
24
+
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'riot'
3
+ require 'pathname'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,19 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: javagems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - ggironda
7
+ - gabrielg
8
8
  - jaknowlden
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-13 00:00:00 -06:00
13
+ date: 2009-11-14 00:00:00 -06:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: gemcutter
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: jeweler
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: riot
38
+ type: :development
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
17
46
  description: Provides gem-esque support to Java
18
47
  email: gabriel.gironda@gmail.com
19
48
  executables:
@@ -32,10 +61,14 @@ files:
32
61
  - Rakefile
33
62
  - VERSION
34
63
  - bin/javagem
35
- - jar/.gitignore
36
- - jar/javagems.jar
37
64
  - javagems.gemspec
38
65
  - lib/javagems.rb
66
+ - lib/javagems/commands/javagem_command.rb
67
+ - lib/javagems/gem_overrides.rb
68
+ - lib/rubygems/commands/jeweler_command.rb
69
+ - test/gem_overrides_test.rb
70
+ - test/jeweler_command_test.rb
71
+ - test/test_helper.rb
39
72
  has_rdoc: true
40
73
  homepage: http://www.javagems.org/
41
74
  licenses: []
data/jar/.gitignore DELETED
@@ -1 +0,0 @@
1
- *.jar
data/jar/javagems.jar DELETED
Binary file