jeweler 1.4.0 → 1.5.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.document +14 -0
  2. data/.gitignore +13 -2
  3. data/ChangeLog.markdown +8 -8
  4. data/Gemfile +21 -0
  5. data/Gemfile.lock +57 -0
  6. data/README.markdown +6 -6
  7. data/Rakefile +32 -46
  8. data/features/generator/cucumber.feature +20 -0
  9. data/features/generator/directory_layout.feature +10 -0
  10. data/features/generator/gemfile.feature +71 -0
  11. data/features/generator/git.feature +8 -0
  12. data/features/generator/license.feature +11 -2
  13. data/features/generator/rakefile.feature +25 -23
  14. data/features/generator/test.feature +6 -0
  15. data/features/generator/test_helper.feature +107 -11
  16. data/features/step_definitions/filesystem_steps.rb +5 -3
  17. data/features/step_definitions/generator_steps.rb +68 -4
  18. data/features/support/env.rb +26 -13
  19. data/jeweler.gemspec +222 -207
  20. data/lib/jeweler.rb +7 -5
  21. data/lib/jeweler/commands.rb +1 -3
  22. data/lib/jeweler/commands/check_dependencies.rb +3 -5
  23. data/lib/jeweler/commands/install_gem.rb +1 -2
  24. data/lib/jeweler/commands/release_to_git.rb +5 -3
  25. data/lib/jeweler/commands/release_to_github.rb +24 -8
  26. data/lib/jeweler/commands/{release_to_gemcutter.rb → release_to_rubygems.rb} +1 -2
  27. data/lib/jeweler/commands/version/base.rb +16 -2
  28. data/lib/jeweler/commands/write_gemspec.rb +0 -1
  29. data/lib/jeweler/errors.rb +4 -16
  30. data/lib/jeweler/gemcutter_tasks.rb +4 -32
  31. data/lib/jeweler/gemspec_helper.rb +3 -6
  32. data/lib/jeweler/generator.rb +23 -6
  33. data/lib/jeweler/generator/options.rb +17 -14
  34. data/lib/jeweler/generator/rspec_mixin.rb +1 -1
  35. data/lib/jeweler/generator/shindo_mixin.rb +44 -0
  36. data/lib/jeweler/generator/shoulda_mixin.rb +1 -1
  37. data/lib/jeweler/rubyforge_tasks.rb +5 -29
  38. data/lib/jeweler/rubygems_dot_org_tasks.rb +38 -0
  39. data/lib/jeweler/rubygems_tasks.rb +38 -0
  40. data/lib/jeweler/specification.rb +36 -12
  41. data/lib/jeweler/tasks.rb +49 -13
  42. data/lib/jeweler/templates/.document +6 -0
  43. data/lib/jeweler/templates/.gitignore +34 -16
  44. data/lib/jeweler/templates/Gemfile +12 -0
  45. data/lib/jeweler/templates/LICENSE +1 -1
  46. data/lib/jeweler/templates/Rakefile +1 -0
  47. data/lib/jeweler/templates/bacon/helper.rb +1 -0
  48. data/lib/jeweler/templates/bundler_setup.erb +10 -0
  49. data/lib/jeweler/templates/features/support/env.rb +2 -0
  50. data/lib/jeweler/templates/jeweler_tasks.erb +20 -23
  51. data/lib/jeweler/templates/micronaut/helper.rb +1 -0
  52. data/lib/jeweler/templates/minitest/helper.rb +1 -0
  53. data/lib/jeweler/templates/other_tasks.erb +27 -59
  54. data/lib/jeweler/templates/riot/helper.rb +1 -0
  55. data/lib/jeweler/templates/rspec/{spec.opts → .rspec} +0 -0
  56. data/lib/jeweler/templates/rspec/helper.rb +7 -3
  57. data/lib/jeweler/templates/shindo/flunking.rb +8 -0
  58. data/lib/jeweler/templates/shindo/helper.rb +6 -0
  59. data/lib/jeweler/templates/shoulda/helper.rb +1 -0
  60. data/lib/jeweler/templates/testunit/helper.rb +1 -0
  61. data/lib/jeweler/version.rb +10 -0
  62. data/lib/jeweler/version_helper.rb +1 -2
  63. data/test/fixtures/existing-project-with-version-constant/Rakefile +4 -2
  64. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +4 -2
  65. data/test/fixtures/existing-project-with-version-yaml/Rakefile +4 -2
  66. data/test/jeweler/commands/test_install_gem.rb +2 -2
  67. data/test/jeweler/commands/test_release_to_gemcutter.rb +4 -4
  68. data/test/jeweler/commands/test_release_to_git.rb +32 -25
  69. data/test/jeweler/commands/test_release_to_github.rb +108 -25
  70. data/test/jeweler/generator/test_options.rb +16 -22
  71. data/test/jeweler/test_generator.rb +5 -0
  72. data/test/jeweler/test_specification.rb +18 -7
  73. data/test/jeweler/test_tasks.rb +1 -1
  74. data/test/test_helper.rb +12 -14
  75. data/test/test_jeweler.rb +0 -12
  76. metadata +159 -66
  77. data/VERSION.yml +0 -5
  78. data/lib/jeweler/commands/release_to_rubyforge.rb +0 -52
  79. data/lib/jeweler/commands/setup_rubyforge.rb +0 -63
  80. data/test/jeweler/commands/test_release_to_rubyforge.rb +0 -153
  81. data/test/jeweler/commands/test_setup_rubyforge.rb +0 -178
