visionmedia-release 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +4 -0
- data/Manifest +14 -0
- data/README.rdoc +62 -0
- data/Rakefile +15 -0
- data/Todo.rdoc +13 -0
- data/bin/re +68 -0
- data/release.gemspec +33 -0
- data/spec/fixtures/bar/version.rb +6 -0
- data/spec/fixtures/foo.rb +6 -0
- data/spec/release_spec.rb +83 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/docs.rake +13 -0
- data/tasks/gemspec.rake +3 -0
- data/tasks/spec.rake +22 -0
- metadata +75 -0
data/History.rdoc
ADDED
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
= Release
|
3
|
+
|
4
|
+
Github release management system.
|
5
|
+
|
6
|
+
== Description
|
7
|
+
|
8
|
+
Tired of altering versions?, committing, tagging, pushing, and
|
9
|
+
pushing tags to Github manually? Never fear, release is here!
|
10
|
+
|
11
|
+
== Features
|
12
|
+
|
13
|
+
* Bump version levels [major, minor, (tiny | patch)]
|
14
|
+
* Commit with default release message (or alter)
|
15
|
+
* Tag and push to github
|
16
|
+
* Run rake-tasks before releasing
|
17
|
+
* All in a single command!
|
18
|
+
|
19
|
+
== Examples
|
20
|
+
|
21
|
+
Bump patch (tiny), auto-locates version.rb
|
22
|
+
$ re bump
|
23
|
+
|
24
|
+
Bump major with custom commit message (VERSION is replaced with release version)
|
25
|
+
$ re bump major -m 'Release VERSION, check it out!'
|
26
|
+
|
27
|
+
Run rake tasks before releasing (defaults to manifest,gemspec)
|
28
|
+
$ re bump minor -r manifest,gemspec,email
|
29
|
+
|
30
|
+
Specific version file
|
31
|
+
$ re bump --file bin/re
|
32
|
+
|
33
|
+
== Limitations
|
34
|
+
|
35
|
+
* Currently supports 'n.n.n' format only
|
36
|
+
* Auto-locates version.rb (specify a specific file with --file switch)
|
37
|
+
|
38
|
+
== License:
|
39
|
+
|
40
|
+
(The MIT License)
|
41
|
+
|
42
|
+
Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
|
43
|
+
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
45
|
+
a copy of this software and associated documentation files (the
|
46
|
+
'Software'), to deal in the Software without restriction, including
|
47
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
48
|
+
distribute, sublicense, an d/or sell copies of the Software, and to
|
49
|
+
permit persons to whom the Software is furnished to do so, subject to
|
50
|
+
the following conditions:
|
51
|
+
|
52
|
+
The above copyright notice and this permission notice shall be
|
53
|
+
included in all copies or substantial portions of the Software.
|
54
|
+
|
55
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
56
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
57
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
58
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
59
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
60
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
61
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
62
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
require 'echoe'
|
5
|
+
load './bin/re'
|
6
|
+
|
7
|
+
Echoe.new("release", program(:version)) do |p|
|
8
|
+
p.author = "TJ Holowaychuk"
|
9
|
+
p.email = "tj@vision-media.ca"
|
10
|
+
p.summary = "Github release management system"
|
11
|
+
p.url = "http://github.com/visionmedia/release"
|
12
|
+
p.runtime_dependencies = []
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir['tasks/**/*.rake'].sort.each { |f| load f }
|
data/Todo.rdoc
ADDED
data/bin/re
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander'
|
5
|
+
|
6
|
+
program :name, 'release'
|
7
|
+
program :version, '0.0.2'
|
8
|
+
program :description, 'Github release management'
|
9
|
+
|
10
|
+
def sh command
|
11
|
+
system command
|
12
|
+
end
|
13
|
+
|
14
|
+
def extract_version_from file
|
15
|
+
raise "version cannot find version file #{file}" unless file
|
16
|
+
contents = File.read file
|
17
|
+
version = $~.captures if contents =~ /(\d+)\.(\d+)\.(\d+)/
|
18
|
+
raise "failed to locate version within #{file}. Must be format 'n.n.n'." unless version.length == 3
|
19
|
+
version.map { |v| v.to_i }
|
20
|
+
end
|
21
|
+
|
22
|
+
def bump_version file, level
|
23
|
+
version = extract_version_from file
|
24
|
+
levels = { :major => 0, :minor => 1, :patch => 2, :tiny => 2 }
|
25
|
+
version[levels[level.to_sym]] += 1
|
26
|
+
version
|
27
|
+
end
|
28
|
+
|
29
|
+
def replace_version file, level
|
30
|
+
version = bump_version(file, level).join '.'
|
31
|
+
contents = File.read file
|
32
|
+
contents.sub! /\d+\.\d+\.\d+/, version
|
33
|
+
File.open(file, 'w+') do |file|
|
34
|
+
file.write contents
|
35
|
+
end
|
36
|
+
version
|
37
|
+
end
|
38
|
+
|
39
|
+
def locate_version_file
|
40
|
+
Dir['lib/*/**/*.rb'].grep(/version/).first
|
41
|
+
end
|
42
|
+
|
43
|
+
command :bump do |c|
|
44
|
+
c.syntax = 're bump [level] [options]'
|
45
|
+
c.summary = 'Bump the version <level>, defaults to patch.'
|
46
|
+
c.description = 'Bump the version by major, minor, or patch (tiny) levels, defaults to patch.'
|
47
|
+
c.example 'Bump patch level, running several rake tasks first', 're bump --rake manifest,gemspec'
|
48
|
+
c.example 'Custom message, VERSION replaced with actual version', 're bump major --message \'Release of App VERSION\''
|
49
|
+
c.option '-f', '--file FILE', 'File containing the version, otherwise searches lib/ for version.rb'
|
50
|
+
c.option '-m', '--message MESSAGE', String, 'Message defaults to \'- Release VERSION\''
|
51
|
+
c.option '-r', '--rake TASKS', Array, 'Defaults to manifest,gemspec to build manifest / gemspec before releasing'
|
52
|
+
c.option '-R', '--no-rake', 'Disable rake tasks'
|
53
|
+
c.when_called do |args, o|
|
54
|
+
# Defaults
|
55
|
+
level = args.shift || 'patch'
|
56
|
+
o.rake = o.rake || %w( manifest gemspec )
|
57
|
+
o.file = o.file || locate_version_file
|
58
|
+
o.message = o.message || '- Release VERSION'
|
59
|
+
|
60
|
+
# Release
|
61
|
+
say "... bumping #{level} level in #{o.file}"
|
62
|
+
version = replace_version o.file, level
|
63
|
+
o.rake.each { |task| sh "rake #{task}" } if o.no_rake
|
64
|
+
sh "git commit -a -m '#{ o.message.sub('VERSION', version) }'"
|
65
|
+
sh "git tag #{version} && git push && git push --tags"
|
66
|
+
say "... release #{version} complete"
|
67
|
+
end
|
68
|
+
end
|
data/release.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{release}
|
5
|
+
s.version = "0.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["TJ Holowaychuk"]
|
9
|
+
s.date = %q{2009-03-05}
|
10
|
+
s.default_executable = %q{re}
|
11
|
+
s.description = %q{Github release management system}
|
12
|
+
s.email = %q{tj@vision-media.ca}
|
13
|
+
s.executables = ["re"]
|
14
|
+
s.extra_rdoc_files = ["bin/re", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
15
|
+
s.files = ["bin/re", "History.rdoc", "Manifest", "Rakefile", "README.rdoc", "release.gemspec", "spec/fixtures/bar/version.rb", "spec/fixtures/foo.rb", "spec/release_spec.rb", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "Todo.rdoc"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{http://github.com/visionmedia/release}
|
18
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Release", "--main", "README.rdoc"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{release}
|
21
|
+
s.rubygems_version = %q{1.3.1}
|
22
|
+
s.summary = %q{Github release management system}
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 2
|
27
|
+
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
+
else
|
30
|
+
end
|
31
|
+
else
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
describe "bin/re" do
|
3
|
+
|
4
|
+
before :each do
|
5
|
+
@input = StringIO.new
|
6
|
+
@output = StringIO.new
|
7
|
+
$terminal = HighLine.new @input, @output
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "bump" do
|
11
|
+
before :each do
|
12
|
+
@previous_version = extract_version_from(locate_version_file)
|
13
|
+
@bump = get_command :bump
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should locate version file" do
|
17
|
+
locate_version_file.should include('fixtures/bar/version.rb')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should use default rake tasks manifest and gemspec" do
|
21
|
+
@bump.call
|
22
|
+
@output.string.should include('rake manifest')
|
23
|
+
@output.string.should include('rake gemspec')
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should add a commit message" do
|
27
|
+
@bump.call
|
28
|
+
@output.string.should include("git commit -a -m")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should push, tag, and push tags" do
|
32
|
+
@bump.call
|
33
|
+
@output.string.should include("git tag")
|
34
|
+
@output.string.should include("git push")
|
35
|
+
@output.string.should include("git push --tags")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should bump patch level by default" do
|
39
|
+
@bump.call
|
40
|
+
extract_version_from(locate_version_file)[2].should == @previous_version[2] + 1
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should bump patch level using tiny" do
|
44
|
+
@bump.call ['tiny']
|
45
|
+
extract_version_from(locate_version_file)[2].should == @previous_version[2] + 1
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should bump patch level using patch" do
|
49
|
+
@bump.call ['patch']
|
50
|
+
extract_version_from(locate_version_file)[2].should == @previous_version[2] + 1
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should bump minor level" do
|
54
|
+
@bump.call ['minor']
|
55
|
+
extract_version_from(locate_version_file)[1].should == @previous_version[1] + 1
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should bump major level" do
|
59
|
+
@bump.call ['major']
|
60
|
+
extract_version_from(locate_version_file)[0].should == @previous_version[0] + 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should allow altering of commit message with --message" do
|
64
|
+
run 'bump', '--message', 'New release of VERSION'
|
65
|
+
@output.string.should include('New release of')
|
66
|
+
end
|
67
|
+
|
68
|
+
# it "should allow altering rake tasks with --rake" do
|
69
|
+
# run 'bump', '--rake', 'foo,bar'
|
70
|
+
# @output.string.should include('rake foo')
|
71
|
+
# @output.string.should include('rake bar')
|
72
|
+
# end
|
73
|
+
|
74
|
+
# it "should allow you to specify a version file with --file" do
|
75
|
+
# foo = File.dirname(__FILE__) + '/fixtures/foo.rb'
|
76
|
+
# previous_version = extract_version_from foo
|
77
|
+
# run 'bump', '--file', foo
|
78
|
+
# extract_version_from(foo)[2].should == previous_version[2] + 1
|
79
|
+
# end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
load File.expand_path(File.dirname(__FILE__) + '/../bin/re')
|
3
|
+
|
4
|
+
def locate_version_file
|
5
|
+
Dir["#{File.dirname(__FILE__)}/*/**/*.rb"].grep(/version/).first
|
6
|
+
end
|
7
|
+
|
8
|
+
def sh command
|
9
|
+
say command
|
10
|
+
end
|
11
|
+
|
12
|
+
def run *args
|
13
|
+
$command_runner = Commander::Runner.new args
|
14
|
+
program :name, 'release'
|
15
|
+
program :version, '0.0.1'
|
16
|
+
program :description, 'Github release management'
|
17
|
+
end
|
data/tasks/docs.rake
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
namespace :docs do
|
3
|
+
|
4
|
+
desc 'Remove rdoc products'
|
5
|
+
task :remove => [:clobber_docs]
|
6
|
+
|
7
|
+
desc 'Build docs, and open in browser for viewing (specify BROWSER)'
|
8
|
+
task :open do
|
9
|
+
browser = ENV["BROWSER"] || "safari"
|
10
|
+
sh "open -a #{browser} doc/index.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/tasks/gemspec.rake
ADDED
data/tasks/spec.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc "Run all specifications"
|
5
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
6
|
+
t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :spec do
|
10
|
+
|
11
|
+
desc "Run all specifications verbosely"
|
12
|
+
Spec::Rake::SpecTask.new(:verbose) do |t|
|
13
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Run specific specification verbosely (specify SPEC)"
|
17
|
+
Spec::Rake::SpecTask.new(:select) do |t|
|
18
|
+
t.spec_files = [ENV["SPEC"]]
|
19
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: visionmedia-release
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TJ Holowaychuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-05 00:00:00 -08:00
|
13
|
+
default_executable: re
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Github release management system
|
17
|
+
email: tj@vision-media.ca
|
18
|
+
executables:
|
19
|
+
- re
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- bin/re
|
24
|
+
- README.rdoc
|
25
|
+
- tasks/docs.rake
|
26
|
+
- tasks/gemspec.rake
|
27
|
+
- tasks/spec.rake
|
28
|
+
files:
|
29
|
+
- bin/re
|
30
|
+
- History.rdoc
|
31
|
+
- Manifest
|
32
|
+
- Rakefile
|
33
|
+
- README.rdoc
|
34
|
+
- release.gemspec
|
35
|
+
- spec/fixtures/bar/version.rb
|
36
|
+
- spec/fixtures/foo.rb
|
37
|
+
- spec/release_spec.rb
|
38
|
+
- spec/spec_helper.rb
|
39
|
+
- tasks/docs.rake
|
40
|
+
- tasks/gemspec.rake
|
41
|
+
- tasks/spec.rake
|
42
|
+
- Todo.rdoc
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/visionmedia/release
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --line-numbers
|
48
|
+
- --inline-source
|
49
|
+
- --title
|
50
|
+
- Release
|
51
|
+
- --main
|
52
|
+
- README.rdoc
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "1.2"
|
66
|
+
version:
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project: release
|
70
|
+
rubygems_version: 1.2.0
|
71
|
+
signing_key:
|
72
|
+
specification_version: 2
|
73
|
+
summary: Github release management system
|
74
|
+
test_files: []
|
75
|
+
|