jbundler 0.3.2 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,4 @@
1
1
  source :rubygems
2
2
  gemspec
3
3
 
4
- # needed for local setup
5
- #gem 'maven-tools', :path => '../jruby-maven-plugins/ruby-tools/src/main/gem/maven-tools'
6
-
7
- group :test do
8
- gem 'minitest', '~> 2.10.0'
9
- gem 'cucumber', '~> 1.1.9'
10
- end
4
+ gem 'jruby-openssl', '0.8.2', :platform => 'jruby'
data/Gemfile.lock CHANGED
@@ -1,42 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jbundler (0.3.2)
5
- ruby-maven (= 3.0.4.1)
4
+ jbundler (0.4.1)
5
+ maven-tools (~> 0.32.1)
6
+ ruby-maven (~> 3.0.4)
6
7
 
7
8
  GEM
8
9
  remote: http://rubygems.org/
9
10
  specs:
10
- builder (3.0.0)
11
+ bouncy-castle-java (1.5.0146.1)
12
+ builder (3.1.4)
13
+ copyright-header (1.0.7)
11
14
  cucumber (1.1.9)
12
15
  builder (>= 2.1.2)
13
16
  diff-lcs (>= 1.1.2)
14
17
  gherkin (~> 2.9.0)
15
18
  json (>= 1.4.6)
16
19
  term-ansicolor (>= 1.0.6)
17
- diff-lcs (1.1.3)
18
- gherkin (2.9.3)
19
- json (>= 1.4.6)
20
+ diff-lcs (1.2.0)
20
21
  gherkin (2.9.3-java)
21
22
  json (>= 1.4.6)
22
- json (1.7.5)
23
- json (1.7.5-java)
24
- maven-tools (0.29.3)
25
- minitest (2.10.1)
26
- rake (0.9.2.2)
27
- ruby-maven (3.0.4.1)
28
- maven-tools (~> 0.29.1)
23
+ jruby-openssl (0.8.2)
24
+ bouncy-castle-java (>= 1.5.0146.1)
25
+ json (1.7.6-java)
26
+ maven-tools (0.32.1)
27
+ minitest (4.5.0)
28
+ rake (10.0.3)
29
+ ruby-maven (3.0.4.1.3)
30
+ maven-tools (~> 0.32.1)
29
31
  thor (>= 0.14.6, < 2.0)
30
32
  term-ansicolor (1.0.7)
31
33
  thor (0.15.4)
32
34
 
33
35
  PLATFORMS
34
36
  java
35
- ruby
36
37
 
37
38
  DEPENDENCIES
39
+ copyright-header (~> 1.0.7)
38
40
  cucumber (~> 1.1.9)
39
41
  jbundler!
40
- minitest (~> 2.10.0)
41
- rake (= 0.9.2.2)
42
+ jruby-openssl (= 0.8.2)
43
+ minitest (~> 4.3)
44
+ rake (~> 10.0.3)
42
45
  thor (> 0.14.0, < 0.16.0)
