gem-release 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ h1. gem release
2
+
3
+ This gem plugin adds a `release` command to the rubygems `gem` command which
4
+
5
+ * builds
@@ -1,3 +1,3 @@
1
1
  module GemRelease
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -1,3 +1,52 @@
1
1
  require 'rubygems/command_manager'
2
+ require 'rubygems/commands/build_command'
3
+ require 'rubygems/commands/push_command'
4
+
5
+ class Gem::Commands::ReleaseCommand < Gem::Command
6
+ def initialize
7
+ super 'release', 'Build a gem from a gemspec and push to rubygems.org'
8
+ end
9
+
10
+ def arguments # :nodoc:
11
+ "GEMSPEC_FILE optional (will use the first *.gemspec if not specified)"
12
+ end
13
+
14
+ def usage # :nodoc:
15
+ "#{program_name} [GEMSPEC_FILE]"
16
+ end
17
+
18
+ def execute
19
+ file_name = build
20
+ push(file_name)
21
+ remove(filename)
22
+ say "All done, thanks buddy."
23
+ end
24
+
25
+ def build
26
+ command = Gem::Commands::BuildCommand.new
27
+ command.handle_options([gemspec])
28
+ command.execute
29
+ command.load_gemspecs(gemspec).first.file_name
30
+ end
31
+
32
+ def push(filename)
33
+ command = Gem::Commands::PushCommand.new
34
+ command.handle_options([filename])
35
+ command.execute
36
+ end
37
+
38
+ def remove(filename)
39
+ `rm #{file_name}`
40
+ say "Deleting left over gem file #{filename}"
41
+ end
42
+
43
+ def gemspec
44
+ @gemspec ||= begin
45
+ gemspec = Array(options[:args]).first
46
+ gemspec ||= Dir['*.gemspec'].first
47
+ gemspec || raise("No gemspec found or given.")
48
+ end
49
+ end
50
+ end
2
51
 
3
52
  Gem::CommandManager.instance.register_command :release
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sven Fuchs
@@ -18,7 +18,7 @@ date: 2010-04-03 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: Release your ruby gems with ease.
21
+ description: Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)
22
22
  email: svenfuchs@artweb-design.de
23
23
  executables: []
24
24
 
@@ -28,8 +28,8 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - lib/gem_release/version.rb
31
- - lib/rubygems/commands/gem_release.rb
32
31
  - lib/rubygems_plugin.rb
32
+ - README.textile
33
33
  has_rdoc: true
34
34
  homepage: http://github.com/svenfuchs/gem-release
35
35
  licenses: []
@@ -1,20 +0,0 @@
1
- class Gem::Commands::ReleaseCommand < Gem::Command
2
- def initialize
3
- super 'release', 'Build a gem from a gemspec and push to rubygems.org'
4
- end
5
-
6
- def arguments # :nodoc:
7
- "GEMSPEC_FILE optional (will use the first *.gemspec if not specified)"
8
- end
9
-
10
- def usage # :nodoc:
11
- "#{program_name} [GEMSPEC_FILE]"
12
- end
13
-
14
- def execute
15
- p args
16
- exit
17
- BuildCommand.new.execute
18
- PushCommand.new.execute
19
- end
20
- end