gem-release 1.0.0 → 2.0.0.dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +13 -0
  3. data/Gemfile.lock +72 -0
  4. data/{lib/gem_release/templates/LICENSE → MIT-LICENSE.md} +3 -2
  5. data/README.md +646 -0
  6. data/README.md.erb +159 -0
  7. data/TODO.txt +194 -0
  8. data/lib/gem/release.rb +13 -0
  9. data/lib/gem/release/cmds.rb +16 -0
  10. data/lib/gem/release/cmds/base.rb +101 -0
  11. data/lib/gem/release/cmds/bootstrap.rb +222 -0
  12. data/lib/gem/release/cmds/bump.rb +165 -0
  13. data/lib/gem/release/cmds/gemspec.rb +85 -0
  14. data/lib/gem/release/cmds/release.rb +100 -0
  15. data/lib/gem/release/cmds/runner.rb +52 -0
  16. data/lib/gem/release/cmds/tag.rb +93 -0
  17. data/lib/gem/release/config.rb +42 -0
  18. data/lib/gem/release/config/env.rb +49 -0
  19. data/lib/gem/release/config/files.rb +35 -0
  20. data/lib/gem/release/context.rb +76 -0
  21. data/lib/gem/release/context/gem.rb +28 -0
  22. data/lib/gem/release/context/gemspec.rb +41 -0
  23. data/lib/gem/release/context/paths.rb +87 -0
  24. data/lib/gem/release/context/system.rb +36 -0
  25. data/lib/gem/release/data.rb +60 -0
  26. data/lib/gem/release/files/template.rb +61 -0
  27. data/lib/gem/release/files/template/context.rb +30 -0
  28. data/lib/gem/release/files/templates.rb +59 -0
  29. data/lib/gem/release/files/templates/group.rb +47 -0
  30. data/lib/gem/release/files/version.rb +68 -0
  31. data/lib/gem/release/helper.rb +45 -0
  32. data/lib/gem/release/helper/hash.rb +35 -0
  33. data/lib/gem/release/helper/string.rb +43 -0
  34. data/lib/gem/release/support/gem_command.rb +67 -0
  35. data/lib/gem/release/support/registry.rb +59 -0
  36. data/lib/gem/release/templates/.gitignore +8 -0
  37. data/lib/gem/release/templates/Gemfile +3 -0
  38. data/lib/gem/release/templates/gemspec +19 -0
  39. data/lib/gem/release/templates/licenses/mit.md +21 -0
  40. data/lib/gem/release/templates/licenses/mpl-2.md +373 -0
  41. data/lib/gem/release/templates/main.rb +1 -0
  42. data/lib/gem/release/templates/rspec/.rspec +3 -0
  43. data/lib/gem/release/templates/rspec/spec/spec_helper.rb +4 -0
  44. data/lib/gem/release/templates/travis/.travis.yml +1 -0
  45. data/lib/gem/release/templates/version.rb +1 -0
  46. data/lib/gem/release/version.rb +5 -0
  47. data/lib/gem/release/version/number.rb +102 -0
  48. data/lib/rubygems/commands/bootstrap_command.rb +4 -93
  49. data/lib/rubygems/commands/bump_command.rb +4 -110
  50. data/lib/rubygems/commands/gemspec_command.rb +5 -29
  51. data/lib/rubygems/commands/release_command.rb +4 -70
  52. data/lib/rubygems/commands/tag_command.rb +5 -46
  53. data/lib/rubygems_plugin.rb +8 -2
  54. metadata +56 -83
  55. data/lib/core_ext/hash/symbolize_keys.rb +0 -13
  56. data/lib/core_ext/kernel/silence.rb +0 -18
  57. data/lib/core_ext/string/camelize.rb +0 -5
  58. data/lib/gem_release.rb +0 -10
  59. data/lib/gem_release/command_options.rb +0 -31
  60. data/lib/gem_release/configuration.rb +0 -33
  61. data/lib/gem_release/gemspec_template.rb +0 -35
  62. data/lib/gem_release/helpers.rb +0 -104
  63. data/lib/gem_release/template.rb +0 -52
  64. data/lib/gem_release/templates/Gemfile +0 -3
  65. data/lib/gem_release/templates/README.md +0 -1
  66. data/lib/gem_release/templates/Rakefile +0 -10
  67. data/lib/gem_release/templates/gemspec +0 -18
  68. data/lib/gem_release/templates/gitignore +0 -25
  69. data/lib/gem_release/templates/test/test_helper.rb +0 -2
  70. data/lib/gem_release/templates/version.rb +0 -12
  71. data/lib/gem_release/version.rb +0 -3
  72. data/lib/gem_release/version_file.rb +0 -115
  73. data/lib/gem_release/version_template.rb +0 -14
