dima-jeweler 0.9.2 → 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 +54 -1
- data/README.markdown +89 -20
- data/ROADMAP +12 -0
- data/Rakefile +52 -12
- data/VERSION.yml +3 -3
- 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 +39 -52
- data/lib/jeweler/commands.rb +2 -0
- data/lib/jeweler/commands/build_gem.rb +9 -0
- data/lib/jeweler/commands/check_dependencies.rb +52 -0
- data/lib/jeweler/commands/install_gem.rb +23 -2
- data/lib/jeweler/commands/release.rb +52 -12
- data/lib/jeweler/commands/release_to_rubyforge.rb +32 -9
- data/lib/jeweler/commands/setup_rubyforge.rb +57 -0
- data/lib/jeweler/commands/validate_gemspec.rb +9 -0
- data/lib/jeweler/commands/version/base.rb +13 -2
- data/lib/jeweler/commands/write_gemspec.rb +13 -0
- data/lib/jeweler/errors.rb +13 -1
- data/lib/jeweler/gemspec_helper.rb +31 -3
- data/lib/jeweler/generator.rb +80 -120
- data/lib/jeweler/generator/application.rb +12 -3
- 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 +37 -3
- 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 +72 -39
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/README.rdoc +12 -1
- data/lib/jeweler/templates/Rakefile +83 -49
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +4 -7
- data/lib/jeweler/templates/micronaut/helper.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -1
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +4 -3
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/lib/jeweler/version_helper.rb +78 -33
- 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/jeweler/commands/test_build_gem.rb +20 -1
- data/test/jeweler/commands/test_install_gem.rb +74 -0
- data/test/jeweler/commands/test_release.rb +289 -77
- data/test/jeweler/commands/test_release_to_rubyforge.rb +66 -50
- 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 +34 -0
- data/test/jeweler/commands/version/test_base.rb +32 -0
- data/test/jeweler/commands/version/test_bump_major.rb +1 -0
- data/test/test_application.rb +31 -1
- data/test/test_gemspec_helper.rb +4 -0
- data/test/test_generator.rb +101 -114
- data/test/test_generator_initialization.rb +156 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +104 -16
- data/test/test_jeweler.rb +134 -96
- data/test/test_options.rb +59 -0
- data/test/test_specification.rb +61 -0
- data/test/test_tasks.rb +13 -18
- data/test/test_version_helper.rb +47 -9
- metadata +174 -43
- data/TODO +0 -11
- data/test/generators/initialization_test.rb +0 -146
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestGeneratorMixins < Test::Unit::TestCase
|
4
|
+
|
5
|
+
[Jeweler::Generator::BaconMixin, Jeweler::Generator::MicronautMixin,
|
6
|
+
Jeweler::Generator::RspecMixin, Jeweler::Generator::ShouldaMixin,
|
7
|
+
Jeweler::Generator::TestunitMixin, Jeweler::Generator::MinitestMixin].each do |mixin|
|
8
|
+
context "#{mixin}" do
|
9
|
+
%w(default_task feature_support_require feature_support_extend
|
10
|
+
test_dir test_task test_pattern test_filename
|
11
|
+
test_helper_filename).each do |method|
|
12
|
+
should "define #{method}" do
|
13
|
+
assert mixin.method_defined?(method)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
|
5
|
-
require 'ruby-debug'
|
6
|
-
|
7
|
-
|
4
|
+
begin
|
5
|
+
require 'ruby-debug'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'shoulda'
|
11
|
+
require 'rr'
|
12
|
+
require 'redgreen'
|
13
|
+
rescue LoadError => e
|
14
|
+
puts "*" * 80
|
15
|
+
puts "Some dependencies needed to run tests were missing. Run the following command to find them:"
|
16
|
+
puts
|
17
|
+
puts "\trake development_dependencies:check"
|
18
|
+
puts "*" * 80
|
19
|
+
exit 1
|
20
|
+
end
|
21
|
+
|
8
22
|
require 'time'
|
9
23
|
|
10
24
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
@@ -13,28 +27,34 @@ require 'jeweler'
|
|
13
27
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
28
|
require 'shoulda_macros/jeweler_macros'
|
15
29
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
30
|
+
TMP_DIR = File.expand_path('../tmp', __FILE__)
|
31
|
+
FIXTURE_DIR = File.expand_path('../fixtures', __FILE__)
|
32
|
+
|
33
|
+
class RubyForgeStub
|
34
|
+
attr_accessor :userconfig, :autoconfig
|
35
|
+
def initialize
|
36
|
+
@userconfig = {}
|
37
|
+
@autoconfig = {}
|
38
|
+
end
|
21
39
|
end
|
22
40
|
|
23
41
|
class Test::Unit::TestCase
|
24
42
|
include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit)
|
25
43
|
|
26
|
-
def
|
27
|
-
|
28
|
-
block.call
|
29
|
-
end
|
44
|
+
def tmp_dir
|
45
|
+
TMP_DIR
|
30
46
|
end
|
31
47
|
|
32
48
|
def fixture_dir
|
33
|
-
File.join(
|
49
|
+
File.join(FIXTURE_DIR, 'bar')
|
34
50
|
end
|
35
51
|
|
36
|
-
def
|
37
|
-
|
52
|
+
def remove_tmpdir!
|
53
|
+
FileUtils.rm_rf(tmp_dir)
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_tmpdir!
|
57
|
+
FileUtils.mkdir_p(tmp_dir)
|
38
58
|
end
|
39
59
|
|
40
60
|
def build_spec(*files)
|
@@ -46,6 +66,74 @@ class Test::Unit::TestCase
|
|
46
66
|
s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
47
67
|
s.authors = ["Josh Nichols"]
|
48
68
|
s.files = FileList[*files] unless files.empty?
|
69
|
+
s.version = '0.1.1'
|
49
70
|
end
|
50
71
|
end
|
72
|
+
|
73
|
+
def self.rubyforge_command_context(description, &block)
|
74
|
+
context description do
|
75
|
+
setup do
|
76
|
+
@command = eval(self.class.name.gsub(/::Test/, '::')).new
|
77
|
+
|
78
|
+
if @command.respond_to? :gemspec=
|
79
|
+
@gemspec = Object.new
|
80
|
+
@command.gemspec = @gemspec
|
81
|
+
end
|
82
|
+
|
83
|
+
if @command.respond_to? :gemspec_helper=
|
84
|
+
@gemspec_helper = Object.new
|
85
|
+
@command.gemspec_helper = @gemspec_helper
|
86
|
+
end
|
87
|
+
|
88
|
+
if @command.respond_to? :rubyforge=
|
89
|
+
@rubyforge = RubyForgeStub.new
|
90
|
+
@command.rubyforge = @rubyforge
|
91
|
+
end
|
92
|
+
|
93
|
+
if @command.respond_to? :output
|
94
|
+
@output = StringIO.new
|
95
|
+
@command.output = @output
|
96
|
+
end
|
97
|
+
|
98
|
+
if @command.respond_to? :repo
|
99
|
+
@repo = Object.new
|
100
|
+
@command.repo = @repo
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "", &block
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.build_command_context(description, &block)
|
109
|
+
context description do
|
110
|
+
setup do
|
111
|
+
|
112
|
+
@repo = Object.new
|
113
|
+
@version_helper = Object.new
|
114
|
+
@gemspec = Object.new
|
115
|
+
@commit = Object.new
|
116
|
+
@version = Object.new
|
117
|
+
@output = Object.new
|
118
|
+
@base_dir = Object.new
|
119
|
+
@gemspec_helper = Object.new
|
120
|
+
@rubyforge = Object.new
|
121
|
+
|
122
|
+
@jeweler = Object.new
|
123
|
+
|
124
|
+
stub(@jeweler).repo { @repo }
|
125
|
+
stub(@jeweler).version_helper { @version_helper }
|
126
|
+
stub(@jeweler).gemspec { @gemspec }
|
127
|
+
stub(@jeweler).commit { @commit }
|
128
|
+
stub(@jeweler).version { @version }
|
129
|
+
stub(@jeweler).output { @output }
|
130
|
+
stub(@jeweler).gemspec_helper { @gemspec_helper }
|
131
|
+
stub(@jeweler).base_dir { @base_dir }
|
132
|
+
stub(@jeweler).rubyforge { @rubyforge }
|
133
|
+
end
|
134
|
+
|
135
|
+
context "", &block
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
51
139
|
end
|
data/test/test_jeweler.rb
CHANGED
@@ -2,135 +2,173 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TestJeweler < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
5
|
+
def build_jeweler(base_dir = nil)
|
6
|
+
base_dir ||= non_git_dir_path
|
7
|
+
FileUtils.mkdir_p base_dir
|
8
8
|
|
9
|
-
|
9
|
+
Jeweler.new(build_spec, base_dir)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def git_dir_path
|
13
|
+
File.join(tmp_dir, 'git')
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
@jeweler = Jeweler.new(build_spec, tmp_dir)
|
20
|
-
end
|
16
|
+
def non_git_dir_path
|
17
|
+
File.join(tmp_dir, 'nongit')
|
18
|
+
end
|
21
19
|
|
22
|
-
|
23
|
-
|
20
|
+
def build_git_dir
|
21
|
+
|
22
|
+
FileUtils.mkdir_p git_dir_path
|
23
|
+
Dir.chdir git_dir_path do
|
24
|
+
Git.init
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def build_non_git_dir
|
29
|
+
FileUtils.mkdir_p non_git_dir_path
|
30
|
+
end
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@jeweler = Jeweler.new(build_spec, tmp_dir)
|
33
|
-
@jeweler.output = StringIO.new
|
32
|
+
should "raise an error if a nil gemspec is given" do
|
33
|
+
assert_raises Jeweler::GemspecError do
|
34
|
+
Jeweler.new(nil)
|
34
35
|
end
|
36
|
+
end
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
should_have_patch_version 2
|
39
|
-
should_be_version '1.5.2'
|
38
|
+
should "know if it is in a git repo" do
|
39
|
+
build_git_dir
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
@jeweler.bump_patch_version
|
44
|
-
end
|
45
|
-
should_bump_version 1, 5, 3
|
46
|
-
end
|
41
|
+
assert build_jeweler(git_dir_path).in_git_repo?
|
42
|
+
end
|
47
43
|
|
48
|
-
|
49
|
-
|
50
|
-
@jeweler.bump_minor_version
|
51
|
-
end
|
44
|
+
should "know if it is not in a git repo" do
|
45
|
+
build_non_git_dir
|
52
46
|
|
53
|
-
|
54
|
-
|
47
|
+
jeweler = build_jeweler(non_git_dir_path)
|
48
|
+
assert ! jeweler.in_git_repo?, "jeweler doesn't know that #{jeweler.base_dir} is not a git repository"
|
49
|
+
end
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
@jeweler.bump_major_version
|
59
|
-
end
|
51
|
+
should "build and run write gemspec command when writing gemspec" do
|
52
|
+
jeweler = build_jeweler
|
60
53
|
|
61
|
-
|
62
|
-
|
54
|
+
command = Object.new
|
55
|
+
mock(command).run
|
63
56
|
|
64
|
-
|
65
|
-
assert ! @jeweler.gemspec.files.empty?
|
66
|
-
end
|
57
|
+
mock(Jeweler::Commands::WriteGemspec).build_for(jeweler) { command }
|
67
58
|
|
68
|
-
|
69
|
-
|
70
|
-
@alt_jeweler = Jeweler.new(build_spec("[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"), tmp_dir)
|
71
|
-
end
|
72
|
-
|
73
|
-
should "have the same files as when no 'files' are specified" do
|
74
|
-
assert_equal @jeweler.gemspec.files, @alt_jeweler.gemspec.files
|
75
|
-
end
|
76
|
-
end
|
59
|
+
jeweler.write_gemspec
|
60
|
+
end
|
77
61
|
|
78
|
-
|
79
|
-
|
80
|
-
assert @jeweler.gemspec.has_rdoc
|
81
|
-
end
|
62
|
+
should "build and run validate gemspec command when validating gemspec" do
|
63
|
+
jeweler = build_jeweler
|
82
64
|
|
83
|
-
|
84
|
-
|
85
|
-
end
|
65
|
+
command = Object.new
|
66
|
+
mock(command).run
|
86
67
|
|
87
|
-
|
88
|
-
assert @jeweler.gemspec.rdoc_options.include?('--charset=UTF-8')
|
89
|
-
end
|
68
|
+
mock(Jeweler::Commands::ValidateGemspec).build_for(jeweler) { command }
|
90
69
|
|
91
|
-
|
70
|
+
jeweler.validate_gemspec
|
71
|
+
end
|
92
72
|
|
93
|
-
|
94
|
-
|
95
|
-
@jeweler.write_gemspec
|
96
|
-
@output = @jeweler.output.string
|
97
|
-
end
|
73
|
+
should "build and run build gem command when building gem" do
|
74
|
+
jeweler = build_jeweler
|
98
75
|
|
99
|
-
|
100
|
-
|
101
|
-
end
|
76
|
+
command = Object.new
|
77
|
+
mock(command).run
|
102
78
|
|
103
|
-
|
104
|
-
assert @jeweler.valid_gemspec?
|
105
|
-
end
|
79
|
+
mock(Jeweler::Commands::BuildGem).build_for(jeweler) { command }
|
106
80
|
|
107
|
-
|
108
|
-
|
109
|
-
end
|
81
|
+
jeweler.build_gem
|
82
|
+
end
|
110
83
|
|
111
|
-
|
112
|
-
|
113
|
-
gemspec_path = File.join(tmp_dir, 'bar.gemspec')
|
114
|
-
data = File.read(gemspec_path)
|
84
|
+
should "build and run build gem command when installing gem" do
|
85
|
+
jeweler = build_jeweler
|
115
86
|
|
116
|
-
|
117
|
-
|
87
|
+
command = Object.new
|
88
|
+
mock(command).run
|
118
89
|
|
119
|
-
|
120
|
-
assert_equal '1.5.2', @parsed_spec.version.version
|
121
|
-
end
|
90
|
+
mock(Jeweler::Commands::InstallGem).build_for(jeweler) { command }
|
122
91
|
|
123
|
-
|
124
|
-
assert_equal Time.local(@now.year, @now.month, @now.day), @parsed_spec.date
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
92
|
+
jeweler.install_gem
|
128
93
|
end
|
129
94
|
|
130
|
-
should "
|
131
|
-
|
132
|
-
|
133
|
-
|
95
|
+
should "build and run bump major version command when bumping major version" do
|
96
|
+
jeweler = build_jeweler
|
97
|
+
|
98
|
+
command = Object.new
|
99
|
+
mock(command).run
|
100
|
+
|
101
|
+
mock(Jeweler::Commands::Version::BumpMajor).build_for(jeweler) { command }
|
102
|
+
|
103
|
+
jeweler.bump_major_version
|
104
|
+
end
|
105
|
+
|
106
|
+
should "build and run bump minor version command when bumping minor version" do
|
107
|
+
jeweler = build_jeweler
|
108
|
+
|
109
|
+
command = Object.new
|
110
|
+
mock(command).run
|
111
|
+
|
112
|
+
mock(Jeweler::Commands::Version::BumpMinor).build_for(jeweler) { command }
|
113
|
+
|
114
|
+
jeweler.bump_minor_version
|
115
|
+
end
|
116
|
+
|
117
|
+
should "build and run write version command when writing version" do
|
118
|
+
jeweler = build_jeweler
|
119
|
+
|
120
|
+
command = Object.new
|
121
|
+
mock(command).run
|
122
|
+
mock(command).major=(1)
|
123
|
+
mock(command).minor=(5)
|
124
|
+
mock(command).patch=(2)
|
125
|
+
|
126
|
+
mock(Jeweler::Commands::Version::Write).build_for(jeweler) { command }
|
127
|
+
|
128
|
+
jeweler.write_version(1, 5, 2)
|
129
|
+
end
|
130
|
+
|
131
|
+
should "build and run release command when running release" do
|
132
|
+
jeweler = build_jeweler
|
133
|
+
|
134
|
+
command = Object.new
|
135
|
+
mock(command).run
|
136
|
+
|
137
|
+
mock(Jeweler::Commands::Release).build_for(jeweler) { command }
|
138
|
+
|
139
|
+
jeweler.release
|
140
|
+
end
|
141
|
+
|
142
|
+
should "build and run release to rubyforge command when running release to rubyforge" do
|
143
|
+
jeweler = build_jeweler
|
144
|
+
|
145
|
+
command = Object.new
|
146
|
+
mock(command).run
|
147
|
+
|
148
|
+
mock(Jeweler::Commands::ReleaseToRubyforge).build_for(jeweler) { command }
|
149
|
+
|
150
|
+
jeweler.release_gem_to_rubyforge
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
should "respond to gemspec_helper" do
|
155
|
+
assert_respond_to build_jeweler, :gemspec_helper
|
156
|
+
end
|
157
|
+
|
158
|
+
should "respond to version_helper" do
|
159
|
+
assert_respond_to build_jeweler, :version_helper
|
160
|
+
end
|
161
|
+
|
162
|
+
should "respond to repo" do
|
163
|
+
assert_respond_to build_jeweler, :repo
|
164
|
+
end
|
165
|
+
|
166
|
+
should "respond to commit" do
|
167
|
+
assert_respond_to build_jeweler, :commit
|
168
|
+
end
|
169
|
+
|
170
|
+
should "respond to rubyforge" do
|
171
|
+
assert_respond_to build_jeweler, :rubyforge
|
134
172
|
end
|
135
173
|
|
136
174
|
end
|
data/test/test_options.rb
CHANGED
@@ -8,6 +8,12 @@ class TestOptions < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.should_have_docmentation_framework(documentation_framework)
|
12
|
+
should "use #{documentation_framework} for documentation" do
|
13
|
+
assert_equal documentation_framework.to_sym, @options[:documentation_framework]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
11
17
|
def setup_options(*arguments)
|
12
18
|
@options = Jeweler::Generator::Options.new(arguments)
|
13
19
|
end
|
@@ -22,6 +28,7 @@ class TestOptions < Test::Unit::TestCase
|
|
22
28
|
context "default options" do
|
23
29
|
setup { setup_options }
|
24
30
|
should_have_testing_framework :shoulda
|
31
|
+
should_have_docmentation_framework :rdoc
|
25
32
|
should 'not create repository' do
|
26
33
|
assert ! @options[:create_repo]
|
27
34
|
end
|
@@ -57,18 +64,50 @@ class TestOptions < Test::Unit::TestCase
|
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
67
|
+
for_options '--reek' do
|
68
|
+
should 'enable reek' do
|
69
|
+
assert_equal true, @options[:use_reek]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
for_options '--roodi' do
|
74
|
+
should 'enable roodi' do
|
75
|
+
assert_equal true, @options[:use_roodi]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
60
79
|
for_options '--create-repo' do
|
61
80
|
should 'create repository' do
|
62
81
|
assert @options[:create_repo]
|
63
82
|
end
|
64
83
|
end
|
65
84
|
|
85
|
+
for_options '--rubyforge' do
|
86
|
+
should 'enable rubyforge' do
|
87
|
+
assert @options[:rubyforge]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
for_options '--rdoc' do
|
92
|
+
should_have_docmentation_framework :rdoc
|
93
|
+
end
|
94
|
+
|
95
|
+
for_options '--yard' do
|
96
|
+
should_have_docmentation_framework :yard
|
97
|
+
end
|
98
|
+
|
66
99
|
for_options '--summary', 'zomg so awesome' do
|
67
100
|
should 'have summary zomg so awesome' do
|
68
101
|
assert_equal 'zomg so awesome', @options[:summary]
|
69
102
|
end
|
70
103
|
end
|
71
104
|
|
105
|
+
for_options '--description', 'Descriptive' do
|
106
|
+
should 'have description Descriptive' do
|
107
|
+
assert_equal 'Descriptive', @options[:description]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
72
111
|
for_options '--directory', 'foo' do
|
73
112
|
should 'have directory foo' do
|
74
113
|
assert_equal 'foo', @options[:directory]
|
@@ -87,4 +126,24 @@ class TestOptions < Test::Unit::TestCase
|
|
87
126
|
end
|
88
127
|
end
|
89
128
|
|
129
|
+
for_options '--zomg-invalid' do
|
130
|
+
should 'be an invalid argument' do
|
131
|
+
assert @options[:invalid_argument]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context "merging options" do
|
136
|
+
should "take options from each" do
|
137
|
+
options = Jeweler::Generator::Options.new(["--rspec"]).
|
138
|
+
merge Jeweler::Generator::Options.new(["--create-repo"])
|
139
|
+
assert_equal :rspec, options[:testing_framework]
|
140
|
+
assert options[:create_repo]
|
141
|
+
end
|
142
|
+
|
143
|
+
should "shadow options" do
|
144
|
+
options = Jeweler::Generator::Options.new(["--bacon"]).
|
145
|
+
merge Jeweler::Generator::Options.new(["--rspec"])
|
146
|
+
assert_equal :rspec, options[:testing_framework]
|
147
|
+
end
|
148
|
+
end
|
90
149
|
end
|