jeweler 1.8.2 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.semver +5 -0
- data/.travis.yml +5 -3
- data/ChangeLog.markdown +30 -0
- data/Gemfile +32 -25
- data/Gemfile.lock +117 -46
- data/README.markdown +36 -10
- data/README.org +374 -0
- data/Rakefile +23 -28
- data/bin/jeweler +1 -0
- data/features/generator/gemfile.feature +1 -0
- data/features/generator/test.feature +2 -2
- data/features/step_definitions/debug_steps.rb +0 -1
- data/features/step_definitions/filesystem_steps.rb +2 -3
- data/features/step_definitions/generator_steps.rb +44 -66
- data/features/step_definitions/task_steps.rb +1 -2
- data/features/support/env.rb +22 -9
- data/jeweler.gemspec +64 -45
- data/lib/jeweler/commands/build_gem.rb +6 -2
- data/lib/jeweler/commands/check_dependencies.rb +3 -3
- data/lib/jeweler/commands/install_gem.rb +1 -1
- data/lib/jeweler/commands/release_gemspec.rb +17 -14
- data/lib/jeweler/commands/release_to_git.rb +20 -11
- data/lib/jeweler/commands/validate_gemspec.rb +5 -7
- data/lib/jeweler/commands/version/base.rb +8 -13
- data/lib/jeweler/commands/version/bump_major.rb +1 -3
- data/lib/jeweler/commands/version/bump_minor.rb +1 -2
- data/lib/jeweler/commands/version/bump_patch.rb +1 -4
- data/lib/jeweler/commands/write_gemspec.rb +4 -3
- data/lib/jeweler/commands.rb +6 -6
- data/lib/jeweler/gemspec_helper.rb +15 -15
- data/lib/jeweler/generator/application.rb +5 -10
- data/lib/jeweler/generator/bacon_mixin.rb +2 -4
- data/lib/jeweler/generator/github_mixin.rb +1 -10
- data/lib/jeweler/generator/micronaut_mixin.rb +3 -3
- data/lib/jeweler/generator/minitest_mixin.rb +2 -3
- data/lib/jeweler/generator/options.rb +16 -25
- data/lib/jeweler/generator/rdoc_mixin.rb +1 -1
- data/lib/jeweler/generator/riot_mixin.rb +2 -3
- data/lib/jeweler/generator/rspec_mixin.rb +2 -3
- data/lib/jeweler/generator/shindo_mixin.rb +2 -3
- data/lib/jeweler/generator/shoulda_mixin.rb +2 -3
- data/lib/jeweler/generator/testspec_mixin.rb +2 -3
- data/lib/jeweler/generator/testunit_mixin.rb +1 -3
- data/lib/jeweler/generator/yard_mixin.rb +3 -4
- data/lib/jeweler/generator.rb +52 -45
- data/lib/jeweler/rubyforge_tasks.rb +13 -13
- data/lib/jeweler/rubygems_dot_org_tasks.rb +3 -3
- data/lib/jeweler/rubygems_tasks.rb +3 -3
- data/lib/jeweler/specification.rb +22 -11
- data/lib/jeweler/tasks.rb +68 -59
- data/lib/jeweler/templates/Gemfile +1 -1
- data/lib/jeweler/templates/bacon/flunking.rb +3 -3
- data/lib/jeweler/templates/bacon/helper.rb +1 -0
- data/lib/jeweler/templates/features/support/env.rb +1 -0
- data/lib/jeweler/templates/jeweler_tasks.erb +1 -1
- data/lib/jeweler/templates/micronaut/flunking.rb +3 -3
- data/lib/jeweler/templates/micronaut/helper.rb +1 -0
- data/lib/jeweler/templates/minitest/flunking.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +4 -3
- data/lib/jeweler/templates/other_tasks.erb +4 -20
- data/lib/jeweler/templates/riot/flunking.rb +1 -1
- data/lib/jeweler/templates/riot/helper.rb +1 -0
- data/lib/jeweler/templates/rspec/flunking.rb +3 -3
- data/lib/jeweler/templates/rspec/helper.rb +3 -1
- data/lib/jeweler/templates/shindo/flunking.rb +3 -3
- data/lib/jeweler/templates/shindo/helper.rb +1 -0
- data/lib/jeweler/templates/shoulda/helper.rb +1 -0
- data/lib/jeweler/templates/simplecov.erb +16 -0
- data/lib/jeweler/templates/testspec/flunking.rb +3 -3
- data/lib/jeweler/templates/testspec/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -0
- data/lib/jeweler/version.rb +3 -3
- data/lib/jeweler/version_helper.rb +18 -15
- data/lib/jeweler.rb +23 -23
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -1
- data/test/fixtures/existing-project-with-version-constant/Rakefile +18 -20
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +2 -2
- data/test/jeweler/commands/test_build_gem.rb +33 -27
- data/test/jeweler/commands/test_install_gem.rb +7 -7
- data/test/jeweler/commands/test_release_to_gemcutter.rb +6 -7
- data/test/jeweler/commands/test_release_to_git.rb +95 -37
- data/test/jeweler/commands/test_release_to_github.rb +161 -97
- data/test/jeweler/commands/test_validate_gemspec.rb +4 -6
- data/test/jeweler/commands/test_write_gemspec.rb +21 -24
- data/test/jeweler/commands/version/test_base.rb +26 -6
- data/test/jeweler/commands/version/test_bump_major.rb +1 -5
- data/test/jeweler/commands/version/test_bump_minor.rb +1 -2
- data/test/jeweler/commands/version/test_bump_patch.rb +1 -3
- data/test/jeweler/commands/version/test_write.rb +1 -3
- data/test/jeweler/generator/test_application.rb +22 -26
- data/test/jeweler/generator/test_options.rb +26 -38
- data/test/jeweler/test_gemspec_helper.rb +7 -7
- data/test/jeweler/test_generator.rb +31 -33
- data/test/jeweler/test_generator_initialization.rb +40 -57
- data/test/jeweler/test_generator_mixins.rb +6 -7
- data/test/jeweler/test_specification.rb +44 -43
- data/test/jeweler/test_tasks.rb +2 -3
- data/test/jeweler/test_version_helper.rb +33 -35
- data/test/shoulda_macros/jeweler_macros.rb +5 -5
- data/test/test_helper.rb +25 -31
- data/test/test_jeweler.rb +28 -29
- metadata +206 -165
@@ -5,102 +5,88 @@ class TestGeneratorInitialization < Test::Unit::TestCase
|
|
5
5
|
set_default_git_config
|
6
6
|
end
|
7
7
|
|
8
|
-
context
|
8
|
+
context 'given a nil github repo name' do
|
9
9
|
setup do
|
10
10
|
stub_git_config
|
11
11
|
end
|
12
12
|
|
13
13
|
should 'raise NoGithubRepoNameGiven' do
|
14
14
|
assert_raise Jeweler::NoGitHubRepoNameGiven do
|
15
|
-
Jeweler::Generator.new
|
15
|
+
Jeweler::Generator.new
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context "without git user's name set" do
|
21
21
|
setup do
|
22
|
-
stub_git_config
|
22
|
+
stub_git_config
|
23
23
|
end
|
24
24
|
|
25
25
|
should 'raise an NoGitUserName' do
|
26
26
|
assert_raise Jeweler::NoGitUserName do
|
27
|
-
Jeweler::Generator.new(:
|
27
|
+
Jeweler::Generator.new(project_name: @project_name, testing_framework: :shoulda, documentation_framework: :rdoc)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
context "without git user's email set" do
|
33
33
|
setup do
|
34
|
-
stub_git_config
|
34
|
+
stub_git_config
|
35
35
|
end
|
36
36
|
|
37
37
|
should 'raise NoGitUserEmail' do
|
38
38
|
assert_raise Jeweler::NoGitUserEmail do
|
39
|
-
Jeweler::Generator.new(:
|
39
|
+
Jeweler::Generator.new(project_name: @project_name, user_name: @git_name, testing_framework: :shoulda, documentation_framework: :rdoc)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
context
|
44
|
+
context 'without github username set' do
|
45
45
|
setup do
|
46
46
|
stub_git_config
|
47
47
|
end
|
48
48
|
|
49
49
|
should 'raise NotGitHubUser' do
|
50
50
|
assert_raise Jeweler::NoGitHubUser do
|
51
|
-
Jeweler::Generator.new(:
|
51
|
+
Jeweler::Generator.new(project_name: @project_name, user_name: @git_name, user_email: @git_email, testing_framework: :shoulda, documentation_framework: :rdoc)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
|
-
context "without github token set" do
|
57
|
-
setup do
|
58
|
-
stub_git_config
|
59
|
-
end
|
60
|
-
|
61
|
-
should 'raise NoGitHubToken if creating repo' do
|
62
|
-
assert_raise Jeweler::NoGitHubToken do
|
63
|
-
Jeweler::Generator.new(:project_name => @project_name, :user_name => @git_name, :user_email => @git_email, :github_username => @github_user, :create_repo => true, :testing_framework => :shoulda, :documentation_framework => :rdoc)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
55
|
def build_generator(options = {})
|
69
|
-
defaults = { :
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:documentation_framework => :rdoc }
|
56
|
+
defaults = { project_name: @project_name,
|
57
|
+
user_name: @git_name,
|
58
|
+
user_email: @git_email,
|
59
|
+
github_username: @github_user,
|
60
|
+
testing_framework: :shoulda,
|
61
|
+
documentation_framework: :rdoc }
|
76
62
|
|
77
63
|
options = defaults.merge(options)
|
78
|
-
Jeweler::Generator.new(options)
|
64
|
+
Jeweler::Generator.new(options)
|
79
65
|
end
|
80
66
|
|
81
|
-
context
|
67
|
+
context 'default configuration' do
|
82
68
|
setup do
|
83
69
|
stub_git_config
|
84
70
|
@generator = build_generator
|
85
71
|
end
|
86
72
|
|
87
|
-
should
|
73
|
+
should 'use shoulda for testing' do
|
88
74
|
assert_equal :shoulda, @generator.testing_framework
|
89
75
|
end
|
90
76
|
|
91
|
-
should
|
77
|
+
should 'use rdoc for documentation' do
|
92
78
|
assert_equal :rdoc, @generator.documentation_framework
|
93
79
|
end
|
94
80
|
|
95
|
-
should
|
96
|
-
assert_match
|
81
|
+
should 'set todo in summary' do
|
82
|
+
assert_match(/todo/i, @generator.summary)
|
97
83
|
end
|
98
84
|
|
99
|
-
should
|
100
|
-
assert_match
|
85
|
+
should 'set todo in description' do
|
86
|
+
assert_match(/todo/i, @generator.description)
|
101
87
|
end
|
102
88
|
|
103
|
-
should
|
89
|
+
should 'set target directory to the project name' do
|
104
90
|
assert_equal @project_name, File.split(@generator.target_dir).last
|
105
91
|
end
|
106
92
|
|
@@ -108,57 +94,54 @@ class TestGeneratorInitialization < Test::Unit::TestCase
|
|
108
94
|
assert_equal @git_name, @generator.user_name
|
109
95
|
end
|
110
96
|
|
111
|
-
should
|
97
|
+
should 'set email from git config' do
|
112
98
|
assert_equal @git_email, @generator.user_email
|
113
99
|
end
|
114
100
|
|
115
|
-
should
|
101
|
+
should 'set origin remote as github, based on username and project name' do
|
116
102
|
assert_equal "git@github.com:#{@github_user}/#{@project_name}.git", @generator.git_remote
|
117
103
|
end
|
118
104
|
|
119
|
-
should
|
105
|
+
should 'set homepage as github based on username and project name' do
|
120
106
|
assert_equal "http://github.com/#{@github_user}/#{@project_name}", @generator.homepage
|
121
107
|
end
|
122
108
|
|
123
|
-
should
|
109
|
+
should 'set github username from git config' do
|
124
110
|
assert_equal @github_user, @generator.github_username
|
125
111
|
end
|
126
112
|
|
127
|
-
should
|
113
|
+
should 'set project name as the-perfect-gem' do
|
128
114
|
assert_equal @project_name, @generator.project_name
|
129
115
|
end
|
130
116
|
end
|
131
117
|
|
132
|
-
context
|
118
|
+
context 'using yard' do
|
133
119
|
setup do
|
134
|
-
@generator = build_generator(:
|
120
|
+
@generator = build_generator(documentation_framework: :yard)
|
135
121
|
end
|
136
122
|
|
137
|
-
should
|
138
|
-
assert_equal
|
123
|
+
should 'set the doc_task to yardoc' do
|
124
|
+
assert_equal 'yardoc', @generator.doc_task
|
139
125
|
end
|
140
|
-
|
141
126
|
end
|
142
127
|
|
143
|
-
context
|
128
|
+
context 'using rdoc' do
|
144
129
|
setup do
|
145
|
-
@generator = build_generator(:
|
130
|
+
@generator = build_generator(documentation_framework: :rdoc)
|
146
131
|
end
|
147
132
|
|
148
|
-
should
|
149
|
-
assert_equal
|
133
|
+
should 'set the doc_task to rdoc' do
|
134
|
+
assert_equal 'rdoc', @generator.doc_task
|
150
135
|
end
|
151
136
|
end
|
152
137
|
|
153
|
-
context
|
138
|
+
context 'using a custom homepage' do
|
154
139
|
setup do
|
155
|
-
@generator = build_generator(:
|
140
|
+
@generator = build_generator(homepage: 'http://zomg.com')
|
156
141
|
end
|
157
142
|
|
158
|
-
should
|
159
|
-
assert_equal
|
143
|
+
should 'set the homepage' do
|
144
|
+
assert_equal 'http://zomg.com', @generator.homepage
|
160
145
|
end
|
161
|
-
|
162
146
|
end
|
163
|
-
|
164
147
|
end
|
@@ -1,23 +1,22 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class TestGeneratorMixins < Test::Unit::TestCase
|
4
|
-
|
5
4
|
[Jeweler::Generator::BaconMixin,
|
6
5
|
Jeweler::Generator::MicronautMixin,
|
7
6
|
Jeweler::Generator::MinitestMixin,
|
8
7
|
Jeweler::Generator::RspecMixin,
|
9
8
|
Jeweler::Generator::ShouldaMixin,
|
10
9
|
Jeweler::Generator::TestspecMixin,
|
11
|
-
Jeweler::Generator::TestunitMixin
|
10
|
+
Jeweler::Generator::TestunitMixin
|
12
11
|
].each do |mixin|
|
13
|
-
context
|
12
|
+
context mixin.to_s do
|
14
13
|
%w(default_task feature_support_require feature_support_extend
|
15
14
|
test_dir test_task test_pattern test_filename
|
16
15
|
test_helper_filename).each do |method|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
should "define #{method}" do
|
17
|
+
assert mixin.method_defined?(method)
|
18
|
+
end
|
19
|
+
end
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
@@ -13,37 +13,36 @@ class TestSpecification < Test::Unit::TestCase
|
|
13
13
|
gemspec = if block
|
14
14
|
Gem::Specification.new(&block)
|
15
15
|
else
|
16
|
-
Gem::Specification.new
|
16
|
+
Gem::Specification.new
|
17
17
|
end
|
18
18
|
gemspec.extend(Jeweler::Specification)
|
19
19
|
gemspec
|
20
20
|
end
|
21
21
|
|
22
|
-
should
|
22
|
+
should 'be able to use to_ruby on a duped gemspec without error' do
|
23
23
|
gemspec = build_jeweler_gemspec
|
24
24
|
gemspec.files.include 'throwaway value'
|
25
25
|
|
26
26
|
gemspec.dup.to_ruby
|
27
27
|
end
|
28
28
|
|
29
|
-
context
|
29
|
+
context 'basic defaults' do
|
30
30
|
setup do
|
31
31
|
@gemspec = build_jeweler_gemspec
|
32
32
|
end
|
33
33
|
|
34
|
-
should
|
34
|
+
should 'make files a FileList' do
|
35
35
|
assert_equal FileList, @gemspec.files.class
|
36
36
|
end
|
37
37
|
|
38
|
-
should
|
38
|
+
should 'make extra_rdoc_files a FileList' do
|
39
39
|
assert_equal FileList, @gemspec.extra_rdoc_files.class
|
40
40
|
end
|
41
|
-
|
42
41
|
end
|
43
|
-
|
42
|
+
|
44
43
|
context "there aren't any executables in the project directory" do
|
45
44
|
setup do
|
46
|
-
@project.directory 'bin'
|
45
|
+
@project.directory 'bin'
|
47
46
|
end
|
48
47
|
|
49
48
|
context "and there hasn't been any set on the gemspec" do
|
@@ -52,61 +51,62 @@ class TestSpecification < Test::Unit::TestCase
|
|
52
51
|
@gemspec.set_jeweler_defaults(@project)
|
53
52
|
end
|
54
53
|
|
55
|
-
|
56
|
-
should "have empty gemspec executables" do
|
54
|
+
should 'have empty gemspec executables' do
|
57
55
|
assert_equal [], @gemspec.executables
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
61
|
-
context
|
59
|
+
context 'and has been previously set executables' do
|
62
60
|
setup do
|
63
|
-
@gemspec
|
61
|
+
@gemspec = build_jeweler_gemspec do |gemspec|
|
64
62
|
gemspec.executables = %w(non-existant)
|
65
63
|
end
|
66
64
|
@gemspec.set_jeweler_defaults(@project)
|
67
65
|
end
|
68
66
|
|
69
|
-
should
|
67
|
+
should 'have only the original executables in the gemspec' do
|
70
68
|
assert_equal %w(non-existant), @gemspec.executables
|
71
69
|
end
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
75
|
-
context
|
73
|
+
context 'there are multiple executables in the project directory' do
|
76
74
|
setup do
|
77
75
|
@project.directory('bin') do |bin|
|
78
76
|
bin.file 'burnination'
|
79
77
|
bin.file 'trogdor'
|
80
78
|
end
|
81
79
|
repo = Git.init(@project.to_s)
|
80
|
+
repo.config('user.name', 'who')
|
81
|
+
repo.config('user.email', 'who@where.com')
|
82
82
|
repo.add('bin/burnination')
|
83
83
|
repo.commit('Initial commit')
|
84
84
|
end
|
85
85
|
|
86
86
|
context "and there hasn't been any set on the gemspec" do
|
87
87
|
setup do
|
88
|
-
@gemspec
|
88
|
+
@gemspec = build_jeweler_gemspec
|
89
89
|
@gemspec.set_jeweler_defaults(@project)
|
90
90
|
end
|
91
91
|
|
92
|
-
should
|
92
|
+
should 'have the executables under version control in the gemspec' do
|
93
93
|
assert_equal %w(burnination), @gemspec.executables
|
94
94
|
end
|
95
95
|
end
|
96
|
-
context
|
96
|
+
context 'and has been previously set executables' do
|
97
97
|
setup do
|
98
|
-
@gemspec
|
98
|
+
@gemspec = build_jeweler_gemspec do |gemspec|
|
99
99
|
gemspec.executables = %w(burnination)
|
100
100
|
end
|
101
101
|
@gemspec.set_jeweler_defaults(@project)
|
102
102
|
end
|
103
|
-
should
|
103
|
+
should 'have only the original executables in the gemspec' do
|
104
104
|
assert_equal %w(burnination), @gemspec.executables
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
context
|
109
|
+
context 'there are mutiple extconf.rb and mkrf_conf.rb in the project directory' do
|
110
110
|
setup do
|
111
111
|
@project.directory('ext') do |ext|
|
112
112
|
ext.file 'extconf.rb'
|
@@ -120,19 +120,17 @@ class TestSpecification < Test::Unit::TestCase
|
|
120
120
|
|
121
121
|
context "and there hasn't been any extensions set on the gemspec" do
|
122
122
|
setup do
|
123
|
-
@gemspec
|
123
|
+
@gemspec = build_jeweler_gemspec
|
124
124
|
@gemspec.set_jeweler_defaults(@project)
|
125
125
|
end
|
126
126
|
|
127
|
-
should
|
127
|
+
should 'have all the extconf.rb and mkrf_config.rb files in extensions' do
|
128
128
|
assert_equal %w(ext/mkrf_conf.rb ext/trogdor_native/mkrf_conf.rb ext/extconf.rb ext/trogdor_native/extconf.rb).sort, @gemspec.extensions.sort
|
129
129
|
end
|
130
|
-
|
131
130
|
end
|
132
|
-
|
133
131
|
end
|
134
132
|
|
135
|
-
context
|
133
|
+
context 'there are some files and is setup for git' do
|
136
134
|
setup do
|
137
135
|
@project.file 'Rakefile'
|
138
136
|
@project.directory('lib') do |lib|
|
@@ -140,37 +138,38 @@ class TestSpecification < Test::Unit::TestCase
|
|
140
138
|
end
|
141
139
|
|
142
140
|
repo = Git.init(@project.to_s)
|
141
|
+
repo.config('user.name', 'who')
|
142
|
+
repo.config('user.email', 'who@where.com')
|
143
143
|
repo.add('.')
|
144
144
|
repo.commit('Initial commit')
|
145
145
|
end
|
146
146
|
|
147
|
-
context
|
147
|
+
context 'and the files defaults are used' do
|
148
148
|
setup do
|
149
|
-
@gemspec
|
149
|
+
@gemspec = build_jeweler_gemspec
|
150
150
|
@gemspec.set_jeweler_defaults(@project, @project)
|
151
151
|
end
|
152
152
|
|
153
|
-
should
|
153
|
+
should 'populate files from git' do
|
154
154
|
assert_equal %w(Rakefile lib/example.rb), @gemspec.files.sort
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
context
|
158
|
+
context 'and the files specified manually' do
|
159
159
|
setup do
|
160
|
-
@gemspec
|
160
|
+
@gemspec = build_jeweler_gemspec do |gemspec|
|
161
161
|
gemspec.files = %w(Rakefile)
|
162
162
|
end
|
163
163
|
@gemspec.set_jeweler_defaults(@project, @project)
|
164
164
|
end
|
165
165
|
|
166
|
-
should
|
166
|
+
should 'not be overridden by files from git' do
|
167
167
|
assert_equal %w(Rakefile), @gemspec.files
|
168
168
|
end
|
169
169
|
end
|
170
|
-
|
171
170
|
end
|
172
171
|
|
173
|
-
context
|
172
|
+
context 'there are some files and is setup for git with ignored files' do
|
174
173
|
setup do
|
175
174
|
@project.file '.gitignore', 'ignored'
|
176
175
|
@project.file 'ignored'
|
@@ -180,20 +179,21 @@ class TestSpecification < Test::Unit::TestCase
|
|
180
179
|
end
|
181
180
|
|
182
181
|
repo = Git.init(@project.to_s)
|
182
|
+
repo.config('user.name', 'who')
|
183
|
+
repo.config('user.email', 'who@where.com')
|
183
184
|
repo.add('.')
|
184
185
|
repo.commit('Initial commit')
|
185
186
|
|
186
|
-
|
187
|
-
@gemspec = build_jeweler_gemspec
|
187
|
+
@gemspec = build_jeweler_gemspec
|
188
188
|
@gemspec.set_jeweler_defaults(@project, @project)
|
189
189
|
end
|
190
190
|
|
191
|
-
should
|
191
|
+
should 'populate files from git excluding ignored and .gitignore' do
|
192
192
|
assert_equal %w(Rakefile lib/example.rb), @gemspec.files.sort
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
-
context
|
196
|
+
context 'there are some files and is setup for git and working in a sub directory' do
|
197
197
|
setup do
|
198
198
|
@subproject = File.join(@project, 'subproject')
|
199
199
|
@project.file 'Rakefile'
|
@@ -206,32 +206,33 @@ class TestSpecification < Test::Unit::TestCase
|
|
206
206
|
end
|
207
207
|
|
208
208
|
repo = Git.init(@project.to_s)
|
209
|
+
repo.config('user.name', 'who')
|
210
|
+
repo.config('user.email', 'who@where.com')
|
209
211
|
repo.add('.')
|
210
212
|
repo.commit('Initial commit')
|
211
213
|
|
212
|
-
@gemspec
|
214
|
+
@gemspec = build_jeweler_gemspec
|
213
215
|
@gemspec.set_jeweler_defaults(@subproject, @project)
|
214
216
|
end
|
215
217
|
|
216
|
-
should
|
218
|
+
should 'populate files from git relative to sub directory' do
|
217
219
|
assert_equal %w(lib/subproject_example.rb README).sort, @gemspec.files.sort
|
218
220
|
end
|
219
221
|
end
|
220
222
|
|
221
|
-
context
|
223
|
+
context 'there are some files and is not setup for git' do
|
222
224
|
setup do
|
223
225
|
@project.file 'Rakefile'
|
224
226
|
@project.directory('lib') do |lib|
|
225
227
|
lib.file 'example.rb'
|
226
228
|
end
|
227
229
|
|
228
|
-
@gemspec
|
230
|
+
@gemspec = build_jeweler_gemspec
|
229
231
|
@gemspec.set_jeweler_defaults(@project, @project)
|
230
232
|
end
|
231
233
|
|
232
|
-
should
|
234
|
+
should 'not populate files' do
|
233
235
|
assert_equal [], @gemspec.files.sort
|
234
236
|
end
|
235
237
|
end
|
236
|
-
|
237
238
|
end
|
data/test/jeweler/test_tasks.rb
CHANGED
@@ -6,8 +6,8 @@ class TestTasks < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
context 'instantiating Jeweler::Tasks' do
|
8
8
|
setup do
|
9
|
-
@gemspec_building_block =
|
10
|
-
@tasks = Jeweler::Tasks.new
|
9
|
+
@gemspec_building_block = ->(gemspec) {}
|
10
|
+
@tasks = Jeweler::Tasks.new(&@gemspec_building_block)
|
11
11
|
end
|
12
12
|
|
13
13
|
teardown do
|
@@ -45,6 +45,5 @@ class TestTasks < Test::Unit::TestCase
|
|
45
45
|
@tasks = Jeweler::Tasks.new { |s| spec = s }
|
46
46
|
assert_not_nil @tasks.jeweler.gemspec
|
47
47
|
end
|
48
|
-
|
49
48
|
end
|
50
49
|
end
|