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