@@ -1,48 +1,7 @@
1
- class Gem::Commands::TagCommand < Gem::Command
2
- include GemRelease
3
- include Helpers, CommandOptions
4
-
5
- DEFAULTS = {
6
- :quiet => false,
7
- :destination => "origin"
8
- }
9
-
10
- attr_reader :arguments, :usage, :name
11
-
12
- def initialize(options = {})
13
- @name = 'tag'
14
- super @name, 'Create a git tag and push it to the destination', default_options_with(options)
15
-
16
- option :quiet, '-q', 'Do not output status messages'
17
- option :destination, '-d', 'Git destination'
18
- end
19
-
20
- def execute
21
- [:tag, :push].each do |task|
22
- run_cmd(task)
23
- end
1
+ require 'gem/release/support/gem_command'
2
+ require 'gem/release/cmds/tag'
24
3
 
25
- success
26
- end
27
-
28
- protected
29
-
30
- def tag
31
- say "Creating git tag #{tag_name}" unless quiet?
32
- system("git tag -am \"tag #{tag_name}\" #{tag_name}")
33
- end
34
-
35
- def push
36
- unless options[:push_tags_only]
37
- say "Pushing to the origin git repository" unless quiet?
38
- return false unless system("git push #{options[:destination]}")
39
- end
40
-
41
- say "Pushing #{tag_name} to the #{options[:destination]} repository" unless quiet?
42
- system("git push #{options[:destination]} #{tag_name}")
43
- end
44
-
45
- def tag_name
46
- "v#{gem_version}"
47
- end
4
+ class Gem::Commands::TagCommand < Gem::Command
5
+ include Gem::Release::GemCommand
6
+ self.cmd = :tag
48
7
  end
@@ -1,8 +1,14 @@
1
+ require 'gem/release'
1
2
  require 'rubygems/command_manager'
2
- require 'gem_release'
3
3
 
4
- Gem::CommandManager.instance.register_command :gemspec
4
+ require 'rubygems/commands/bootstrap_command'
5
+ require 'rubygems/commands/bump_command'
6
+ require 'rubygems/commands/gemspec_command'
7
+ require 'rubygems/commands/release_command'
8
+ require 'rubygems/commands/tag_command'
9
+
5
10
  Gem::CommandManager.instance.register_command :bootstrap
6
11
  Gem::CommandManager.instance.register_command :bump
12
+ Gem::CommandManager.instance.register_command :gemspec
7
13
  Gem::CommandManager.instance.register_command :release
8
14
  Gem::CommandManager.instance.register_command :tag
metadata CHANGED
@@ -1,106 +1,79 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0.dev.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
8
+ - Dan Gebhardt
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
  date: 2017-05-01 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: test_declarative
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.0.2
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 0.0.2
27
- - !ruby/object:Gem::Dependency
28
- name: mocha
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0.14'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0.14'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
13
+ dependencies: []
69
14
  description: Release your ruby gems with ease. (What a bold statement for such a tiny
70
15
  plugin ...)
71
- email: svenfuchs@artweb-design.de
16
+ email:
17
+ - me@svenfuchs.com
72
18
  executables: []
