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