technicalpickles-jeweler 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/ChangeLog.markdown +6 -0
  2. data/README.markdown +67 -2
  3. data/Rakefile +31 -3
  4. data/VERSION.yml +2 -2
  5. data/lib/jeweler.rb +30 -31
  6. data/lib/jeweler/commands.rb +2 -0
  7. data/lib/jeweler/commands/build_gem.rb +9 -0
  8. data/lib/jeweler/commands/install_gem.rb +7 -0
  9. data/lib/jeweler/commands/release.rb +13 -0
  10. data/lib/jeweler/commands/release_to_rubyforge.rb +51 -0
  11. data/lib/jeweler/commands/setup_rubyforge.rb +38 -0
  12. data/lib/jeweler/commands/validate_gemspec.rb +9 -0
  13. data/lib/jeweler/commands/version/base.rb +11 -0
  14. data/lib/jeweler/commands/write_gemspec.rb +13 -0
  15. data/lib/jeweler/errors.rb +13 -1
  16. data/lib/jeweler/generator.rb +3 -1
  17. data/lib/jeweler/generator/options.rb +4 -0
  18. data/lib/jeweler/tasks.rb +29 -5
  19. data/lib/jeweler/templates/Rakefile +46 -9
  20. data/test/fixtures/existing-project-with-version/LICENSE +20 -0
  21. data/test/fixtures/existing-project-with-version/README.rdoc +7 -0
  22. data/test/fixtures/existing-project-with-version/Rakefile +82 -0
  23. data/test/fixtures/existing-project-with-version/VERSION.yml +4 -0
  24. data/test/fixtures/existing-project-with-version/existing-project-with-version.gemspec +29 -0
  25. data/test/fixtures/existing-project-with-version/lib/existing_project_with_version.rb +0 -0
  26. data/test/fixtures/existing-project-with-version/test/existing_project_with_version_test.rb +7 -0
  27. data/test/fixtures/existing-project-with-version/test/test_helper.rb +10 -0
  28. data/test/geminstaller.yml +12 -0
  29. data/test/jeweler/commands/test_build_gem.rb +20 -1
  30. data/test/jeweler/commands/test_install_gem.rb +21 -0
  31. data/test/jeweler/commands/test_release.rb +30 -0
  32. data/test/jeweler/commands/test_release_to_rubyforge.rb +157 -0
  33. data/test/jeweler/commands/test_setup_rubyforge.rb +88 -0
  34. data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
  35. data/test/jeweler/commands/test_write_gemspec.rb +34 -0
  36. data/test/jeweler/commands/version/test_base.rb +32 -0
  37. data/test/jeweler/commands/version/test_bump_major.rb +1 -0
  38. data/test/test_application.rb +4 -0
  39. data/test/test_generator.rb +4 -0
  40. data/test/test_helper.rb +75 -8
  41. data/test/test_jeweler.rb +137 -96
  42. data/test/test_options.rb +6 -0
  43. data/test/test_tasks.rb +2 -0
  44. metadata +26 -4
data/test/test_jeweler.rb CHANGED
@@ -2,135 +2,176 @@ require 'test_helper'
2
2
 
3
3
  class TestJeweler < Test::Unit::TestCase
4
4
 
5
- def setup
6
- @now = Time.now
7
- stub(Time).now { @now }
5
+ def build_jeweler(base_dir = nil)
6
+ base_dir ||= non_git_dir_path
8
7
 
9
- FileUtils.rm_rf("#{File.dirname(__FILE__)}/tmp")
8
+ Jeweler.new(build_spec, base_dir)
10
9
  end
11
10
 
12
- def teardown
13
- FileUtils.rm_rf("#{File.dirname(__FILE__)}/tmp")
11
+ def git_dir_path
12
+ File.join(tmp_dir, 'git')
14
13
  end
15
14
 
16
- context "Initializing jewewler in a blank directory" do
17
- setup do
18
- FileUtils.mkdir_p(tmp_dir)
19
- @jeweler = Jeweler.new(build_spec, tmp_dir)
20
- end
15
+ def non_git_dir_path
16
+ File.join(tmp_dir, 'nongit')
17
+ end
21
18
 
