ritual 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/LICENSE +20 -0
- data/README.markdown +54 -0
- data/Rakefile +2 -0
- data/lib/ritual.rb +143 -0
- data/lib/ritual/version.rb +3 -0
- metadata +73 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 George Ogata
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Ritual
|
2
|
+
|
3
|
+
Adds tasks and helpers to your Rakefile to manage releases.
|
4
|
+
|
5
|
+
Much more lightweight than [Jeweler][jeweler] or [Newgem][newgem]. Way less
|
6
|
+
flexible, as it's only geared towards my workflow so far.
|
7
|
+
|
8
|
+
Like the idea? Feel free to fork and send patches!
|
9
|
+
|
10
|
+
[jeweler]: http://github.com/technicalpickles/jeweler
|
11
|
+
[newgem]: http://github.com/drnic/newgem
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
In `Rakefile`:
|
16
|
+
|
17
|
+
gem 'ritual'
|
18
|
+
require 'ritual'
|
19
|
+
|
20
|
+
Adds some shortcuts:
|
21
|
+
|
22
|
+
* `spec_task(*args, &block)`: Define a spec task. Noop if RSpec cannot be
|
23
|
+
loaded.
|
24
|
+
* `rdoc_task(*args, &block)`: Define an rdoc task.
|
25
|
+
|
26
|
+
And some tasks:
|
27
|
+
|
28
|
+
* `rake major release`
|
29
|
+
* `rake minor release`
|
30
|
+
* `rake patch release`
|
31
|
+
* Perform the release ritual:
|
32
|
+
* Bump the major/minor/patch version. This is defined in
|
33
|
+
`lib/<library-name>/version.rb.`
|
34
|
+
* Tag the release in git.
|
35
|
+
* Push the git repo to origin.
|
36
|
+
* Build the gem from the gemspec.
|
37
|
+
* Push the gem to Gemcutter.
|
38
|
+
|
39
|
+
You [maintain the gemspec directly][using-gemspecs-as-intended], rather than via
|
40
|
+
a wrapper like Jeweler or Hoe.
|
41
|
+
|
42
|
+
[using-gemspecs-as-intended]: http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended
|
43
|
+
|
44
|
+
## Note on Patches/Pull Requests
|
45
|
+
|
46
|
+
* Bug reports: http://github.com/oggy/ritual/issues
|
47
|
+
* Source: http://github.com/oggy/ritual
|
48
|
+
* Patches: Fork on Github, send pull request.
|
49
|
+
* Ensure patch includes tests.
|
50
|
+
* Leave the version alone, or bump it in a separate commit.
|
51
|
+
|
52
|
+
## Copyright
|
53
|
+
|
54
|
+
Copyright (c) 2010 George Ogata. See LICENSE for details.
|
data/Rakefile
ADDED
data/lib/ritual.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
desc "Select a major version bump."
|
4
|
+
task :major do
|
5
|
+
Ritual.component = 0
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Select a minor version bump."
|
9
|
+
task :minor do
|
10
|
+
Ritual.component = 1
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Select a patch version bump."
|
14
|
+
task :patch do
|
15
|
+
Ritual.component = 2
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Bump the patch version and do the release ritual."
|
19
|
+
task :release => %w'ritual:check_release_args ritual:bump ritual:tag ritual:push ritual:build ritual:push_gem'
|
20
|
+
|
21
|
+
# Private helper tasks.
|
22
|
+
namespace :ritual do
|
23
|
+
task :check_release_args do
|
24
|
+
Ritual.component or
|
25
|
+
raise "Please select a version component to bump, e.g.: rake patch release"
|
26
|
+
end
|
27
|
+
|
28
|
+
task :bump do
|
29
|
+
version.increment(Ritual.component)
|
30
|
+
version.write
|
31
|
+
sh "git add #{version.path}"
|
32
|
+
sh "git commit #{version.path} -m 'Bump to version #{version}.'"
|
33
|
+
puts "Bumped to version #{version}."
|
34
|
+
end
|
35
|
+
|
36
|
+
task :tag do
|
37
|
+
sh "git tag v#{version}"
|
38
|
+
end
|
39
|
+
|
40
|
+
task :push do
|
41
|
+
sh "git push origin master"
|
42
|
+
end
|
43
|
+
|
44
|
+
task :build do
|
45
|
+
sh "gem build #{library_name}.gemspec"
|
46
|
+
end
|
47
|
+
|
48
|
+
task :push_gem do
|
49
|
+
sh "gem push #{library_name}-#{version}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
module Ritual
|
54
|
+
class << self
|
55
|
+
attr_accessor :component
|
56
|
+
|
57
|
+
def library_name
|
58
|
+
ENV['LIB'] || default_library_name
|
59
|
+
end
|
60
|
+
|
61
|
+
def default_library_name
|
62
|
+
gemspecs = Dir['*.gemspec']
|
63
|
+
names = gemspecs.map{|path| File.basename(path, '.gemspec')}
|
64
|
+
if names.size.zero?
|
65
|
+
abort "cannot find any gemspecs"
|
66
|
+
elsif names.size > 1
|
67
|
+
abort "choose a gemspec: LIB=#{names.join('|')}"
|
68
|
+
end
|
69
|
+
names.first
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class Version
|
74
|
+
def initialize(library_name)
|
75
|
+
@library_name = library_name
|
76
|
+
@value ||= read
|
77
|
+
end
|
78
|
+
|
79
|
+
attr_reader :value, :library_name
|
80
|
+
|
81
|
+
def to_s
|
82
|
+
value.join('.')
|
83
|
+
end
|
84
|
+
|
85
|
+
def read
|
86
|
+
if File.exist?(path)
|
87
|
+
load path
|
88
|
+
self.module::VERSION
|
89
|
+
else
|
90
|
+
self.module.const_set(:VERSION, [0, 0, 0])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def write
|
95
|
+
FileUtils.mkdir_p File.dirname(path)
|
96
|
+
open(path, 'w') do |file|
|
97
|
+
file.puts "module #{module_name}\n VERSION = #{value.inspect}\nend"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def increment(component)
|
102
|
+
value[component] += 1
|
103
|
+
(component+1 ... value.size).each{|i| value[i] = 0}
|
104
|
+
end
|
105
|
+
|
106
|
+
def path
|
107
|
+
"lib/#{library_name}/version.rb"
|
108
|
+
end
|
109
|
+
|
110
|
+
def module_name
|
111
|
+
library_name.gsub(/(?:\A|_)(.)/){$1.upcase}
|
112
|
+
end
|
113
|
+
|
114
|
+
def module
|
115
|
+
Object.const_defined?(module_name) or
|
116
|
+
Object.const_set(module_name, Module.new)
|
117
|
+
Object.const_get(module_name)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#
|
123
|
+
# Global API
|
124
|
+
#
|
125
|
+
|
126
|
+
def library_name
|
127
|
+
Ritual.library_name
|
128
|
+
end
|
129
|
+
|
130
|
+
def version
|
131
|
+
@version ||= Ritual::Version.new(library_name)
|
132
|
+
end
|
133
|
+
|
134
|
+
def spec_task(*args, &block)
|
135
|
+
require 'spec/rake/spectask'
|
136
|
+
Spec::Rake::SpecTask.new(*args, &block)
|
137
|
+
rescue LoadError
|
138
|
+
end
|
139
|
+
|
140
|
+
def rdoc_task(*args, &block)
|
141
|
+
require 'rake/rdoctask'
|
142
|
+
Rake::RDocTask.new(*args, &block)
|
143
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ritual
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- George Ogata
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-12 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: |
|
22
|
+
Adds tasks and helpers to your Rakefile to manage releases in a
|
23
|
+
lightweight manner.
|
24
|
+
|
25
|
+
email:
|
26
|
+
- george.ogata@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- lib/ritual/version.rb
|
35
|
+
- lib/ritual.rb
|
36
|
+
- LICENSE
|
37
|
+
- README.markdown
|
38
|
+
- Rakefile
|
39
|
+
- CHANGELOG
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://github.com/oggy/ritual
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 3
|
63
|
+
- 6
|
64
|
+
version: 1.3.6
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.3.6
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Rakefile release tasks and helpers.
|
72
|
+
test_files: []
|
73
|
+
|