gem-release 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/gem_release.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  module GemRelease
2
- autoload :CommandOptions, 'gem_release/command_options'
3
- autoload :Gemspec, 'gem_release/gemspec'
4
- autoload :Helpers, 'gem_release/helpers'
5
- autoload :Template, 'gem_release/template'
6
- autoload :Version, 'gem_release/version'
7
- autoload :VersionFile, 'gem_release/version_file'
2
+ autoload :CommandOptions, 'gem_release/command_options'
3
+ autoload :GemspecTemplate, 'gem_release/gemspec_template'
4
+ autoload :Helpers, 'gem_release/helpers'
5
+ autoload :Template, 'gem_release/template'
6
+ autoload :Version, 'gem_release/version'
7
+ autoload :VersionFile, 'gem_release/version_file'
8
+ autoload :VersionTemplate, 'gem_release/version_template'
8
9
  end
@@ -10,7 +10,12 @@ module GemRelease
10
10
 
11
11
  if default.is_a?(String)
12
12
  long = "--#{key} #{key.to_s.upcase}"
13
- args = [short, long, String, "#{description} (defaults to #{default})"]
13
+ if default == ''
14
+ default_description = 'not set by default'
15
+ else
16
+ default_description = "defaults to #{default}"
17
+ end
18
+ args = [short, long, String, "#{description} (#{default_description})"]
14
19
  else
15
20
  long = "--[no-]#{key}"
16
21
  args = [short, long, "#{description} (defaults to #{default})"]
@@ -1,5 +1,5 @@
1
1
  module GemRelease
2
- class Gemspec < Template
2
+ class GemspecTemplate < Template
3
3
  attr_reader :author, :email, :homepage, :summary, :description, :strategy
4
4
 
5
5
  def initialize(options = {})
@@ -1,16 +1,3 @@
1
1
  module GemRelease
2
- VERSION = '0.1.3'
3
-
4
- class Version < Template
5
- attr_reader :version
6
-
7
- def initialize(options = {})
8
- super('version.rb', options)
9
- @version ||= '0.0.1'
10
- end
11
-
12
- def filename
13
- "lib/#{module_path}/version.rb"
14
- end
15
- end if defined?(Template)
2
+ VERSION = '0.2.0'
16
3
  end
@@ -0,0 +1,14 @@
1
+ module GemRelease
2
+ class VersionTemplate < Template
3
+ attr_reader :version
4
+
5
+ def initialize(options = {})
6
+ super('version.rb', options)
7
+ @version ||= '0.0.1'
8
+ end
9
+
10
+ def filename
11
+ "lib/#{module_path}/version.rb"
12
+ end
13
+ end
14
+ end
@@ -50,7 +50,7 @@ class Gem::Commands::BootstrapCommand < Gem::Command
50
50
  create_file Template.new('Gemfile')
51
51
  create_file Template.new('Rakefile')
52
52
  create_file Template.new('test/test_helper.rb')
53
- create_file Version.new(options)
53
+ create_file VersionTemplate.new(options)
54
54
  end
55
55
 
56
56
  def create_lib
@@ -10,10 +10,8 @@ class Gem::Commands::BumpCommand < Gem::Command
10
10
 
11
11
  DEFAULTS = {
12
12
  :version => 'patch',
13
- :push => false,
14
- :tag => false,
15
- :release => false,
16
13
  :commit => true,
14
+ :push => false,
17
15
  :quiet => false
18
16
  }
19
17
 
@@ -23,8 +21,6 @@ class Gem::Commands::BumpCommand < Gem::Command
23
21
  option :version, '-v', 'Target version: next [major|minor|patch] or a given version number [x.x.x]'
24
22
  option :commit, '-c', 'Perform a commit after incrementing gem version'
25
23
  option :push, '-p', 'Push to origin'
26
- option :tag, '-t', 'Create a git tag and push --tags to origin'
27
- option :release, '-r', 'Build gem from a gemspec and push to rubygems.org'
28
24
  option :quiet, '-q', 'Do not output status messages'
29
25
  end
30
26
 
@@ -32,8 +28,7 @@ class Gem::Commands::BumpCommand < Gem::Command
32
28
  @new_version_number = nil
33
29
 
34
30
  # enforce option dependencies
35
- options[:push] = options[:push] || options[:tag]
36
- options[:commit] = options[:commit] || options[:push] || options[:release]
31
+ options[:commit] = options[:commit] || options[:push]
37
32
 
38
33
  in_gemspec_dirs do
39
34
  bump
@@ -44,8 +39,6 @@ class Gem::Commands::BumpCommand < Gem::Command
44
39
  else
45
40
  commit if options[:commit]
46
41
  push if options[:push]
47
- release if options[:release]
48
- tag if options[:tag]
49
42
  end
50
43
  end
51
44
 
@@ -72,12 +65,4 @@ class Gem::Commands::BumpCommand < Gem::Command
72
65
  say "Pushing to origin" unless quiet?
73
66
  `git push`
74
67
  end
75
-
76
- def release
77
- ReleaseCommand.new.invoke
78
- end
79
-
80
- def tag
81
- TagCommand.new.invoke
82
- end
83
68
  end
@@ -17,7 +17,7 @@ class Gem::Commands::GemspecCommand < Gem::Command
17
17
  end
18
18
 
