mcornick-jeweler 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/ChangeLog.markdown +111 -0
- data/LICENSE +20 -0
- data/README.markdown +185 -0
- data/ROADMAP +12 -0
- data/Rakefile +103 -0
- data/VERSION.yml +4 -0
- data/bin/jeweler +8 -0
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +151 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +68 -0
- data/features/step_definitions/generator_steps.rb +284 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +29 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +225 -0
- data/lib/jeweler.rb +153 -0
- data/lib/jeweler/commands.rb +14 -0
- data/lib/jeweler/commands/build_gem.rb +31 -0
- data/lib/jeweler/commands/check_dependencies.rb +52 -0
- data/lib/jeweler/commands/install_gem.rb +40 -0
- data/lib/jeweler/commands/release.rb +86 -0
- data/lib/jeweler/commands/release_to_rubyforge.rb +51 -0
- data/lib/jeweler/commands/setup_rubyforge.rb +57 -0
- data/lib/jeweler/commands/validate_gemspec.rb +30 -0
- data/lib/jeweler/commands/version/base.rb +41 -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 +39 -0
- data/lib/jeweler/errors.rb +20 -0
- data/lib/jeweler/gemspec_helper.rb +79 -0
- data/lib/jeweler/generator.rb +306 -0
- data/lib/jeweler/generator/application.rb +54 -0
- data/lib/jeweler/generator/bacon_mixin.rb +43 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +41 -0
- data/lib/jeweler/generator/minitest_mixin.rb +42 -0
- data/lib/jeweler/generator/options.rb +102 -0
- data/lib/jeweler/generator/rdoc_mixin.rb +9 -0
- data/lib/jeweler/generator/rspec_mixin.rb +42 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +42 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator/yard_mixin.rb +14 -0
- data/lib/jeweler/rubyforge_tasks.rb +98 -0
- data/lib/jeweler/specification.rb +66 -0
- data/lib/jeweler/tasks.rb +135 -0
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/.gitignore +5 -0
- data/lib/jeweler/templates/LICENSE +20 -0
- data/lib/jeweler/templates/README.rdoc +18 -0
- data/lib/jeweler/templates/Rakefile +153 -0
- data/lib/jeweler/templates/bacon/flunking.rb +7 -0
- data/lib/jeweler/templates/bacon/helper.rb +8 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/support/env.rb +8 -0
- 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 +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +11 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +10 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
- data/lib/jeweler/templates/shoulda/helper.rb +10 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +9 -0
- data/lib/jeweler/version_helper.rb +128 -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-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +82 -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 +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -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/jeweler/commands/test_build_gem.rb +72 -0
- data/test/jeweler/commands/test_install_gem.rb +74 -0
- data/test/jeweler/commands/test_release.rb +362 -0
- data/test/jeweler/commands/test_release_to_rubyforge.rb +157 -0
- data/test/jeweler/commands/test_setup_rubyforge.rb +182 -0
- data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
- data/test/jeweler/commands/test_write_gemspec.rb +92 -0
- data/test/jeweler/commands/version/test_base.rb +32 -0
- data/test/jeweler/commands/version/test_bump_major.rb +22 -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/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_application.rb +139 -0
- data/test/test_gemspec_helper.rb +40 -0
- data/test/test_generator.rb +166 -0
- data/test/test_generator_initialization.rb +156 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +159 -0
- data/test/test_jeweler.rb +174 -0
- data/test/test_options.rb +149 -0
- data/test/test_specification.rb +61 -0
- data/test/test_tasks.rb +35 -0
- data/test/test_version_helper.rb +153 -0
- metadata +283 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: generated license
|
2
|
+
In order to start a new gem
|
3
|
+
A user should be able to
|
4
|
+
generate a default license
|
5
|
+
|
6
|
+
Scenario: copyright
|
7
|
+
Given a working directory
|
8
|
+
And I have configured git sanely
|
9
|
+
When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
|
10
|
+
|
11
|
+
Then 'README.rdoc' contains '= the-perfect-gem'
|
12
|
+
And 'README.rdoc' mentions copyright belonging to me in the current year
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: generated test or spec
|
2
|
+
In order to start a new gem
|
3
|
+
A user should be able to
|
4
|
+
generate a test or spec
|
5
|
+
|
6
|
+
Scenario: bacon
|
7
|
+
Given a working directory
|
8
|
+
And I have configured git sanely
|
9
|
+
When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
|
10
|
+
Then 'spec/the-perfect-gem_spec.rb' should describe 'ThePerfectGem'
|
11
|
+
|
12
|
+
Scenario: minitest
|
13
|
+
Given a working directory
|
14
|
+
And I have configured git sanely
|
15
|
+
When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
|
16
|
+
Then 'test/the-perfect-gem_test.rb' should define 'ThePerfectGemTest' as a subclass of 'Mini::Test::TestCase'
|
17
|
+
|
18
|
+
Scenario: rspec
|
19
|
+
Given a working directory
|
20
|
+
And I have configured git sanely
|
21
|
+
When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
|
22
|
+
Then 'spec/the-perfect-gem_spec.rb' should describe 'ThePerfectGem'
|
23
|
+
|
24
|
+
Scenario: shoulda
|
25
|
+
Given a working directory
|
26
|
+
And I have configured git sanely
|
27
|
+
And I intend to test with shoulda
|
28
|
+
When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
|
29
|
+
Then 'test/the-perfect-gem_test.rb' should define 'ThePerfectGemTest' as a subclass of 'Test::Unit::TestCase'
|
30
|
+
|
31
|
+
Scenario: testunit
|
32
|
+
Given a working directory
|
33
|
+
And I have configured git sanely
|
34
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
35
|
+
Then 'test/the-perfect-gem_test.rb' should define 'ThePerfectGemTest' as a subclass of 'Test::Unit::TestCase'
|
36
|
+
|
37
|
+
Scenario: micronaut
|
38
|
+
Given a working directory
|
39
|
+
And I have configured git sanely
|
40
|
+
When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
|
41
|
+
Then 'examples/the-perfect-gem_example.rb' should describe 'ThePerfectGem'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: generated test or spec
|
2
|
+
In order to start a new gem
|
3
|
+
A user should be able to
|
4
|
+
generate a test or spec
|
5
|
+
|
6
|
+
Scenario: bacon
|
7
|
+
Given a working directory
|
8
|
+
And I have configured git sanely
|
9
|
+
When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
|
10
|
+
Then 'spec/spec_helper.rb' requires 'bacon'
|
11
|
+
And 'spec/spec_helper.rb' requires 'the-perfect-gem'
|
12
|
+
|
13
|
+
Scenario: minitest
|
14
|
+
Given a working directory
|
15
|
+
And I have configured git sanely
|
16
|
+
When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
|
17
|
+
Then 'test/test_helper.rb' requires 'mini/test'
|
18
|
+
And 'test/test_helper.rb' requires 'the-perfect-gem'
|
19
|
+
And 'test/test_helper.rb' should autorun tests
|
20
|
+
|
21
|
+
Scenario: rspec
|
22
|
+
Given a working directory
|
23
|
+
And I have configured git sanely
|
24
|
+
When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
|
25
|
+
Then 'spec/spec_helper.rb' requires 'spec'
|
26
|
+
And 'spec/spec_helper.rb' requires 'the-perfect-gem'
|
27
|
+
|
28
|
+
Scenario: shoulda
|
29
|
+
Given a working directory
|
30
|
+
And I have configured git sanely
|
31
|
+
When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good'
|
32
|
+
Then 'test/test_helper.rb' requires 'test/unit'
|
33
|
+
And 'test/test_helper.rb' requires 'shoulda'
|
34
|
+
And 'test/test_helper.rb' requires 'the-perfect-gem'
|
35
|
+
|
36
|
+
Scenario: testunit
|
37
|
+
Given a working directory
|
38
|
+
And I have configured git sanely
|
39
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
40
|
+
Then 'test/test_helper.rb' requires 'test/unit'
|
41
|
+
And 'test/test_helper.rb' requires 'the-perfect-gem'
|
42
|
+
|
43
|
+
Scenario: micronaut
|
44
|
+
Given a working directory
|
45
|
+
And I have configured git sanely
|
46
|
+
When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
|
47
|
+
Then 'examples/example_helper.rb' requires 'rubygems'
|
48
|
+
Then 'examples/example_helper.rb' requires 'micronaut'
|
49
|
+
Then 'examples/example_helper.rb' requires 'the-perfect-gem'
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Given 'a working directory' do
|
2
|
+
@working_dir = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'tmp')
|
3
|
+
FileUtils.rm_rf @working_dir
|
4
|
+
FileUtils.mkdir_p @working_dir
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^I use the jeweler command to generate the "([^"]+)" project in the working directory$/ do |name|
|
8
|
+
@name = name
|
9
|
+
|
10
|
+
return_to = Dir.pwd
|
11
|
+
path_to_jeweler = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jeweler')
|
12
|
+
|
13
|
+
begin
|
14
|
+
FileUtils.cd @working_dir
|
15
|
+
@stdout = `#{path_to_jeweler} #{@name}`
|
16
|
+
ensure
|
17
|
+
FileUtils.cd return_to
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^"([^"]+)" does not exist$/ do |file|
|
22
|
+
assert ! File.exists?(File.join(@working_dir, file))
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^I run "([^"]+)" in "([^"]+)"$/ do |command, directory|
|
26
|
+
full_path = File.join(@working_dir, directory)
|
27
|
+
|
28
|
+
lib_path = File.expand_path 'lib'
|
29
|
+
command.gsub!(/^rake /, "rake -I#{lib_path} ")
|
30
|
+
|
31
|
+
assert File.directory?(full_path), "#{full_path} is not a directory"
|
32
|
+
|
33
|
+
@stdout = `cd #{full_path} && #{command}`
|
34
|
+
@exited_cleanly = $?.exited?
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^the updated version, (\d+\.\d+\.\d+), is displayed$/ do |version|
|
38
|
+
assert_match "Updated version: #{version}", @stdout
|
39
|
+
end
|
40
|
+
|
41
|
+
Then /^the current version, (\d+\.\d+\.\d+), is displayed$/ do |version|
|
42
|
+
assert_match "Current version: #{version}", @stdout
|
43
|
+
end
|
44
|
+
|
45
|
+
Then /^the process should exit cleanly$/ do
|
46
|
+
assert @exited_cleanly, "Process did not exit cleanly: #{@stdout}"
|
47
|
+
end
|
48
|
+
|
49
|
+
Then /^the process should not exit cleanly$/ do
|
50
|
+
assert !@exited_cleanly, "Process did exit cleanly: #{@stdout}"
|
51
|
+
end
|
52
|
+
|
53
|
+
Given /^I use the existing project "([^"]+)" as a template$/ do |fixture_project|
|
54
|
+
@name = fixture_project
|
55
|
+
FileUtils.cp_r File.join(fixture_dir, fixture_project), @working_dir
|
56
|
+
end
|
57
|
+
|
58
|
+
Given /^"VERSION\.yml" contains hash "([^"]+)"$/ do |ruby_string|
|
59
|
+
version_hash = YAML.load(File.read(File.join(@working_dir, @name, 'VERSION.yml')))
|
60
|
+
evaled_hash = eval(ruby_string)
|
61
|
+
assert_equal evaled_hash, version_hash
|
62
|
+
end
|
63
|
+
|
64
|
+
Given /^"VERSION" contains "([^\"]*)"$/ do |expected|
|
65
|
+
version = File.read(File.join(@working_dir, @name, 'VERSION')).chomp
|
66
|
+
assert_equal expected, version
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,284 @@
|
|
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 roodi$/ do
|
18
|
+
@use_roodi = false
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^I want roodi$/ do
|
22
|
+
@use_roodi = true
|
23
|
+
end
|
24
|
+
|
25
|
+
And /^I do not want rubyforge setup$/ do
|
26
|
+
@use_rubyforge = false
|
27
|
+
end
|
28
|
+
|
29
|
+
And /^I want rubyforge setup$/ do
|
30
|
+
@use_rubyforge = true
|
31
|
+
end
|
32
|
+
|
33
|
+
Given /^I want to use yard instead of rdoc$/ do
|
34
|
+
@documentation_framework = "yard"
|
35
|
+
end
|
36
|
+
|
37
|
+
Given /^I want to use rdoc instead of yard$/ do
|
38
|
+
@documentation_framework = "rdoc"
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
Given /^I intend to test with (\w+)$/ do |testing_framework|
|
43
|
+
@testing_framework = testing_framework.to_sym
|
44
|
+
end
|
45
|
+
|
46
|
+
Given /^I have configured git sanely$/ do
|
47
|
+
@user_email = 'bar@example.com'
|
48
|
+
@user_name = 'foo'
|
49
|
+
@github_user = 'technicalpickles'
|
50
|
+
@github_token = 'zomgtoken'
|
51
|
+
|
52
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).
|
53
|
+
returns({
|
54
|
+
'user.name' => @user_name,
|
55
|
+
'user.email' => @user_email,
|
56
|
+
'github.user' => @github_user,
|
57
|
+
'github.token' => @github_token})
|
58
|
+
end
|
59
|
+
|
60
|
+
Given /^I set JEWELER_OPTS env variable to "(.*)"$/ do |val|
|
61
|
+
ENV['JEWELER_OPTS'] = val
|
62
|
+
end
|
63
|
+
|
64
|
+
When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)'$/ do |testing_framework, name, summary|
|
65
|
+
When "I generate a #{testing_framework}project named '#{name}' that is '#{summary}' and described as ''"
|
66
|
+
end
|
67
|
+
|
68
|
+
When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and described as '([^']*)'$/ do |testing_framework, name, summary, description|
|
69
|
+
@name = name
|
70
|
+
@summary = summary
|
71
|
+
@description = description
|
72
|
+
|
73
|
+
testing_framework = testing_framework.squeeze.strip
|
74
|
+
unless testing_framework.blank?
|
75
|
+
@testing_framework = testing_framework.to_sym
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
arguments = ['--directory',
|
80
|
+
"#{@working_dir}/#{@name}",
|
81
|
+
'--summary', @summary,
|
82
|
+
'--description', @description,
|
83
|
+
@use_cucumber ? '--cucumber' : nil,
|
84
|
+
@testing_framework ? "--#{@testing_framework}" : nil,
|
85
|
+
@use_rubyforge ? '--rubyforge' : nil,
|
86
|
+
@use_roodi ? '--roodi' : nil,
|
87
|
+
@use_reek ? '--reek' : nil,
|
88
|
+
@documentation_framework ? "--#{@documentation_framework}" : nil,
|
89
|
+
@name].compact
|
90
|
+
|
91
|
+
@stdout = OutputCatcher.catch_out do
|
92
|
+
Jeweler::Generator::Application.run! *arguments
|
93
|
+
end
|
94
|
+
|
95
|
+
@repo = Git.open(File.join(@working_dir, @name))
|
96
|
+
end
|
97
|
+
|
98
|
+
Then /^a directory named '(.*)' is created$/ do |directory|
|
99
|
+
directory = File.join(@working_dir, directory)
|
100
|
+
|
101
|
+
assert File.exists?(directory), "#{directory} did not exist"
|
102
|
+
assert File.directory?(directory), "#{directory} is not a directory"
|
103
|
+
end
|
104
|
+
|
105
|
+
Then "cucumber directories are created" do
|
106
|
+
Then "a directory named 'the-perfect-gem/features' is created"
|
107
|
+
Then "a directory named 'the-perfect-gem/features/support' is created"
|
108
|
+
Then "a directory named 'the-perfect-gem/features/step_definitions' is created"
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
Then /^a file named '(.*)' is created$/ do |file|
|
113
|
+
file = File.join(@working_dir, file)
|
114
|
+
|
115
|
+
assert File.exists?(file), "#{file} expected to exist, but did not"
|
116
|
+
assert File.file?(file), "#{file} expected to be a file, but is not"
|
117
|
+
end
|
118
|
+
|
119
|
+
Then /^a file named '(.*)' is not created$/ do |file|
|
120
|
+
file = File.join(@working_dir, file)
|
121
|
+
|
122
|
+
assert ! File.exists?(file), "#{file} expected to not exist, but did"
|
123
|
+
end
|
124
|
+
|
125
|
+
Then /^a sane '.gitignore' is created$/ do
|
126
|
+
Then "a file named 'the-perfect-gem/.gitignore' is created"
|
127
|
+
Then "'coverage' is ignored by git"
|
128
|
+
Then "'*.sw?' is ignored by git"
|
129
|
+
Then "'.DS_Store' is ignored by git"
|
130
|
+
Then "'rdoc' is ignored by git"
|
131
|
+
Then "'pkg' is ignored by git"
|
132
|
+
end
|
133
|
+
|
134
|
+
Then /^'(.*)' is ignored by git$/ do |git_ignore|
|
135
|
+
@gitignore_content ||= File.read(File.join(@working_dir, @name, '.gitignore'))
|
136
|
+
|
137
|
+
assert_match git_ignore, @gitignore_content
|
138
|
+
end
|
139
|
+
|
140
|
+
Then /^Rakefile has '(.*)' for the (.*) (.*)$/ do |value, task_class, field|
|
141
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
142
|
+
block_variable, task_block = yank_task_info(@rakefile_content, task_class)
|
143
|
+
#raise "Found in #{task_class}: #{block_variable.inspect}: #{task_block.inspect}"
|
144
|
+
|
145
|
+
assert_match /#{block_variable}\.#{field} = (%Q\{|"|')#{Regexp.escape(value)}(\}|"|')/, task_block
|
146
|
+
end
|
147
|
+
|
148
|
+
Then /^Rakefile has '(.*)' in the Rcov::RcovTask libs$/ do |libs|
|
149
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
150
|
+
block_variable, task_block = yank_task_info(@rakefile_content, 'Rcov::RcovTask')
|
151
|
+
|
152
|
+
assert_match "#{block_variable}.libs << '#{libs}'", @rakefile_content
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
Then /^'(.*)' contains '(.*)'$/ do |file, expected_string|
|
157
|
+
contents = File.read(File.join(@working_dir, @name, file))
|
158
|
+
assert_match expected_string, contents
|
159
|
+
end
|
160
|
+
|
161
|
+
Then /^'(.*)' mentions copyright belonging to me in (\d{4})$/ do |file, year|
|
162
|
+
contents = File.read(File.join(@working_dir, @name, file))
|
163
|
+
assert_match "Copyright (c) #{year} #{@user_name}", contents
|
164
|
+
end
|
165
|
+
|
166
|
+
Then /^'(.*)' mentions copyright belonging to me in the current year$/ do |file|
|
167
|
+
current_year = Time.now.year
|
168
|
+
Then "'#{file}' mentions copyright belonging to me in #{current_year}"
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
Then /^LICENSE has the copyright as belonging to '(.*)' in '(\d{4})'$/ do |copyright_holder, year|
|
173
|
+
Then "a file named 'the-perfect-gem/LICENSE' is created"
|
174
|
+
|
175
|
+
@license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE'))
|
176
|
+
|
177
|
+
assert_match copyright_holder, @license_content
|
178
|
+
|
179
|
+
assert_match year, @license_content
|
180
|
+
end
|
181
|
+
|
182
|
+
Then /^'(.*)' should define '(.*)' as a subclass of '(.*)'$/ do |file, class_name, superclass_name|
|
183
|
+
@test_content = File.read((File.join(@working_dir, @name, file)))
|
184
|
+
|
185
|
+
assert_match "class #{class_name} < #{superclass_name}", @test_content
|
186
|
+
end
|
187
|
+
|
188
|
+
Then /^'(.*)' should describe '(.*)'$/ do |file, describe_name|
|
189
|
+
@spec_content ||= File.read((File.join(@working_dir, @name, file)))
|
190
|
+
|
191
|
+
assert_match %Q{describe "#{describe_name}" do}, @spec_content
|
192
|
+
end
|
193
|
+
|
194
|
+
Then /^'(.*)' requires '(.*)'$/ do |file, lib|
|
195
|
+
content = File.read(File.join(@working_dir, @name, file))
|
196
|
+
|
197
|
+
assert_match /require ['"]#{Regexp.escape(lib)}['"]/, content
|
198
|
+
end
|
199
|
+
|
200
|
+
Then /^'(.*)' does not require '(.*)'$/ do |file, lib|
|
201
|
+
content = File.read(File.join(@working_dir, @name, file))
|
202
|
+
|
203
|
+
assert_no_match /require ['"]#{Regexp.escape(lib)}['"]/, content
|
204
|
+
end
|
205
|
+
|
206
|
+
Then /^Rakefile does not require '(.*)'$/ do |file|
|
207
|
+
Then "'Rakefile' does not require '#{file}'"
|
208
|
+
end
|
209
|
+
|
210
|
+
Then /^Rakefile requires '(.*)'$/ do |file|
|
211
|
+
Then "'Rakefile' requires '#{file}'"
|
212
|
+
end
|
213
|
+
|
214
|
+
Then /^Rakefile does not instantiate a (.*)$/ do |task_name|
|
215
|
+
content = File.read(File.join(@working_dir, @name, 'Rakefile'))
|
216
|
+
assert_no_match /#{task_name}/, content
|
217
|
+
end
|
218
|
+
|
219
|
+
Then /^Rakefile instantiates a (.*)$/ do |task_name|
|
220
|
+
content = File.read(File.join(@working_dir, @name, 'Rakefile'))
|
221
|
+
assert_match /#{task_name}/, content
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
Then /^'test\/test_helper\.rb' should autorun tests$/ do
|
226
|
+
content = File.read(File.join(@working_dir, @name, 'test/test_helper.rb'))
|
227
|
+
|
228
|
+
assert_match "Mini::Test.autorun", content
|
229
|
+
end
|
230
|
+
|
231
|
+
Then /^cucumber world extends "(.*)"$/ do |module_to_extend|
|
232
|
+
content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb'))
|
233
|
+
assert_match "World(#{module_to_extend})", content
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
Then /^'features\/support\/env\.rb' sets up features to use test\/unit assertions$/ do
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
Then /^'features\/support\/env\.rb' sets up features to use minitest assertions$/ do
|
242
|
+
content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb'))
|
243
|
+
|
244
|
+
assert_match "world.extend(Mini::Test::Assertions)", content
|
245
|
+
end
|
246
|
+
|
247
|
+
Then /^git repository has '(.*)' remote$/ do |remote|
|
248
|
+
remote = @repo.remotes.first
|
249
|
+
|
250
|
+
assert_equal 'origin', remote.name
|
251
|
+
end
|
252
|
+
|
253
|
+
Then /^git repository '(.*)' remote should be '(.*)'/ do |remote, remote_url|
|
254
|
+
remote = @repo.remotes.first
|
255
|
+
|
256
|
+
assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
|
257
|
+
end
|
258
|
+
|
259
|
+
Then /^a commit with the message '(.*)' is made$/ do |message|
|
260
|
+
assert_match message, @repo.log.first.message
|
261
|
+
end
|
262
|
+
|
263
|
+
Then /^'(.*)' was checked in$/ do |file|
|
264
|
+
status = @repo.status[file]
|
265
|
+
|
266
|
+
assert_not_nil status, "wasn't able to get status for #{file}"
|
267
|
+
assert ! status.untracked, "#{file} was untracked"
|
268
|
+
assert_nil status.type, "#{file} had a type. it should have been nil"
|
269
|
+
end
|
270
|
+
|
271
|
+
Then /^no files are (\w+)$/ do |type|
|
272
|
+
assert_equal 0, @repo.status.send(type).size
|
273
|
+
end
|
274
|
+
|
275
|
+
Then /^Rakefile has "(.*)" as the default task$/ do |task|
|
276
|
+
@rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
|
277
|
+
assert_match "task :default => :#{task}", @rakefile_content
|
278
|
+
end
|
279
|
+
|
280
|
+
|
281
|
+
After do
|
282
|
+
ENV['JEWELER_OPTS'] = nil
|
283
|
+
FileUtils.rm_rf @working_dir if @working_dir
|
284
|
+
end
|