22
- should "not create a VERSION.yml" do
23
- assert ! File.exists?(File.join(tmp_dir, 'VERSION.yml'))
19
+ def build_git_dir
20
+ return_to = Dir.pwd
21
+
22
+ FileUtils.mkdir_p git_dir_path
23
+ begin
24
+ Dir.chdir git_dir_path
25
+ Git.init
26
+ ensure
27
+ Dir.chdir return_to
24
28
  end
25
29
  end
26
30
 
31
+ def build_non_git_dir
32
+ FileUtils.mkdir_p non_git_dir_path
33
+ end
27
34
 
28
- context "A Jeweler with a VERSION.yml" do
29
- setup do
30
- FileUtils.cp_r(fixture_dir, tmp_dir)
31
-
32
- @jeweler = Jeweler.new(build_spec, tmp_dir)
33
- @jeweler.output = StringIO.new
35
+ should "raise an error if a nil gemspec is given" do
36
+ assert_raises Jeweler::GemspecError do
37
+ Jeweler.new(nil)
34
38
  end
39
+ end
35
40
 
36
- should_have_major_version 1
37
- should_have_minor_version 5
38
- should_have_patch_version 2
39
- should_be_version '1.5.2'
41
+ should "know if it is in a git repo" do
42
+ build_git_dir
40
43
 
41
- context "bumping the patch version" do
42
- setup do
43
- @jeweler.bump_patch_version
44
- end
45
- should_bump_version 1, 5, 3
46
- end
44
+ assert build_jeweler(git_dir_path).in_git_repo?
45
+ end
47
46
 
48
- context "bumping the minor version" do
49
- setup do
50
- @jeweler.bump_minor_version
51
- end
47
+ should "know if it is not in a git repo" do
48
+ build_non_git_dir
52
49
 
53
- should_bump_version 1, 6, 0
54
- end
50
+ jeweler = build_jeweler(non_git_dir_path)
51
+ assert ! jeweler.in_git_repo?, "jeweler doesn't know that #{jeweler.base_dir} is not a git repository"
52
+ end
55
53
 
56
- context "bumping the major version" do
57
- setup do
58
- @jeweler.bump_major_version
59
- end
54
+ should "build and run write gemspec command when writing gemspec" do
55
+ jeweler = build_jeweler
60
56
 
61
- should_bump_version 2, 0, 0
62
- end
57
+ command = Object.new
58
+ mock(command).run
63
59
 
64
- should "should populate gemspec's files" do
65
- assert ! @jeweler.gemspec.files.empty?
66
- end
60
+ mock(Jeweler::Commands::WriteGemspec).build_for(jeweler) { command }
67
61
 
68
- context "with standard 'files' specified" do
69
- setup do
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
62
+ jeweler.write_gemspec
63
+ end
77
64
 
78
- context "gemsepc's rdoc" do
79
- should 'have be enabled' do
80
- assert @jeweler.gemspec.has_rdoc
81
- end
65
+ should "build and run validate gemspec command when validating gemspec" do
66
+ jeweler = build_jeweler
82
67
 
83
- should 'do inline source' do
84
- assert @jeweler.gemspec.rdoc_options.include?('--inline-source')
85
- end
68
+ command = Object.new
69
+ mock(command).run
86
70
 
87
- should 'be utf-8' do
88
- assert @jeweler.gemspec.rdoc_options.include?('--charset=UTF-8')
89
- end
71
+ mock(Jeweler::Commands::ValidateGemspec).build_for(jeweler) { command }
90
72
 
91
- end
73
+ jeweler.validate_gemspec
74
+ end
92
75
 
93
- context "writing the gemspec" do
94
- setup do
95
- @jeweler.write_gemspec
96
- @output = @jeweler.output.string
97
- end
76
+ should "build and run build gem command when building gem" do
77
+ jeweler = build_jeweler
98
78
 
99
- should "create bar.gemspec" do
100
- assert File.exists?(File.join(tmp_dir, 'bar.gemspec'))
101
- end
79
+ command = Object.new
80
+ mock(command).run
102
81
 
103
- should "have created a valid gemspec" do
104
- assert @jeweler.valid_gemspec?
105
- end
82
+ mock(Jeweler::Commands::BuildGem).build_for(jeweler) { command }
106
83
 
