gem_publisher 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,12 +7,12 @@ module GemPublisher
7
7
  end
8
8
 
9
9
  PUSH_METHODS = {
10
- :rubygems => %w[gem push],
11
- :gemfury => %w[fury push]
10
+ "rubygems" => %w[gem push],
11
+ "gemfury" => %w[fury push]
12
12
  }
13
13
 
14
14
  def push(gem, method)
15
- push_command = PUSH_METHODS[method] or raise "Unknown Gem push method #{method.inspect}."
15
+ push_command = PUSH_METHODS[method.to_s] or raise "Unknown Gem push method #{method.inspect}."
16
16
  @cli_facade.execute *push_command + [gem]
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module GemPublisher
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,38 @@
1
+ require "rubygems/command_manager"
2
+ require "rubygems/command"
3
+ require "gem_publisher"
4
+
5
+ class Gem::Commands::PublishCommand < Gem::Command
6
+ def initialize
7
+ super "publish", "Automatically publish a gem if the version has been updated"
8
+
9
+ defaults.merge! :gem_repository => "rubygems"
10
+
11
+ add_option(
12
+ "-r", "--repository",
13
+ "Set the gem repository (rubygems or gemfury)",
14
+ "Default: #{options[:gem_repository]}") do |value, options|
15
+ options[:gem_repository] = value
16
+ end
17
+ end
18
+
19
+ def usage # :nodoc:
20
+ "#{program_name} GEMFILE [GEMFILE ...]"
21
+ end
22
+
23
+ def execute
24
+ options[:args].each do |gemspec|
25
+ Dir.chdir(File.dirname(gemspec)) do
26
+ gem = GemPublisher.publish_if_updated(File.basename(gemspec), options[:gem_repository])
27
+
28
+ if gem
29
+ $stderr.puts "Published #{gem}"
30
+ else
31
+ $stderr.puts "Nothing to do for #{gemspec}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ Gem::CommandManager.instance.register_command :publish
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gem_publisher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Battley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-11 00:00:00 Z
13
+ date: 2012-06-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mocha
@@ -50,6 +50,7 @@ files:
50
50
  - lib/gem_publisher/git_remote.rb
51
51
  - lib/gem_publisher/version.rb
52
52
  - lib/gem_publisher.rb
53
+ - lib/rubygems_plugin.rb
53
54
  - test/common.rb
54
55
  - test/publisher_test.rb
55
56
  - test/git_remote_test.rb
@@ -72,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
73
  requirements:
73
74
  - - ">="
74
75
  - !ruby/object:Gem::Version
75
- hash: -2346134412139626115
76
+ hash: -660420523550429852
76
77
  segments:
77
78
  - 0
78
79
  version: "0"
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  requirements:
82
83
  - - ">="
83
84
  - !ruby/object:Gem::Version
84
- hash: -2346134412139626115
85
+ hash: -660420523550429852
85
86
  segments:
86
87
  - 0
87
88
  version: "0"