juwelier 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.document +8 -0
- data/.semver +5 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/ChangeLog.markdown +230 -0
- data/Gemfile +40 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +252 -0
- data/Rakefile +78 -0
- data/bin/juwelier +9 -0
- data/features/generator/cucumber.feature +103 -0
- data/features/generator/directory_layout.feature +86 -0
- data/features/generator/dotdocument.feature +13 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/gemfile.feature +81 -0
- data/features/generator/git.feature +102 -0
- data/features/generator/license.feature +20 -0
- data/features/generator/rakefile.feature +158 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +54 -0
- data/features/generator/test_helper.feature +149 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +70 -0
- data/features/step_definitions/generator_steps.rb +387 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +41 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +31 -0
- data/features/tasks/version_bumping.feature +49 -0
- data/juwelier.gemspec +241 -0
- data/lib/juwelier.rb +178 -0
- data/lib/juwelier/commands.rb +20 -0
- data/lib/juwelier/commands/build_gem.rb +40 -0
- data/lib/juwelier/commands/check_dependencies.rb +66 -0
- data/lib/juwelier/commands/install_gem.rb +31 -0
- data/lib/juwelier/commands/release_gemspec.rb +87 -0
- data/lib/juwelier/commands/release_to_git.rb +64 -0
- data/lib/juwelier/commands/release_to_rubygems.rb +28 -0
- data/lib/juwelier/commands/validate_gemspec.rb +30 -0
- data/lib/juwelier/commands/version/base.rb +55 -0
- data/lib/juwelier/commands/version/bump_major.rb +13 -0
- data/lib/juwelier/commands/version/bump_minor.rb +12 -0
- data/lib/juwelier/commands/version/bump_patch.rb +14 -0
- data/lib/juwelier/commands/version/write.rb +12 -0
- data/lib/juwelier/commands/write_gemspec.rb +39 -0
- data/lib/juwelier/errors.rb +8 -0
- data/lib/juwelier/gemcutter_tasks.rb +8 -0
- data/lib/juwelier/gemspec_helper.rb +87 -0
- data/lib/juwelier/generator.rb +304 -0
- data/lib/juwelier/generator/application.rb +63 -0
- data/lib/juwelier/generator/bacon_mixin.rb +43 -0
- data/lib/juwelier/generator/github_mixin.rb +22 -0
- data/lib/juwelier/generator/micronaut_mixin.rb +41 -0
- data/lib/juwelier/generator/minitest_mixin.rb +42 -0
- data/lib/juwelier/generator/options.rb +172 -0
- data/lib/juwelier/generator/rdoc_mixin.rb +13 -0
- data/lib/juwelier/generator/riot_mixin.rb +42 -0
- data/lib/juwelier/generator/rspec_mixin.rb +42 -0
- data/lib/juwelier/generator/shindo_mixin.rb +44 -0
- data/lib/juwelier/generator/shoulda_mixin.rb +42 -0
- data/lib/juwelier/generator/testspec_mixin.rb +42 -0
- data/lib/juwelier/generator/testunit_mixin.rb +39 -0
- data/lib/juwelier/generator/yard_mixin.rb +15 -0
- data/lib/juwelier/rubyforge_tasks.rb +95 -0
- data/lib/juwelier/rubygems_dot_org_tasks.rb +38 -0
- data/lib/juwelier/rubygems_tasks.rb +38 -0
- data/lib/juwelier/specification.rb +110 -0
- data/lib/juwelier/tasks.rb +239 -0
- data/lib/juwelier/templates/.document +5 -0
- data/lib/juwelier/templates/.gitignore +49 -0
- data/lib/juwelier/templates/Gemfile +12 -0
- data/lib/juwelier/templates/LICENSE.txt +20 -0
- data/lib/juwelier/templates/README.rdoc +19 -0
- data/lib/juwelier/templates/Rakefile +9 -0
- data/lib/juwelier/templates/bacon/flunking.rb +7 -0
- data/lib/juwelier/templates/bacon/helper.rb +10 -0
- data/lib/juwelier/templates/bundler_setup.erb +10 -0
- data/lib/juwelier/templates/features/default.feature +9 -0
- data/lib/juwelier/templates/features/support/env.rb +11 -0
- data/lib/juwelier/templates/juwelier_tasks.erb +31 -0
- data/lib/juwelier/templates/micronaut/flunking.rb +7 -0
- data/lib/juwelier/templates/micronaut/helper.rb +19 -0
- data/lib/juwelier/templates/minitest/flunking.rb +7 -0
- data/lib/juwelier/templates/minitest/helper.rb +13 -0
- data/lib/juwelier/templates/other_tasks.erb +70 -0
- data/lib/juwelier/templates/riot/flunking.rb +11 -0
- data/lib/juwelier/templates/riot/helper.rb +5 -0
- data/lib/juwelier/templates/rspec/.rspec +1 -0
- data/lib/juwelier/templates/rspec/flunking.rb +7 -0
- data/lib/juwelier/templates/rspec/helper.rb +14 -0
- data/lib/juwelier/templates/shindo/flunking.rb +8 -0
- data/lib/juwelier/templates/shindo/helper.rb +7 -0
- data/lib/juwelier/templates/shoulda/flunking.rb +7 -0
- data/lib/juwelier/templates/shoulda/helper.rb +12 -0
- data/lib/juwelier/templates/simplecov.erb +16 -0
- data/lib/juwelier/templates/testspec/flunking.rb +7 -0
- data/lib/juwelier/templates/testspec/helper.rb +7 -0
- data/lib/juwelier/templates/testunit/flunking.rb +7 -0
- data/lib/juwelier/templates/testunit/helper.rb +11 -0
- data/lib/juwelier/version.rb +10 -0
- data/lib/juwelier/version_helper.rb +141 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/geminstaller.yml +12 -0
- data/test/juwelier/commands/test_build_gem.rb +112 -0
- data/test/juwelier/commands/test_install_gem.rb +35 -0
- data/test/juwelier/commands/test_release_to_gemcutter.rb +39 -0
- data/test/juwelier/commands/test_release_to_git.rb +271 -0
- data/test/juwelier/commands/test_release_to_github.rb +477 -0
- data/test/juwelier/commands/test_validate_gemspec.rb +27 -0
- data/test/juwelier/commands/test_write_gemspec.rb +103 -0
- data/test/juwelier/commands/version/test_base.rb +53 -0
- data/test/juwelier/commands/version/test_bump_major.rb +22 -0
- data/test/juwelier/commands/version/test_bump_minor.rb +19 -0
- data/test/juwelier/commands/version/test_bump_patch.rb +20 -0
- data/test/juwelier/commands/version/test_write.rb +22 -0
- data/test/juwelier/generator/test_application.rb +142 -0
- data/test/juwelier/generator/test_options.rb +227 -0
- data/test/juwelier/test_gemspec_helper.rb +44 -0
- data/test/juwelier/test_generator.rb +140 -0
- data/test/juwelier/test_generator_initialization.rb +150 -0
- data/test/juwelier/test_generator_mixins.rb +23 -0
- data/test/juwelier/test_specification.rb +245 -0
- data/test/juwelier/test_tasks.rb +50 -0
- data/test/juwelier/test_version_helper.rb +214 -0
- data/test/shoulda_macros/juwelier_macros.rb +35 -0
- data/test/test_helper.rb +174 -0
- data/test/test_juwelier.rb +177 -0
- metadata +396 -0
@@ -0,0 +1,387 @@
|
|
1
|
+
Given /^I do not want cucumber stories$/ do
|
2
|
+
@use_cucumber = false
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I want cucumber stories$/ do
|
6
|
+
@use_cucumber = true
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^I do not want reek$/ do
|
10
|
+
@use_reek = false
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^I want reek$/ do
|
14
|
+
@use_reek = true
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /^I do not want bundler$/ do
|
18
|
+
@use_bundler = false
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
Given /^I want bundler$/ do
|
23
|
+
@use_bundler = true
|
24
|
+
end
|
25
|
+
|
26
|
+
Given /^I do not want roodi$/ do
|
27
|
+
@use_roodi = false
|
28
|
+
end
|
29
|
+
|
30
|
+
Given /^I want roodi$/ do
|
31
|
+
@use_roodi = true
|
32
|
+
end
|
33
|
+
|
34
|
+
And /^I do not want rubyforge setup$/ do
|
35
|
+
@use_rubyforge = false
|
36
|
+
end
|
37
|
+
|
38
|
+
And /^I want rubyforge setup$/ do
|
39
|
+
@use_rubyforge = true
|
40
|
+
end
|
41
|
+
|
42
|
+
Given /^I want to use yard instead of rdoc$/ do
|
43
|
+
@documentation_framework = "yard"
|
44
|
+
end
|
45
|
+
|
46
|
+
Given /^I want to use rdoc instead of yard$/ do
|
47
|
+
@documentation_framework = "rdoc"
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
Given /^I intend to test with (\w+)$/ do |testing_framework|
|
52
|
+
@testing_framework = testing_framework.to_sym
|
53
|
+
end
|
54
|
+
|
55
|
+
Given /^I have configured git sanely$/ do
|
56
|
+
@user_email = 'bar@example.com'
|
57
|
+
@user_name = 'foo'
|
58
|
+
@github_user = 'flajann2'
|
59
|
+
|
60
|
+
require 'git'
|
61
|
+
Git.stubs(:global_config).
|
62
|
+
returns({
|
63
|
+
'user.name' => @user_name,
|
64
|
+
'user.email' => @user_email,
|
65
|
+
'github.user' => @github_user})
|
66
|
+
end
|
67
|
+
|
68
|
+
Given /^I set JUWELIER_OPTS env variable to "(.*)"$/ do |val|
|
69
|
+
ENV['JUWELIER_OPTS'] = val
|
70
|
+
end
|
71
|
+
|
72
|
+
When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)'$/ do |testing_framework, name, summary|
|
73
|
+
step "I generate a #{testing_framework}project named '#{name}' that is '#{summary}' and described as ''"
|
74
|
+
end
|
75
|
+
|
76
|
+
When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and described as '([^']*)'$/ do |testing_framework, name, summary, description|
|
77
|
+
@name = name
|
78
|
+
@summary = summary
|
79
|
+
@description = description
|
80
|
+
|
81
|
+
testing_framework = testing_framework.squeeze.strip
|
82
|
+
unless testing_framework.blank?
|
83
|
+
@testing_framework = testing_framework.to_sym
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
arguments = [ '--summary', @summary,
|
88
|
+
'--description', @description,
|
89
|
+
@use_cucumber ? '--cucumber' : nil,
|
90
|
+
@testing_framework ? "--#{@testing_framework}" : nil,
|
91
|
+
@use_rubyforge ? '--rubyforge' : nil,
|
92
|
+
@use_roodi ? '--roodi' : nil,
|
93
|
+
@use_reek ? '--reek' : nil,
|
94
|
+
case @use_bundler
|
95
|
+
when true then '--bundler'
|
96
|
+
when false then '--no-bundler'
|
97
|
+
else nil
|
98
|
+
end,
|
99
|
+
@documentation_framework ? "--#{@documentation_framework}" : nil,
|
100
|
+
"#{@working_dir}/#{@name}"].compact
|
101
|
+
|
102
|
+
|
103
|
+
@stdout = OutputCatcher.catch_out do
|
104
|
+
Juwelier::Generator::Application.run! *arguments
|
105
|
+
end
|
106
|
+
|
107
|
+
@repo = Git.open(File.join(@working_dir, @name))
|
108
|
+
end
|
109
|
+
|
110
|
+
Then /^a directory named '(.*)' is created$/ do |directory|
|
111
|
+
directory = File.join(@working_dir, directory)
|
112
|
+
|
113
|
+
assert File.exists?(directory), "#{directory} did not exist"
|
114
|
+
assert File.directory?(directory), "#{directory} is not a directory"
|
115
|
+
end
|
116
|
+
|
117
|
+
Then "cucumber directories are created" do
|
118
|
+
step "a directory named 'the-perfect-gem/features' is created"
|
119
|
+
step "a directory named 'the-perfect-gem/features/support' is created"
|
120
|
+
step "a directory named 'the-perfect-gem/features/step_definitions' is created"
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
Then /^a file named '(.*)' is created$/ do |file|
|
125
|
+
file = File.join(@working_dir, file)
|
126
|
+
|
127
|
+
assert File.exists?(file), "#{file} expected to exist, but did not"
|
128
|
+
assert File.file?(file), "#{file} expected to be a file, but is not"
|
129
|
+
end
|
130
|
+
|
131
|
+
Then /^a file named '(.*)' is not created$/ do |file|
|
132
|
+
file = File.join(@working_dir, file)
|
133
|
+
|
134
|
+
assert ! File.exists?(file), "#{file} expected to not exist, but did"
|
135
|
+
end
|
136
|
+
|
137
|
+
Then /^a sane '.gitignore' is created$/ do
|
138
|
+
step "a file named 'the-perfect-gem/.gitignore' is created"
|
139
|
+
step "'coverage' is ignored by git"
|
140
|
+
step "'coverage.data' is ignored by git"
|
141
|
+
step "'*.swp' is ignored by git"
|
142
|
+
step "'.DS_Store' is ignored by git"
|
143
|
+
step "'rdoc' is ignored by git"
|
144
|
+
step "'pkg' is ignored by git"
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^'(.*)' is ignored by git$/ do |git_ignore|
|
148
|
+
@gitignore_content ||= File.read(File.join(@working_dir, @name, '.gitignore'))
|
149
|
+
|
150
|
+
assert_match git_ignore, @gitignore_content
|
151
|
+
end
|
152
|
+
|
153
|
+
Then /^Rakefile has '(.*)' for the (.*) (.*)$/ do |value, task_class, field|
|
154
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
155
|
+
block_variable, task_block = yank_task_info(@rakefile_content, task_class)
|
156
|
+
#raise "Found in #{task_class}: #{block_variable.inspect}: #{task_block.inspect}"
|
157
|
+
|
158
|
+
assert_match /#{block_variable}\.#{field} = (%Q\{|"|')#{Regexp.escape(value)}(\}|"|')/, task_block
|
159
|
+
end
|
160
|
+
|
161
|
+
Then /^Rakefile adds '(.*)' as a development dependency to Juwelier::Tasks$/ do |dependency|
|
162
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
163
|
+
block_variable, task_block = yank_task_info(@rakefile_content, "Juwelier::Tasks")
|
164
|
+
|
165
|
+
assert_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block
|
166
|
+
end
|
167
|
+
|
168
|
+
Then /^Rakefile does not add '(.*)' as a development dependency to Juwelier::Tasks$/ do |dependency|
|
169
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
170
|
+
block_variable, task_block = yank_task_info(@rakefile_content, "Juwelier::Tasks")
|
171
|
+
|
172
|
+
assert_no_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block
|
173
|
+
end
|
174
|
+
|
175
|
+
Then /^Rakefile has '(.*)' in the Rcov::RcovTask libs$/ do |libs|
|
176
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
177
|
+
block_variable, task_block = yank_task_info(@rakefile_content, 'Rcov::RcovTask')
|
178
|
+
|
179
|
+
assert_match "#{block_variable}.libs << '#{libs}'", @rakefile_content
|
180
|
+
end
|
181
|
+
|
182
|
+
Then /^Rakefile has '(.*)' in the Rcov::RcovTask rcov_opts$/ do |rcov_opts|
|
183
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
184
|
+
block_variable, task_block = yank_task_info(@rakefile_content, 'Rcov::RcovTask')
|
185
|
+
|
186
|
+
assert_match "#{block_variable}.rcov_opts << '#{rcov_opts}'", @rakefile_content
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
Then /^'(.*)' contains '(.*)'$/ do |file, expected_string|
|
191
|
+
contents = File.read(File.join(@working_dir, @name, file))
|
192
|
+
assert_match expected_string, contents
|
193
|
+
end
|
194
|
+
|
195
|
+
Then /^'(.*)' mentions copyright belonging to me in (\d{4})$/ do |file, year|
|
196
|
+
contents = File.read(File.join(@working_dir, @name, file))
|
197
|
+
assert_match "Copyright (c) #{year} #{@user_name}", contents
|
198
|
+
end
|
199
|
+
|
200
|
+
Then /^'(.*)' mentions copyright belonging to me in the current year$/ do |file|
|
201
|
+
current_year = Time.now.year
|
202
|
+
step "'#{file}' mentions copyright belonging to me in #{current_year}"
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
Then /^LICENSE\.txt credits '(.*)'$/ do |copyright_holder|
|
207
|
+
step "a file named 'the-perfect-gem/LICENSE.txt' is created"
|
208
|
+
@license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt'))
|
209
|
+
assert_match copyright_holder, @license_content
|
210
|
+
end
|
211
|
+
|
212
|
+
Given /^it is the year (\d+)$/ do |year|
|
213
|
+
time = Time.local(year.to_i, 9, 1, 10, 5, 0)
|
214
|
+
Timecop.travel(time)
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
Then /^LICENSE\.txt has a copyright in the year (\d+)$/ do |year|
|
219
|
+
step "a file named 'the-perfect-gem/LICENSE.txt' is created"
|
220
|
+
@license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt'))
|
221
|
+
assert_match year, @license_content
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
Then /^'(.*)' should define '(.*)' as a subclass of '(.*)'$/ do |file, class_name, superclass_name|
|
226
|
+
@test_content = File.read((File.join(@working_dir, @name, file)))
|
227
|
+
|
228
|
+
assert_match "class #{class_name} < #{superclass_name}", @test_content
|
229
|
+
end
|
230
|
+
|
231
|
+
Then /^'(.*)' should describe '(.*)'$/ do |file, describe_name|
|
232
|
+
@spec_content ||= File.read((File.join(@working_dir, @name, file)))
|
233
|
+
|
234
|
+
assert_match %Q{describe "#{describe_name}" do}, @spec_content
|
235
|
+
end
|
236
|
+
|
237
|
+
Then /^'(.*)' should contextualize '(.*)'$/ do |file, describe_name|
|
238
|
+
@spec_content ||= File.read((File.join(@working_dir, @name, file)))
|
239
|
+
|
240
|
+
assert_match %Q{context "#{describe_name}" do}, @spec_content
|
241
|
+
end
|
242
|
+
|
243
|
+
Then /^'(.*)' should have tests for '(.*)'$/ do |file, describe_name|
|
244
|
+
@tests_content ||= File.read((File.join(@working_dir, @name, file)))
|
245
|
+
|
246
|
+
assert_match %Q{Shindo.tests("#{describe_name}") do}, @tests_content
|
247
|
+
end
|
248
|
+
|
249
|
+
Then /^'(.*)' requires '(.*)'$/ do |file, lib|
|
250
|
+
content = File.read(File.join(@working_dir, @name, file))
|
251
|
+
|
252
|
+
assert_match /require ['"]#{Regexp.escape(lib)}['"]/, content
|
253
|
+
end
|
254
|
+
|
255
|
+
Then /^'(.*)' does not require '(.*)'$/ do |file, lib|
|
256
|
+
content = File.read(File.join(@working_dir, @name, file))
|
257
|
+
|
258
|
+
assert_no_match /require ['"]#{Regexp.escape(lib)}['"]/, content
|
259
|
+
end
|
260
|
+
|
261
|
+
Then /^Rakefile does not require '(.*)'$/ do |file|
|
262
|
+
step "'Rakefile' does not require '#{file}'"
|
263
|
+
end
|
264
|
+
|
265
|
+
Then /^Rakefile requires '(.*)'$/ do |file|
|
266
|
+
step "'Rakefile' requires '#{file}'"
|
267
|
+
end
|
268
|
+
|
269
|
+
Then /^Rakefile does not instantiate a (.*)$/ do |task_name|
|
270
|
+
content = File.read(File.join(@working_dir, @name, 'Rakefile'))
|
271
|
+
assert_no_match /#{task_name}/, content
|
272
|
+
end
|
273
|
+
|
274
|
+
Then /^Rakefile instantiates a (.*)$/ do |task_name|
|
275
|
+
content = File.read(File.join(@working_dir, @name, 'Rakefile'))
|
276
|
+
assert_match /#{task_name}/, content
|
277
|
+
end
|
278
|
+
|
279
|
+
|
280
|
+
Then /^'(.+?)' should autorun tests$/ do |test_helper|
|
281
|
+
content = File.read(File.join(@working_dir, @name, test_helper))
|
282
|
+
|
283
|
+
assert_match "MiniTest::Unit.autorun", content
|
284
|
+
end
|
285
|
+
|
286
|
+
Then /^cucumber world extends "(.*)"$/ do |module_to_extend|
|
287
|
+
content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb'))
|
288
|
+
assert_match "World(#{module_to_extend})", content
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
Then /^'features\/support\/env\.rb' sets up features to use test\/unit assertions$/ do
|
293
|
+
|
294
|
+
end
|
295
|
+
|
296
|
+
Then /^'features\/support\/env\.rb' sets up features to use minitest assertions$/ do
|
297
|
+
content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb'))
|
298
|
+
|
299
|
+
assert_match "world.extend(Mini::Test::Assertions)", content
|
300
|
+
end
|
301
|
+
|
302
|
+
Then /^git repository has '(.*)' remote$/ do |remote|
|
303
|
+
remote = @repo.remotes.first
|
304
|
+
|
305
|
+
assert_equal 'origin', remote.name
|
306
|
+
end
|
307
|
+
|
308
|
+
Then /^git repository '(.*)' remote should be '(.*)'/ do |remote, remote_url|
|
309
|
+
remote = @repo.remotes.first
|
310
|
+
|
311
|
+
assert_equal 'git@github.com:flajann2/the-perfect-gem.git', remote.url
|
312
|
+
end
|
313
|
+
|
314
|
+
Then /^a commit with the message '(.*)' is made$/ do |message|
|
315
|
+
assert_match message, @repo.log.first.message
|
316
|
+
end
|
317
|
+
|
318
|
+
Then /^'(.*)' was checked in$/ do |file|
|
319
|
+
status = @repo.status[file]
|
320
|
+
|
321
|
+
assert_not_nil status, "wasn't able to get status for #{file}"
|
322
|
+
assert ! status.untracked, "#{file} was untracked"
|
323
|
+
assert_nil status.type, "#{file} had a type. it should have been nil"
|
324
|
+
end
|
325
|
+
|
326
|
+
Then /^no files are (\w+)$/ do |type|
|
327
|
+
assert_equal 0, @repo.status.send(type).size
|
328
|
+
end
|
329
|
+
|
330
|
+
Then /^Rakefile has "(.*)" as the default task$/ do |task|
|
331
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
332
|
+
assert_match "task :default => :#{task}", @rakefile_content
|
333
|
+
end
|
334
|
+
|
335
|
+
|
336
|
+
After do
|
337
|
+
ENV['JUWELIER_OPTS'] = nil
|
338
|
+
end
|
339
|
+
|
340
|
+
Then /^'Gemfile' has a (\w+) dependency on '(.*)'$/ do |group, name|
|
341
|
+
@gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
|
342
|
+
|
343
|
+
group_block = yank_group_info(@gemfile_content, group)
|
344
|
+
|
345
|
+
assert_match name, group_block
|
346
|
+
end
|
347
|
+
|
348
|
+
Then /^'Gemfile' does not have a (\w+) dependency on '(.*)'$/ do |group, name|
|
349
|
+
@gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
|
350
|
+
|
351
|
+
group_block = yank_group_info(@gemfile_content, group)
|
352
|
+
|
353
|
+
assert_no_match Regexp.new(Regexp.escape(name)), group_block
|
354
|
+
end
|
355
|
+
|
356
|
+
Then /^'Gemfile' has a development dependency on the current version of juwelier$/ do
|
357
|
+
@gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
|
358
|
+
group_block = yank_group_info(@gemfile_content, 'development')
|
359
|
+
|
360
|
+
assert_match %Q{gem "juwelier", "~> #{Juwelier::Version::STRING}"}, group_block
|
361
|
+
end
|
362
|
+
|
363
|
+
|
364
|
+
Then /^'(.*)' sets up bundler using the default and development groups$/ do |file|
|
365
|
+
content = File.read(File.join(@working_dir, @name, file))
|
366
|
+
|
367
|
+
assert_match "Bundler.setup(:default, :development)", content
|
368
|
+
end
|
369
|
+
|
370
|
+
Then /^'(.*)' does not setup bundler$/ do |file|
|
371
|
+
content = File.read(File.join(@working_dir, @name, file))
|
372
|
+
|
373
|
+
assert_no_match /Bundler\.setup/, content
|
374
|
+
end
|
375
|
+
|
376
|
+
Then /^'Gemfile' uses the (.*) source$/ do |source|
|
377
|
+
content = File.read(File.join(@working_dir, @name, 'Gemfile'))
|
378
|
+
|
379
|
+
assert_match %Q{source "http://rubygems.org"}, content
|
380
|
+
end
|
381
|
+
|
382
|
+
|
383
|
+
Then /^Rakefile has a magic comment for UTF\-(\d+)$/ do |arg1|
|
384
|
+
content = File.read(File.join(@working_dir, @name, 'Rakefile'))
|
385
|
+
assert_match "# encoding: utf-8", content
|
386
|
+
end
|
387
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :xzibit, :test)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'juwelier'
|
11
|
+
require 'mocha'
|
12
|
+
require 'output_catcher'
|
13
|
+
require 'timecop'
|
14
|
+
require 'ruby-debug'
|
15
|
+
require 'active_support'
|
16
|
+
|
17
|
+
require 'test/unit/assertions'
|
18
|
+
World(Test::Unit::Assertions)
|
19
|
+
|
20
|
+
require 'construct'
|
21
|
+
World(Construct::Helpers)
|
22
|
+
|
23
|
+
def yank_task_info(content, task)
|
24
|
+
if content =~ /#{Regexp.escape(task)}.new(\(.*\))? do \|(.*?)\|(.*?)^end$/m
|
25
|
+
[$2, $3]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def yank_group_info(content, group)
|
30
|
+
if content =~ /group :#{group} do(.*?)end/m
|
31
|
+
$1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def fixture_dir
|
36
|
+
File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures')
|
37
|
+
end
|
38
|
+
|
39
|
+
After do
|
40
|
+
Timecop.return
|
41
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: building gems
|
2
|
+
|
3
|
+
Scenario: default
|
4
|
+
Given a working directory
|
5
|
+
And I use the existing project "existing-project-with-version-yaml" as a template
|
6
|
+
And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}"
|
7
|
+
And "existing-project-with-version/pkg/existing-project-with-version-1.5.3.gem" does not exist
|
8
|
+
When I run "rake build" in "existing-project-with-version-yaml"
|
9
|
+
Then I can gem install "existing-project-with-version-yaml/pkg/existing-project-with-version-1.5.3.gem"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: version rake task
|
2
|
+
|
3
|
+
#Scenario: a newly created project without a version
|
4
|
+
# Given a working directory
|
5
|
+
# And I use the juwelier command to generate the "the-perfect-gem" project in the working directory
|
6
|
+
# And "the-perfect-gem/VERSION" does not exist
|
7
|
+
# When I run "rake version" in "the-perfect-gem"
|
8
|
+
# Then the process should not exit cleanly
|
9
|
+
|
10
|
+
Scenario: an existing project with version yaml
|
11
|
+
Given a working directory
|
12
|
+
And I use the existing project "existing-project-with-version-yaml" as a template
|
13
|
+
And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}"
|
14
|
+
When I run "rake version" in "existing-project-with-version-yaml"
|
15
|
+
Then the process should exit cleanly
|
16
|
+
And the current version, 1.5.3, is displayed
|
17
|
+
|
18
|
+
Scenario: an existing project with version plaintext
|
19
|
+
Given a working directory
|
20
|
+
And I use the existing project "existing-project-with-version-plaintext" as a template
|
21
|
+
And "VERSION" contains "1.5.3"
|
22
|
+
When I run "rake version" in "existing-project-with-version-plaintext"
|
23
|
+
Then the process should exit cleanly
|
24
|
+
And the current version, 1.5.3, is displayed
|
25
|
+
|
26
|
+
Scenario: an existing project with version constant
|
27
|
+
Given a working directory
|
28
|
+
And I use the existing project "existing-project-with-version-constant" as a template
|
29
|
+
When I run "rake version" in "existing-project-with-version-constant"
|
30
|
+
Then the process should exit cleanly
|
31
|
+
And the current version, 1.0.0, is displayed
|