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.
- checksums.yaml +4 -4
- data/Gemfile +13 -0
- data/Gemfile.lock +72 -0
- data/{lib/gem_release/templates/LICENSE → MIT-LICENSE.md} +3 -2
- data/README.md +646 -0
- data/README.md.erb +159 -0
- data/TODO.txt +194 -0
- data/lib/gem/release.rb +13 -0
- data/lib/gem/release/cmds.rb +16 -0
- data/lib/gem/release/cmds/base.rb +101 -0
- data/lib/gem/release/cmds/bootstrap.rb +222 -0
- data/lib/gem/release/cmds/bump.rb +165 -0
- data/lib/gem/release/cmds/gemspec.rb +85 -0
- data/lib/gem/release/cmds/release.rb +100 -0
- data/lib/gem/release/cmds/runner.rb +52 -0
- data/lib/gem/release/cmds/tag.rb +93 -0
- data/lib/gem/release/config.rb +42 -0
- data/lib/gem/release/config/env.rb +49 -0
- data/lib/gem/release/config/files.rb +35 -0
- data/lib/gem/release/context.rb +76 -0
- data/lib/gem/release/context/gem.rb +28 -0
- data/lib/gem/release/context/gemspec.rb +41 -0
- data/lib/gem/release/context/paths.rb +87 -0
- data/lib/gem/release/context/system.rb +36 -0
- data/lib/gem/release/data.rb +60 -0
- data/lib/gem/release/files/template.rb +61 -0
- data/lib/gem/release/files/template/context.rb +30 -0
- data/lib/gem/release/files/templates.rb +59 -0
- data/lib/gem/release/files/templates/group.rb +47 -0
- data/lib/gem/release/files/version.rb +68 -0
- data/lib/gem/release/helper.rb +45 -0
- data/lib/gem/release/helper/hash.rb +35 -0
- data/lib/gem/release/helper/string.rb +43 -0
- data/lib/gem/release/support/gem_command.rb +67 -0
- data/lib/gem/release/support/registry.rb +59 -0
- data/lib/gem/release/templates/.gitignore +8 -0
- data/lib/gem/release/templates/Gemfile +3 -0
- data/lib/gem/release/templates/gemspec +19 -0
- data/lib/gem/release/templates/licenses/mit.md +21 -0
- data/lib/gem/release/templates/licenses/mpl-2.md +373 -0
- data/lib/gem/release/templates/main.rb +1 -0
- data/lib/gem/release/templates/rspec/.rspec +3 -0
- data/lib/gem/release/templates/rspec/spec/spec_helper.rb +4 -0
- data/lib/gem/release/templates/travis/.travis.yml +1 -0
- data/lib/gem/release/templates/version.rb +1 -0
- data/lib/gem/release/version.rb +5 -0
- data/lib/gem/release/version/number.rb +102 -0
- data/lib/rubygems/commands/bootstrap_command.rb +4 -93
- data/lib/rubygems/commands/bump_command.rb +4 -110
- data/lib/rubygems/commands/gemspec_command.rb +5 -29
- data/lib/rubygems/commands/release_command.rb +4 -70
- data/lib/rubygems/commands/tag_command.rb +5 -46
- data/lib/rubygems_plugin.rb +8 -2
- metadata +56 -83
- data/lib/core_ext/hash/symbolize_keys.rb +0 -13
- data/lib/core_ext/kernel/silence.rb +0 -18
- data/lib/core_ext/string/camelize.rb +0 -5
- data/lib/gem_release.rb +0 -10
- data/lib/gem_release/command_options.rb +0 -31
- data/lib/gem_release/configuration.rb +0 -33
- data/lib/gem_release/gemspec_template.rb +0 -35
- data/lib/gem_release/helpers.rb +0 -104
- data/lib/gem_release/template.rb +0 -52
- data/lib/gem_release/templates/Gemfile +0 -3
- data/lib/gem_release/templates/README.md +0 -1
- data/lib/gem_release/templates/Rakefile +0 -10
- data/lib/gem_release/templates/gemspec +0 -18
- data/lib/gem_release/templates/gitignore +0 -25
- data/lib/gem_release/templates/test/test_helper.rb +0 -2
- data/lib/gem_release/templates/version.rb +0 -12
- data/lib/gem_release/version.rb +0 -3
- data/lib/gem_release/version_file.rb +0 -115
- data/lib/gem_release/version_template.rb +0 -14
data/lib/gem_release/template.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'core_ext/string/camelize'
|
4
|
-
|
5
|
-
module GemRelease
|
6
|
-
class Template
|
7
|
-
include GemRelease::Helpers
|
8
|
-
|
9
|
-
attr_reader :template, :filename, :name, :module_names, :module_path
|
10
|
-
|
11
|
-
def initialize(template, options = {})
|
12
|
-
@template = template
|
13
|
-
|
14
|
-
options.each do |key, value|
|
15
|
-
instance_variable_set(:"@#{key}", value)
|
16
|
-
meta_class.send(:attr_reader, key)
|
17
|
-
end
|
18
|
-
|
19
|
-
@filename ||= @template
|
20
|
-
@name ||= gem_name_from_directory
|
21
|
-
@module_path ||= name
|
22
|
-
@module_names ||= module_names_from_path(module_path)
|
23
|
-
end
|
24
|
-
|
25
|
-
def write
|
26
|
-
FileUtils.mkdir_p(File.dirname(filename))
|
27
|
-
File.open(filename, 'w+') { |f| f.write(render) }
|
28
|
-
end
|
29
|
-
|
30
|
-
protected
|
31
|
-
|
32
|
-
def module_names_from_path(path)
|
33
|
-
names = []
|
34
|
-
path.split('-').each do |segment|
|
35
|
-
names << segment.camelize
|
36
|
-
end
|
37
|
-
names
|
38
|
-
end
|
39
|
-
|
40
|
-
def render
|
41
|
-
ERB.new(read_template, nil, "%").result(binding)
|
42
|
-
end
|
43
|
-
|
44
|
-
def read_template
|
45
|
-
File.new(File.expand_path("../templates/#{template}", __FILE__)).read
|
46
|
-
end
|
47
|
-
|
48
|
-
def meta_class
|
49
|
-
class << self; self; end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
# <%= gem_name %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$:.unshift File.expand_path('../lib', __FILE__)
|
4
|
-
require '<%= module_path %>/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = <%= name.inspect %>
|
8
|
-
s.version = <%= module_names.join('::') %>::VERSION
|
9
|
-
s.authors = [<%= author.inspect %>]
|
10
|
-
s.email = [<%= email.inspect %>]
|
11
|
-
s.homepage = <%= homepage.inspect %>
|
12
|
-
s.summary = <%= summary.inspect %>
|
13
|
-
s.description = <%= description.inspect %>
|
14
|
-
|
15
|
-
s.files = <%= files %>
|
16
|
-
s.platform = Gem::Platform::RUBY
|
17
|
-
s.require_paths = ['lib']
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Because this is a gem, ignore Gemfile.lock:
|
2
|
-
|
3
|
-
Gemfile.lock
|
4
|
-
|
5
|
-
# And because this is Ruby, ignore the following
|
6
|
-
# (source: https://github.com/github/gitignore/blob/master/Ruby.gitignore):
|
7
|
-
|
8
|
-
*.gem
|
9
|
-
*.rbc
|
10
|
-
.bundle
|
11
|
-
.config
|
12
|
-
coverage
|
13
|
-
InstalledFiles
|
14
|
-
lib/bundler/man
|
15
|
-
pkg
|
16
|
-
rdoc
|
17
|
-
spec/reports
|
18
|
-
test/tmp
|
19
|
-
test/version_tmp
|
20
|
-
tmp
|
21
|
-
|
22
|
-
# YARD artifacts
|
23
|
-
.yardoc
|
24
|
-
_yardoc
|
25
|
-
doc/
|
data/lib/gem_release/version.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'core_ext/kernel/silence'
|
2
|
-
|
3
|
-
module GemRelease
|
4
|
-
class VersionFile
|
5
|
-
include GemRelease::Helpers
|
6
|
-
|
7
|
-
VERSION_PATTERN = /(VERSION\s*=\s*(?:"|'))((?:(?!"|').)*)("|')/
|
8
|
-
NUMBER_PATTERN = /(\d+)\.(\d+)\.(\d+)(.*)/
|
9
|
-
PRERELEASE_NUMBER_PATTERN = /(\d+)\.(\d+)\.(\d+)\.(\D+|.*)(\d+)/
|
10
|
-
|
11
|
-
attr_reader :target
|
12
|
-
|
13
|
-
def initialize(options = {})
|
14
|
-
@target = options[:target]
|
15
|
-
if @target == nil || @target == ''
|
16
|
-
@target = is_prerelease_version_number?(old_number) ? :pre : :patch
|
17
|
-
elsif @target.to_sym == :release
|
18
|
-
@target = :patch unless is_prerelease_version_number?(old_number)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def bump!
|
23
|
-
File.open(filename, 'w+') { |f| f.write(bumped_content) }
|
24
|
-
reload_version
|
25
|
-
end
|
26
|
-
|
27
|
-
def new_number
|
28
|
-
@new_number ||=
|
29
|
-
if is_version_number?(target)
|
30
|
-
target
|
31
|
-
elsif [:major, :minor, :patch].include?(target.to_sym)
|
32
|
-
old_number.sub(NUMBER_PATTERN) do
|
33
|
-
send(target, $1, $2, $3)
|
34
|
-
end
|
35
|
-
elsif is_prerelease_version_number?(old_number)
|
36
|
-
old_number.sub(PRERELEASE_NUMBER_PATTERN) do
|
37
|
-
(target.to_sym == :release) ? release($1, $2, $3) : prerelease($1, $2, $3, $4, $5)
|
38
|
-
end
|
39
|
-
else
|
40
|
-
old_number.sub(NUMBER_PATTERN) do
|
41
|
-
"#{patch($1, $2, $3)}.#{target}1"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def old_number
|
47
|
-
@old_number ||= content =~ VERSION_PATTERN && $2
|
48
|
-
end
|
49
|
-
|
50
|
-
def filename
|
51
|
-
path = gem_name
|
52
|
-
path = path.gsub('-', '/') unless File.exists?(path_to_version_file(path))
|
53
|
-
path = path.gsub('/', '_') unless File.exists?(path_to_version_file(path))
|
54
|
-
|
55
|
-
File.expand_path(path_to_version_file(path))
|
56
|
-
end
|
57
|
-
|
58
|
-
protected
|
59
|
-
|
60
|
-
def path_to_version_file(path)
|
61
|
-
"lib/#{path}/version.rb"
|
62
|
-
end
|
63
|
-
|
64
|
-
def reload_version
|
65
|
-
silently { load(filename) }
|
66
|
-
end
|
67
|
-
|
68
|
-
def major(major, minor, patch)
|
69
|
-
"#{major.to_i + 1}.0.0"
|
70
|
-
end
|
71
|
-
|
72
|
-
def minor(major, minor, patch)
|
73
|
-
"#{major}.#{minor.to_i + 1}.0"
|
74
|
-
end
|
75
|
-
|
76
|
-
def patch(major, minor, patch)
|
77
|
-
"#{major}.#{minor}.#{patch.to_i + 1}"
|
78
|
-
end
|
79
|
-
|
80
|
-
def release(major, minor, patch)
|
81
|
-
"#{major}.#{minor}.#{patch}"
|
82
|
-
end
|
83
|
-
|
84
|
-
def prerelease(major, minor, patch, prereleasePrefix, prereleaseNumber)
|
85
|
-
"#{major}.#{minor}.#{patch}.#{prereleasePrefix || 'pre'}#{prereleaseNumber.to_i + 1}"
|
86
|
-
end
|
87
|
-
|
88
|
-
def content
|
89
|
-
@content ||= File.read(filename)
|
90
|
-
end
|
91
|
-
|
92
|
-
def bumped_content
|
93
|
-
content.sub(VERSION_PATTERN) { "#{$1}#{new_number}#{$3}" }
|
94
|
-
end
|
95
|
-
|
96
|
-
def silently(&block)
|
97
|
-
warn_level = $VERBOSE
|
98
|
-
$VERBOSE = nil
|
99
|
-
begin
|
100
|
-
result = block.call
|
101
|
-
ensure
|
102
|
-
$VERBOSE = warn_level
|
103
|
-
end
|
104
|
-
result
|
105
|
-
end
|
106
|
-
|
107
|
-
def is_version_number?(v)
|
108
|
-
v.to_s.match(NUMBER_PATTERN) != nil
|
109
|
-
end
|
110
|
-
|
111
|
-
def is_prerelease_version_number?(v)
|
112
|
-
v.to_s.match(PRERELEASE_NUMBER_PATTERN) != nil
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|