@@ -1,5 +0,0 @@
1
- ---
2
- :minor: 4
3
- :patch: 0
4
- :major: 1
5
- :build:
@@ -1,52 +0,0 @@
1
- class Jeweler
2
- module Commands
3
- class ReleaseToRubyforge
4
- attr_accessor :gemspec, :version, :output, :gemspec_helper, :rubyforge
5
-
6
- def initialize
7
- self.output = $stdout
8
-
9
- require 'rubyforge'
10
- self.rubyforge = RubyForge.new
11
- end
12
-
13
- def run
14
-
15
- raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project
16
-
17
- @rubyforge.configure rescue nil
18
-
19
- output.puts 'Logging in rubyforge'
20
- @rubyforge.login
21
-
22
- @rubyforge.userconfig['release_notes'] = @gemspec.description if @gemspec.description
23
- @rubyforge.userconfig['preformatted'] = true
24
-
25
- output.puts "Releasing #{@gemspec.name}-#{@version} to #{@gemspec.rubyforge_project}"
26
- begin
27
- @rubyforge.add_release(@gemspec.rubyforge_project, @gemspec.name, @version.to_s, @gemspec_helper.gem_path)
28
- rescue StandardError => e
29
- case e.message
30
- when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
31
- raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
32
- when /no <package_id> configured for <#{Regexp.escape @gemspec.name}>/i
33
- raise MissingRubyForgePackageError, @gemspec.name
34
- else
35
- raise
36
- end
37
- end
38
- end
39
-
40
- def self.build_for(jeweler)
41
- command = new
42
- command.gemspec = jeweler.gemspec
43
- command.gemspec_helper = jeweler.gemspec_helper
44
- command.version = jeweler.version
45
- command.output = jeweler.output
46
-
47
- command
48
- end
49
-
50
- end
51
- end
52
- end
@@ -1,63 +0,0 @@
1
- class Jeweler
2
- module Commands
3
- class SetupRubyforge
4
- attr_accessor :gemspec, :output, :rubyforge
5
-
6
-
7
- def initialize
8
- self.output = $stdout
9
- require 'rubyforge'
10
- self.rubyforge = RubyForge.new
11
- end
12
-
13
- def run
14
- raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project
15
-
16
- @rubyforge.configure
17
-
18
- output.puts "Logging into rubyforge"
19
- @rubyforge.login
20
-
21
- if package_exists?
22
- output.puts "#{@gemspec.name} package already exists in the #{@gemspec.rubyforge_project} project"
23
- return
24
- end
25
-
26
- output.puts "Creating #{@gemspec.name} package in the #{@gemspec.rubyforge_project} project"
27
- create_package
28
- end
29
-
30
- def package_exists?
31
- begin
32
- @rubyforge.lookup 'package', @gemspec.name
33
- true
34
- rescue RuntimeError => e
35
- raise unless e.message == "no <package_id> configured for <#{@gemspec.name}>"
36
- false
37
- end
38
- end
39
-
40
- def create_package
41
- begin
42
- @rubyforge.create_package(@gemspec.rubyforge_project, @gemspec.name)
43
- rescue StandardError => e
44
- case e.message
45
- when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
46
- raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
47
- else
48
- raise
49
- end
50
- end
51
- end
52
-
53
- def self.build_for(jeweler)
54
- command = new
55
-
56
- command.gemspec = jeweler.gemspec
57
- command.output = jeweler.output
58
-
59
- command
60
- end
61
- end
62
- end
63
- end
@@ -1,153 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Jeweler
4
- module Commands
5
- class TestReleaseToRubyforge < Test::Unit::TestCase
6
- def self.subject
7
- Jeweler::Commands::ReleaseToRubyforge.new
8
- end
9
-
10
- rubyforge_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do
11
- setup do
12
- stub(@rubyforge).configure
13
- stub(@rubyforge).login
14
- stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem")
15
-
16
- stub(@gemspec).description {"The zomg gem rocks."}
17
- stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"}
18
- stub(@gemspec).name {"zomg"}
19
-
20
- stub(@gemspec_helper).write
21
- stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
22
- stub(@gemspec_helper).update_version('1.2.3')
23
-
24
- @command.version = '1.2.3'
25
-
26
- @command.run
27
- end
28
-
29
- should "configure" do
30
- assert_received(@rubyforge) {|rubyforge| rubyforge.configure }
31
- end
32
-
33
- should "login" do
34
- assert_received(@rubyforge) {|rubyforge| rubyforge.login }
35
- end
36
-
37
- should "set release notes" do
38
- assert_equal "The zomg gem rocks.", @rubyforge.userconfig["release_notes"]
39
- end
40
-
41
- should "set preformatted to true" do
42
- assert_equal true, @rubyforge.userconfig['preformatted']
43
- end
44
-
45
- should "add release" do
46
- assert_received(@rubyforge) {|rubyforge| rubyforge.add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") }
47
- end
48
- end
49
-
50
- rubyforge_command_context "rubyforge_project is defined in gemspec and package does not exist on rubyforge" do
51
- setup do
52
- stub(@rubyforge).configure
53
- stub(@rubyforge).login
54
- stub(@rubyforge).scrape_config
55
- stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") {
56
- raise "no <package_id> configured for <zomg>"
57
- }
58
-
59
- stub(@gemspec).description {"The zomg gem rocks."}
60
- stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"}
61
- stub(@gemspec).name {"zomg"}
62
-
63
- stub(@gemspec_helper).write
64
- stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
65
- stub(@gemspec_helper).update_version('1.2.3')
66
-
67
- @command.version = '1.2.3'
68
- end
69
-
70
- should "raise MissingRubyForgePackageError" do
71
- assert_raises Jeweler::MissingRubyForgePackageError do
72
- @command.run
73
- end
74
- end
75
- end
76
-
77
- rubyforge_command_context "rubyforge_project is not defined in gemspec" do
78
- setup do
79
- stub(@rubyforge).configure
80
- stub(@rubyforge).login
81
- stub(@rubyforge).add_release(nil, "zomg", "1.2.3", "pkg/zomg-1.2.3.gem")
82
-
83
- stub(@gemspec).description {"The zomg gem rocks."}
84
- stub(@gemspec).rubyforge_project { nil }
85
- stub(@gemspec).name {"zomg"}
86
-
87
- stub(@gemspec_helper).write
88
- stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
89
- stub(@gemspec_helper).update_version('1.2.3')
90
-
91
- @command.version = '1.2.3'
92
- end
93
-
94
- should "raise NoRubyForgeProjectConfigured" do
95
- assert_raises Jeweler::NoRubyForgeProjectInGemspecError do
96
- @command.run
97
- end
98
- end
99
- end
100
-
101
- rubyforge_command_context "after running when rubyforge_project is not defined in ~/.rubyforge/auto_config.yml" do
102
- setup do
103
- stub(@rubyforge).configure
104
- stub(@rubyforge).login
105
- stub(@rubyforge).add_release("some_project_that_doesnt_exist", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") do
106
- raise RuntimeError, "no <group_id> configured for <some_project_that_doesnt_exist>"
107
- end
108
-
109
- @rubyforge.autoconfig['package_ids'] = { 'zomg' => 1234 }
110
-
111
- stub(@gemspec).description {"The zomg gem rocks."}
112
- stub(@gemspec).rubyforge_project { "some_project_that_doesnt_exist" }
113
- stub(@gemspec).name {"zomg"}
114
-
115
- stub(@gemspec_helper).write
116
- stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
117
- stub(@gemspec_helper).update_version('1.2.3')
118
-
119
- @command.version = '1.2.3'
120
- end
121
-
122
- should "raise RubyForgeProjectNotConfiguredError" do
123
- assert_raises RubyForgeProjectNotConfiguredError do
124
- @command.run
125
- end
126
- end
127
- end
128
-
129
- build_command_context "build for jeweler" do
130
- setup do
131
- @command = Jeweler::Commands::ReleaseToRubyforge.build_for(@jeweler)
132
- end
133
-
134
- should "assign gemspec helper" do
135
- assert_equal @gemspec_helper, @command.gemspec_helper
136
- end
137
-
138
- should "assign gemspec" do
139
- assert_equal @gemspec, @command.gemspec
140
- end
141
-
142
- should "assign version" do
143
- assert_equal @version, @command.version
144
- end
145
-
146
- should "assign output" do
147
- assert_equal @output, @command.output
148
- end
149
- end
150
-
151
- end
152
- end
153
- end
@@ -1,178 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Jeweler
4
- module Commands
5
- class TestSetupRubyforge < Test::Unit::TestCase
6
- def self.subject
7
- Jeweler::Commands::SetupRubyforge.new
8
- end
9
-
10
- rubyforge_command_context "package_exists?" do
11
- setup do
12
- stub(@gemspec).name { 'zomg' }
13
- end
14
-
15
- should "be true if rubyforge.lookup doesn't cause an Error" do
16
- mock(@rubyforge).lookup('package', 'zomg')
17
-
18
- assert @command.package_exists?
19
- end
20
-
21
- should "be false if rubyforge.lookup raises an error like: no <package_id> configured for <zomg>" do
22
- mock(@rubyforge).lookup('package', 'zomg') do
23
- raise RuntimeError, "no <package_id> configured for <zomg>"
24
- end
25
-
26
- assert ! @command.package_exists?
27
- end
28
-
29
- should "reraise any other Errors" do
30
- mock(@rubyforge).lookup('package', 'zomg') do
31
- raise RuntimeError, 'burnination!'
32
- end
33
-
34
- assert_raises RuntimeError, 'burnination!' do
35
- @command.package_exists?
36
- end
37
- end
38
- end
39
-
40
- rubyforge_command_context "create_package" do
41
- setup do
42
- stub(@gemspec).name { 'zomg' }
43
- end
44
-
45
- context "when everything is happy" do
46
- setup do
47
- stub(@gemspec).rubyforge_project { 'myproject' }
48
- stub(@rubyforge).create_package('myproject', 'zomg')
49
-
50
- @command.create_package
51
- end
52
-
53
- should "create zomg package to myproject on rubyforge" do
54
- assert_received(@rubyforge) {|rubyforge| rubyforge.create_package('myproject', 'zomg') }
55
- end
56
-
57
- end
58
-
59
- context "when rubyforge project not existing or being setup in ~/.rubyforge/autoconfig.yml" do
60
- setup do
61
- stub(@gemspec).rubyforge_project { 'myproject' }
62
- stub(@rubyforge).create_package('myproject', 'zomg')do
63
- raise RuntimeError, "no <group_id> configured for <myproject>"
64
- end
65
- end
66
-
67
- should "raise RubyForgeProjectNotConfiguredError" do
68
- assert_raises RubyForgeProjectNotConfiguredError do
69
- @command.create_package
70
- end
71
- end
72
- end
73
- end
74
-
75
-
76
- rubyforge_command_context "rubyforge_project defined in gemspec and project existing on rubyforge" do
77
- setup do
78
- stub(@rubyforge).configure
79
- stub(@rubyforge).login
80
-
81
- stub(@gemspec).name { 'zomg' }
82
- stub(@gemspec).rubyforge_project { 'myproject' }
83
-
84
- stub(@command).package_exists? { false }
85
- stub(@command).create_package
86
- @command.run
87
- end
88
-
89
- should "configure rubyforge" do
90
- assert_received(@rubyforge) {|rubyforge| rubyforge.configure}
91
- end
92
-
93
- should "login to rubyforge" do
94
- assert_received(@rubyforge) {|rubyforge| rubyforge.login}
95
- end
96
-
97
- should "create zomg package to myproject on rubyforge" do
98
- assert_received(@command) {|command| command.create_package }
99
- end
100
- end
101
-
102
- rubyforge_command_context "rubyforge_project defined in gemspec, project and project already existing on rubyforge" do
103
- setup do
104
- stub(@rubyforge).configure
105
- stub(@rubyforge).login
106
-
107
-
108
- stub(@gemspec).name { 'zomg' }
109
- stub(@gemspec).rubyforge_project { 'myproject' }
110
-
111
- stub(@command).package_exists? { true }
112
- dont_allow(@command).create_package
113
- @command.run
114
- end
115
-
116
- should "configure rubyforge" do
117
- assert_received(@rubyforge) {|rubyforge| rubyforge.configure}
118
- end
119
-
120
- should "login to rubyforge" do
121
- assert_received(@rubyforge) {|rubyforge| rubyforge.login}
122
- end
123
-
124
- end
125
-
126
-
127
- rubyforge_command_context "rubyforge_project is not defined" do
128
- setup do
129
- stub(@gemspec).name { 'zomg' }
130
- stub(@gemspec).rubyforge_project { nil }
131
- end
132
-
133
- should "raise NoRubyForgeProjectConfigured" do
134
- assert_raises Jeweler::NoRubyForgeProjectInGemspecError do
135
- @command.run
136
- end
137
- end
138
- end
139
-
140
- rubyforge_command_context "rubyforge project not existing or being setup in ~/.rubyforge/autoconfig.yml" do
141
- setup do
142
- stub(@rubyforge).configure
143
- stub(@rubyforge).login
144
-
145
- stub(@gemspec).name { 'zomg' }
146
- stub(@gemspec).rubyforge_project { 'some_project_that_doesnt_exist' }
147
-
148
- stub(@command).package_exists? { false }
149
- stub(@command).create_package do
150
- raise RubyForgeProjectNotConfiguredError, 'some_project_that_doesnt_exist'
151
- end
152
- end
153
-
154
- should "raise RubyForgeProjectNotConfiguredError" do
155
- assert_raises RubyForgeProjectNotConfiguredError do
156
- @command.run
157
- end
158
- end
159
-
160
- end
161
-
162
- build_command_context "build for jeweler" do
163
- setup do
164
- @command = Jeweler::Commands::SetupRubyforge.build_for(@jeweler)
165
- end
166
-
167
- should "assign gemspec" do
168
- assert_equal @gemspec, @command.gemspec
169
- end
170
-
171
- should "assign output" do
172
- assert_equal @output, @command.output
173
- end
174
- end
175
-
176
- end
177
- end
178
- end