ritual 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.4.0 2012-01-07
2
+
3
+ * 'ritual' command for creating new gems.
4
+ * Fix spec_task.
5
+
1
6
  == 0.3.1 2011-09-01
2
7
 
3
8
  * Better error message when version file is invalid.
data/bin/ritual ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'ritual/version'
5
+ ROOT = File.expand_path('..', File.dirname(__FILE__))
6
+
7
+ module Ritual
8
+ class CLI < Thor
9
+ include Thor::Actions
10
+
11
+ desc "new GEMNAME", "Create a new gem in a subdirectory."
12
+ def new(name)
13
+ File.exist?(name) and
14
+ abort "file exists: #{name}"
15
+ empty_directory name
16
+ self.destination_root = name
17
+ Dir.chdir name do
18
+ apply
19
+ system 'git', 'init'
20
+ system 'git', 'add', '.'
21
+ system 'git', 'commit', '-m', 'New gem.'
22
+ end
23
+ end
24
+
25
+ desc "apply", "Ritualize the gem in the current directory."
26
+ def apply
27
+ template "#{ROOT}/templates/Gemfile", "Gemfile"
28
+ template "#{ROOT}/templates/Rakefile", "Rakefile"
29
+ template "#{ROOT}/templates/CHANGELOG", "CHANGELOG"
30
+ template "#{ROOT}/templates/README.markdown", "README.markdown"
31
+ template "#{ROOT}/templates/LICENSE", "LICENSE"
32
+ template "#{ROOT}/templates/lib.rb", "lib/#{gem_name}.rb"
33
+ template "#{ROOT}/templates/version.rb", "lib/#{gem_name}/version.rb"
34
+ template "#{ROOT}/templates/gemspec.rb", "#{gem_name}.gemspec"
35
+ end
36
+
37
+ source_root "#{ROOT}/templates"
38
+
39
+ private
40
+
41
+ def gem_name
42
+ @gem_name ||= File.basename(Dir.pwd)
43
+ end
44
+
45
+ def namespace
46
+ @namespace ||= gem_name.gsub(/(?:\A|(.)_)(.)/) {$1.to_s + $2.upcase}
47
+ end
48
+
49
+ def human_name
50
+ @human_name ||= gem_name.gsub(/(?:\A|(.)_)(.)/) {"#$1 " + $2.upcase}.lstrip
51
+ end
52
+
53
+ def author
54
+ @author ||= ENV['RITUAL_AUTHOR'] || `git config user.name`.strip
55
+ end
56
+
57
+ def email
58
+ @email ||= ENV['RITUAL_EMAIL'] || `git config user.email`.strip
59
+ end
60
+
61
+ def ritual_version
62
+ @ritual_version ||= ENV['RITUAL_VERSION'] || Ritual::VERSION
63
+ end
64
+ end
65
+ end
66
+
67
+ Ritual::CLI.start(ARGV)
data/lib/ritual.rb CHANGED
@@ -79,12 +79,14 @@ end
79
79
 
80
80
  def spec_task(*args, &block)
81
81
  require 'rspec/core/rake_task'
82
- RSpec::Core::RakeTask.new(&block)
82
+ RSpec::Core::RakeTask.new(*args, &block)
83
83
  rescue LoadError
84
84
  begin
85
85
  require 'rspec/rake/spectask'
86
86
  Spec::Rake::SpecTask.new(*args, &block)
87
87
  rescue LoadError
88
+ require 'spec/rake/spectask'
89
+ Spec::Rake::SpecTask.new(*args, &block)
88
90
  end
89
91
  end
90
92
 
@@ -1,5 +1,5 @@
1
1
  module Ritual
2
- VERSION = [0, 3, 1]
2
+ VERSION = [0, 4, 0]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -0,0 +1,3 @@
1
+ == LATEST
2
+
3
+ * Hi.
data/templates/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/templates/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= author %>
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.
@@ -0,0 +1 @@
1
+ ## <%= human_name %>
@@ -0,0 +1 @@
1
+ require 'ritual'
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.unshift File.expand_path('lib', File.dirname(__FILE__))
3
+ require '<%= gem_name %>/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = '<%= gem_name %>'
7
+ gem.version = <%= namespace %>::VERSION
8
+ gem.authors = ['<%= author %>']
9
+ gem.email = ['<%= email %>']
10
+ gem.description = "TODO: Write a gem description"
11
+ gem.summary = "TODO: Write a gem summary"
12
+ gem.homepage = ''
13
+
14
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+
18
+ gem.add_development_dependency 'ritual', '~> <%= ritual_version %>'
19
+ end
data/templates/lib.rb ADDED
@@ -0,0 +1,3 @@
1
+ module <%= namespace %>
2
+ autoload :VERSION, '<%= gem_name %>/version'
3
+ end
@@ -0,0 +1,11 @@
1
+ module <%= namespace %>
2
+ VERSION = [0, 0, 0]
3
+
4
+ class << VERSION
5
+ include Comparable
6
+
7
+ def to_s
8
+ join('.')
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ritual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-01 00:00:00.000000000Z
12
+ date: 2012-01-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70216021490160 !ruby/object:Gem::Requirement
16
+ requirement: &70309457910760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70216021490160
24
+ version_requirements: *70309457910760
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70309457910260 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70309457910260
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &70216021489400 !ruby/object:Gem::Requirement
38
+ requirement: &70309457909660 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '2.0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70216021489400
46
+ version_requirements: *70309457909660
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: cucumber
38
- requirement: &70216021488760 !ruby/object:Gem::Requirement
49
+ requirement: &70309457909180 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70216021488760
57
+ version_requirements: *70309457909180
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: ruby-debug19
49
- requirement: &70216021488220 !ruby/object:Gem::Requirement
60
+ requirement: &70309457908600 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,7 +65,7 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70216021488220
68
+ version_requirements: *70309457908600
58
69
  description: ! 'Adds tasks and helpers to your Rakefile to manage releases in a
59
70
 
60
71
  lightweight manner.
@@ -62,7 +73,8 @@ description: ! 'Adds tasks and helpers to your Rakefile to manage releases in a
62
73
  '
63
74
  email:
64
75
  - george.ogata@gmail.com
65
- executables: []
76
+ executables:
77
+ - ritual
66
78
  extensions: []
67
79
  extra_rdoc_files: []
68
80
  files:
@@ -75,10 +87,19 @@ files:
75
87
  - lib/ritual/version.rb
76
88
  - lib/ritual/version_file.rb
77
89
  - lib/ritual.rb
90
+ - templates/CHANGELOG
91
+ - templates/Gemfile
92
+ - templates/gemspec.rb
93
+ - templates/lib.rb
94
+ - templates/LICENSE
95
+ - templates/Rakefile
96
+ - templates/README.markdown
97
+ - templates/version.rb
78
98
  - LICENSE
79
99
  - README.markdown
80
100
  - Rakefile
81
101
  - CHANGELOG
102
+ - bin/ritual
82
103
  homepage: http://github.com/oggy/ritual
83
104
  licenses: []
84
105
  post_install_message:
@@ -99,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
120
  version: 1.3.6
100
121
  requirements: []
101
122
  rubyforge_project:
102
- rubygems_version: 1.8.6
123
+ rubygems_version: 1.8.10
103
124
  signing_key:
104
125
  specification_version: 3
105
126
  summary: Rakefile release tasks and helpers.