data/Gemfile.lock~ ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jbundler (0.3.2)
5
+ ruby-maven (= 3.0.4.1)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ builder (3.0.0)
11
+ cucumber (1.1.9)
12
+ builder (>= 2.1.2)
13
+ diff-lcs (>= 1.1.2)
14
+ gherkin (~> 2.9.0)
15
+ json (>= 1.4.6)
16
+ term-ansicolor (>= 1.0.6)
17
+ diff-lcs (1.1.3)
18
+ gherkin (2.9.3)
19
+ json (>= 1.4.6)
20
+ gherkin (2.9.3-java)
21
+ json (>= 1.4.6)
22
+ json (1.7.5)
23
+ json (1.7.5-java)
24
+ maven-tools (0.29.3)
25
+ minitest (2.10.1)
26
+ rake (0.9.2.2)
27
+ ruby-maven (3.0.4.1)
28
+ maven-tools (~> 0.29.1)
29
+ thor (>= 0.14.6, < 2.0)
30
+ term-ansicolor (1.0.7)
31
+ thor (0.15.4)
32
+
33
+ PLATFORMS
34
+ java
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ cucumber (~> 1.1.9)
39
+ jbundler!
40
+ minitest (~> 2.10.0)
41
+ rake (= 0.9.2.2)
42
+ thor (> 0.14.0, < 0.16.0)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Kristian Meier
1
+ Copyright (c) 2013 Christian Meier
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Readme.md CHANGED
@@ -1,4 +1,6 @@
1
- # jbundler [![Build Status](https://secure.travis-ci.org/mkristian/jbundler.png)](http://travis-ci.org/mkristian/jbundler) #
1
+ # jbundler
2
+
3
+ * [![Build Status](https://secure.travis-ci.org/mkristian/jbundler.png)](http://travis-ci.org/mkristian/jbundler) #
2
4
 
3
5
  manage jar dependencies similar than **bundler** manages gem dependencies.
4
6
 
@@ -77,8 +79,6 @@ will offer the same `jar`/`jars` method than you have inside the console.
77
79
 
78
80
  ## example ##
79
81
 
80
- **please first build the jar file for the jbundler gem, see [Build](https://github.com/mkristian/jbundler/wiki/Build).**
81
-
82
82
  *src/example/my_project* has a Gemfile which uses a gem which depends on jar dependency. see *src/example/gem_with_jar/gem_with_jar.gemspec* how the jar gets declared.
83
83
 
84
84
  execute *src/example/my_project/info.rb* to see it in action:
@@ -103,6 +103,25 @@ update of a single artifact is not possible (yet). but to update the whole set o
103
103
 
104
104
  if jbundler sees that **Gemfile.lock** or **Jarfile** is newer then the **.jbundler/classpath.rb** file then jbundler tries to gracefully upgrade towards the changes.
105
105
 
106
- ## meta-fu ##
106
+ # special thanks #
107
+
108
+ the whole project actually started with a controversial discussion on a [pull request on bundler](https://github.com/carlhuda/bundler/pull/1683). this very same pull request were the starting point of that project here. probably by now there is no much left of the original code but many thanks to [ANithian](https://github.com/ANithian) for given the seed of that project.
109
+
110
+ License
111
+ -------
112
+
113
+ Almost all code is under the MIT license but the java class (AetherSettings.java)[https://github.com/mkristian/jbundler/blob/master/src/main/java/jbundler/AetherSettings.java] which was derived from EPL licensed code.
114
+
115
+ Contributing
116
+ ------------
117
+
118
+ 1. Fork it
119
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
120
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
121
+ 4. Push to the branch (`git push origin my-new-feature`)
122
+ 5. Create new Pull Request
123
+
124
+ meta-fu
125
+ -------
107
126
 
108
- bug-reports and pull request are most welcome.
127
+ enjoy :)
data/bin/jbundle CHANGED
@@ -17,8 +17,35 @@ else
17
17
  include JBundler::Lazy
18
18
  end
19
19
 
20
+ require 'jbundler/config'
21
+ config = JBundler::Config.new
20
22
  begin
21
- load Gem.bin_path('bundler', 'bundle')
23
+ require 'yaml'
24
+ bundle_config = YAML.load_file( File.join( ENV['HOME'],
25
+ '.bundle',
26
+ 'config' ) )
27
+ mirrors = bundle_config.select { |k,v| nil != (k =~ /BUNDLE_MIRROR__/) }
28
+ if config.rubygems_mirror || mirrors.size > 0
29
+ mirrors.each do |k,v|
30
+ ENV[ k ] = v
31
+ end
32
+ if config.rubygems_mirror
33
+ ENV['BUNDLE_MIRROR__HTTP://RUBYGEMS.ORG'] = config.rubygems_mirror
34
+ ENV['BUNDLE_MIRROR__HTTPS://RUBYGEMS.ORG'] = config.rubygems_mirror
35
+ end
36
+
37
+ begin
38
+ load Gem.bin_path('nexus', 'nbundle')
39
+ rescue Gem::GemNotFoundException
40
+ warn ''
41
+ warn 'to use a rubygems mirror you need to install the nexus gem'
42
+ warn ' $ gem install nexus'
43
+ warn ''
44
+ warn 'rubygems mirror ignored !'
45
+ end
46
+ else
47
+ load Gem.bin_path('bundler', 'bundle')
48
+ end
22
49
  rescue Exception
23
50
  if ARGV[0] == 'console'
24
51
  ARGV.shift
@@ -1,67 +1,28 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'yaml'
2
22
  require 'jbundler/config'
3
23
 
4
24
  module JBundler
5
25
 
6
- # allow yaml config in $HOME/.jbundlerrc and $PWD/.jbundlerrc
7
- class AetherConfig
8
-
9
- attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip
10
-
11
- def initialize
12
- file = '.jbundlerrc'
13
- homefile = File.join(ENV['HOME'], file)
14
- home_config = YAML.load_file(homefile) if File.exists?(homefile)
15
- pwd_config = YAML.load_file(file) if File.exists?(file)
16
- @config = (home_config || {}).merge(pwd_config || {})
17
- end
18
-
19
- if defined? JRUBY_VERSION
20
- def jbundler_env(key)
21
- ENV[key.upcase.gsub(/./, '_')] || java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || @config[key.downcase.sub(/^j?bundler/, '').sub(/./, '_')]
22
- end
23
- else
24
- def jbundler_env(key)
25
- ENV[key.upcase.gsub(/./, '_')] || @config[key.downcase.sub(/^j?bundler/, '').sub(/./, '_')]
26
- end
27
- end
28
- private :jbundler_env
29
-
30
- def skip
31
- skip = jbundler_env('JBUNDLE_SKIP')
32
- # defaults to false
33
- @skip ||= skip && skip != 'false'
34
- end
35
-
36
- def verbose
37
- verbose = jbundler_env('JBUNDLE_VERBOSE')
38
- # defaults to false
39
- @verbose ||= verbose && verbose != 'false'
40
- end
41
-
42
- def jarfile
43
- if File.exists?('Mvnfile')
44
- warn "'Mvnfile' name is deprecated, please use 'Jarfile' instead"
45
- @jarfile = 'Mvnfile'
46
- end
47
- @jarfile ||= jbundler_env('JBUNDLE_JARFILE') || 'Jarfile'
48
- end
49
-
50
- def gemfile
51
- @gemfile ||= jbundler_env('BUNDLE_GEMFILE') || 'Gemfile'
52
- end
53
-
54
- def classpath_file
55
- '.jbundler/classpath.rb'
56
- end
57
-
58
- def local_repository
59
- # use maven default local repo as default
60
- @local_maven_repository ||= (jbundler_env('JBUNDLE_LOCAL_REPOSITORY') ||
61
- File.join( ENV['HOME'], ".m2", "repository"))
62
- end
63
- end
64
-
65
26
  class AetherRuby
66
27
 
67
28
  def self.setup_classloader
@@ -79,17 +40,25 @@ module JBundler
79
40
  java_import 'jbundler.Aether'
80
41
  rescue NameError
81
42
  # assume this happens only when working on the git clone
82
- raise "jbundler.jar is missing - maybe you need to build it first ? try\n$ rmvn prepare-package -Dmaven.test.skip\n"
43
+ raise "jbundler.jar is missing - maybe you need to build it first ? use\n$ rmvn prepare-package -Dmaven.test.skip\n"
83
44
  end
84
45
  end
85
46
  java_import 'jbundler.Aether'
86
47
  end
87
48
 
88
- def initialize(config = Config.new, offline = false)
49
+ def initialize( config = Config.new )
89
50
  unless defined? Aether
90
51
  self.class.setup_classloader
91
52
  end
92
- @aether = Aether.new(config.local_repository, config.verbose, offline)
53
+ @aether = Aether.new( config.verbose )
54
+ @aether.add_proxy( config.proxy ) if config.proxy
55
+ @aether.add_mirror( config.mirror ) if config.mirror
56
+ @aether.offline = config.offline
57
+ @aether.user_settings = config.settings if config.settings
58
+ @aether.local_repository = config.local_repository if config.local_repository
59
+ rescue NativeException => e
60
+ e.cause.print_stack_trace
61
+ raise e
93
62
  end
94
63
 
95
64
  def add_artifact(coordinate, extension = nil)
@@ -108,6 +77,9 @@ module JBundler
108
77
 
109
78
  def resolve
110
79
  @aether.resolve unless artifacts.empty?
80
+ rescue NativeException => e
81
+ e.cause.print_stack_trace
82
+ raise e
111
83
  end
112
84
 
113
85
  def classpath
@@ -140,7 +112,10 @@ module JBundler
140
112
 
141
113
  def install(coordinate, file)
142
114
  @aether.install(coordinate, file)
115
+ rescue NativeException => e
116
+ e.cause.print_stack_trace
117
+ raise e
143
118
  end
144
119
 
145
120
  end
146
- end
121
+ end
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  module JBundler
2
22
 
3
23
  class ClasspathFile
@@ -19,7 +39,7 @@ module JBundler
19
39
  end
20
40
 
21
41
  def needs_update?(jarfile, gemfile_lock)
22
- (jarfile.exists? || gemfile_lock.exists?) && (!exists? || !jarfile.exists_lock? || (jarfile.exists? && (jarfile.mtime > mtime)) || (jarfile.exists_lock? && (jarfile.mtime_lock > mtime)) || (gemfile_lock.exists? && (gemfile_lock.mtime > mtime)))
42
+ (jarfile.exists? || gemfile_lock.exists? || jarfile.exists_lock?) && (!exists? || !jarfile.exists_lock? || (jarfile.exists? && (jarfile.mtime > mtime)) || (jarfile.exists_lock? && (jarfile.mtime_lock > mtime)) || (gemfile_lock.exists? && (gemfile_lock.mtime > mtime)))
23
43
  end
24
44
 
25
45
  def generate(classpath_array)
@@ -36,4 +56,4 @@ module JBundler
36
56
  end
37
57
 
38
58
  end
39
- end
59
+ end
data/lib/jbundler/cli.rb CHANGED
@@ -1,9 +1,29 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'thor'
2
22
  module JBundler
3
23
  class Cli < Thor
4
24
  no_tasks do
5
25
  def mvn
6
- @mvn ||= Maven::RubyMaven.new
26
+ @mvn ||= Maven::Ruby::Maven.new
7
27
  end
8
28
 
9
29
  def do_show
@@ -13,7 +33,7 @@ module JBundler
13
33
  config = JBundler::Config.new
14
34
  classpath_file = JBundler::ClasspathFile.new(config.classpath_file)
15
35
  if classpath_file.exists?
16
- classpath_file.require_classpath
36
+ classpath_file.require_classpath unless defined? JBUNDLER_CLASSPATH
17
37
  puts "JBundler classpath:"
18
38
  JBUNDLER_CLASSPATH.each do |path|
19
39
  puts " * #{path}"
@@ -46,6 +66,7 @@ module JBundler
46
66
 
47
67
  require 'jbundler'
48
68
  do_show
69
+ puts ''
49
70
  puts 'Your jbundle is updated! Use `jbundle show` to see where the bundled jars are installed.'
50
71
  end
51
72
  end
@@ -57,4 +78,4 @@ module JBundler
57
78
  end
58
79
  end
59
80
  end
60
- end
81
+ end
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'yaml'
2
22
 
3
23
  module JBundler
@@ -5,7 +25,7 @@ module JBundler
5
25
  # allow yaml config in $HOME/.jbundlerrc and $PWD/.jbundlerrc
6
26
  class Config
7
27
 
8
- attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip
28
+ attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip, :settings, :offline
9
29
 
10
30
  def initialize
11
31
  file = '.jbundlerrc'
@@ -17,11 +37,11 @@ module JBundler
17
37
 
18
38
  if defined? JRUBY_VERSION
19
39
  def jbundler_env(key)
20
- ENV[key.upcase.gsub(/./, '_')] || java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || @config[key.downcase.sub(/^j?bundler/, '').sub(/./, '_')]
40
+ ENV[key.upcase.gsub(/[.]/, '_')] || java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')]
21
41
  end
22
42
  else
23
43
  def jbundler_env(key)
24
- ENV[key.upcase.gsub(/./, '_')] || @config[key.downcase.sub(/^j?bundler/, '').sub(/./, '_')]
44
+ ENV[key.upcase.gsub(/[.]/, '_')] || @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')]
25
45
  end
26
46
  end
27
47
  private :jbundler_env
@@ -64,8 +84,34 @@ module JBundler
64
84
 
65
85
  def local_repository
66
86
  # use maven default local repo as default
67
- @local_maven_repository ||= (jbundler_env('JBUNDLE_LOCAL_REPOSITORY') ||
68
- File.join( ENV['HOME'], ".m2", "repository"))
87
+ @local_maven_repository ||= jbundler_env('JBUNDLE_LOCAL_REPOSITORY')
88
+ end
89
+
90
+ def settings
91
+ @settings ||= jbundler_env('JBUNDLE_SETTINGS')
92
+ end
93
+
94
+ def offline
95
+ @offline ||= jbundler_env('JBUNDLE_OFFLINE')
96
+ @offline == 'true' || @offline == true
97
+ end
98
+
99
+ def proxy
100
+ @proxy ||= jbundler_env('JBUNDLE_PROXY')
101
+ end
102
+
103
+ def mirror
104
+ @mirror ||= jbundler_env('JBUNDLE_MIRROR')
105
+ # nce to have no leading slash
106
+ @mirror.sub!( /\/$/, '' ) if @mirror
107
+ @mirror
108
+ end
109
+
110
+ def rubygems_mirror
111
+ @rubygems_mirror ||= jbundler_env('BUNDLE_RUBYGEMS_MIRROR')
112
+ # here a leading slash is needed !!
113
+ @rubygems_mirror.sub!( /([^\/])$/ , "\\1/" ) if @rubygems_mirror
114
+ @rubygems_mirror
69
115
  end
70
116
  end
71
- end
117
+ end
@@ -1,5 +1,26 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'rubygems'
2
22
  require 'jbundler/pom'
23
+ require 'bundler'
3
24
 
4
25
  module JBundler
5
26
 
@@ -41,4 +62,4 @@ module JBundler
41
62
  end
42
63
  end
43
64
 
44
- end
65
+ end
data/lib/jbundler/lazy.rb CHANGED
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'jbundler/aether'
2
22
  require 'maven/tools/coordinate'
3
23
  module JBundler
@@ -79,4 +99,4 @@ module JBundler
79
99
  end
80
100
  end
81
101
  end
82
- end
102
+ end
data/lib/jbundler/pom.rb CHANGED
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'fileutils'
2
22
  require 'tempfile'
3
23
  require 'maven/tools/coordinate'
@@ -73,7 +93,17 @@ module JBundler
73
93
 
74
94
  deps.each do |line|
75
95
  if coord = to_coordinate(line)
76
- group_id, artifact_id, extension, version = coord.split(/:/)
96
+ coords = coord.split(/:/)
97
+ group_id = coords[0]
98
+ artifact_id = coords[1]
99
+ extension = coords[2]
100
+ classifier = nil
101
+ if coords.size == 4
102
+ version = coords[3]
103
+ else
104
+ classifier = coords[3]
105
+ version = coords[4]
106
+ end
77
107
 
78
108
  xmlStreamWriter.writeStartElement("dependency".to_java)
79
109
  writeElement(xmlStreamWriter,"groupId", group_id)
@@ -81,6 +111,7 @@ module JBundler
81
111
  writeElement(xmlStreamWriter,"version", version)
82
112
 
83
113
  writeElement(xmlStreamWriter,"type", extension) if extension != 'jar'
114
+ writeElement(xmlStreamWriter,"classifier", classifier) if classifier
84
115
  xmlStreamWriter.writeEndElement #dependency
85
116
  end
86
117
  end
@@ -94,4 +125,4 @@ module JBundler
94
125
  end
95
126
 
96
127
  end
97
- end
128
+ end
data/lib/jbundler.jar CHANGED
Binary file
data/lib/jbundler.rb CHANGED
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013 Kristian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
1
21
  require 'maven/tools/jarfile'
2
22
  require 'jbundler/classpath_file'
3
23
  require 'jbundler/gemfile_lock'
@@ -36,4 +56,4 @@ else
36
56
  end
37
57
  end
38
58
 
39
- end
59
+ end
data/spec/pom_spec.rb CHANGED
@@ -22,4 +22,10 @@ describe JBundler::Pom do
22
22
  pom.coordinate.must_equal "ruby.bundler:second:jar:1"
23
23
  end
24
24
 
25
+ it 'should respect classifiers' do
26
+ pom = JBundler::Pom.new("third", "1", ["jar \"org.jruby:jruby-core\", '~>1.7.0'", "pom \"f:g:jdk15\", \">1.2\", \"<=2.0\""])
27
+ File.read(pom.file).must_equal "<?xml version=\"1.0\" ?><project><modelVersion>4.0.0</modelVersion><groupId>ruby.bundler</groupId><artifactId>third</artifactId><version>1</version><dependencies><dependency><groupId>org.jruby</groupId><artifactId>jruby-core</artifactId><version>[1.7.0,1.7.99999]</version></dependency><dependency><groupId>f</groupId><artifactId>g</artifactId><version>(1.2,2.0]</version><type>pom</type><classifier>jdk15</classifier></dependency></dependencies></project>"
28
+ pom.coordinate.must_equal "ruby.bundler:third:jar:1"
29
+ end
30
+
25
31
  end
metadata CHANGED
@@ -1,117 +1,194 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jbundler
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.3.2
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.1
6
6
  platform: ruby
7
- authors:
8
- - Kristian Meier
9
- autorequire:
7
+ authors:
8
+ - Kristian Meier
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-10-11 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: ruby-maven
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 3.0.4.1
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
34
- version: 0.9.2.2
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: thor
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - <
44
- - !ruby/object:Gem::Version
45
- version: 0.16.0
46
- - - ">"
47
- - !ruby/object:Gem::Version
48
- version: 0.14.0
49
- type: :development
50
- version_requirements: *id003
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ruby-maven
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 3.0.4
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.4
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ name: maven-tools
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: 0.32.1
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.32.1
43
+ none: false
44
+ prerelease: false
45
+ type: :runtime
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: 10.0.3
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: 10.0.3
59
+ none: false
60
+ prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ name: thor
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - !binary |-
67
+ PA==
68
+ - !ruby/object:Gem::Version
69
+ version: 0.16.0
70
+ - - !binary |-
71
+ Pg==
72
+ - !ruby/object:Gem::Version
73
+ version: 0.14.0
74
+ none: false
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - !binary |-
78
+ PA==
79
+ - !ruby/object:Gem::Version
80
+ version: 0.16.0
81
+ - - !binary |-
82
+ Pg==
83
+ - !ruby/object:Gem::Version
84
+ version: 0.14.0
85
+ none: false
86
+ prerelease: false
87
+ type: :development
88
+ - !ruby/object:Gem::Dependency
89
+ name: cucumber
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 1.1.9
95
+ none: false
96
+ requirement: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: 1.1.9
101
+ none: false
102
+ prerelease: false
103
+ type: :development
104
+ - !ruby/object:Gem::Dependency
105
+ name: minitest
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.3'
111
+ none: false
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '4.3'
117
+ none: false
118
+ prerelease: false
119
+ type: :development
120
+ - !ruby/object:Gem::Dependency
121
+ name: copyright-header
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 1.0.7
127
+ none: false
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: 1.0.7
133
+ none: false
134
+ prerelease: false
135
+ type: :development
51
136
  description: |
52
137
  managing jar dependencies with or without bundler. adding bundler like handling of version ranges for jar dependencies.
53
-
54
- email:
55
- - m.kristian@web.de
56
- executables:
57
- - jbundle
138
+ email:
139
+ - m.kristian@web.de
140
+ executables:
141
+ - jbundle
58
142
  extensions: []
59
-
60
143
  extra_rdoc_files: []
61
-
62
- files:
63
- - bin/jbundle
64
- - lib/rubygems_plugin.rb~
65
- - lib/jbundler.rb
66
- - lib/jars.rb~
67
- - lib/jbundler.jar
68
- - lib/commands/install_with_jars.rb~
69
- - lib/commands/abstract_command.rb~
70
- - lib/commands/push.rb~
71
- - lib/commands/nexus.rb~
72
- - lib/jbundler/pom.rb
73
- - lib/jbundler/cli.rb
74
- - lib/jbundler/config.rb
75
- - lib/jbundler/classpath_file.rb
76
- - lib/jbundler/aether.rb
77
- - lib/jbundler/gemfile_lock.rb
78
- - lib/jbundler/lazy.rb
79
- - spec/classpath_file_spec.rb
80
- - spec/setup.rb
81
- - spec/pom_spec.rb
82
- - spec/aether_spec.rb
83
- - MIT-LICENSE
84
- - Readme.md
85
- - Gemfile
86
- - Gemfile.lock
144
+ files:
145
+ - bin/jbundle
146
+ - lib/jbundler.rb
147
+ - lib/jbundler.jar
148
+ - lib/jbundler/pom.rb
149
+ - lib/jbundler/cli.rb
150
+ - lib/jbundler/config.rb
151
+ - lib/jbundler/classpath_file.rb
152
+ - lib/jbundler/aether.rb
153
+ - lib/jbundler/gemfile_lock.rb
154
+ - lib/jbundler/lazy.rb
155
+ - spec/classpath_file_spec.rb
156
+ - spec/setup.rb
157
+ - spec/pom_spec.rb
158
+ - spec/aether_spec.rb
159
+ - MIT-LICENSE
160
+ - Readme.md
161
+ - Gemfile.lock~
162
+ - Gemfile
163
+ - Gemfile.lock
87
164
  homepage: https://github.com/mkristian/jbundler
88
- licenses: []
89
-
90
- post_install_message:
165
+ licenses:
166
+ - MIT
167
+ post_install_message:
91
168
  rdoc_options: []
92
-
93
- require_paths:
94
- - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: !binary |-
176
+ MA==
96
177
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: "0"
101
- required_rubygems_version: !ruby/object:Gem::Requirement
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: !binary |-
183
+ MA==
102
184
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: "0"
107
185
  requirements: []
108
-
109
- rubyforge_project:
186
+ rubyforge_project:
110
187
  rubygems_version: 1.8.24
111
- signing_key:
188
+ signing_key:
112
189
  specification_version: 3
113
190
  summary: managing jar dependencies
114
- test_files:
115
- - spec/classpath_file_spec.rb
116
- - spec/pom_spec.rb
117
- - spec/aether_spec.rb
191
+ test_files:
192
+ - spec/classpath_file_spec.rb
193
+ - spec/pom_spec.rb
194
+ - spec/aether_spec.rb
@@ -1,113 +0,0 @@
1
- require 'rubygems/local_remote_options'
2
-
3
- class Gem::AbstractCommand < Gem::Command
4
- include Gem::LocalRemoteOptions
5
-
6
- def gemcutter_url
7
- ENV['GEMCUTTER_URL'] || 'https://gemcutter.org'
8
- end
9
-
10
- def setup
11
- use_proxy! if http_proxy
12
- sign_in unless api_key
13
- end
14
-
15
- def sign_in
16
- say "Enter your Gemcutter credentials. Don't have an account yet? Create one at http://gemcutter.org/sign_up"
17
-
18
- email = ask("Email: ")
19
- password = ask_for_password("Password: ")
20
-
21
- response = make_request(:get, "api_key") do |request|
22
- request.basic_auth email, password
23
- end
24
-
25
- case response
26
- when Net::HTTPSuccess
27
- self.api_key = response.body
28
- say "Signed in. Your api key has been stored in ~/.gem/credentials"
29
- else
30
- say response.body
31
- terminate_interaction
32
- end
33
- end
34
-
35
- def credentials_path
36
- File.join(Gem.user_home, '.gem', 'credentials')
37
- end
38
-
39
- def api_key
40
- Gem.configuration.load_file(credentials_path)[:rubygems_api_key]
41
- end
42
-
43
- def api_key=(api_key)
44
- config = Gem.configuration.load_file(credentials_path).merge(:rubygems_api_key => api_key)
45
-
46
- dirname = File.dirname(credentials_path)
47
- Dir.mkdir(dirname) unless File.exists?(dirname)
48
-
49
- File.open(credentials_path, 'w') do |f|
50
- f.write config.to_yaml
51
- end
52
-
53
- @rubygems_api_key = api_key
54
- end
55
-
56
- def make_request(method, path)
57
- require 'net/http'
58
- require 'net/https'
59
-
60
- url = URI.parse("#{gemcutter_url}/api/v1/#{path}")
61
-
62
- http = proxy_class.new(url.host, url.port)
63
-
64
- if url.scheme == 'https'
65
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
66
- http.use_ssl = true
67
- end
68
-
69
- request_method =
70
- case method
71
- when :get
72
- proxy_class::Get
73
- when :post
74
- proxy_class::Post
75
- when :put
76
- proxy_class::Put
77
- when :delete
78
- proxy_class::Delete
79
- else
80
- raise ArgumentError
81
- end
82
-
83
- request = request_method.new(url.path)
84
- request.add_field "User-Agent", "Gemcutter/0.2.0"
85
-
86
- yield request if block_given?
87
- http.request(request)
88
- end
89
-
90
- def use_proxy!
91
- proxy_uri = http_proxy
92
- @proxy_class = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
93
- end
94
-
95
- def proxy_class
96
- @proxy_class || Net::HTTP
97
- end
98
-
99
- # @return [URI, nil] the HTTP-proxy as a URI if set; +nil+ otherwise
100
- def http_proxy
101
- proxy = Gem.configuration[:http_proxy] || ENV['http_proxy'] || ENV['HTTP_PROXY']
102
- return nil if proxy.nil? || proxy == :no_proxy
103
- URI.parse(proxy)
104
- end
105
-
106
- def ask_for_password(message)
107
- system "stty -echo"
108
- password = ask(message)
109
- system "stty echo"
110
- ui.say("\n")
111
- password
112
- end
113
- end
@@ -1,22 +0,0 @@
1
- require 'rubygems/commands/install_command'
2
- class Gem::Commands::InstallCommand
3
-
4
- unless respond_to? :execute_without_jars
5
- alias :execute_without_jars :execute
6
- def execute
7
- begin
8
- execute_without_jars
9
- rescue Gem::SystemExitException => e
10
- if e.exit_code == 0
11
- puts "DO SOMETHING HERE WITH JARS"
12
- end
13
- raise e
14
- end
15
- end
16
- alias :_s_a_y_ :say
17
- def say( arg )
18
- puts arg.sub( /.*\ /, '')
19
- _s_a_y_( arg )
20
- end
21
- end
22
- end
@@ -1,38 +0,0 @@
1
- class Gem::Commands::PushCommand < Gem::AbstractCommand
2
-
3
- def description
4
- 'Push a gem up to Nexus server'
5
- end
6
-
7
- def arguments
8
- "GEM built gem to push up"
9
- end
10
-
11
- def usage
12
- "#{program_name} GEM"
13
- end
14
-
15
- def initialize
16
- super 'push', description
17
- add_proxy_option
18
- end
19
-
20
- def execute
21
- setup
22
- send_gem
23
- end
24
-
25
- def send_gem
26
- say "Pushing gem to Nexus..."
27
-
28
- path = get_one_gem_name
29
- response = make_request(:post, "gems") do |request|
30
- request.body = Gem.read_binary(path)
31
- request.add_field("Content-Length", request.body.size)
32
- request.add_field("Content-Type", "application/octet-stream")
33
- request.add_field("Authorization", api_key)
34
- end
35
-
36
- say response.body
37
- end
38
- end
@@ -1,38 +0,0 @@
1
- class Gem::Commands::PushCommand < Gem::AbstractCommand
2
-
3
- def description
4
- 'Push a gem up to Gemcutter'
5
- end
6
-
7
- def arguments
8
- "GEM built gem to push up"
9
- end
10
-
11
- def usage
12
- "#{program_name} GEM"
13
- end
14
-
15
- def initialize
16
- super 'push', description
17
- add_proxy_option
18
- end
19
-
20
- def execute
21
- setup
22
- send_gem
23
- end
24
-
25
- def send_gem
26
- say "Pushing gem to Gemcutter..."
27
-
28
- path = get_one_gem_name
29
- response = make_request(:post, "gems") do |request|
30
- request.body = Gem.read_binary(path)
31
- request.add_field("Content-Length", request.body.size)
32
- request.add_field("Content-Type", "application/octet-stream")
33
- request.add_field("Authorization", api_key)
34
- end
35
-
36
- say response.body
37
- end
38
- end
data/lib/jars.rb~ DELETED
@@ -1,3 +0,0 @@
1
- class Kernel
2
-
3
- end
@@ -1,6 +0,0 @@
1
- require 'rubygems/command_manager'
2
- require 'commands/abstract_command'
3
-
4
- require "commands/nexus"
5
- Gem::CommandManager.instance.register_command :nexus
6
-