107
- should "output the name of the gemspec" do
108
- assert_match 'bar.gemspec', @output
109
- end
84
+ jeweler.build_gem
85
+ end
110
86
 
111
- context "re-reading the gemspec" do
112
- setup do
113
- gemspec_path = File.join(tmp_dir, 'bar.gemspec')
114
- data = File.read(gemspec_path)
87
+ should "build and run build gem command when installing gem" do
88
+ jeweler = build_jeweler
115
89
 
116
- @parsed_spec = eval("$SAFE = 3\n#{data}", binding, gemspec_path)
117
- end
90
+ command = Object.new
91
+ mock(command).run
118
92
 
119
- should "have version 1.5.2" do
120
- assert_equal '1.5.2', @parsed_spec.version.version
121
- end
93
+ mock(Jeweler::Commands::InstallGem).build_for(jeweler) { command }
122
94
 
123
- should "have date filled in" do
124
- assert_equal Time.local(@now.year, @now.month, @now.day), @parsed_spec.date
125
- end
126
- end
127
- end
95
+ jeweler.install_gem
128
96
  end
129
97
 
130
- should "raise an exception when created with a nil gemspec" do
131
- assert_raises Jeweler::GemspecError do
132
- @jeweler = Jeweler.new(nil, tmp_dir)
133
- end
98
+ should "build and run bump major version command when bumping major version" do
99
+ jeweler = build_jeweler
100
+
101
+ command = Object.new
102
+ mock(command).run
103
+
104
+ mock(Jeweler::Commands::Version::BumpMajor).build_for(jeweler) { command }
105
+
106
+ jeweler.bump_major_version
107
+ end
108
+
109
+ should "build and run bump minor version command when bumping minor version" do
110
+ jeweler = build_jeweler
111
+
112
+ command = Object.new
113
+ mock(command).run
114
+
115
+ mock(Jeweler::Commands::Version::BumpMinor).build_for(jeweler) { command }
116
+
117
+ jeweler.bump_minor_version
118
+ end
119
+
120
+ should "build and run write version command when writing version" do
121
+ jeweler = build_jeweler
122
+
123
+ command = Object.new
124
+ mock(command).run
125
+ mock(command).major=(1)
126
+ mock(command).minor=(5)
127
+ mock(command).patch=(2)
128
+
129
+ mock(Jeweler::Commands::Version::Write).build_for(jeweler) { command }
130
+
131
+ jeweler.write_version(1, 5, 2)
132
+ end
133
+
134
+ should "build and run release command when running release" do
135
+ jeweler = build_jeweler
136
+
137
+ command = Object.new
138
+ mock(command).run
139
+
140
+ mock(Jeweler::Commands::Release).build_for(jeweler) { command }
141
+
142
+ jeweler.release
143
+ end
144
+
145
+ should "build and run release to rubyforge command when running release to rubyforge" do
146
+ jeweler = build_jeweler
147
+
148
+ command = Object.new
149
+ mock(command).run
150
+
151
+ mock(Jeweler::Commands::ReleaseToRubyforge).build_for(jeweler) { command }
152
+
153
+ jeweler.release_gem_to_rubyforge
154
+ end
155
+
156
+
157
+ should "respond to gemspec_helper" do
158
+ assert_respond_to build_jeweler, :gemspec_helper
159
+ end
160
+
161
+ should "respond to version_helper" do
162
+ assert_respond_to build_jeweler, :version_helper
163
+ end
164
+
165
+ should "respond to repo" do
166
+ assert_respond_to build_jeweler, :repo
167
+ end
168
+
169
+ should "respond to commit" do
170
+ assert_respond_to build_jeweler, :commit
171
+ end
172
+
173
+ should "respond to rubyforge" do
174
+ assert_respond_to build_jeweler, :rubyforge
134
175
  end
135
176
 
136
177
  end
data/test/test_options.rb CHANGED
@@ -63,6 +63,12 @@ class TestOptions < Test::Unit::TestCase
63
63
  end
64
64
  end
65
65
 
66
+ for_options '--rubyforge' do
67
+ should 'enable rubyforge' do
68
+ assert @options[:rubyforge]
69
+ end
70
+ end
71
+
66
72
  for_options '--summary', 'zomg so awesome' do