73
19
  extensions: []
74
20
  extra_rdoc_files: []
75
21
  files:
76
- - lib/core_ext/hash/symbolize_keys.rb
77
- - lib/core_ext/kernel/silence.rb
78
- - lib/core_ext/string/camelize.rb
79
- - lib/gem_release.rb
80
- - lib/gem_release/command_options.rb
81
- - lib/gem_release/configuration.rb
82
- - lib/gem_release/gemspec_template.rb
83
- - lib/gem_release/helpers.rb
84
- - lib/gem_release/template.rb
85
- - lib/gem_release/templates/Gemfile
86
- - lib/gem_release/templates/LICENSE
87
- - lib/gem_release/templates/README.md
88
- - lib/gem_release/templates/Rakefile
89
- - lib/gem_release/templates/gemspec
90
- - lib/gem_release/templates/gitignore
91
- - lib/gem_release/templates/test/test_helper.rb
92
- - lib/gem_release/templates/version.rb
93
- - lib/gem_release/version.rb
94
- - lib/gem_release/version_file.rb
95
- - lib/gem_release/version_template.rb
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - MIT-LICENSE.md
25
+ - README.md
26
+ - README.md.erb
27
+ - TODO.txt
28
+ - lib/gem/release.rb
29
+ - lib/gem/release/cmds.rb
30
+ - lib/gem/release/cmds/base.rb
31
+ - lib/gem/release/cmds/bootstrap.rb
32
+ - lib/gem/release/cmds/bump.rb
33
+ - lib/gem/release/cmds/gemspec.rb
34
+ - lib/gem/release/cmds/release.rb
35
+ - lib/gem/release/cmds/runner.rb
36
+ - lib/gem/release/cmds/tag.rb
37
+ - lib/gem/release/config.rb
38
+ - lib/gem/release/config/env.rb
39
+ - lib/gem/release/config/files.rb
40
+ - lib/gem/release/context.rb
41
+ - lib/gem/release/context/gem.rb
42
+ - lib/gem/release/context/gemspec.rb
43
+ - lib/gem/release/context/paths.rb
44
+ - lib/gem/release/context/system.rb
45
+ - lib/gem/release/data.rb
46
+ - lib/gem/release/files/template.rb
47
+ - lib/gem/release/files/template/context.rb
48
+ - lib/gem/release/files/templates.rb
49
+ - lib/gem/release/files/templates/group.rb
50
+ - lib/gem/release/files/version.rb
51
+ - lib/gem/release/helper.rb
52
+ - lib/gem/release/helper/hash.rb
53
+ - lib/gem/release/helper/string.rb
54
+ - lib/gem/release/support/gem_command.rb
55
+ - lib/gem/release/support/registry.rb
56
+ - lib/gem/release/templates/.gitignore
57
+ - lib/gem/release/templates/Gemfile
58
+ - lib/gem/release/templates/gemspec
59
+ - lib/gem/release/templates/licenses/mit.md
60
+ - lib/gem/release/templates/licenses/mpl-2.md
61
+ - lib/gem/release/templates/main.rb
62
+ - lib/gem/release/templates/rspec/.rspec
63
+ - lib/gem/release/templates/rspec/spec/spec_helper.rb
64
+ - lib/gem/release/templates/travis/.travis.yml
65
+ - lib/gem/release/templates/version.rb
66
+ - lib/gem/release/version.rb
67
+ - lib/gem/release/version/number.rb
96
68
  - lib/rubygems/commands/bootstrap_command.rb
97
69
  - lib/rubygems/commands/bump_command.rb
98
70
  - lib/rubygems/commands/gemspec_command.rb
99
71
  - lib/rubygems/commands/release_command.rb
100
72
  - lib/rubygems/commands/tag_command.rb
101
73
  - lib/rubygems_plugin.rb
