technicalpickles-jeweler 0.7.2 → 0.8.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 +11 -0
- data/README.markdown +5 -2
- data/Rakefile +15 -4
- data/TODO +1 -3
- data/VERSION.yml +2 -2
- data/bin/jeweler +15 -3
- data/lib/jeweler.rb +6 -0
- data/lib/jeweler/generator.rb +169 -54
- data/lib/jeweler/templates/Rakefile +39 -11
- data/lib/jeweler/templates/bacon/{flunking_spec.rb → flunking.rb} +0 -0
- data/lib/jeweler/templates/bacon/{spec_helper.rb → helper.rb} +0 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/steps/default_steps.rb +0 -0
- data/lib/jeweler/templates/features/support/env.rb +13 -0
- data/lib/jeweler/templates/minitest/flunking.rb +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +10 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +9 -0
- data/lib/jeweler/templates/shoulda/{flunking_test.rb → flunking.rb} +0 -0
- data/lib/jeweler/templates/shoulda/{test_helper.rb → helper.rb} +0 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +9 -0
- metadata +21 -7
- data/test/test_generator.rb +0 -269
data/ChangeLog.markdown
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# jeweler 0.8.0
|
2
|
+
|
3
|
+
* Generator:
|
4
|
+
* Supports these new testing frameworks:
|
5
|
+
* test/unit
|
6
|
+
* minitest
|
7
|
+
* rspec
|
8
|
+
* Added support for cucumber
|
9
|
+
* Creating a new gem is now more verbose, and will show files/directories created
|
10
|
+
* Binaries will now be automatically detected in 'bin'
|
11
|
+
|
1
12
|
# jeweler 0.7.2
|
2
13
|
|
3
14
|
* Added rake task 'version:bump' which is shorthand for 'version:bump:patch'
|
data/README.markdown
CHANGED
@@ -37,8 +37,11 @@ This will prepare a project in the 'the-perfect-gem' directory, setup to use Jew
|
|
37
37
|
It supports a number of options:
|
38
38
|
|
39
39
|
* --create-repo: in addition to preparing a project, it create an repo up on GitHub and enable RubyGem generation
|
40
|
-
* --
|
41
|
-
* --
|
40
|
+
* --testunit: generate test_helper.rb and test ready for test/unit
|
41
|
+
* --minitest: generate test_helper.rb and test ready for minitest
|
42
|
+
* --shoulda: generate test_helper.rb and test ready for shoulda (this is the default)
|
43
|
+
* --rspec: generate spec_helper.rb and spec ready for rspec
|
44
|
+
* --bacon: generate spec_helper.rb and spec ready for bacon
|
42
45
|
|
43
46
|
## Gemspec
|
44
47
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,6 @@ rescue LoadError
|
|
6
6
|
require 'rake/rdoctask'
|
7
7
|
end
|
8
8
|
|
9
|
-
require 'rcov/rcovtask'
|
10
9
|
|
11
10
|
$:.unshift('lib')
|
12
11
|
|
@@ -14,7 +13,6 @@ begin
|
|
14
13
|
require 'jeweler'
|
15
14
|
Jeweler::Tasks.new do |s|
|
16
15
|
s.name = "jeweler"
|
17
|
-
s.executables = "jeweler"
|
18
16
|
s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
19
17
|
s.email = "josh@technicalpickles.com"
|
20
18
|
s.homepage = "http://github.com/technicalpickles/jeweler"
|
@@ -38,6 +36,19 @@ Rake::RDocTask.new do |rdoc|
|
|
38
36
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
39
37
|
end
|
40
38
|
|
41
|
-
|
39
|
+
begin
|
40
|
+
require 'rcov/rcovtask'
|
41
|
+
Rcov::RcovTask.new
|
42
|
+
rescue LoadError
|
43
|
+
puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
require 'cucumber/rake/task'
|
48
|
+
Cucumber::Rake::Task.new(:features)
|
49
|
+
rescue LoadError
|
50
|
+
puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
51
|
+
end
|
52
|
+
|
42
53
|
|
43
|
-
task :default => :
|
54
|
+
task :default => [:test, :features]
|
data/TODO
CHANGED
@@ -5,9 +5,7 @@
|
|
5
5
|
* use Net::HTTP.post_form instead of `` for enabling gem creation
|
6
6
|
* Generators
|
7
7
|
* Rails generator for making a plugin that's Jeweler enabled
|
8
|
-
* Support rspec?
|
9
|
-
* Support test/unit
|
10
8
|
* Change generated test filename (test_foo not foo_test)
|
11
9
|
* Releasing
|
12
10
|
* Open hasmygembuiltyet.org
|
13
|
-
*
|
11
|
+
* Enable runcoderun by default
|
data/VERSION.yml
CHANGED
data/bin/jeweler
CHANGED
@@ -11,17 +11,29 @@ class JewelerOpts < Hash
|
|
11
11
|
def initialize(args)
|
12
12
|
super()
|
13
13
|
|
14
|
-
self[:
|
14
|
+
self[:testing_framework] = :shoulda
|
15
15
|
|
16
16
|
@opts = OptionParser.new do |o|
|
17
17
|
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
18
18
|
|
19
19
|
o.on('--bacon', 'generate bacon specs') do
|
20
|
-
self[:
|
20
|
+
self[:testing_framework] = :bacon
|
21
21
|
end
|
22
22
|
|
23
23
|
o.on('--shoulda', 'generate shoulda tests') do
|
24
|
-
self[:
|
24
|
+
self[:testing_framework] = :shoulda
|
25
|
+
end
|
26
|
+
|
27
|
+
o.on('--testunit', 'generate test/unit tests') do
|
28
|
+
self[:testing_framework] = :testunit
|
29
|
+
end
|
30
|
+
|
31
|
+
o.on('--miniunit', 'generate mini/unit tests') do
|
32
|
+
self[:testing_framework] = :miniunit
|
33
|
+
end
|
34
|
+
|
35
|
+
o.on('--rspec', 'generate rspec tests') do
|
36
|
+
self[:testing_framework] = :rspec
|
25
37
|
end
|
26
38
|
|
27
39
|
o.on('--create-repo', 'create the repository on GitHub') do
|
data/lib/jeweler.rb
CHANGED
@@ -23,6 +23,12 @@ class Jeweler
|
|
23
23
|
@gemspec.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
|
24
24
|
end
|
25
25
|
|
26
|
+
if @gemspec.executables.nil? || @gemspec.executables.empty?
|
27
|
+
@gemspec.executables = Dir["#{@base_dir}/bin/*"].map do |f|
|
28
|
+
File.basename(f)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
26
32
|
@gemspec.has_rdoc = true
|
27
33
|
@gemspec.rdoc_options << '--inline-source' << '--charset=UTF-8'
|
28
34
|
@gemspec.extra_rdoc_files ||= FileList["[A-Z]*.*"]
|
data/lib/jeweler/generator.rb
CHANGED
@@ -21,57 +21,142 @@ class Jeweler
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class Generator
|
24
|
-
attr_accessor :target_dir, :user_name, :user_email, :summary,
|
25
|
-
:github_repo_name, :
|
26
|
-
:github_username, :github_token,
|
27
|
-
:lib_dir, :constant_name, :file_name_prefix, :config, :test_style,
|
24
|
+
attr_accessor :target_dir, :user_name, :user_email, :summary, :testing_framework,
|
25
|
+
:github_repo_name, :github_username, :github_token,
|
28
26
|
:repo, :should_create_repo
|
29
27
|
|
30
28
|
def initialize(github_repo_name, options = {})
|
31
|
-
check_user_git_config()
|
32
|
-
|
33
29
|
if github_repo_name.nil?
|
34
30
|
raise NoGitHubRepoNameGiven
|
35
31
|
end
|
36
|
-
self.github_repo_name = github_repo_name
|
37
32
|
|
38
|
-
|
39
|
-
|
33
|
+
use_user_git_config
|
34
|
+
|
35
|
+
self.github_repo_name = github_repo_name
|
36
|
+
|
37
|
+
self.testing_framework = options[:testing_framework] || :shoulda
|
38
|
+
self.target_dir = options[:directory] || self.github_repo_name
|
40
39
|
|
41
|
-
self.test_style = options[:test_style] || :shoulda
|
42
|
-
self.target_dir = options[:directory] || self.github_repo_name
|
43
|
-
self.lib_dir = File.join(target_dir, 'lib')
|
44
|
-
self.constant_name = self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join
|
45
|
-
self.file_name_prefix = self.github_repo_name.gsub('-', '_')
|
46
40
|
self.should_create_repo = options[:create_repo]
|
47
|
-
self.summary
|
41
|
+
self.summary = options[:summary] || 'TODO'
|
48
42
|
end
|
49
43
|
|
50
44
|
def run
|
51
45
|
create_files
|
52
46
|
gitify
|
53
|
-
puts "Jeweler has prepared your gem in #{github_repo_name}"
|
47
|
+
$stdout.puts "Jeweler has prepared your gem in #{github_repo_name}"
|
54
48
|
if should_create_repo
|
55
49
|
create_and_push_repo
|
56
|
-
puts "Jeweler has pushed your repo to #{github_url}"
|
50
|
+
$stdout.puts "Jeweler has pushed your repo to #{github_url}"
|
57
51
|
enable_gem_for_repo
|
58
|
-
puts "Jeweler has enabled gem building for your repo"
|
52
|
+
$stdout.puts "Jeweler has enabled gem building for your repo"
|
59
53
|
end
|
60
54
|
end
|
61
55
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
56
|
+
|
57
|
+
def test_dir
|
58
|
+
test_or_spec
|
59
|
+
end
|
60
|
+
|
61
|
+
def feature_support_require
|
62
|
+
case testing_framework.to_sym
|
63
|
+
when :testunit, :shoulda, :bacon # NOTE bacon doesn't really work inside of cucumber
|
64
|
+
'test/unit/assertions'
|
65
|
+
when :minitest
|
66
|
+
'mini/test'
|
67
|
+
when :rspec
|
68
|
+
'spec/expectations'
|
69
|
+
else
|
70
|
+
raise "Don't know what to require for #{testing_framework}"
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
74
|
+
def feature_support_extend
|
75
|
+
case testing_framework.to_sym
|
76
|
+
when :testunit, :shoulda, :bacon # NOTE bacon doesn't really work inside of cucumber
|
77
|
+
'Test::Unit::Assertions'
|
78
|
+
when :minitest
|
79
|
+
'Mini::Test::Assertions'
|
80
|
+
when :rspec
|
81
|
+
nil
|
82
|
+
else
|
83
|
+
raise "Don't know what to extend for #{testing_framework}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def github_remote
|
88
|
+
"git@github.com:#{github_username}/#{github_repo_name}.git"
|
89
|
+
end
|
90
|
+
|
91
|
+
def github_url
|
92
|
+
"http://github.com/#{github_username}/#{github_repo_name}"
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
def constant_name
|
97
|
+
self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join
|
98
|
+
end
|
99
|
+
|
100
|
+
def file_name_prefix
|
101
|
+
self.github_repo_name.gsub('-', '_')
|
102
|
+
end
|
103
|
+
|
104
|
+
def lib_dir
|
105
|
+
'lib'
|
106
|
+
end
|
107
|
+
|
71
108
|
def test_dir
|
72
|
-
|
109
|
+
test_or_spec
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_filename
|
113
|
+
"#{file_name_prefix}_#{test_or_spec}.rb"
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_helper_filename
|
117
|
+
"#{test_or_spec}_helper.rb"
|
118
|
+
end
|
119
|
+
|
120
|
+
def feature_filename
|
121
|
+
"#{file_name_prefix}.feature"
|
122
|
+
end
|
123
|
+
|
124
|
+
def steps_filename
|
125
|
+
"#{file_name_prefix}_steps.rb"
|
126
|
+
end
|
127
|
+
|
128
|
+
def features_dir
|
129
|
+
'features'
|
130
|
+
end
|
131
|
+
|
132
|
+
def features_support_dir
|
133
|
+
File.join(features_dir, 'support')
|
134
|
+
end
|
135
|
+
|
136
|
+
def features_steps_dir
|
137
|
+
File.join(features_dir, 'steps')
|
73
138
|
end
|
74
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'
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_or_spec
|
151
|
+
case testing_framework.to_sym
|
152
|
+
when :shoulda, :testunit, :minitest
|
153
|
+
'test'
|
154
|
+
when :bacon, :rspec
|
155
|
+
'spec'
|
156
|
+
else
|
157
|
+
raise "Unknown test style: #{testing_framework}"
|
158
|
+
end
|
159
|
+
end
|
75
160
|
|
76
161
|
private
|
77
162
|
def create_files
|
@@ -81,48 +166,84 @@ class Jeweler
|
|
81
166
|
raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
|
82
167
|
end
|
83
168
|
|
84
|
-
FileUtils.mkdir lib_dir
|
85
|
-
FileUtils.mkdir test_dir
|
86
169
|
|
87
|
-
output_template_in_target
|
88
|
-
output_template_in_target
|
89
|
-
output_template_in_target
|
90
|
-
output_template_in_target
|
91
|
-
|
92
|
-
|
170
|
+
output_template_in_target '.gitignore'
|
171
|
+
output_template_in_target 'Rakefile'
|
172
|
+
output_template_in_target 'LICENSE'
|
173
|
+
output_template_in_target 'README'
|
174
|
+
|
175
|
+
mkdir_in_target lib_dir
|
176
|
+
touch_in_target File.join(lib_dir, "#{file_name_prefix}.rb")
|
177
|
+
|
178
|
+
mkdir_in_target test_dir
|
179
|
+
output_template_in_target File.join(testing_framework.to_s, 'helper.rb'), File.join(test_dir, test_helper_filename)
|
180
|
+
output_template_in_target File.join(testing_framework.to_s, 'flunking.rb'), File.join(test_dir, test_filename)
|
181
|
+
|
182
|
+
mkdir_in_target features_dir
|
183
|
+
output_template_in_target File.join(%w(features default.feature)), File.join('features', feature_filename)
|
184
|
+
|
185
|
+
mkdir_in_target features_support_dir
|
186
|
+
output_template_in_target File.join(features_support_dir, 'env.rb')
|
187
|
+
|
188
|
+
mkdir_in_target features_steps_dir
|
189
|
+
output_template_in_target File.join(features_steps_dir, 'default_steps.rb'), File.join('features', 'steps', steps_filename)
|
93
190
|
|
94
|
-
FileUtils.touch File.join(lib_dir, "#{file_name_prefix}.rb")
|
95
191
|
end
|
96
192
|
|
97
|
-
def
|
98
|
-
|
99
|
-
|
100
|
-
unless
|
193
|
+
def use_user_git_config
|
194
|
+
git_config = self.read_git_config
|
195
|
+
|
196
|
+
unless git_config.has_key? 'user.name'
|
101
197
|
raise NoGitUserName
|
102
198
|
end
|
103
199
|
|
104
|
-
unless
|
200
|
+
unless git_config.has_key? 'user.email'
|
105
201
|
raise NoGitUserEmail
|
106
202
|
end
|
107
203
|
|
108
|
-
unless
|
204
|
+
unless git_config.has_key? 'github.user'
|
109
205
|
raise NoGitHubUser
|
110
206
|
end
|
111
207
|
|
112
|
-
unless
|
208
|
+
unless git_config.has_key? 'github.token'
|
113
209
|
raise NoGitHubToken
|
114
210
|
end
|
115
211
|
|
116
|
-
self.user_name
|
117
|
-
self.user_email
|
118
|
-
self.github_username =
|
119
|
-
self.github_token
|
212
|
+
self.user_name = git_config['user.name']
|
213
|
+
self.user_email = git_config['user.email']
|
214
|
+
self.github_username = git_config['github.user']
|
215
|
+
self.github_token = git_config['github.token']
|
120
216
|
end
|
121
217
|
|
122
218
|
def output_template_in_target(source, destination = source)
|
123
|
-
|
219
|
+
final_destination = File.join(target_dir, destination)
|
220
|
+
|
221
|
+
template_contents = File.read(File.join(template_dir, source))
|
222
|
+
template = ERB.new(template_contents, nil, '<>')
|
223
|
+
|
224
|
+
template_result = template.result(binding)
|
225
|
+
|
226
|
+
File.open(final_destination, 'w') {|file| file.write(template_result)}
|
124
227
|
|
125
|
-
|
228
|
+
$stdout.puts "\tcreate\t#{destination}"
|
229
|
+
end
|
230
|
+
|
231
|
+
def template_dir
|
232
|
+
File.join(File.dirname(__FILE__), 'templates')
|
233
|
+
end
|
234
|
+
|
235
|
+
def mkdir_in_target(directory)
|
236
|
+
final_destination = File.join(target_dir, directory)
|
237
|
+
|
238
|
+
FileUtils.mkdir final_destination
|
239
|
+
|
240
|
+
$stdout.puts "\tcreate\t#{directory}"
|
241
|
+
end
|
242
|
+
|
243
|
+
def touch_in_target(destination)
|
244
|
+
final_destination = File.join(target_dir, destination)
|
245
|
+
FileUtils.touch final_destination
|
246
|
+
$stdout.puts "\tcreate\t#{destination}"
|
126
247
|
end
|
127
248
|
|
128
249
|
def gitify
|
@@ -165,7 +286,7 @@ class Jeweler
|
|
165
286
|
'token' => github_token,
|
166
287
|
'repository[description]' => summary,
|
167
288
|
'repository[name]' => github_repo_name
|
168
|
-
|
289
|
+
# TODO do a HEAD request to see when it's ready
|
169
290
|
@repo.push('origin')
|
170
291
|
end
|
171
292
|
|
@@ -180,11 +301,5 @@ class Jeweler
|
|
180
301
|
#'value' => '1'
|
181
302
|
end
|
182
303
|
|
183
|
-
def read_git_config
|
184
|
-
# we could just use Git::Base's .config, but that relies on a repo being around already
|
185
|
-
# ... which we don't have yet, since this is part of a sanity check
|
186
|
-
lib = Git::Lib.new(nil, nil)
|
187
|
-
config = lib.parse_config '~/.gitconfig'
|
188
|
-
end
|
189
304
|
end
|
190
305
|
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
2
|
|
5
3
|
begin
|
6
4
|
require 'jeweler'
|
@@ -16,28 +14,58 @@ rescue LoadError
|
|
16
14
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
17
15
|
end
|
18
16
|
|
19
|
-
|
20
|
-
t.libs << 'lib'
|
21
|
-
t.pattern = '<%= testspec %>/**/*_<%= testspec %>.rb'
|
22
|
-
t.verbose = false
|
23
|
-
end
|
24
|
-
|
17
|
+
require 'rake/rdoctask'
|
25
18
|
Rake::RDocTask.new do |rdoc|
|
26
19
|
rdoc.rdoc_dir = 'rdoc'
|
27
|
-
rdoc.title
|
20
|
+
rdoc.title = '<%= github_repo_name %>'
|
28
21
|
rdoc.options << '--line-numbers' << '--inline-source'
|
29
22
|
rdoc.rdoc_files.include('README*')
|
30
23
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
31
24
|
end
|
32
25
|
|
26
|
+
<% if testing_framework.to_sym == :rspec %>
|
27
|
+
require 'spec/rake/spectask'
|
28
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
29
|
+
t.libs << 'lib' << 'spec'
|
30
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
+
end
|
32
|
+
<% else %>
|
33
|
+
require 'rake/testtask'
|
34
|
+
Rake::TestTask.new(:<%= test_or_spec %>) do |t|
|
35
|
+
t.libs << 'lib' << '<%= test_or_spec %>'
|
36
|
+
t.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
|
37
|
+
t.verbose = false
|
38
|
+
end
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<% if testing_framework.to_sym == :rspec %>
|
42
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
43
|
+
t.libs << 'lib' << 'spec'
|
44
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
45
|
+
t.rcov = true
|
46
|
+
end
|
47
|
+
<% else %>
|
33
48
|
begin
|
34
49
|
require 'rcov/rcovtask'
|
35
50
|
Rcov::RcovTask.new do |t|
|
36
|
-
t.libs << '<%=
|
37
|
-
t.test_files = FileList['<%=
|
51
|
+
t.libs << '<%= test_or_spec %>'
|
52
|
+
t.test_files = FileList['<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb']
|
38
53
|
t.verbose = true
|
39
54
|
end
|
40
55
|
rescue LoadError
|
56
|
+
puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
57
|
+
end
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
begin
|
61
|
+
require 'cucumber/rake/task'
|
62
|
+
Cucumber::Rake::Task.new(:features)
|
63
|
+
rescue LoadError
|
64
|
+
puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
41
65
|
end
|
42
66
|
|
67
|
+
<% if testing_framework.to_sym == :rspec %>
|
68
|
+
task :default => :spec
|
69
|
+
<% else %>
|
43
70
|
task :default => :test
|
71
|
+
<% end %>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
require '<%= file_name_prefix %>'
|
3
|
+
|
4
|
+
require '<%= feature_support_require %>'
|
5
|
+
|
6
|
+
require 'test/unit/assertions'
|
7
|
+
|
8
|
+
World do |world|
|
9
|
+
<% if feature_support_extend %>
|
10
|
+
world.extend(<%= feature_support_extend %>)
|
11
|
+
<% end %>
|
12
|
+
world
|
13
|
+
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: technicalpickles-jeweler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nichols
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-03 00:00:00 -08:00
|
13
13
|
default_executable: jeweler
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -44,14 +44,29 @@ files:
|
|
44
44
|
- lib/jeweler/tasks.rb
|
45
45
|
- lib/jeweler/templates
|
46
46
|
- lib/jeweler/templates/bacon
|
47
|
-
- lib/jeweler/templates/bacon/
|
48
|
-
- lib/jeweler/templates/bacon/
|
47
|
+
- lib/jeweler/templates/bacon/flunking.rb
|
48
|
+
- lib/jeweler/templates/bacon/helper.rb
|
49
|
+
- lib/jeweler/templates/features
|
50
|
+
- lib/jeweler/templates/features/default.feature
|
51
|
+
- lib/jeweler/templates/features/steps
|
52
|
+
- lib/jeweler/templates/features/steps/default_steps.rb
|
53
|
+
- lib/jeweler/templates/features/support
|
54
|
+
- lib/jeweler/templates/features/support/env.rb
|
49
55
|
- lib/jeweler/templates/LICENSE
|
56
|
+
- lib/jeweler/templates/minitest
|
57
|
+
- lib/jeweler/templates/minitest/flunking.rb
|
58
|
+
- lib/jeweler/templates/minitest/helper.rb
|
50
59
|
- lib/jeweler/templates/Rakefile
|
51
60
|
- lib/jeweler/templates/README
|
61
|
+
- lib/jeweler/templates/rspec
|
62
|
+
- lib/jeweler/templates/rspec/flunking.rb
|
63
|
+
- lib/jeweler/templates/rspec/helper.rb
|
52
64
|
- lib/jeweler/templates/shoulda
|
53
|
-
- lib/jeweler/templates/shoulda/
|
54
|
-
- lib/jeweler/templates/shoulda/
|
65
|
+
- lib/jeweler/templates/shoulda/flunking.rb
|
66
|
+
- lib/jeweler/templates/shoulda/helper.rb
|
67
|
+
- lib/jeweler/templates/testunit
|
68
|
+
- lib/jeweler/templates/testunit/flunking.rb
|
69
|
+
- lib/jeweler/templates/testunit/helper.rb
|
55
70
|
- lib/jeweler/version.rb
|
56
71
|
- lib/jeweler.rb
|
57
72
|
- test/fixtures
|
@@ -63,7 +78,6 @@ files:
|
|
63
78
|
- test/shoulda_macros
|
64
79
|
- test/shoulda_macros/jeweler_macros.rb
|
65
80
|
- test/test_gemspec.rb
|
66
|
-
- test/test_generator.rb
|
67
81
|
- test/test_helper.rb
|
68
82
|
- test/test_jeweler.rb
|
69
83
|
- test/test_tasks.rb
|
data/test/test_generator.rb
DELETED
@@ -1,269 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
|
3
|
-
class TestGenerator < Test::Unit::TestCase
|
4
|
-
def self.should_create_directory(directory)
|
5
|
-
should "create #{directory} directory" do
|
6
|
-
assert File.exists?(File.join(@tmp_dir, directory))
|
7
|
-
assert File.directory?(File.join(@tmp_dir, directory))
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.should_create_files(*files)
|
12
|
-
should "create #{files.join ', '}" do
|
13
|
-
files.each do |file|
|
14
|
-
assert File.exists?(File.join(@tmp_dir, file))
|
15
|
-
assert File.file?(File.join(@tmp_dir, file))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.should_be_checked_in(*files)
|
21
|
-
should "have #{files.join ', '} checked in" do
|
22
|
-
files.each do |file|
|
23
|
-
status = @repo.status[file]
|
24
|
-
assert_not_nil status, "wasn't able to get status for #{file}"
|
25
|
-
assert ! status.untracked, "#{file} was untracked"
|
26
|
-
assert_nil status.type, "#{file} had a type. it should have been nil"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.should_have_sane_license
|
32
|
-
context "LICENSE" do
|
33
|
-
setup do
|
34
|
-
@content = File.read((File.join(@tmp_dir, 'LICENSE')))
|
35
|
-
end
|
36
|
-
|
37
|
-
should "include copyright for this year with user's name" do
|
38
|
-
assert_match 'Copyright (c) 2008 foo', @content
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.should_have_sane_gitignore
|
44
|
-
context ".gitignore" do
|
45
|
-
setup do
|
46
|
-
@content = File.read((File.join(@tmp_dir, '.gitignore')))
|
47
|
-
end
|
48
|
-
|
49
|
-
should "include vim swap files" do
|
50
|
-
assert_match '*.sw?', @content
|
51
|
-
end
|
52
|
-
|
53
|
-
should "include coverage" do
|
54
|
-
assert_match 'coverage', @content
|
55
|
-
end
|
56
|
-
|
57
|
-
should "include .DS_Store" do
|
58
|
-
assert_match '.DS_Store', @content
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.should_have_sane_rakefile(options)
|
64
|
-
context "Rakefile" do
|
65
|
-
setup do
|
66
|
-
@content = File.read((File.join(@tmp_dir, 'Rakefile')))
|
67
|
-
end
|
68
|
-
|
69
|
-
should "include repo's name as the gem's name" do
|
70
|
-
assert_match 's.name = "the-perfect-gem"', @content
|
71
|
-
end
|
72
|
-
|
73
|
-
should "include the user's email as the gem's email" do
|
74
|
-
assert_match 's.email = "bar@example.com"', @content
|
75
|
-
end
|
76
|
-
|
77
|
-
should "include the summary in the gem" do
|
78
|
-
assert_match %Q{s.summary = %Q{zomg, so good}}, @content
|
79
|
-
end
|
80
|
-
|
81
|
-
should "include the github repo's url as the gem's url" do
|
82
|
-
assert_match 's.homepage = "http://github.com/technicalpickles/the-perfect-gem"', @content
|
83
|
-
end
|
84
|
-
|
85
|
-
should "include #{options[:pattern]} in the TestTask" do
|
86
|
-
assert_match "t.pattern = '#{options[:pattern]}'", @content
|
87
|
-
end
|
88
|
-
|
89
|
-
should "include #{options[:pattern]} in the RcovTask" do
|
90
|
-
assert_match "t.test_files = FileList['#{options[:pattern]}']", @content
|
91
|
-
end
|
92
|
-
|
93
|
-
should "push #{options[:libs]} dir into RcovTask libs" do
|
94
|
-
assert_match "t.libs << '#{options[:libs]}'", @content
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.should_have_sane_origin_remote
|
100
|
-
should "have git@github.com:technicalpickles/the-perfect-gem.git as origin remote" do
|
101
|
-
assert_equal 1, @repo.remotes.size
|
102
|
-
remote = @repo.remotes.first
|
103
|
-
assert_equal 'origin', remote.name
|
104
|
-
assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context "with valid git user configuration" do
|
109
|
-
setup do
|
110
|
-
Jeweler::Generator.any_instance.stubs(:read_git_config).
|
111
|
-
returns({'user.name' => 'foo', 'user.email' => 'bar@example.com', 'github.user' => 'technicalpickles', 'github.token' => 'zomgtoken'})
|
112
|
-
end
|
113
|
-
|
114
|
-
context "and cleaned out tmp directory" do
|
115
|
-
setup do
|
116
|
-
@tmp_dir = File.join(File.dirname(__FILE__), 'tmp')
|
117
|
-
FileUtils.rm_rf(@tmp_dir)
|
118
|
-
|
119
|
-
assert ! File.exists?(@tmp_dir)
|
120
|
-
end
|
121
|
-
|
122
|
-
teardown do
|
123
|
-
FileUtils.rm_rf(@tmp_dir)
|
124
|
-
end
|
125
|
-
|
126
|
-
context "for generating technicalpickles's the-perfect-gem repo in 'tmp'" do
|
127
|
-
setup do
|
128
|
-
@generator = Jeweler::Generator.new('the-perfect-gem', :directory => @tmp_dir, :summary => 'zomg, so good')
|
129
|
-
end
|
130
|
-
|
131
|
-
should "use tmp for target directory" do
|
132
|
-
assert_equal @tmp_dir, @generator.target_dir
|
133
|
-
end
|
134
|
-
|
135
|
-
context "running with default test style" do
|
136
|
-
setup do
|
137
|
-
@output = catch_out { @generator.run }
|
138
|
-
end
|
139
|
-
|
140
|
-
should 'create target directory' do
|
141
|
-
assert File.exists?(@tmp_dir)
|
142
|
-
end
|
143
|
-
|
144
|
-
should_create_directory 'lib'
|
145
|
-
should_create_directory 'test'
|
146
|
-
|
147
|
-
should_create_files 'LICENSE', 'README', 'lib/the_perfect_gem.rb', 'test/test_helper.rb', 'test/the_perfect_gem_test.rb', '.gitignore'
|
148
|
-
|
149
|
-
should_have_sane_rakefile :libs => 'test', :pattern => 'test/**/*_test.rb'
|
150
|
-
should_have_sane_license
|
151
|
-
should_have_sane_gitignore
|
152
|
-
|
153
|
-
|
154
|
-
context "test/the_perfect_gem_test.rb" do
|
155
|
-
setup do
|
156
|
-
@content = File.read((File.join(@tmp_dir, 'test', 'the_perfect_gem_test.rb')))
|
157
|
-
end
|
158
|
-
|
159
|
-
should "have class of ThePerfectGemTest" do
|
160
|
-
assert_match 'class ThePerfectGemTest < Test::Unit::TestCase', @content
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
|
165
|
-
context "created git repo" do
|
166
|
-
setup do
|
167
|
-
@repo = Git.open(@tmp_dir)
|
168
|
-
end
|
169
|
-
|
170
|
-
should "have one commit log an initial commit message" do
|
171
|
-
assert_equal 1, @repo.log.size
|
172
|
-
# TODO message seems to include leading whitespace, could probably fix that in ruby-git
|
173
|
-
assert_match 'Initial commit to the-perfect-gem.', @repo.log.first.message
|
174
|
-
end
|
175
|
-
|
176
|
-
should_be_checked_in 'README', 'Rakefile', 'LICENSE', 'lib/the_perfect_gem.rb', 'test/test_helper.rb', 'test/the_perfect_gem_test.rb', '.gitignore'
|
177
|
-
|
178
|
-
should "have no untracked files" do
|
179
|
-
assert_equal 0, @repo.status.untracked.size
|
180
|
-
end
|
181
|
-
|
182
|
-
should "have no changed files" do
|
183
|
-
assert_equal 0, @repo.status.changed.size
|
184
|
-
end
|
185
|
-
|
186
|
-
should "have no added files" do
|
187
|
-
assert_equal 0, @repo.status.added.size
|
188
|
-
end
|
189
|
-
|
190
|
-
should "have no deleted files" do
|
191
|
-
assert_equal 0, @repo.status.deleted.size
|
192
|
-
end
|
193
|
-
|
194
|
-
should_have_sane_origin_remote
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
context "running with bacon test style" do
|
199
|
-
setup do
|
200
|
-
@generator.test_style = :bacon
|
201
|
-
@output = catch_out {
|
202
|
-
@generator.run
|
203
|
-
}
|
204
|
-
end
|
205
|
-
|
206
|
-
should 'create target directory' do
|
207
|
-
assert File.exists?(@tmp_dir)
|
208
|
-
end
|
209
|
-
|
210
|
-
should_create_directory 'lib'
|
211
|
-
should_create_directory 'spec'
|
212
|
-
|
213
|
-
should_create_files 'LICENSE', 'README', 'lib/the_perfect_gem.rb', 'spec/spec_helper.rb', 'spec/the_perfect_gem_spec.rb', '.gitignore'
|
214
|
-
|
215
|
-
should_have_sane_rakefile :libs => 'spec', :pattern => 'spec/**/*_spec.rb'
|
216
|
-
should_have_sane_license
|
217
|
-
should_have_sane_gitignore
|
218
|
-
|
219
|
-
|
220
|
-
context "spec/the_perfect_gem_spec.rb" do
|
221
|
-
setup do
|
222
|
-
@content = File.read((File.join(@tmp_dir, 'spec', 'the_perfect_gem_spec.rb')))
|
223
|
-
end
|
224
|
-
|
225
|
-
should "describe ThePerfectGem" do
|
226
|
-
assert_match 'describe "ThePerfectGem" do', @content
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
|
231
|
-
context "created git repo" do
|
232
|
-
setup do
|
233
|
-
@repo = Git.open(@tmp_dir)
|
234
|
-
end
|
235
|
-
|
236
|
-
should 'have one commit log' do
|
237
|
-
assert_equal 1, @repo.log.size
|
238
|
-
end
|
239
|
-
|
240
|
-
should "have one commit log an initial commit message" do
|
241
|
-
# TODO message seems to include leading whitespace, could probably fix that in ruby-git
|
242
|
-
assert_match 'Initial commit to the-perfect-gem.', @repo.log.first.message
|
243
|
-
end
|
244
|
-
|
245
|
-
should_be_checked_in 'README', 'Rakefile', 'LICENSE', 'lib/the_perfect_gem.rb', 'spec/spec_helper.rb', 'spec/the_perfect_gem_spec.rb', '.gitignore'
|
246
|
-
|
247
|
-
should "have no untracked files" do
|
248
|
-
assert_equal 0, @repo.status.untracked.size
|
249
|
-
end
|
250
|
-
|
251
|
-
should "have no changed files" do
|
252
|
-
assert_equal 0, @repo.status.changed.size
|
253
|
-
end
|
254
|
-
|
255
|
-
should "have no added files" do
|
256
|
-
assert_equal 0, @repo.status.added.size
|
257
|
-
end
|
258
|
-
|
259
|
-
should "have no deleted files" do
|
260
|
-
assert_equal 0, @repo.status.deleted.size
|
261
|
-
end
|
262
|
-
|
263
|
-
should_have_sane_origin_remote
|
264
|
-
end
|
265
|
-
end
|
266
|
-
end
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|