67
73
  should 'have summary zomg so awesome' do
68
74
  assert_equal 'zomg so awesome', @options[:summary]
data/test/test_tasks.rb CHANGED
@@ -34,6 +34,8 @@ class TestTasks < Test::Unit::TestCase
34
34
  assert Task.task_defined?(:'version:bump:minor')
35
35
  assert Task.task_defined?(:'version:bump:patch')
36
36
  assert Task.task_defined?(:'release')
37
+ assert Task.task_defined?(:'rubyforge:release:gem')
38
+ assert Task.task_defined?(:'rubyforge:setup')
37
39
  end
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-05 00:00:00 -08:00
12
+ date: 2009-03-26 00:00:00 -07:00
13
13
  default_executable: jeweler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: schacon-git
16
+ name: peterwald-git
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -45,6 +45,8 @@ files:
45
45
  - lib/jeweler/commands/build_gem.rb
46
46
  - lib/jeweler/commands/install_gem.rb
47
47
  - lib/jeweler/commands/release.rb
48
+ - lib/jeweler/commands/release_to_rubyforge.rb
49
+ - lib/jeweler/commands/setup_rubyforge.rb
48
50
  - lib/jeweler/commands/validate_gemspec.rb
49
51
  - lib/jeweler/commands/version
50
52
  - lib/jeweler/commands/version/base.rb
@@ -92,6 +94,18 @@ files:
92
94
  - test/fixtures
93
95
  - test/fixtures/bar
94
96
  - test/fixtures/bar/VERSION.yml
97
+ - test/fixtures/existing-project-with-version
98
+ - test/fixtures/existing-project-with-version/existing-project-with-version.gemspec
99
+ - test/fixtures/existing-project-with-version/lib
100
+ - test/fixtures/existing-project-with-version/lib/existing_project_with_version.rb
101
+ - test/fixtures/existing-project-with-version/LICENSE
102
+ - test/fixtures/existing-project-with-version/Rakefile
103
+ - test/fixtures/existing-project-with-version/README.rdoc
104
+ - test/fixtures/existing-project-with-version/test
105
+ - test/fixtures/existing-project-with-version/test/existing_project_with_version_test.rb
106
+ - test/fixtures/existing-project-with-version/test/test_helper.rb
107
+ - test/fixtures/existing-project-with-version/VERSION.yml
108
+ - test/geminstaller.yml
95
109
  - test/generators
96
110
  - test/generators/initialization_test.rb
97
111
  - test/jeweler
@@ -99,8 +113,12 @@ files:
99
113
  - test/jeweler/commands/test_build_gem.rb
100
114
  - test/jeweler/commands/test_install_gem.rb
101
115
  - test/jeweler/commands/test_release.rb
116
+ - test/jeweler/commands/test_release_to_rubyforge.rb
117
+ - test/jeweler/commands/test_setup_rubyforge.rb
118
+ - test/jeweler/commands/test_validate_gemspec.rb
102
119
  - test/jeweler/commands/test_write_gemspec.rb
103
120
  - test/jeweler/commands/version
121
+ - test/jeweler/commands/version/test_base.rb
104
122
  - test/jeweler/commands/version/test_bump_major.rb
105
123
  - test/jeweler/commands/version/test_bump_minor.rb
106
124
  - test/jeweler/commands/version/test_bump_patch.rb
@@ -115,8 +133,12 @@ files:
115
133
  - test/test_options.rb
116
134
  - test/test_tasks.rb
117
135
  - test/test_version_helper.rb
136
+ - test/tmp
137
+ - test/tmp/git
138
+ - test/tmp/nongit
118
139
  - test/version_tmp
119
140
  - test/version_tmp/VERSION.yml
141
+ - lib/jeweler/templates/.documena
120
142
  - lib/jeweler/templates/.gitignore
121
143
  has_rdoc: true
122
144
  homepage: http://github.com/technicalpickles/jeweler
@@ -140,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
162
  version:
141
163
  requirements: []
142
164
 
143
- rubyforge_project:
165
+ rubyforge_project: pickles
144
166
  rubygems_version: 1.2.0
145
167
  signing_key:
146
168
  specification_version: 2