19
19
  def execute
20
- gemspec = Gemspec.new(options)
20
+ gemspec = GemspecTemplate.new(options)
21
21
  if gemspec.exists?
22
22
  say "Skipping #{gemspec.filename}: already exists" unless quiet?
23
23
  else
@@ -8,7 +8,9 @@ class Gem::Commands::ReleaseCommand < Gem::Command
8
8
 
9
9
  DEFAULTS = {
10
10
  :tag => false,
11
- :quiet => false
11
+ :quiet => false,
12
+ :key => '',
13
+ :host => ''
12
14
  }
13
15
 
14
16
  attr_reader :arguments, :usage
@@ -18,6 +20,8 @@ class Gem::Commands::ReleaseCommand < Gem::Command
18
20
 
19
21
  option :tag, '-t', 'Create a git tag and push --tags to origin'
20
22
  option :quiet, '-q', 'Do not output status messages'
23
+ option :key, '-k', 'Use the given API key from ~/.gem/credentials'
24
+ option :host, '-h', 'Push to a gemcutter-compatible host other than rubygems.org'
21
25
 
22
26
  @arguments = "gemspec - optional gemspec file name, will use the first *.gemspec if not specified"
23
27
  @usage = "#{program_name} [gemspec]"
@@ -41,7 +45,13 @@ class Gem::Commands::ReleaseCommand < Gem::Command
41
45
  end
42
46
 
43
47
  def push
44
- PushCommand.new.invoke(gem_filename)
48
+ args = []
49
+ [:key, :host].each do |option|
50
+ args += ["--#{option}", options[option]] unless options[option] == ''
51
+ end
52
+ args += "--quiet" if quiet?
53
+
54
+ PushCommand.new.invoke(gem_filename, *args)
45
55
  end
46
56
 
47
57
  def remove
metadata CHANGED
@@ -1,71 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gem-release
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sven Fuchs
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-26 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: test_declarative
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70146446234740 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 27
30
- segments:
31
- - 0
32
- - 0
33
- - 2
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
34
21
  version: 0.0.2
35
22
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: mocha
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70146446234740
25
+ - !ruby/object:Gem::Dependency
26
+ name: mocha
27
+ requirement: &70146446233940 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 43
46
- segments:
47
- - 0
48
- - 9
49
- - 8
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
50
32
  version: 0.9.8
51
33
  type: :development
52
- version_requirements: *id002
53
- description: Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)
34
+ prerelease: false
35
+ version_requirements: *70146446233940
36
+ description: Release your ruby gems with ease. (What a bold statement for such a tiny
37
+ plugin ...)
54
38
  email: svenfuchs@artweb-design.de
55
39
  executables: []
56
-
57
40
  extensions: []
58
-
59
41
  extra_rdoc_files: []
60
-
61
- files:
42
+ files:
62
43
  - lib/core_ext/kernel/silence.rb
63
44
  - lib/core_ext/string/camelize.rb
64
45
  - lib/gem_release.rb
65
46
  - lib/gem_release/command_options.rb
66
- - lib/gem_release/gemspec.rb
47
+ - lib/gem_release/gemspec_template.rb
67
48
  - lib/gem_release/helpers.rb
68
- - lib/gem_release/license.rb
69
49
  - lib/gem_release/template.rb
70
50
  - lib/gem_release/templates/Gemfile
71
51
  - lib/gem_release/templates/LICENSE
@@ -77,47 +57,35 @@ files:
77
57
  - lib/gem_release/templates/version.rb
78
58
  - lib/gem_release/version.rb
79
59
  - lib/gem_release/version_file.rb
60
+ - lib/gem_release/version_template.rb
80
61
  - lib/rubygems/commands/bootstrap_command.rb
81
62
  - lib/rubygems/commands/bump_command.rb
82
63
  - lib/rubygems/commands/gemspec_command.rb
83
64
  - lib/rubygems/commands/release_command.rb
84
65
  - lib/rubygems/commands/tag_command.rb
85
66
  - lib/rubygems_plugin.rb
86
- has_rdoc: true
87
67
  homepage: http://github.com/svenfuchs/gem-release
88
68
  licenses: []
89
-
90
69
  post_install_message:
91
70
  rdoc_options: []
92
-
93
- require_paths:
71
+ require_paths:
94
72
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
73
+ required_ruby_version: !ruby/object:Gem::Requirement
96
74
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
104
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
80
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 23
110
- segments:
111
- - 1
112
- - 3
113
- - 6
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
114
84
  version: 1.3.6
115
85
  requirements: []
116
-
117
- rubyforge_project: "[none]"
118
- rubygems_version: 1.4.2
86
+ rubyforge_project: ! '[none]'
87
+ rubygems_version: 1.8.15
119
88
  signing_key:
120
89
  specification_version: 3
121
90
  summary: Release your ruby gems with ease
122
91
  test_files: []
123
-
@@ -1,18 +0,0 @@
1
- module GemRelease
2
- class License < Template
3
- attr_reader :author, :email, :year
4
-
5
- def initialize(options = {})
6
- super
7
-
8
- @author ||= user_name
9
- @email ||= user_email
10
- @year ||= Time.now.year
11
- end
12
-
13
- def template_name
14
- 'gemspec.erb'
15
- end
16
- end
17
- end
18
-