technicalpickles-jeweler 1.0.2 → 1.1.0
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 +1 -0
- data/Rakefile +53 -7
- data/VERSION.yml +2 -2
- data/features/generator/rakefile.feature +42 -36
- data/features/step_definitions/filesystem_steps.rb +3 -0
- data/features/step_definitions/generator_steps.rb +9 -0
- data/features/support/env.rb +12 -2
- data/jeweler.gemspec +24 -6
- data/lib/jeweler/commands/install_gem.rb +16 -2
- data/lib/jeweler/commands/release.rb +10 -7
- data/lib/jeweler/commands/setup_rubyforge.rb +19 -0
- data/lib/jeweler/gemspec_helper.rb +3 -0
- data/lib/jeweler/generator/options.rb +10 -1
- data/lib/jeweler/generator.rb +15 -6
- data/lib/jeweler/rubyforge_tasks.rb +57 -5
- data/lib/jeweler/specification.rb +2 -2
- data/lib/jeweler/tasks.rb +22 -28
- data/lib/jeweler/templates/Rakefile +17 -5
- data/test/jeweler/commands/test_install_gem.rb +53 -0
- data/test/jeweler/commands/test_release.rb +101 -144
- data/test/jeweler/commands/test_setup_rubyforge.rb +102 -8
- data/test/test_application.rb +2 -2
- data/test/test_generator.rb +1 -1
- data/test/test_generator_initialization.rb +69 -26
- data/test/test_helper.rb +18 -12
- data/test/test_options.rb +15 -0
- data/test/test_tasks.rb +4 -20
- metadata +53 -3
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -15,14 +15,27 @@ begin
|
|
15
15
|
gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
16
16
|
gem.authors = ["Josh Nichols"]
|
17
17
|
gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
|
18
|
-
|
18
|
+
|
19
|
+
gem.add_dependency "git", ">= 1.2.1"
|
19
20
|
gem.add_dependency "rubyforge"
|
21
|
+
|
20
22
|
gem.rubyforge_project = "pickles"
|
23
|
+
|
24
|
+
gem.add_development_dependency "thoughtbot-shoulda"
|
25
|
+
gem.add_development_dependency "mhennemeyer-output_catcher"
|
26
|
+
gem.add_development_dependency "rr"
|
27
|
+
gem.add_development_dependency "mocha"
|
28
|
+
gem.add_development_dependency "redgreen"
|
29
|
+
end
|
30
|
+
|
31
|
+
Jeweler::RubyforgeTasks.new do |t|
|
32
|
+
t.doc_task = :yardoc
|
21
33
|
end
|
22
34
|
rescue LoadError
|
23
35
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
|
24
36
|
end
|
25
37
|
|
38
|
+
|
26
39
|
require 'rake/testtask'
|
27
40
|
Rake::TestTask.new(:test) do |test|
|
28
41
|
test.test_files = FileList.new('test/**/test_*.rb') do |list|
|
@@ -32,14 +45,18 @@ Rake::TestTask.new(:test) do |test|
|
|
32
45
|
test.verbose = true
|
33
46
|
end
|
34
47
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
begin
|
49
|
+
require 'yard'
|
50
|
+
YARD::Rake::YardocTask.new(:yardoc) do |t|
|
51
|
+
t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb')
|
52
|
+
end
|
53
|
+
rescue LoadError
|
54
|
+
task :yardoc do
|
55
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
56
|
+
end
|
41
57
|
end
|
42
58
|
|
59
|
+
|
43
60
|
begin
|
44
61
|
require 'rcov/rcovtask'
|
45
62
|
Rcov::RcovTask.new(:rcov) do |rcov|
|
@@ -104,3 +121,32 @@ if ENV["RUN_CODE_RUN"] == "true"
|
|
104
121
|
else
|
105
122
|
task :default => :test
|
106
123
|
end
|
124
|
+
|
125
|
+
namespace :development_dependencies do
|
126
|
+
task :check do
|
127
|
+
missing_dependencies = Rake.application.jeweler.gemspec.development_dependencies.select do |dependency|
|
128
|
+
begin
|
129
|
+
Gem.activate dependency.name, dependency.version_requirements.to_s
|
130
|
+
false
|
131
|
+
rescue LoadError => e
|
132
|
+
true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
#require 'ruby-debug'; breakpoint
|
137
|
+
|
138
|
+
if missing_dependencies.empty?
|
139
|
+
puts "Development dependencies seem to be installed."
|
140
|
+
else
|
141
|
+
puts "Missing some dependencies. Install them with the following commands:"
|
142
|
+
missing_dependencies.each do |dependency|
|
143
|
+
puts %Q{\tgem install #{dependency.name} --version "#{dependency.version_requirements}"}
|
144
|
+
end
|
145
|
+
abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
task :test => 'development_dependencies:check'
|
152
|
+
task :features => 'development_dependencies:check'
|
data/VERSION.yml
CHANGED
@@ -3,9 +3,11 @@ Feature: generated Rakefile
|
|
3
3
|
A user should be able to
|
4
4
|
generate a Rakefile
|
5
5
|
|
6
|
-
|
6
|
+
Background:
|
7
7
|
Given a working directory
|
8
8
|
And I have configured git sanely
|
9
|
+
|
10
|
+
Scenario: shared
|
9
11
|
When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive'
|
10
12
|
|
11
13
|
Then 'Rakefile' requires 'rubygems'
|
@@ -18,8 +20,6 @@ Feature: generated Rakefile
|
|
18
20
|
And Rakefile has 'http://github.com/technicalpickles/the-perfect-gem' for the Jeweler::Tasks homepage
|
19
21
|
|
20
22
|
Scenario: bacon
|
21
|
-
Given a working directory
|
22
|
-
And I have configured git sanely
|
23
23
|
When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
|
24
24
|
|
25
25
|
|
@@ -30,8 +30,6 @@ Feature: generated Rakefile
|
|
30
30
|
And Rakefile has "spec" as the default task
|
31
31
|
|
32
32
|
Scenario: minitest
|
33
|
-
Given a working directory
|
34
|
-
And I have configured git sanely
|
35
33
|
When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
|
36
34
|
|
37
35
|
Then 'Rakefile' requires 'rcov/rcovtask'
|
@@ -41,8 +39,6 @@ Feature: generated Rakefile
|
|
41
39
|
And Rakefile has "test" as the default task
|
42
40
|
|
43
41
|
Scenario: rspec
|
44
|
-
Given a working directory
|
45
|
-
And I have configured git sanely
|
46
42
|
When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
|
47
43
|
|
48
44
|
Then 'Rakefile' requires 'spec/rake/spectask'
|
@@ -50,8 +46,6 @@ Feature: generated Rakefile
|
|
50
46
|
And Rakefile has "spec" as the default task
|
51
47
|
|
52
48
|
Scenario: shoulda
|
53
|
-
Given a working directory
|
54
|
-
And I have configured git sanely
|
55
49
|
When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good'
|
56
50
|
|
57
51
|
Then 'Rakefile' requires 'rcov/rcovtask'
|
@@ -61,8 +55,6 @@ Feature: generated Rakefile
|
|
61
55
|
And Rakefile has "test" as the default task
|
62
56
|
|
63
57
|
Scenario: micronaut
|
64
|
-
Given a working directory
|
65
|
-
And I have configured git sanely
|
66
58
|
When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
|
67
59
|
|
68
60
|
Then 'Rakefile' requires 'micronaut/rake_task'
|
@@ -70,8 +62,6 @@ Feature: generated Rakefile
|
|
70
62
|
And Rakefile has "examples" as the default task
|
71
63
|
|
72
64
|
Scenario: testunit
|
73
|
-
Given a working directory
|
74
|
-
And I have configured git sanely
|
75
65
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
76
66
|
|
77
67
|
Then 'Rakefile' requires 'rcov/rcovtask'
|
@@ -81,65 +71,81 @@ Feature: generated Rakefile
|
|
81
71
|
And Rakefile has "test" as the default task
|
82
72
|
|
83
73
|
Scenario: no cucumber
|
84
|
-
Given
|
85
|
-
And I have configured git sanely
|
86
|
-
And I do not want cucumber stories
|
74
|
+
Given I do not want cucumber stories
|
87
75
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
88
76
|
Then Rakefile does not require 'cucumber/rake/task'
|
89
77
|
And Rakefile does not instantiate a Cucumber::Rake::Task
|
90
78
|
|
91
79
|
Scenario: cucumber
|
92
|
-
Given
|
93
|
-
And I have configured git sanely
|
94
|
-
And I want cucumber stories
|
80
|
+
Given I want cucumber stories
|
95
81
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
96
82
|
Then Rakefile requires 'cucumber/rake/task'
|
97
83
|
And Rakefile instantiates a Cucumber::Rake::Task
|
98
84
|
|
99
85
|
Scenario: no reek
|
100
|
-
Given
|
101
|
-
And I have configured git sanely
|
102
|
-
And I do not want reek
|
86
|
+
Given I do not want reek
|
103
87
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
104
88
|
Then Rakefile does not require 'reek/rake_task'
|
105
89
|
And Rakefile does not instantiate a Reek::RakeTask
|
106
90
|
|
107
91
|
Scenario: reek
|
108
|
-
Given
|
109
|
-
And I have configured git sanely
|
110
|
-
And I want reek
|
92
|
+
Given I want reek
|
111
93
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
112
94
|
Then Rakefile requires 'reek/rake_task'
|
113
95
|
And Rakefile instantiates a Reek::RakeTask
|
114
96
|
|
115
97
|
Scenario: no roodi
|
116
|
-
Given
|
117
|
-
And I have configured git sanely
|
118
|
-
And I do not want roodi
|
98
|
+
Given I do not want roodi
|
119
99
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
120
100
|
Then Rakefile does not require 'roodi'
|
121
101
|
And Rakefile does not require 'roodi_task'
|
122
102
|
And Rakefile does not instantiate a RoodiTask
|
123
103
|
|
124
104
|
Scenario: roodi
|
125
|
-
Given
|
126
|
-
And I have configured git sanely
|
127
|
-
And I want roodi
|
105
|
+
Given I want roodi
|
128
106
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
129
107
|
Then Rakefile requires 'roodi'
|
130
108
|
And Rakefile requires 'roodi_task'
|
131
109
|
And Rakefile instantiates a RoodiTask
|
132
110
|
|
133
111
|
Scenario: no rubyforge
|
134
|
-
Given
|
135
|
-
And I have configured git sanely
|
136
|
-
And I do not want rubyforge setup
|
112
|
+
Given I do not want rubyforge setup
|
137
113
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
138
114
|
Then Rakefile does not instantiate a Jeweler::RubyforgeTasks
|
139
115
|
|
140
116
|
Scenario: rubyforge
|
141
|
-
Given
|
142
|
-
|
117
|
+
Given I want rubyforge setup
|
118
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
119
|
+
Then Rakefile instantiates a Jeweler::RubyforgeTasks
|
120
|
+
|
121
|
+
Scenario: yard
|
122
|
+
Given I want to use yard instead of rdoc
|
123
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
124
|
+
|
125
|
+
Then 'Rakefile' does not require 'rake/rdoctask'
|
126
|
+
And 'Rakefile' requires 'yard'
|
127
|
+
And Rakefile instantiates a YARD::Rake::YardocTask
|
128
|
+
|
129
|
+
Scenario: rdoc
|
130
|
+
Given I want to use rdoc instead of yard
|
131
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
132
|
+
|
133
|
+
Then 'Rakefile' does not require 'yard'
|
134
|
+
And 'Rakefile' requires 'rake/rdoctask'
|
135
|
+
And Rakefile does not instantiate a YARD::Rake::YardocTask
|
136
|
+
And Rakefile instantiates a Rake::RDocTask.new
|
137
|
+
|
138
|
+
Scenario: rubyforge and yard
|
139
|
+
Given I want to use yard instead of rdoc
|
140
|
+
And I want rubyforge setup
|
141
|
+
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
142
|
+
Then Rakefile instantiates a Jeweler::RubyforgeTasks
|
143
|
+
And Rakefile has 'yardoc' for the Jeweler::RubyforgeTasks doc_task
|
144
|
+
|
145
|
+
Scenario: rubyfoge and doc
|
146
|
+
Given I want to use rdoc instead of yard
|
147
|
+
And I want rubyforge setup
|
143
148
|
And I want rubyforge setup
|
144
149
|
When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
|
145
150
|
Then Rakefile instantiates a Jeweler::RubyforgeTasks
|
151
|
+
And Rakefile has 'rdoc' for the Jeweler::RubyforgeTasks doc_task
|
@@ -25,6 +25,9 @@ end
|
|
25
25
|
When /^I run "([^"]+)" in "([^"]+)"$/ do |command, directory|
|
26
26
|
full_path = File.join(@working_dir, directory)
|
27
27
|
|
28
|
+
lib_path = File.expand_path 'lib'
|
29
|
+
command.gsub!(/^rake /, "rake -I#{lib_path} ")
|
30
|
+
|
28
31
|
assert File.directory?(full_path), "#{full_path} is not a directory"
|
29
32
|
|
30
33
|
@stdout = `cd #{full_path} && #{command}`
|
@@ -30,6 +30,14 @@ And /^I want rubyforge setup$/ do
|
|
30
30
|
@use_rubyforge = true
|
31
31
|
end
|
32
32
|
|
33
|
+
Given /^I want to use yard instead of rdoc$/ do
|
34
|
+
@documentation_framework = "yard"
|
35
|
+
end
|
36
|
+
|
37
|
+
Given /^I want to use rdoc instead of yard$/ do
|
38
|
+
@documentation_framework = "rdoc"
|
39
|
+
end
|
40
|
+
|
33
41
|
|
34
42
|
Given /^I intend to test with (\w+)$/ do |testing_framework|
|
35
43
|
@testing_framework = testing_framework.to_sym
|
@@ -77,6 +85,7 @@ When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and desc
|
|
77
85
|
@use_rubyforge ? '--rubyforge' : nil,
|
78
86
|
@use_roodi ? '--roodi' : nil,
|
79
87
|
@use_reek ? '--reek' : nil,
|
88
|
+
@documentation_framework ? "--#{@documentation_framework}" : nil,
|
80
89
|
@name].compact
|
81
90
|
|
82
91
|
@stdout = OutputCatcher.catch_out do
|
data/features/support/env.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
2
|
require 'jeweler'
|
3
3
|
|
4
|
-
|
5
|
-
require '
|
4
|
+
begin
|
5
|
+
require 'mocha'
|
6
|
+
require 'output_catcher'
|
7
|
+
rescue LoadError => e
|
8
|
+
puts "*" * 80
|
9
|
+
puts "Some dependencies needed to run tests were missing. Run the following command to find them:"
|
10
|
+
puts
|
11
|
+
puts "\trake development_dependencies:check"
|
12
|
+
puts "*" * 80
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
6
16
|
|
7
17
|
require 'test/unit/assertions'
|
8
18
|
|
data/jeweler.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{jeweler}
|
5
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Josh Nichols"]
|
9
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-08-05}
|
10
13
|
s.default_executable = %q{jeweler}
|
11
14
|
s.description = %q{Simple and opinionated helper for creating Rubygem projects on GitHub}
|
12
15
|
s.email = %q{josh@technicalpickles.com}
|
@@ -150,7 +153,7 @@ Gem::Specification.new do |s|
|
|
150
153
|
s.rdoc_options = ["--charset=UTF-8"]
|
151
154
|
s.require_paths = ["lib"]
|
152
155
|
s.rubyforge_project = %q{pickles}
|
153
|
-
s.rubygems_version = %q{1.3.
|
156
|
+
s.rubygems_version = %q{1.3.5}
|
154
157
|
s.summary = %q{Simple and opinionated helper for creating Rubygem projects on GitHub}
|
155
158
|
s.test_files = [
|
156
159
|
"test/fixtures/bar/lib/foo_the_ultimate_lib.rb",
|
@@ -191,14 +194,29 @@ Gem::Specification.new do |s|
|
|
191
194
|
s.specification_version = 3
|
192
195
|
|
193
196
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
194
|
-
s.add_runtime_dependency(%q<git>, [">= 1.
|
197
|
+
s.add_runtime_dependency(%q<git>, [">= 1.2.1"])
|
195
198
|
s.add_runtime_dependency(%q<rubyforge>, [">= 0"])
|
199
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
200
|
+
s.add_development_dependency(%q<mhennemeyer-output_catcher>, [">= 0"])
|
201
|
+
s.add_development_dependency(%q<rr>, [">= 0"])
|
202
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
203
|
+
s.add_development_dependency(%q<redgreen>, [">= 0"])
|
196
204
|
else
|
197
|
-
s.add_dependency(%q<git>, [">= 1.
|
205
|
+
s.add_dependency(%q<git>, [">= 1.2.1"])
|
198
206
|
s.add_dependency(%q<rubyforge>, [">= 0"])
|
207
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
208
|
+
s.add_dependency(%q<mhennemeyer-output_catcher>, [">= 0"])
|
209
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
210
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
211
|
+
s.add_dependency(%q<redgreen>, [">= 0"])
|
199
212
|
end
|
200
213
|
else
|
201
|
-
s.add_dependency(%q<git>, [">= 1.
|
214
|
+
s.add_dependency(%q<git>, [">= 1.2.1"])
|
202
215
|
s.add_dependency(%q<rubyforge>, [">= 0"])
|
216
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
217
|
+
s.add_dependency(%q<mhennemeyer-output_catcher>, [">= 0"])
|
218
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
219
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
220
|
+
s.add_dependency(%q<redgreen>, [">= 0"])
|
203
221
|
end
|
204
222
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
1
3
|
class Jeweler
|
2
4
|
module Commands
|
3
5
|
class InstallGem
|
@@ -9,10 +11,22 @@ class Jeweler
|
|
9
11
|
|
10
12
|
|
11
13
|
def run
|
12
|
-
command = "
|
14
|
+
command = "gem install #{gemspec_helper.gem_path}"
|
13
15
|
output.puts "Executing #{command.inspect}:"
|
14
16
|
|
15
|
-
sh command # TODO where does sh actually come from!?
|
17
|
+
sh sudo_wrapper(command) # TODO where does sh actually come from!? - rake, apparently
|
18
|
+
end
|
19
|
+
|
20
|
+
def sudo_wrapper(command)
|
21
|
+
use_sudo? ? "sudo #{command}" : command
|
22
|
+
end
|
23
|
+
|
24
|
+
def use_sudo?
|
25
|
+
host_os !~ /mswin|windows|cygwin/i
|
26
|
+
end
|
27
|
+
|
28
|
+
def host_os
|
29
|
+
Config::CONFIG['host_os']
|
16
30
|
end
|
17
31
|
|
18
32
|
def self.build_for(jeweler)
|
@@ -12,7 +12,7 @@ class Jeweler
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def run
|
15
|
-
raise "Hey buddy, try committing them files first"
|
15
|
+
raise "Hey buddy, try committing them files first" unless clean_staging_area?
|
16
16
|
|
17
17
|
repo.checkout('master')
|
18
18
|
|
@@ -22,11 +22,12 @@ class Jeweler
|
|
22
22
|
output.puts "Pushing master to origin"
|
23
23
|
repo.push
|
24
24
|
|
25
|
-
tag_release!
|
25
|
+
tag_release! if release_not_tagged?
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def clean_staging_area?
|
29
|
+
status = repo.status
|
30
|
+
status.added.empty? && status.deleted.empty? && status.changed.empty?
|
30
31
|
end
|
31
32
|
|
32
33
|
def tag_release!
|
@@ -52,13 +53,15 @@ class Jeweler
|
|
52
53
|
"v#{version}"
|
53
54
|
end
|
54
55
|
|
55
|
-
def
|
56
|
+
def release_not_tagged?
|
56
57
|
tag = repo.tag(release_tag) rescue nil
|
57
|
-
|
58
|
+
tag.nil?
|
58
59
|
end
|
59
60
|
|
60
61
|
def gemspec_changed?
|
61
|
-
|
62
|
+
`git status` # OMGHAX. status always ends up being 'M' unless this runs
|
63
|
+
status = repo.status[gemspec_helper.path]
|
64
|
+
! status.type.nil?
|
62
65
|
end
|
63
66
|
|
64
67
|
def gemspec_helper
|
@@ -11,7 +11,26 @@ class Jeweler
|
|
11
11
|
output.puts "Logging into rubyforge"
|
12
12
|
@rubyforge.login
|
13
13
|
|
14
|
+
if package_exists?
|
15
|
+
output.puts "#{@gemspec.name} package already exists in the #{@gemspec.rubyforge_project} project"
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
14
19
|
output.puts "Creating #{@gemspec.name} package in the #{@gemspec.rubyforge_project} project"
|
20
|
+
create_package
|
21
|
+
end
|
22
|
+
|
23
|
+
def package_exists?
|
24
|
+
begin
|
25
|
+
@rubyforge.lookup 'package', @gemspec.name
|
26
|
+
true
|
27
|
+
rescue RuntimeError => e
|
28
|
+
raise unless e.message == "no <package_id> configured for <#{@gemspec.name}>"
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_package
|
15
34
|
begin
|
16
35
|
@rubyforge.create_package(@gemspec.rubyforge_project, @gemspec.name)
|
17
36
|
rescue StandardError => e
|
@@ -30,6 +30,9 @@ class Jeweler
|
|
30
30
|
gemspec_ruby = prettyify_array(gemspec_ruby, :files)
|
31
31
|
gemspec_ruby = prettyify_array(gemspec_ruby, :test_files)
|
32
32
|
gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files)
|
33
|
+
f.puts "# Generated by jeweler"
|
34
|
+
f.puts "# DO NOT EDIT THIS FILE"
|
35
|
+
f.puts "# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`"
|
33
36
|
f.write gemspec_ruby
|
34
37
|
end
|
35
38
|
end
|
@@ -7,7 +7,8 @@ class Jeweler
|
|
7
7
|
super()
|
8
8
|
|
9
9
|
@orig_args = args.clone
|
10
|
-
self[:testing_framework]
|
10
|
+
self[:testing_framework] = :shoulda
|
11
|
+
self[:documentation_framework] = :rdoc
|
11
12
|
|
12
13
|
@opts = OptionParser.new do |o|
|
13
14
|
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
@@ -68,6 +69,14 @@ class Jeweler
|
|
68
69
|
self[:directory] = directory
|
69
70
|
end
|
70
71
|
|
72
|
+
o.on('--yard', 'use yard for documentation') do
|
73
|
+
self[:documentation_framework] = :yard
|
74
|
+
end
|
75
|
+
|
76
|
+
o.on('--rdoc', 'use rdoc for documentation') do
|
77
|
+
self[:documentation_framework] = :rdoc
|
78
|
+
end
|
79
|
+
|
71
80
|
o.on_tail('-h', '--help', 'display this help and exit') do
|
72
81
|
self[:show_help] = true
|
73
82
|
end
|
data/lib/jeweler/generator.rb
CHANGED
@@ -28,13 +28,16 @@ class Jeweler
|
|
28
28
|
end
|
29
29
|
|
30
30
|
class Generator
|
31
|
-
attr_accessor :target_dir, :user_name, :user_email, :summary,
|
31
|
+
attr_accessor :target_dir, :user_name, :user_email, :summary,
|
32
32
|
:project_name, :github_username, :github_token,
|
33
|
-
:repo, :should_create_repo,
|
33
|
+
:repo, :should_create_repo,
|
34
|
+
:testing_framework, :documentation_framework,
|
35
|
+
:should_use_cucumber, :should_setup_rubyforge,
|
34
36
|
:should_use_reek, :should_use_roodi,
|
35
37
|
:description
|
36
38
|
|
37
39
|
DEFAULT_TESTING_FRAMEWORK = :shoulda
|
40
|
+
DEFAULT_DOCUMENTATION_FRAMEWORK = :rdoc
|
38
41
|
|
39
42
|
def initialize(project_name, options = {})
|
40
43
|
if project_name.nil? || project_name.squeeze.strip == ""
|
@@ -44,6 +47,7 @@ class Jeweler
|
|
44
47
|
self.project_name = project_name
|
45
48
|
|
46
49
|
self.testing_framework = (options[:testing_framework] || DEFAULT_TESTING_FRAMEWORK).to_sym
|
50
|
+
self.documentation_framework = options[:documentation_framework] || DEFAULT_DOCUMENTATION_FRAMEWORK
|
47
51
|
begin
|
48
52
|
generator_mixin_name = "#{self.testing_framework.to_s.capitalize}Mixin"
|
49
53
|
generator_mixin = self.class.const_get(generator_mixin_name)
|
@@ -127,14 +131,19 @@ class Jeweler
|
|
127
131
|
File.join(features_dir, 'step_definitions')
|
128
132
|
end
|
129
133
|
|
134
|
+
def doc_task
|
135
|
+
case documentation_framework
|
136
|
+
when :yard then "yardoc"
|
137
|
+
else
|
138
|
+
documentation_framework.to_s
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
130
142
|
protected
|
131
143
|
|
132
144
|
# This is in a separate method so we can stub it out during testing
|
133
145
|
def read_git_config
|
134
|
-
|
135
|
-
# ... which we don't have yet, since this is part of a sanity check
|
136
|
-
lib = Git::Lib.new(nil, nil)
|
137
|
-
config = lib.parse_config '~/.gitconfig'
|
146
|
+
Git.global_config
|
138
147
|
end
|
139
148
|
|
140
149
|
private
|
@@ -4,8 +4,29 @@ require 'rake/contrib/sshpublisher'
|
|
4
4
|
|
5
5
|
|
6
6
|
class Jeweler
|
7
|
+
# Rake tasks for putting a Jeweler gem on Rubyforge.
|
8
|
+
#
|
9
|
+
# Jeweler::Tasks.new needs to be used before this.
|
10
|
+
#
|
11
|
+
# Basic usage:
|
12
|
+
#
|
13
|
+
# Jeweler::RubyforgeTasks.new
|
14
|
+
#
|
15
|
+
# Easy enough, right?
|
16
|
+
#
|
17
|
+
# There are a few options you can tweak:
|
18
|
+
#
|
19
|
+
# * project: the rubyforge project to operate on. This defaults to whatever you specified in your gemspec. Defaults to your gem name.
|
20
|
+
# * remote_doc_path: the place to upload docs to on Rubyforge under /var/www/gforge-projects/#{project}/
|
21
|
+
#
|
7
22
|
class RubyforgeTasks < ::Rake::TaskLib
|
8
|
-
|
23
|
+
# The RubyForge project to interact with. Defaults to whatever is in your jeweler gemspec.
|
24
|
+
attr_accessor :project
|
25
|
+
# The path to upload docs to. It is relative to /var/www/gforge-projects/#{project}/, and defaults to your gemspec's name
|
26
|
+
attr_accessor :remote_doc_path
|
27
|
+
# Task to be used for generating documentation, before they are uploaded. Defaults to rdoc.
|
28
|
+
attr_accessor :doc_task
|
29
|
+
|
9
30
|
attr_accessor :jeweler
|
10
31
|
|
11
32
|
def initialize
|
@@ -15,6 +36,7 @@ class Jeweler
|
|
15
36
|
|
16
37
|
self.remote_doc_path ||= jeweler.gemspec.name
|
17
38
|
self.project ||= jeweler.gemspec.rubyforge_project
|
39
|
+
self.doc_task ||= :rdoc
|
18
40
|
|
19
41
|
define
|
20
42
|
end
|
@@ -26,21 +48,51 @@ class Jeweler
|
|
26
48
|
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
27
49
|
|
28
50
|
namespace :release do
|
29
|
-
desc "
|
30
|
-
task :
|
51
|
+
desc "Release the current gem version to RubyForge."
|
52
|
+
task :gem => [:gemspec, :build] do
|
53
|
+
begin
|
54
|
+
jeweler.release_gem_to_rubyforge
|
55
|
+
rescue NoRubyForgeProjectInGemspecError => e
|
56
|
+
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
57
|
+
rescue MissingRubyForgePackageError => e
|
58
|
+
abort "Rubyforge reported that the #{e.message} package isn't setup. Run rake rubyforge:setup to do so."
|
59
|
+
rescue RubyForgeProjectNotConfiguredError => e
|
60
|
+
abort "RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Publish docs to RubyForge."
|
65
|
+
task :docs => doc_task do
|
31
66
|
config = YAML.load(
|
32
67
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
33
68
|
)
|
34
69
|
|
35
70
|
host = "#{config['username']}@rubyforge.org"
|
36
71
|
remote_dir = "/var/www/gforge-projects/#{project}/#{remote_doc_path}"
|
37
|
-
|
72
|
+
|
73
|
+
local_dir = case self.doc_task.to_sym
|
74
|
+
when :rdoc then 'rdoc'
|
75
|
+
when :yardoc then 'doc'
|
76
|
+
else
|
77
|
+
raise "Unsure what to run to generate documentation. Please set doc_task and re-run."
|
78
|
+
end
|
38
79
|
|
39
80
|
sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}}
|
40
81
|
end
|
41
82
|
end
|
83
|
+
|
84
|
+
desc "Setup a rubyforge project for this gem"
|
85
|
+
task :setup do
|
86
|
+
begin
|
87
|
+
jeweler.setup_rubyforge
|
88
|
+
rescue NoRubyForgeProjectInGemspecError => e
|
89
|
+
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
90
|
+
rescue RubyForgeProjectNotConfiguredError => e
|
91
|
+
abort "The RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
42
95
|
end
|
43
|
-
|
44
96
|
end
|
45
97
|
end
|
46
98
|
end
|