gem-release 0.0.5 → 0.0.6

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/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://gemcutter.org'
2
+
3
+ group :test do
4
+ gem 'test_declarative'
5
+ gem 'mocha'
6
+ end
@@ -0,0 +1,23 @@
1
+ module GemRelease
2
+ module Helpers
3
+ def gem_filename
4
+ gemspec.file_name
5
+ end
6
+
7
+ def gem_version
8
+ gemspec.version.to_s
9
+ end
10
+
11
+ def gemspec
12
+ @gemspec ||= Gem::Specification.load(gemspec_filename)
13
+ end
14
+
15
+ def gemspec_filename
16
+ @gemspec_filename ||= begin
17
+ name = Array(options[:args]).first
18
+ name ||= Dir['*.gemspec'].first
19
+ name || raise("No gemspec found or given.")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module GemRelease
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -0,0 +1,46 @@
1
+ require 'rubygems/commands/build_command'
2
+ require 'rubygems/commands/push_command'
3
+ require 'rubygems/commands/tag_command'
4
+ require 'gem_release/helpers'
5
+
6
+ class Gem::Commands::ReleaseCommand < Gem::Command
7
+ include GemRelease::Helpers, Gem::Commands
8
+
9
+ attr_reader :arguments, :usage
10
+
11
+ def initialize
12
+ super('release', 'Build a gem from a gemspec and push to rubygems.org', :tag => false)
13
+ add_option('-t', '--tag', "Create a git tag and push --tags to origin. Defaults to #{options[:tag]}.") do |tag, options|
14
+ options[:tag] = tag
15
+ end
16
+ @arguments = "gemspec - optional gemspec file, will use the first *.gemspec if not specified"
17
+ @usage = "#{program_name} [gemspec]"
18
+ end
19
+
20
+ def execute
21
+ build
22
+ push
23
+ remove
24
+ tag if options[:tag]
25
+ say "All done, thanks buddy.\n"
26
+ end
27
+
28
+ protected
29
+
30
+ def build
31
+ BuildCommand.new.invoke(gemspec_filename)
32
+ end
33
+
34
+ def push
35
+ PushCommand.new.invoke(gem_filename)
36
+ end
37
+
38
+ def remove
39
+ `rm #{gem_filename}`
40
+ say "Deleting left over gem file #{gem_filename}"
41
+ end
42
+
43
+ def tag
44
+ TagCommand.new.invoke
45
+ end
46
+ end
@@ -0,0 +1,35 @@
1
+ require 'gem_release/helpers'
2
+
3
+ class Gem::Commands::TagCommand < Gem::Command
4
+ include GemRelease::Helpers
5
+
6
+ attr_reader :arguments, :usage
7
+
8
+ def initialize
9
+ super 'tag', 'Create a git tag and push --tags to origin'
10
+ @arguments = ''
11
+ @usage = "#{program_name}"
12
+ end
13
+
14
+ def execute
15
+ p "KEKSE!"
16
+ # tag
17
+ # push
18
+ end
19
+
20
+ protected
21
+
22
+ def tag
23
+ say "Creating git tag #{tag_name}"
24
+ `git tag -am 'tag #{tag_name}' #{tag_name}`
25
+ end
26
+
27
+ def push
28
+ say "Pushing --tags to origin git repository"
29
+ `git push --tags origin`
30
+ end
31
+
32
+ def tag_name
33
+ "v#{gem_version}"
34
+ end
35
+ end
@@ -1,52 +1,4 @@
1
1
  require 'rubygems/command_manager'
2
- require 'rubygems/commands/build_command'
3
- require 'rubygems/commands/push_command'
4
2
 
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
11
- "GEMSPEC_FILE optional (will use the first *.gemspec if not specified)"
12
- end
13
-
14
- def usage
15
- "#{program_name} [GEMSPEC_FILE]"
16
- end
17
-
18
- def execute
19
- filename = build
20
- push(filename)
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 #{filename}`
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
51
-
52
- Gem::CommandManager.instance.register_command :release
3
+ Gem::CommandManager.instance.register_command :release
4
+ Gem::CommandManager.instance.register_command :tag
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sven Fuchs
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-03 00:00:00 +02:00
17
+ date: 2010-04-04 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -27,8 +27,12 @@ extensions: []
27
27
  extra_rdoc_files: []
28
28
 
29
29
  files:
30
+ - lib/gem_release/helpers.rb
30
31
  - lib/gem_release/version.rb
32
+ - lib/rubygems/commands/release_command.rb
33
+ - lib/rubygems/commands/tag_command.rb
31
34
  - lib/rubygems_plugin.rb
35
+ - Gemfile
32
36
  - README.textile
33
37
  has_rdoc: true
34
38
  homepage: http://github.com/svenfuchs/gem-release