technicalpickles-jeweler 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.markdown +27 -7
- data/README.markdown +9 -3
- data/Rakefile +30 -24
- data/TODO +2 -2
- data/VERSION.yml +2 -2
- data/bin/jeweler +1 -77
- data/lib/jeweler/commands/build_gem.rb +22 -0
- data/lib/jeweler/commands/install_gem.rb +19 -0
- data/lib/jeweler/commands/release.rb +45 -0
- data/lib/jeweler/commands/validate_gemspec.rb +21 -0
- data/lib/jeweler/commands/version/base.rb +30 -0
- data/lib/jeweler/commands/version/bump_major.rb +13 -0
- data/lib/jeweler/commands/version/bump_minor.rb +12 -0
- data/lib/jeweler/commands/version/bump_patch.rb +14 -0
- data/lib/jeweler/commands/version/write.rb +12 -0
- data/lib/jeweler/commands/write_gemspec.rb +26 -0
- data/lib/jeweler/commands.rb +10 -0
- data/lib/jeweler/{gemspec.rb → gemspec_helper.rb} +7 -1
- data/lib/jeweler/generator/application.rb +45 -0
- data/lib/jeweler/generator/options.rb +64 -0
- data/lib/jeweler/generator.rb +66 -26
- data/lib/jeweler/tasks.rb +11 -29
- data/lib/jeweler/templates/.gitignore +3 -1
- data/lib/jeweler/templates/LICENSE +1 -1
- data/lib/jeweler/templates/README.rdoc +7 -0
- data/lib/jeweler/templates/Rakefile +48 -31
- data/lib/jeweler/templates/bacon/flunking.rb +1 -1
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +0 -2
- data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
- data/lib/jeweler/templates/micronaut/helper.rb +17 -0
- data/lib/jeweler/templates/minitest/flunking.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -0
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +1 -1
- data/lib/jeweler/templates/shoulda/flunking.rb +2 -2
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/flunking.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/lib/jeweler/{version.rb → version_helper.rb} +1 -1
- data/lib/jeweler.rb +59 -141
- data/test/jeweler/commands/test_build_gem.rb +53 -0
- data/{lib/jeweler/templates/features/steps/default_steps.rb → test/jeweler/commands/test_install_gem.rb} +0 -0
- data/test/jeweler/commands/test_release.rb +145 -0
- data/test/jeweler/commands/test_write_gemspec.rb +58 -0
- data/test/jeweler/commands/version/test_bump_major.rb +21 -0
- data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
- data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
- data/test/jeweler/commands/version/test_write.rb +23 -0
- data/test/test_application.rb +109 -0
- data/test/{test_gemspec.rb → test_gemspec_helper.rb} +9 -5
- data/test/test_generator.rb +179 -0
- data/test/test_helper.rb +11 -23
- data/test/test_jeweler.rb +12 -9
- data/test/test_options.rb +90 -0
- data/test/test_tasks.rb +3 -4
- data/test/{test_version.rb → test_version_helper.rb} +16 -16
- metadata +44 -11
- data/lib/jeweler/templates/README +0 -9
data/lib/jeweler/generator.rb
CHANGED
@@ -23,22 +23,30 @@ class Jeweler
|
|
23
23
|
class Generator
|
24
24
|
attr_accessor :target_dir, :user_name, :user_email, :summary, :testing_framework,
|
25
25
|
:github_repo_name, :github_username, :github_token,
|
26
|
-
:repo, :should_create_repo
|
26
|
+
:repo, :should_create_repo, :should_use_cucumber
|
27
|
+
|
28
|
+
SUPPORTED_TESTING_FRAMEWORKS = [:shoulda, :testunit, :bacon, :rspec, :micronaut, :minitest]
|
27
29
|
|
28
30
|
def initialize(github_repo_name, options = {})
|
29
|
-
if github_repo_name.nil?
|
31
|
+
if github_repo_name.nil? || github_repo_name.squeeze.strip == ""
|
30
32
|
raise NoGitHubRepoNameGiven
|
31
33
|
end
|
32
34
|
|
33
|
-
use_user_git_config
|
34
|
-
|
35
35
|
self.github_repo_name = github_repo_name
|
36
36
|
|
37
|
-
self.testing_framework = options[:testing_framework] || :shoulda
|
37
|
+
self.testing_framework = (options[:testing_framework] || :shoulda).to_sym
|
38
|
+
unless SUPPORTED_TESTING_FRAMEWORKS.include? self.testing_framework
|
39
|
+
raise ArgumentError, "Unsupported testing framework (#{testing_framework})"
|
40
|
+
end
|
41
|
+
|
38
42
|
self.target_dir = options[:directory] || self.github_repo_name
|
39
43
|
|
40
44
|
self.should_create_repo = options[:create_repo]
|
41
45
|
self.summary = options[:summary] || 'TODO'
|
46
|
+
self.should_use_cucumber= options[:use_cucumber]
|
47
|
+
|
48
|
+
use_user_git_config
|
49
|
+
|
42
50
|
end
|
43
51
|
|
44
52
|
def run
|
@@ -53,11 +61,25 @@ class Jeweler
|
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
56
|
-
|
64
|
+
# Directory where 'tests' live
|
57
65
|
def test_dir
|
58
66
|
test_or_spec
|
59
67
|
end
|
60
68
|
|
69
|
+
# Default rake task to use
|
70
|
+
def default_task
|
71
|
+
case testing_framework.to_sym
|
72
|
+
when :shoulda, :testunit, :minitest
|
73
|
+
'test'
|
74
|
+
when :bacon, :rspec
|
75
|
+
'spec'
|
76
|
+
when :micronaut
|
77
|
+
'examples'
|
78
|
+
else
|
79
|
+
raise ArgumentError, "Don't know default task for #{testing_framework}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
61
83
|
def feature_support_require
|
62
84
|
case testing_framework.to_sym
|
63
85
|
when :testunit, :shoulda, :bacon # NOTE bacon doesn't really work inside of cucumber
|
@@ -66,6 +88,8 @@ class Jeweler
|
|
66
88
|
'mini/test'
|
67
89
|
when :rspec
|
68
90
|
'spec/expectations'
|
91
|
+
when :micronaut
|
92
|
+
'micronaut/expectations'
|
69
93
|
else
|
70
94
|
raise "Don't know what to require for #{testing_framework}"
|
71
95
|
end
|
@@ -79,6 +103,8 @@ class Jeweler
|
|
79
103
|
'Mini::Test::Assertions'
|
80
104
|
when :rspec
|
81
105
|
nil
|
106
|
+
when :micronaut
|
107
|
+
'Micronaut::Matchers'
|
82
108
|
else
|
83
109
|
raise "Don't know what to extend for #{testing_framework}"
|
84
110
|
end
|
@@ -106,7 +132,16 @@ class Jeweler
|
|
106
132
|
end
|
107
133
|
|
108
134
|
def test_dir
|
109
|
-
|
135
|
+
case testing_framework.to_sym
|
136
|
+
when :shoulda, :testunit, :minitest
|
137
|
+
'test'
|
138
|
+
when :bacon, :rspec
|
139
|
+
'spec'
|
140
|
+
when :micronaut
|
141
|
+
'examples'
|
142
|
+
else
|
143
|
+
raise ArgumentError, "Don't know test dir for #{testing_framework.inspect}"
|
144
|
+
end
|
110
145
|
end
|
111
146
|
|
112
147
|
def test_filename
|
@@ -134,17 +169,7 @@ class Jeweler
|
|
134
169
|
end
|
135
170
|
|
136
171
|
def features_steps_dir
|
137
|
-
File.join(features_dir, '
|
138
|
-
end
|
139
|
-
|
140
|
-
protected
|
141
|
-
|
142
|
-
# This is in a separate method so we can stub it out during testing
|
143
|
-
def read_git_config
|
144
|
-
# we could just use Git::Base's .config, but that relies on a repo being around already
|
145
|
-
# ... which we don't have yet, since this is part of a sanity check
|
146
|
-
lib = Git::Lib.new(nil, nil)
|
147
|
-
config = lib.parse_config '~/.gitconfig'
|
172
|
+
File.join(features_dir, 'step_definitions')
|
148
173
|
end
|
149
174
|
|
150
175
|
def test_or_spec
|
@@ -153,11 +178,24 @@ class Jeweler
|
|
153
178
|
'test'
|
154
179
|
when :bacon, :rspec
|
155
180
|
'spec'
|
181
|
+
when :micronaut
|
182
|
+
'example'
|
156
183
|
else
|
157
|
-
raise "Unknown test style: #{testing_framework}"
|
184
|
+
raise ArgumentError, "Unknown test style: #{testing_framework}"
|
158
185
|
end
|
159
186
|
end
|
160
187
|
|
188
|
+
|
189
|
+
protected
|
190
|
+
|
191
|
+
# This is in a separate method so we can stub it out during testing
|
192
|
+
def read_git_config
|
193
|
+
# we could just use Git::Base's .config, but that relies on a repo being around already
|
194
|
+
# ... which we don't have yet, since this is part of a sanity check
|
195
|
+
lib = Git::Lib.new(nil, nil)
|
196
|
+
config = lib.parse_config '~/.gitconfig'
|
197
|
+
end
|
198
|
+
|
161
199
|
private
|
162
200
|
def create_files
|
163
201
|
unless File.exists?(target_dir) || File.directory?(target_dir)
|
@@ -170,7 +208,7 @@ class Jeweler
|
|
170
208
|
output_template_in_target '.gitignore'
|
171
209
|
output_template_in_target 'Rakefile'
|
172
210
|
output_template_in_target 'LICENSE'
|
173
|
-
output_template_in_target 'README'
|
211
|
+
output_template_in_target 'README.rdoc'
|
174
212
|
|
175
213
|
mkdir_in_target lib_dir
|
176
214
|
touch_in_target File.join(lib_dir, "#{file_name_prefix}.rb")
|
@@ -179,14 +217,16 @@ class Jeweler
|
|
179
217
|
output_template_in_target File.join(testing_framework.to_s, 'helper.rb'), File.join(test_dir, test_helper_filename)
|
180
218
|
output_template_in_target File.join(testing_framework.to_s, 'flunking.rb'), File.join(test_dir, test_filename)
|
181
219
|
|
182
|
-
|
183
|
-
|
220
|
+
if should_use_cucumber
|
221
|
+
mkdir_in_target features_dir
|
222
|
+
output_template_in_target File.join(%w(features default.feature)), File.join('features', feature_filename)
|
184
223
|
|
185
|
-
|
186
|
-
|
224
|
+
mkdir_in_target features_support_dir
|
225
|
+
output_template_in_target File.join(features_support_dir, 'env.rb')
|
187
226
|
|
188
|
-
|
189
|
-
|
227
|
+
mkdir_in_target features_steps_dir
|
228
|
+
touch_in_target File.join(features_steps_dir, steps_filename)
|
229
|
+
end
|
190
230
|
|
191
231
|
end
|
192
232
|
|
data/lib/jeweler/tasks.rb
CHANGED
@@ -23,24 +23,13 @@ class Jeweler
|
|
23
23
|
end
|
24
24
|
|
25
25
|
desc "Build gem"
|
26
|
-
task :build
|
27
|
-
|
28
|
-
|
29
|
-
task :gem => :'gem:build'
|
26
|
+
task :build do
|
27
|
+
@jeweler.build_gem
|
28
|
+
end
|
30
29
|
|
31
30
|
desc "Install gem using sudo"
|
32
|
-
task :install
|
33
|
-
|
34
|
-
namespace :gem do
|
35
|
-
desc "Install gem using sudo"
|
36
|
-
task :install => :build do
|
37
|
-
@jeweler.install_gem
|
38
|
-
end
|
39
|
-
|
40
|
-
desc "Build gem"
|
41
|
-
task :build => :'gemspec:validate' do
|
42
|
-
@jeweler.build_gem
|
43
|
-
end
|
31
|
+
task :install do
|
32
|
+
@jeweler.install_gem
|
44
33
|
end
|
45
34
|
|
46
35
|
desc "Generate and validates gemspec"
|
@@ -59,12 +48,11 @@ class Jeweler
|
|
59
48
|
end
|
60
49
|
|
61
50
|
desc "Displays the current version"
|
62
|
-
task :version => 'version:
|
51
|
+
task :version => 'version:setup' do
|
52
|
+
$stdout.puts "Current version: #{@jeweler.version}"
|
53
|
+
end
|
63
54
|
|
64
55
|
namespace :version do
|
65
|
-
desc "Bump the gemspec by a patch version."
|
66
|
-
task :bump => "bump:patch"
|
67
|
-
|
68
56
|
desc "Setup initial version of 0.0.0"
|
69
57
|
task :setup => "VERSION.yml"
|
70
58
|
|
@@ -75,26 +63,21 @@ class Jeweler
|
|
75
63
|
$stdout.puts "Updated version: #{@jeweler.version}"
|
76
64
|
end
|
77
65
|
|
78
|
-
desc "Displays the current version"
|
79
|
-
task :display => :setup do
|
80
|
-
$stdout.puts "Current version: #{@jeweler.version}"
|
81
|
-
end
|
82
|
-
|
83
66
|
namespace :bump do
|
84
67
|
desc "Bump the gemspec by a major version."
|
85
|
-
task :major => ['VERSION.yml', :
|
68
|
+
task :major => ['VERSION.yml', :version] do
|
86
69
|
@jeweler.bump_major_version
|
87
70
|
$stdout.puts "Updated version: #{@jeweler.version}"
|
88
71
|
end
|
89
72
|
|
90
73
|
desc "Bump the gemspec by a minor version."
|
91
|
-
task :minor => ['VERSION.yml',
|
74
|
+
task :minor => ['VERSION.yml', :version] do
|
92
75
|
@jeweler.bump_minor_version
|
93
76
|
$stdout.puts "Updated version: #{@jeweler.version}"
|
94
77
|
end
|
95
78
|
|
96
79
|
desc "Bump the gemspec by a patch version."
|
97
|
-
task :patch => ['VERSION.yml',
|
80
|
+
task :patch => ['VERSION.yml', :version] do
|
98
81
|
@jeweler.bump_patch_version
|
99
82
|
$stdout.puts "Updated version: #{@jeweler.version}"
|
100
83
|
end
|
@@ -105,7 +88,6 @@ class Jeweler
|
|
105
88
|
task :release do
|
106
89
|
@jeweler.release
|
107
90
|
end
|
108
|
-
|
109
91
|
end
|
110
92
|
end
|
111
93
|
end
|
@@ -1,14 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'rake'
|
2
3
|
|
3
4
|
begin
|
4
5
|
require 'jeweler'
|
5
|
-
Jeweler::Tasks.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "<%= github_repo_name %>"
|
8
|
+
gem.summary = %Q{<%= summary %>}
|
9
|
+
gem.email = "<%= user_email %>"
|
10
|
+
gem.homepage = "<%= github_url %>"
|
11
|
+
gem.authors = ["<%= user_name %>"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
12
13
|
end
|
13
14
|
rescue LoadError
|
14
15
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
@@ -23,49 +24,65 @@ Rake::RDocTask.new do |rdoc|
|
|
23
24
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
24
25
|
end
|
25
26
|
|
26
|
-
<%
|
27
|
+
<% case testing_framework.to_sym %>
|
28
|
+
<% when :rspec %>
|
27
29
|
require 'spec/rake/spectask'
|
28
|
-
Spec::Rake::SpecTask.new(:spec) do |
|
29
|
-
|
30
|
-
|
30
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
31
|
+
spec.libs << 'lib' << 'spec'
|
32
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
<% when :micronaut %>
|
35
|
+
require 'micronaut/rake_task'
|
36
|
+
Micronaut::RakeTask.new(:examples) do |examples|
|
37
|
+
examples.pattern = 'examples/**/*_example.rb'
|
38
|
+
examples.ruby_opts << '-Ilib -Iexamples'
|
31
39
|
end
|
32
40
|
<% else %>
|
33
41
|
require 'rake/testtask'
|
34
|
-
Rake::TestTask.new(:<%= test_or_spec %>) do
|
35
|
-
|
36
|
-
|
37
|
-
|
42
|
+
Rake::TestTask.new(:<%= test_or_spec %>) do |<%= test_or_spec %>|
|
43
|
+
<%= test_or_spec %>.libs << 'lib' << '<%= test_or_spec %>'
|
44
|
+
<%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
|
45
|
+
<%= test_or_spec %>.verbose = false
|
38
46
|
end
|
39
47
|
<% end %>
|
40
48
|
|
41
|
-
<%
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
<% case testing_framework.to_sym %>
|
50
|
+
<% when :rspec %>
|
51
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
52
|
+
spec.libs << 'lib' << 'spec'
|
53
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
54
|
+
spec.rcov = true
|
55
|
+
end
|
56
|
+
<% when :micronaut %>
|
57
|
+
Micronaut::RakeTask.new(:rcov) do |examples|
|
58
|
+
examples.pattern = 'examples/**/*_example.rb'
|
59
|
+
examples.rcov_opts = '-Ilib -Iexamples'
|
60
|
+
examples.rcov = true
|
46
61
|
end
|
47
62
|
<% else %>
|
48
63
|
begin
|
49
64
|
require 'rcov/rcovtask'
|
50
|
-
Rcov::RcovTask.new do
|
51
|
-
|
52
|
-
|
53
|
-
|
65
|
+
Rcov::RcovTask.new do |<%= test_or_spec %>|
|
66
|
+
<%= test_or_spec %>.libs << '<%= test_or_spec %>'
|
67
|
+
<%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
|
68
|
+
<%= test_or_spec %>.verbose = true
|
54
69
|
end
|
55
70
|
rescue LoadError
|
56
|
-
|
71
|
+
task :rcov do
|
72
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
73
|
+
end
|
57
74
|
end
|
58
75
|
<% end %>
|
59
76
|
|
77
|
+
<% if should_use_cucumber %>
|
60
78
|
begin
|
61
79
|
require 'cucumber/rake/task'
|
62
80
|
Cucumber::Rake::Task.new(:features)
|
63
81
|
rescue LoadError
|
64
|
-
|
82
|
+
task :features do
|
83
|
+
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
84
|
+
end
|
65
85
|
end
|
66
|
-
|
67
|
-
<% if testing_framework.to_sym == :rspec %>
|
68
|
-
task :default => :spec
|
69
|
-
<% else %>
|
70
|
-
task :default => :test
|
71
86
|
<% end %>
|
87
|
+
|
88
|
+
task :default => :<%= default_task %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'micronaut'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
|
7
|
+
require '<%= file_name_prefix %>'
|
8
|
+
|
9
|
+
def not_in_editor?
|
10
|
+
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
|
11
|
+
end
|
12
|
+
|
13
|
+
Micronaut.configure do |c|
|
14
|
+
c.color_enabled = not_in_editor?
|
15
|
+
c.filter_run :focused => true
|
16
|
+
end
|
17
|
+
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class <%= constant_name %>Test < Test::Unit::TestCase
|
4
4
|
should "probably rename this file and start testing for real" do
|
5
5
|
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
6
|
end
|
7
|
-
end
|
7
|
+
end
|