102
- homepage: http://github.com/svenfuchs/gem-release
103
- licenses: []
74
+ homepage: https://github.com/svenfuchs/gem-release
75
+ licenses:
76
+ - MIT
104
77
  metadata: {}
105
78
  post_install_message:
106
79
  rdoc_options: []
@@ -113,9 +86,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
86
  version: '0'
114
87
  required_rubygems_version: !ruby/object:Gem::Requirement
115
88
  requirements:
116
- - - ">="
89
+ - - ">"
117
90
  - !ruby/object:Gem::Version
118
- version: 1.3.6
91
+ version: 1.3.1
119
92
  requirements: []
120
93
  rubyforge_project:
121
94
  rubygems_version: 2.6.11
@@ -1,13 +0,0 @@
1
- class Hash
2
-
3
- #taken from https://gist.github.com/tommeier/1479299
4
- def deep_symbolize_keys!
5
- self.keys.each do |k|
6
- new_key = k.to_sym
7
- current_value = self.delete(k)
8
- self[new_key] = current_value.is_a?(Hash) ? current_value.dup.deep_symbolize_keys! : current_value
9
- end
10
- self
11
- end
12
-
13
- end
@@ -1,18 +0,0 @@
1
- module Kernel
2
- def silence
3
- silence_stream(STDOUT, STDERR) { yield }
4
- end
5
-
6
- def silence_stream(*streams)
7
- on_hold = streams.collect{ |stream| stream.dup }
8
- streams.each do |stream|
9
- stream.reopen(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
10
- stream.sync = true
11
- end
12
- yield
13
- ensure
14
- streams.each_with_index do |stream, i|
15
- stream.reopen(on_hold[i])
16
- end
17
- end
18
- end
@@ -1,5 +0,0 @@
1
- class String
2
- def camelize
3
- split(/[^a-z0-9]/i).map { |word| word.capitalize }.join
4
- end
5
- end unless String.new.respond_to?(:camelize)
data/lib/gem_release.rb DELETED
@@ -1,10 +0,0 @@
1
- module GemRelease
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'
9
- autoload :Configuration, 'gem_release/configuration'
10
- end
@@ -1,31 +0,0 @@
1
- module GemRelease
2
- module CommandOptions
3
- def initialize(*args)
4
- @arguments = ''
5
- super
6
- end
7
-
8
- def default_options_with(passed_opts)
9
- self.class::DEFAULTS.merge(Configuration.new[name.to_sym]).merge(passed_opts)
10
- end
11
-
12
- def option(key, short, description)
13
- default = Configuration.new[name.to_sym][key] || self.class::DEFAULTS[key]
14
-
15
- if default.is_a?(String)
16
- long = "--#{key} #{key.to_s.upcase}"
17
- if default == ''
18
- default_description = 'not set by default'
19
- else
20
- default_description = "defaults to #{default}"
21
- end
22
- args = [short, long, String, "#{description} (#{default_description})"]
23
- else
24
- long = "--[no-]#{key}"
25
- args = [short, long, "#{description} (defaults to #{default})"]
26
- end
27
-
28
- add_option(*args) { |value, options| options[key] = value }
29
- end
30
- end
31
- end
@@ -1,33 +0,0 @@
1
- require 'yaml'
2
- require 'core_ext/hash/symbolize_keys'
3
-
4
- class Configuration
5
-
6
- attr_reader :options
7
-
8
- def initialize
9
- load_options!
10
- end
11
-
12
- def load_options!
13
- @options = Hash.new { |hash, key| hash[key] = {} }
14
- if File.exist?(conf_path.to_s) && !File.directory?(conf_path.to_s)
15
- config_hash = YAML.load(File.read(conf_path))
16
- if config_hash
17
- @options.merge!(config_hash.deep_symbolize_keys!)
18
- end
19
- end
20
- end
21
-
22
- def conf_path
23
- File.expand_path(Dir.glob('**/.gemrelease').first.to_s)
24
- end
25
-
26
- def []=(key,val)
27
- options[key] = val
28
- end
29
-
30
- def [](key)
31
- options[key]
32
- end
33
- end
@@ -1,35 +0,0 @@
1
- module GemRelease
2
- class GemspecTemplate < Template
3
- attr_reader :author, :email, :homepage, :summary, :description, :strategy
4
-
5
- def initialize(options = {})
6
- super('gemspec', options)
7
-
8
- @author ||= user_name
9
- @email ||= user_email
10
- @homepage ||= "https://github.com/#{github_user}/#{name}" || "[your github name]"
11
-
12
- @summary ||= 'TODO: summary'
13
- @description ||= 'TODO: description'
14
-
15
- @strategy = options[:strategy]
16
- end
17
-
18
- def files
19
- case strategy
20
- when 'git'
21
- '`git ls-files app lib`.split("\n")'
22
- else
23
- 'Dir.glob("{lib/**/*,[A-Z]*}")'
24
- end
25
- end
26
-
27
- def exists?
28
- File.exists?(filename)
29
- end
30
-
31
- def filename
32
- "#{name}.gemspec"
33
- end
34
- end
35
- end
@@ -1,104 +0,0 @@
1
- require 'core_ext/string/camelize'
2
-
3
- module GemRelease
4
- module Helpers
5
- def quiet?
6
- options[:quiet]
7
- end
8
-
9
- def user_name
10
- `git config --get user.name`.strip
11
- end
12
-
13
- def user_email
14
- `git config --get user.email`.strip
15
- end
16
-
17
- def github_user
18
- `git config --get github.user`.strip
19
- end
20
-
21
- def github_token
22
- `git config --get github.token`.strip
23
- end
24
-
25
- def gem_name
26
- gemspec ? gemspec.name : gem_name_from_directory
27
- end
28
-
29
- def gem_name_from_directory
30
- File.basename(Dir.pwd)
31
- end
32
-
33
- def gem_filename
34
- gemspec.file_name
35
- end
36
-
37
- def gem_version
38
- gemspec.version.to_s
39
- end
40
-
41
- def gemspec
42
- Gem::Specification.load(gemspec_filename)
43
- rescue LoadError, RuntimeError
44
- nil
45
- end
46
-
47
- def gemspec_filename
48
- name = Array(options[:args]).first rescue nil
49
- name ||= Dir['*.gemspec'].first
50
- name || raise("No gemspec found or given.")
51
- end
52
-
53
- def in_gemspec_dirs
54
- gemspec_dirs.each do |dir|
55
- Dir.chdir(dir) { yield }
56
- end
57
- end
58
-
59
- def gemspec_dirs
60
- filter_gemspecs(Dir.glob('**/*.gemspec'))
61
- end
62
-
63
- def filter_gemspecs(files)
64
- files.reject { |i| i[/^vendor/i] }.map { |spec| File.dirname(spec) }
65
- end
66
-
67
- def in_bootstrapped_dir
68
- dir = Array(options[:args]).first rescue nil
69
- if dir && dir.kind_of?(String) && dir[0] != '-'
70
- Dir.mkdir dir
71
- Dir.chdir(dir) { yield }
72
- else
73
- yield
74
- end
75
- end
76
-
77
- def reset_gemspec_cache
78
- # Gemspecs are cached in rubygems >= 2.1, so we need to clear the cache
79
- # in case gem versions have changed.
80
- #
81
- # Note: This is not needed or supported with older rubygems, which is
82
- # why exceptions are swallowed.
83
- begin
84
- Gem::Specification.reset
85
- rescue
86
- end
87
- end
88
-
89
- def run_cmd(command)
90
- reset_gemspec_cache
91
-
92
- unless send(command)
93
- say "The task `#{command}` could not be completed. Subsequent tasks will not be attempted."
94
- abort
95
- end
96
- end
97
-
98
- def success
99
- unless quiet? || options[:quiet_success]
100
- say "All is good, thanks my friend.\n"
101
- end
102
- end
103
- end
104
- end