jeweler 0.11.0 → 0.11.1
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 +8 -0
- data/README.markdown +2 -4
- data/Rakefile +9 -4
- data/VERSION.yml +2 -2
- data/lib/jeweler/generator.rb +39 -108
- data/lib/jeweler/generator/application.rb +8 -3
- data/lib/jeweler/generator/bacon_mixin.rb +39 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +38 -0
- data/lib/jeweler/generator/minitest_mixin.rb +39 -0
- data/lib/jeweler/generator/options.rb +5 -1
- data/lib/jeweler/generator/rspec_mixin.rb +39 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +39 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/templates/README.rdoc +1 -1
- data/lib/jeweler/templates/Rakefile +26 -26
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +4 -7
- data/lib/jeweler/templates/micronaut/helper.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +1 -1
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/test/test_application.rb +26 -0
- data/test/test_gemspec_helper.rb +4 -0
- data/test/test_generator.rb +80 -113
- data/test/test_generator_initialization.rb +113 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +1 -0
- data/test/test_options.rb +6 -0
- data/test/version_tmp/VERSION.yml +1 -1
- metadata +23 -5
- data/test/generators/initialization_test.rb +0 -146
@@ -0,0 +1,39 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
module RspecMixin
|
4
|
+
|
5
|
+
def default_task
|
6
|
+
'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
def feature_support_require
|
10
|
+
'spec/expectations'
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_support_extend
|
14
|
+
nil # Cucumber is smart enough extend Spec::Expectations on its own
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_dir
|
18
|
+
'spec'
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_task
|
22
|
+
'spec'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_pattern
|
26
|
+
'spec/**/*_spec.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_filename
|
30
|
+
"#{require_name}_spec.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_helper_filename
|
34
|
+
"spec_helper.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
module ShouldaMixin
|
4
|
+
|
5
|
+
def default_task
|
6
|
+
'test'
|
7
|
+
end
|
8
|
+
|
9
|
+
def feature_support_require
|
10
|
+
'test/unit/assertions'
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_support_extend
|
14
|
+
'Test::Unit::Assertions'
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_dir
|
18
|
+
'test'
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_task
|
22
|
+
'test'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_pattern
|
26
|
+
'test/**/*_test.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_filename
|
30
|
+
"#{require_name}_test.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_helper_filename
|
34
|
+
"test_helper.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
module TestunitMixin
|
4
|
+
|
5
|
+
def default_task
|
6
|
+
'test'
|
7
|
+
end
|
8
|
+
|
9
|
+
def feature_support_require
|
10
|
+
'test/unit/assertions'
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_support_extend
|
14
|
+
'Test::Unit::Assertions'
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_dir
|
18
|
+
'test'
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_task
|
22
|
+
'test'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_pattern
|
26
|
+
'test/**/*_test.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_filename
|
30
|
+
"#{require_name}_test.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_helper_filename
|
34
|
+
"test_helper.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -4,62 +4,62 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "<%=
|
7
|
+
gem.name = "<%= project_name %>"
|
8
8
|
gem.summary = %Q{<%= summary %>}
|
9
9
|
gem.email = "<%= user_email %>"
|
10
|
-
gem.homepage = "<%=
|
10
|
+
gem.homepage = "<%= project_homepage %>"
|
11
11
|
gem.authors = ["<%= user_name %>"]
|
12
12
|
<% if should_setup_rubyforge %>
|
13
|
-
gem.rubyforge_project = "<%=
|
14
|
-
|
13
|
+
gem.rubyforge_project = "<%= project_name %>"
|
14
|
+
<% end %>
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
rescue LoadError
|
18
|
-
puts "Jeweler not available. Install it with: sudo gem install
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
19
|
end
|
20
20
|
|
21
|
-
<% case testing_framework
|
21
|
+
<% case testing_framework %>
|
22
22
|
<% when :rspec %>
|
23
23
|
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(
|
25
|
-
|
26
|
-
|
24
|
+
Spec::Rake::SpecTask.new(:<%= test_task %>) do |<%= test_task %>|
|
25
|
+
<%= test_task %>.libs << 'lib' << '<%= test_dir %>'
|
26
|
+
<%= test_task %>.spec_files = FileList['<%= test_pattern %>']
|
27
27
|
end
|
28
28
|
<% when :micronaut %>
|
29
29
|
require 'micronaut/rake_task'
|
30
|
-
Micronaut::RakeTask.new(
|
31
|
-
|
32
|
-
|
30
|
+
Micronaut::RakeTask.new(<%= test_task %>) do |<%= test_task %>|
|
31
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
32
|
+
<%= test_task %>.ruby_opts << '-Ilib -I<%= test_dir %>'
|
33
33
|
end
|
34
34
|
<% else %>
|
35
35
|
require 'rake/testtask'
|
36
|
-
Rake::TestTask.new(:<%=
|
37
|
-
<%=
|
38
|
-
<%=
|
39
|
-
<%=
|
36
|
+
Rake::TestTask.new(:<%= test_task %>) do |<%= test_task %>|
|
37
|
+
<%= test_task %>.libs << 'lib' << '<%= test_dir %>'
|
38
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
39
|
+
<%= test_task %>.verbose = true
|
40
40
|
end
|
41
41
|
<% end %>
|
42
42
|
|
43
|
-
<% case testing_framework
|
43
|
+
<% case testing_framework %>
|
44
44
|
<% when :rspec %>
|
45
45
|
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
46
46
|
spec.libs << 'lib' << 'spec'
|
47
|
-
spec.pattern = '
|
47
|
+
spec.pattern = '<%= test_pattern %>'
|
48
48
|
spec.rcov = true
|
49
49
|
end
|
50
50
|
<% when :micronaut %>
|
51
51
|
Micronaut::RakeTask.new(:rcov) do |examples|
|
52
|
-
examples.pattern = '
|
53
|
-
examples.rcov_opts = '-Ilib -
|
52
|
+
examples.pattern = '<%= test_pattern %>'
|
53
|
+
examples.rcov_opts = '-Ilib -I<%= test_dir %>'
|
54
54
|
examples.rcov = true
|
55
55
|
end
|
56
56
|
<% else %>
|
57
57
|
begin
|
58
58
|
require 'rcov/rcovtask'
|
59
|
-
Rcov::RcovTask.new do |<%=
|
60
|
-
<%=
|
61
|
-
<%=
|
62
|
-
<%=
|
59
|
+
Rcov::RcovTask.new do |<%= test_task %>|
|
60
|
+
<%= test_task %>.libs << '<%= test_dir %>'
|
61
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
62
|
+
<%= test_task %>.verbose = true
|
63
63
|
end
|
64
64
|
rescue LoadError
|
65
65
|
task :rcov do
|
@@ -91,7 +91,7 @@ Rake::RDocTask.new do |rdoc|
|
|
91
91
|
end
|
92
92
|
|
93
93
|
rdoc.rdoc_dir = 'rdoc'
|
94
|
-
rdoc.title = "<%=
|
94
|
+
rdoc.title = "<%= project_name %> #{version}"
|
95
95
|
rdoc.rdoc_files.include('README*')
|
96
96
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
97
97
|
end
|
@@ -112,7 +112,7 @@ begin
|
|
112
112
|
)
|
113
113
|
|
114
114
|
host = "#{config['username']}@rubyforge.org"
|
115
|
-
remote_dir = "/var/www/gforge-projects/<%=
|
115
|
+
remote_dir = "/var/www/gforge-projects/<%= project_name %>/"
|
116
116
|
local_dir = 'rdoc'
|
117
117
|
|
118
118
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
@@ -1,11 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
-
require '<%=
|
2
|
+
require '<%= require_name %>'
|
3
3
|
|
4
4
|
require '<%= feature_support_require %>'
|
5
|
+
<% if feature_support_extend %>
|
5
6
|
|
6
|
-
World
|
7
|
-
|
8
|
-
world.extend(<%= feature_support_extend %>)
|
9
|
-
<% end %>
|
10
|
-
world
|
11
|
-
end
|
7
|
+
World(<%= feature_support_extend %>)
|
8
|
+
<% end %>
|
@@ -4,7 +4,7 @@ require 'micronaut'
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
|
7
|
-
require '<%=
|
7
|
+
require '<%= require_name %>'
|
8
8
|
|
9
9
|
def not_in_editor?
|
10
10
|
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
|
data/test/test_application.rb
CHANGED
@@ -77,6 +77,32 @@ class TestApplication < Test::Unit::TestCase
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
context "called with --invalid-argument" do
|
81
|
+
setup do
|
82
|
+
@generator = build_generator
|
83
|
+
stub(@generator).run
|
84
|
+
stub(Jeweler::Generator).new { raise "Shouldn't have made this far"}
|
85
|
+
|
86
|
+
assert_nothing_raised do
|
87
|
+
@result = run_application("--invalid-argument")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
should_exit_with_code 1
|
92
|
+
|
93
|
+
should 'display invalid argument' do
|
94
|
+
assert_match '--invalid-argument', @stderr
|
95
|
+
end
|
96
|
+
|
97
|
+
should 'display usage on stderr' do
|
98
|
+
assert_match 'Usage:', @stderr
|
99
|
+
end
|
100
|
+
|
101
|
+
should 'not display anything on stdout' do
|
102
|
+
assert_equal '', @stdout.squeeze.strip
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
80
106
|
context "when called with repo name" do
|
81
107
|
setup do
|
82
108
|
@options = {:testing_framework => :shoulda}
|
data/test/test_gemspec_helper.rb
CHANGED
data/test/test_generator.rb
CHANGED
@@ -50,134 +50,101 @@ class TestGenerator < Test::Unit::TestCase
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
assert_equal 'test', build_generator(:shoulda).test_or_spec
|
56
|
-
end
|
57
|
-
|
58
|
-
should "be test for testunit" do
|
59
|
-
assert_equal 'test', build_generator(:testunit).test_or_spec
|
60
|
-
end
|
61
|
-
|
62
|
-
should "be test for minitest" do
|
63
|
-
assert_equal 'test', build_generator(:minitest).test_or_spec
|
64
|
-
end
|
65
|
-
|
66
|
-
should "be spec for bacon" do
|
67
|
-
assert_equal 'spec', build_generator(:bacon).test_or_spec
|
68
|
-
end
|
69
|
-
|
70
|
-
should "be spec for rspec" do
|
71
|
-
assert_equal 'spec', build_generator(:rspec).test_or_spec
|
72
|
-
end
|
73
|
-
|
74
|
-
should "be example for micronaut" do
|
75
|
-
assert_equal 'example', build_generator(:micronaut).test_or_spec
|
76
|
-
end
|
53
|
+
should "have the correct git remote" do
|
54
|
+
assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote
|
77
55
|
end
|
78
56
|
|
79
|
-
|
80
|
-
|
81
|
-
assert_equal 'test', build_generator(:shoulda).test_dir
|
82
|
-
end
|
83
|
-
|
84
|
-
should "be test for testunit" do
|
85
|
-
assert_equal 'test', build_generator(:testunit).test_dir
|
86
|
-
end
|
87
|
-
|
88
|
-
should "be test for minitest" do
|
89
|
-
assert_equal 'test', build_generator(:minitest).test_dir
|
90
|
-
end
|
91
|
-
|
92
|
-
should "be spec for bacon" do
|
93
|
-
assert_equal 'spec', build_generator(:bacon).test_dir
|
94
|
-
end
|
95
|
-
|
96
|
-
should "be spec for rspec" do
|
97
|
-
assert_equal 'spec', build_generator(:rspec).test_dir
|
98
|
-
end
|
99
|
-
|
100
|
-
should "be examples for micronaut" do
|
101
|
-
assert_equal 'examples', build_generator(:micronaut).test_dir
|
102
|
-
end
|
57
|
+
should "have the correct project homepage" do
|
58
|
+
assert_equal 'http://github.com/johndoe/the-perfect-gem', build_generator.project_homepage
|
103
59
|
end
|
104
60
|
|
105
|
-
|
106
|
-
|
107
|
-
assert_equal 'test', build_generator(:shoulda).default_task
|
108
|
-
end
|
109
|
-
|
110
|
-
should "be test for testunit" do
|
111
|
-
assert_equal 'test', build_generator(:testunit).default_task
|
112
|
-
end
|
113
|
-
|
114
|
-
should "be test for minitest" do
|
115
|
-
assert_equal 'test', build_generator(:minitest).default_task
|
116
|
-
end
|
117
|
-
|
118
|
-
should "be spec for bacon" do
|
119
|
-
assert_equal 'spec', build_generator(:bacon).default_task
|
120
|
-
end
|
121
|
-
|
122
|
-
should "be spec for rspec" do
|
123
|
-
assert_equal 'spec', build_generator(:rspec).default_task
|
124
|
-
end
|
125
|
-
|
126
|
-
should "be examples for micronaut" do
|
127
|
-
assert_equal 'examples', build_generator(:micronaut).default_task
|
128
|
-
end
|
61
|
+
should "have the correct constant name" do
|
62
|
+
assert_equal "ThePerfectGem", build_generator.constant_name
|
129
63
|
end
|
130
64
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
should "be test/unit/assertions for testunit" do
|
137
|
-
assert_equal 'test/unit/assertions', build_generator(:testunit).feature_support_require
|
138
|
-
end
|
139
|
-
|
140
|
-
should "be mini/test for minitest" do
|
141
|
-
assert_equal 'mini/test', build_generator(:minitest).feature_support_require
|
142
|
-
end
|
143
|
-
|
144
|
-
should "be test/unit/assertions for bacon" do
|
145
|
-
assert_equal 'test/unit/assertions', build_generator(:bacon).feature_support_require
|
146
|
-
end
|
147
|
-
|
148
|
-
should "be spec/expectations for rspec" do
|
149
|
-
assert_equal 'spec/expectations', build_generator(:rspec).feature_support_require
|
150
|
-
end
|
65
|
+
should "have the correct file name prefix" do
|
66
|
+
assert_equal "the_perfect_gem", build_generator.file_name_prefix
|
67
|
+
end
|
151
68
|
|
152
|
-
|
153
|
-
|
154
|
-
end
|
69
|
+
should "have the correct require name" do
|
70
|
+
assert_equal "the_perfect_gem", build_generator.require_name
|
155
71
|
end
|
156
72
|
|
157
|
-
|
158
|
-
should "
|
159
|
-
assert_equal
|
73
|
+
def self.should_have_generator_attribute(attribute, value)
|
74
|
+
should "have #{value} for #{attribute}" do
|
75
|
+
assert_equal value, build_generator(@framework).send(attribute)
|
160
76
|
end
|
77
|
+
end
|
161
78
|
|
162
|
-
|
163
|
-
|
164
|
-
|
79
|
+
context "shoulda" do
|
80
|
+
setup { @framework = :shoulda }
|
81
|
+
should_have_generator_attribute :test_task, 'test'
|
82
|
+
should_have_generator_attribute :test_dir, 'test'
|
83
|
+
should_have_generator_attribute :default_task, 'test'
|
84
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
85
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
86
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
87
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_test.rb'
|
88
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
89
|
+
end
|
165
90
|
|
166
|
-
|
167
|
-
|
168
|
-
|
91
|
+
context "testunit" do
|
92
|
+
setup { @framework = :testunit }
|
93
|
+
should_have_generator_attribute :test_task, 'test'
|
94
|
+
should_have_generator_attribute :test_dir, 'test'
|
95
|
+
should_have_generator_attribute :default_task, 'test'
|
96
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
97
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
98
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
99
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_test.rb'
|
100
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
101
|
+
end
|
169
102
|
|
170
|
-
|
171
|
-
|
172
|
-
|
103
|
+
context "minitest" do
|
104
|
+
setup { @framework = :minitest }
|
105
|
+
should_have_generator_attribute :test_task, 'test'
|
106
|
+
should_have_generator_attribute :test_dir, 'test'
|
107
|
+
should_have_generator_attribute :default_task, 'test'
|
108
|
+
should_have_generator_attribute :feature_support_require, 'mini/test'
|
109
|
+
should_have_generator_attribute :feature_support_extend, 'Mini::Test::Assertions'
|
110
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
111
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_test.rb'
|
112
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
113
|
+
end
|
173
114
|
|
174
|
-
|
175
|
-
|
176
|
-
|
115
|
+
context "bacon" do
|
116
|
+
setup { @framework = :bacon }
|
117
|
+
should_have_generator_attribute :test_task, 'spec'
|
118
|
+
should_have_generator_attribute :test_dir, 'spec'
|
119
|
+
should_have_generator_attribute :default_task, 'spec'
|
120
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
121
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
122
|
+
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
123
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_spec.rb'
|
124
|
+
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
125
|
+
end
|
177
126
|
|
178
|
-
|
179
|
-
|
180
|
-
|
127
|
+
context "rspec" do
|
128
|
+
setup { @framework = :rspec }
|
129
|
+
should_have_generator_attribute :test_task, 'spec'
|
130
|
+
should_have_generator_attribute :test_dir, 'spec'
|
131
|
+
should_have_generator_attribute :default_task, 'spec'
|
132
|
+
should_have_generator_attribute :feature_support_require, 'spec/expectations'
|
133
|
+
should_have_generator_attribute :feature_support_extend, nil
|
134
|
+
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
135
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_spec.rb'
|
136
|
+
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
181
137
|
end
|
182
138
|
|
139
|
+
context "micronaut" do
|
140
|
+
setup { @framework = :micronaut }
|
141
|
+
should_have_generator_attribute :test_task, 'examples'
|
142
|
+
should_have_generator_attribute :test_dir, 'examples'
|
143
|
+
should_have_generator_attribute :default_task, 'examples'
|
144
|
+
should_have_generator_attribute :feature_support_require, 'micronaut/expectations'
|
145
|
+
should_have_generator_attribute :feature_support_extend, 'Micronaut::Matchers'
|
146
|
+
should_have_generator_attribute :test_pattern, 'examples/**/*_example.rb'
|
147
|
+
should_have_generator_attribute :test_filename, 'the_perfect_gem_example.rb'
|
148
|
+
should_have_generator_attribute :test_helper_filename, 'example_helper.rb'
|
149
|
+
end
|
183
150
|
end
|