jeweler 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,33 @@
1
+ # jeweler 1.4.0 2009-11-19
2
+
3
+ * Generator now adds gemcutter support by default. Disable it with --no-gemcutter
4
+ * Generator now creates a reek task that works with the latest reek. If you have a previously generated project using it, you may need to change the require line to: require 'reek/adapters/rake_task'
5
+ * Generator now exits with the correct exit code
6
+ * `rake install` no longer uses `sudo` to install. If your ruby configuration needs sudo to install, use `sudo rake install` instead.
7
+ * `rake install` now correctly installs dependencies as well
8
+ * `rake install` should correctly figure out which `gem` binary to invoke now
9
+ * `rake build` now will regenerate the gemspec as well
10
+ * `rake gemspec` now eliminates duplicates for gemspec.files, gemspec.rdoc_files, etc
11
+ * `rake gemspec` now automtically populate gemspec.extensions with any extconf.rb files you have in `ext`
12
+ * Releasing to Rubyforge is now deprecated in favor of Gemcutter.
13
+
14
+ # jeweler 1.3.0
15
+
16
+ * Now supports an addition version type, build. This can be used to add a fourth segment of the version that's arbirtary. One example use is having prereleases.
17
+ * Jeweler now lazily loads, to avoid causing side-effects when running other rake tasks
18
+ * Version can now be set explicitly on the gemspec, rather than relying on a VERSION file
19
+ * Rubyforge and Gemcutter support now hooks into `rake release`
20
+ * `rake build` now uses an in-memory copy of the gemspec, rather than the filesystem persisted one
21
+ * Rubyforge support no longer forces the uploading of documentation
22
+ * Generator:
23
+ * Allow arbitrary homepage and git remotes, to decouple a bit from GitHub
24
+ * Support for the riot testing framework: http://github.com/thumblemonks/riot/
25
+ * Support for test/spec
26
+ * .gitignore now ignores emacs temporary files
27
+ * rspec support now creates a spec.opts with support for color and other stuff
28
+ * Updated minitest support (formally miniunit)
29
+ * Improved support for autotest
30
+
1
31
  # jeweler 1.2.0 2009-08-06
2
32
  * Generator now adds development dependencies appropriate to your testing framework
3
33
  * Added check_dependencies tasks for verifying gem dependencies are installed
@@ -3,11 +3,12 @@
3
3
  Jeweler provides two things:
4
4
 
5
5
  * Rake tasks for managing gems and versioning of a <a href="http://github.com">GitHub</a> project
6
- * A generator for creating kickstarting a new project
6
+ * A generator for creating/kickstarting a new project
7
7
 
8
8
  ## Quick Links
9
9
 
10
10
  * [Wiki](http://wiki.github.com/technicalpickles/jeweler)
11
+ * [Mailing List](http://groups.google.com/group/jeweler-rb)
11
12
  * [Bugs](http://github.com/technicalpickles/jeweler/issues)
12
13
  * [Donate](http://pledgie.org/campaigns/2604)
13
14
 
@@ -15,7 +16,7 @@ Jeweler provides two things:
15
16
 
16
17
  # Install the gem:
17
18
  sudo gem install jeweler
18
-
19
+
19
20
  ## Using in an existing project
20
21
 
21
22
  It's easy to get up and running. Update your Rakefile to instantiate a `Jeweler::Tasks`, and give it a block with details about your project.
@@ -24,15 +25,14 @@ It's easy to get up and running. Update your Rakefile to instantiate a `Jeweler:
24
25
  require 'jeweler'
25
26
  Jeweler::Tasks.new do |gemspec|
26
27
  gemspec.name = "the-perfect-gem"
27
- gemspec.summary = "Summarize your gem"
28
- gemspec.description = "Describe your gem"
28
+ gemspec.summary = "One line summary of your gem"
29
+ gemspec.description = "A different and possibly longer explanation of"
29
30
  gemspec.email = "josh@technicalpickles.com"
30
31
  gemspec.homepage = "http://github.com/technicalpickles/the-perfect-gem"
31
- gemspec.description = "TODO"
32
32
  gemspec.authors = ["Josh Nichols"]
33
33
  end
34
34
  rescue LoadError
35
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
35
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
36
36
  end
37
37
 
38
38
  The yield object here, `gemspec`, is a `Gem::Specification` object. See the [Customizing your project's gem specification](http://wiki.github.com/technicalpickles/jeweler/customizing-your-projects-gem-specification) for more details about how you can customize your gemspec.
@@ -45,11 +45,11 @@ Jeweler provides a generator. It requires you to [setup your name and email for
45
45
 
46
46
  This will prepare a project in the 'the-perfect-gem' directory, setup to use Jeweler.
47
47
 
48
- It supports a number of options:
48
+ It supports a number of options. Here's a taste, but `jeweler --help` will give you the most up-to-date listing:
49
49
 
50
50
  * --create-repo: in addition to preparing a project, it create an repo up on GitHub and enable RubyGem generation
51
51
  * --testunit: generate test_helper.rb and test ready for test/unit
52
- * --minitest: generate test_helper.rb and test ready for minitest
52
+ * --minitest: generate test_helper.rb and test ready for minitest
53
53
  * --shoulda: generate test_helper.rb and test ready for shoulda (this is the default)
54
54
  * --rspec: generate spec_helper.rb and spec ready for rspec
55
55
  * --bacon: generate spec_helper.rb and spec ready for bacon
@@ -72,11 +72,22 @@ This creates a gemspec for your project. It's based on the info you give `Jewele
72
72
 
73
73
  ## Gem
74
74
 
75
- Jeweler gives you tasks for building and installing your gem:
75
+ Jeweler gives you tasks for building and installing your gem.
76
+
77
+ rake install
78
+
79
+ To build the gem (which will end up in `pkg`), run:
76
80
 
77
81
  rake build
82
+
83
+ To install the gem (and build if necessary), i.e. using gem install, run:
84
+
78
85
  rake install
79
86
 
87
+ Note, this does not use `sudo` to install it, so if your ruby setup needs that, you should prefix it with sudo:
88
+
89
+ sudo rake install
90
+
80
91
  ## Versioning
81
92
 
82
93
  Jeweler tracks the version of your project. It assumes you will be using a version in the format `x.y.z`. `x` is the 'major' version, `y` is the 'minor' version, and `z` is the patch version.
@@ -87,7 +98,27 @@ Initially, your project starts out at 0.0.0. Jeweler provides Rake tasks for bum
87
98
  rake version:bump:minor
88
99
  rake version:bump:patch
89
100
 
90
- ## Releasing to GitHub
101
+ You can also programmatically set the version if you wish. Typically, you use this to have a module with the version info so clients can access it. The only downside here is you no longer can use the version:bump tasks.
102
+
103
+ require File.dirname(__FILE__) + "/lib/my_project/version.rb"
104
+
105
+ Jeweler::Tasks.new do |gemspec|
106
+ gemspec.version = MyProject::VERSION
107
+ # more stuff
108
+ end
109
+
110
+ ### Prerelease versioning
111
+
112
+ Major, minor, and patch versions have a distant cousin: build. You can use this to add an arbitrary (or you know, regular type) version. This is particularly useful for prereleases.
113
+
114
+ You have two ways of doing this:
115
+
116
+ * Use `version:write` and specify `BUILD=pre1`
117
+ * Edit VERSION by hand to add a fourth version segment
118
+
119
+ Jeweler does not provide a `version:bump:build` because the build version can really be anything, so it's hard to know what should be the next bump.
120
+
121
+ ## Releasing
91
122
 
92
123
  Jeweler handles releasing your gem into the wild:
93
124
 
@@ -96,16 +127,18 @@ Jeweler handles releasing your gem into the wild:
96
127
  It does the following for you:
97
128
 
98
129
  * Regenerate the gemspec to the latest version of your project
99
- * Push to GitHub (which results in a gem being build)
100
- * Tag the version and push to GitHub
130
+ * git pushes to origin/master branch
131
+ * git tags the version and pushes to the origin remote
132
+
133
+ As is though, it doesn't actually get your gem anywhere. To do that, you'll need to use rubyforge or gemcutter.
101
134
 
102
- ## Releasing to Gemcutter
135
+ ### Releasing to Gemcutter
103
136
 
104
137
  Jeweler can also handle releasing to [Gemcutter](http://gemcutter.org). There are a few steps you need to do before doing any Gemcutter releases with Jeweler:
105
138
 
106
139
  * [Create an account on Gemcutter](http://gemcutter.org/sign_up)
107
- * Install the Gemcutter gem: sudo gem install gemcutter
108
- * Run 'gemcutter tumble' to set up RubyGems to use gemcutter as the default source
140
+ * Install the Gemcutter gem: gem install gemcutter
141
+ * Run 'gem tumble' to set up RubyGems to use gemcutter as the default source if you haven't already
109
142
  * Update your Rakefile to make an instance of `Jeweler::GemcutterTasks`
110
143
 
111
144
 
@@ -113,8 +146,8 @@ A Rakefile setup for gemcutter would include something like this:
113
146
 
114
147
  begin
115
148
  require 'jeweler'
116
- Jeweler::Tasks.new do |gem|
117
- # ommitted for brevity
149
+ Jeweler::Tasks.new do |gemspec|
150
+ # omitted for brevity
118
151
  end
119
152
  Jeweler::GemcutterTasks.new
120
153
  rescue LoadError
@@ -122,11 +155,13 @@ A Rakefile setup for gemcutter would include something like this:
122
155
  end
123
156
 
124
157
 
125
- With all that setup out of the way, you can now release to Gemcutter with impunity. This would release the current version of your gem.
158
+ After you have configured this, `rake release` will now also release to Gemcutter.
159
+
160
+ If you need to release it without the rest of the release task, you can run:
126
161
 
127
162
  $ rake gemcutter:release
128
163
 
129
- ## Releasing to RubyForge
164
+ ### Releasing to RubyForge
130
165
 
131
166
  Jeweler can also handle releasing to [RubyForge](http://rubyforge.org). There are a few steps you need to do before doing any RubyForge releases with Jeweler:
132
167
 
@@ -144,9 +179,9 @@ A Rakefile setup for rubyforge would include something like this:
144
179
 
145
180
  begin
146
181
  require 'jeweler'
147
- Jeweler::Tasks.new do |s|
182
+ Jeweler::Tasks.new do |gemspec|
148
183
  # ommitted for brevity
149
- s.rubyforge_project = 'the-perfect-gem' # This line would be new
184
+ gemspec.rubyforge_project = 'the-perfect-gem' # This line would be new
150
185
  end
151
186
 
152
187
  Jeweler::RubyforgeTasks.new do |rubyforge|
@@ -160,14 +195,14 @@ Now you must initially create a 'package' for your gem in your RubyForge 'projec
160
195
 
161
196
  $ rake rubyforge:setup
162
197
 
163
- With all that setup out of the way, you can now release to RubyForge with impunity. This would release the current version of your gem, and upload the rdoc as your project's webpage.
198
+ After you have configured this, `rake release` will now also release to RubyForge.
199
+
200
+ If you need to release it without the rest of the release task, you can run:
164
201
 
165
202
  $ rake rubyforge:release
166
203
 
167
- ## Release Workflow
204
+ ## Development and Release Workflow
168
205
 
169
206
  * Hack, commit, hack, commit, etc, etc
170
207
  * `rake version:bump:patch release` to do the actual version bump and release
171
- * Have a delicious scotch
172
- * Install [gemstalker](http://github.com/technicalpickles/gemstalker), and use it to know when gem is built. It typically builds in a few minutes, but won't be installable for another 15 minutes.
173
-
208
+ * Have a delicious beverage (I suggest scotch)
data/Rakefile CHANGED
@@ -23,6 +23,10 @@ Jeweler::Tasks.new do |gem|
23
23
  gem.add_development_dependency "rr"
24
24
  gem.add_development_dependency "mocha"
25
25
  gem.add_development_dependency "redgreen"
26
+ gem.add_development_dependency "devver-construct"
27
+
28
+ gem.add_development_dependency "yard"
29
+ gem.add_development_dependency "cucumber"
26
30
  end
27
31
 
28
32
  Jeweler::GemcutterTasks.new
@@ -47,22 +51,18 @@ begin
47
51
  t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb')
48
52
  end
49
53
  rescue LoadError
50
- task :yardoc do
51
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
52
- end
54
+ task :yardoc => :check_dependencies
53
55
  end
54
56
 
55
57
 
56
58
  begin
57
59
  require 'rcov/rcovtask'
58
- Rcov::RcovTask.new(:rcov) do |rcov|
60
+ Rcov::RcovTask.new(:rcov => :check_dependencies) do |rcov|
59
61
  rcov.libs << 'test'
60
62
  rcov.pattern = 'test/**/test_*.rb'
61
63
  end
62
- rescue LoadError
63
- task :rcov do
64
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
65
- end
64
+ rescue
65
+ task :rcov => :check_dependencies
66
66
  end
67
67
 
68
68
  begin
@@ -76,13 +76,9 @@ begin
76
76
  end
77
77
  end
78
78
  rescue LoadError
79
- task :features do
80
- abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
81
- end
79
+ task :features => :check_dependencies
82
80
  namespace :features do
83
- task :pretty do
84
- abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
85
- end
81
+ task :pretty => :check_dependencies
86
82
  end
87
83
  end
88
84
 
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :minor: 4
2
3
  :patch: 0
3
4
  :major: 1
4
- :minor: 3
5
5
  :build:
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'jeweler/generator'
4
4
 
5
- Jeweler::Generator::Application.run!(*ARGV)
5
+ exit Jeweler::Generator::Application.run!(*ARGV)
@@ -85,13 +85,13 @@ Feature: generated Rakefile
85
85
  Scenario: no reek
86
86
  Given I do not want reek
87
87
  When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
88
- Then Rakefile does not require 'reek/rake_task'
88
+ Then Rakefile does not require 'reek/adapters/rake_task'
89
89
  And Rakefile does not instantiate a Reek::RakeTask
90
90
 
91
91
  Scenario: reek
92
92
  Given I want reek
93
93
  When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
94
- Then Rakefile requires 'reek/rake_task'
94
+ Then Rakefile requires 'reek/adapters/rake_task'
95
95
  And Rakefile instantiates a Reek::RakeTask
96
96
 
97
97
  Scenario: no roodi
@@ -126,7 +126,7 @@ end
126
126
  Then /^a sane '.gitignore' is created$/ do
127
127
  Then "a file named 'the-perfect-gem/.gitignore' is created"
128
128
  Then "'coverage' is ignored by git"
129
- Then "'*.sw?' is ignored by git"
129
+ Then "'*.swp' is ignored by git"
130
130
  Then "'.DS_Store' is ignored by git"
131
131
  Then "'rdoc' is ignored by git"
132
132
  Then "'pkg' is ignored by git"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jeweler}
8
- s.version = "1.3.0"
8
+ s.version = "1.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Nichols"]
12
- s.date = %q{2009-10-18}
12
+ s.date = %q{2009-11-19}
13
13
  s.default_executable = %q{jeweler}
14
14
  s.description = %q{Simple and opinionated helper for creating Rubygem projects on GitHub}
15
15
  s.email = %q{josh@technicalpickles.com}
@@ -85,8 +85,6 @@ Gem::Specification.new do |s|
85
85
  "lib/jeweler/specification.rb",
86
86
  "lib/jeweler/tasks.rb",
87
87
  "lib/jeweler/templates/.document",
88
- "lib/jeweler/templates/.document",
89
- "lib/jeweler/templates/.gitignore",
90
88
  "lib/jeweler/templates/.gitignore",
91
89
  "lib/jeweler/templates/LICENSE",
92
90
  "lib/jeweler/templates/README.rdoc",
@@ -95,10 +93,12 @@ Gem::Specification.new do |s|
95
93
  "lib/jeweler/templates/bacon/helper.rb",
96
94
  "lib/jeweler/templates/features/default.feature",
97
95
  "lib/jeweler/templates/features/support/env.rb",
96
+ "lib/jeweler/templates/jeweler_tasks.erb",
98
97
  "lib/jeweler/templates/micronaut/flunking.rb",
99
98
  "lib/jeweler/templates/micronaut/helper.rb",
100
99
  "lib/jeweler/templates/minitest/flunking.rb",
101
100
  "lib/jeweler/templates/minitest/helper.rb",
101
+ "lib/jeweler/templates/other_tasks.erb",
102
102
  "lib/jeweler/templates/riot/flunking.rb",
103
103
  "lib/jeweler/templates/riot/helper.rb",
104
104
  "lib/jeweler/templates/rspec/flunking.rb",
@@ -231,6 +231,9 @@ Gem::Specification.new do |s|
231
231
  s.add_development_dependency(%q<rr>, [">= 0"])
232
232
  s.add_development_dependency(%q<mocha>, [">= 0"])
233
233
  s.add_development_dependency(%q<redgreen>, [">= 0"])
234
+ s.add_development_dependency(%q<devver-construct>, [">= 0"])
235
+ s.add_development_dependency(%q<yard>, [">= 0"])
236
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
234
237
  else
235
238
  s.add_dependency(%q<git>, [">= 1.2.5"])
236
239
  s.add_dependency(%q<rubyforge>, [">= 2.0.0"])
@@ -240,6 +243,9 @@ Gem::Specification.new do |s|
240
243
  s.add_dependency(%q<rr>, [">= 0"])
241
244
  s.add_dependency(%q<mocha>, [">= 0"])
242
245
  s.add_dependency(%q<redgreen>, [">= 0"])
246
+ s.add_dependency(%q<devver-construct>, [">= 0"])
247
+ s.add_dependency(%q<yard>, [">= 0"])
248
+ s.add_dependency(%q<cucumber>, [">= 0"])
243
249
  end
244
250
  else
245
251
  s.add_dependency(%q<git>, [">= 1.2.5"])
@@ -250,6 +256,9 @@ Gem::Specification.new do |s|
250
256
  s.add_dependency(%q<rr>, [">= 0"])
251
257
  s.add_dependency(%q<mocha>, [">= 0"])
252
258
  s.add_dependency(%q<redgreen>, [">= 0"])
259
+ s.add_dependency(%q<devver-construct>, [">= 0"])
260
+ s.add_dependency(%q<yard>, [">= 0"])
261
+ s.add_dependency(%q<cucumber>, [">= 0"])
253
262
  end
254
263
  end
255
264
 
@@ -1,5 +1,3 @@
1
- require 'rbconfig'
2
-
3
1
  class Jeweler
4
2
  module Commands
5
3
  class InstallGem
@@ -11,22 +9,14 @@ class Jeweler
11
9
 
12
10
 
13
11
  def run
14
- command = "gem install --local #{gemspec_helper.gem_path}"
12
+ command = "#{gem_command} install #{gemspec_helper.gem_path}"
15
13
  output.puts "Executing #{command.inspect}:"
16
14
 
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
15
+ sh command # TODO where does sh actually come from!? - rake, apparently
26
16
  end
27
17
 
28
- def host_os
29
- Config::CONFIG['host_os']
18
+ def gem_command
19
+ Config::CONFIG['RUBY_INSTALL_NAME'].sub('ruby', 'gem')
30
20
  end
31
21
 
32
22
  def self.build_for(jeweler)
@@ -105,8 +105,6 @@ class Jeweler
105
105
  if should_create_remote_repo
106
106
  create_and_push_repo
107
107
  $stdout.puts "Jeweler has pushed your repo to #{homepage}"
108
- enable_gem_for_repo
109
- #$stdout.puts "Jeweler has enabled gem building for your repo"
110
108
  end
111
109
  end
112
110
 
@@ -194,14 +192,17 @@ class Jeweler
194
192
 
195
193
  end
196
194
 
197
- def output_template_in_target(source, destination = source)
198
- final_destination = File.join(target_dir, destination)
199
-
195
+ def render_template(source)
200
196
  template_contents = File.read(File.join(template_dir, source))
201
- template = ERB.new(template_contents, nil, '<>')
197
+ template = ERB.new(template_contents, nil, '<>')
202
198
 
203
199
  # squish extraneous whitespace from some of the conditionals
204
- template_result = template.result(binding).gsub(/\n\n\n+/, "\n\n")
200
+ template.result(binding).gsub(/\n\n\n+/, "\n\n")
201
+ end
202
+
203
+ def output_template_in_target(source, destination = source)
204
+ final_destination = File.join(target_dir, destination)
205
+ template_result = render_template(source)
205
206
 
206
207
  File.open(final_destination, 'w') {|file| file.write(template_result)}
207
208
 
@@ -262,23 +263,8 @@ class Jeweler
262
263
  'token' => github_token,
263
264
  'description' => summary,
264
265
  'name' => project_name
265
- # TODO do a HEAD request to see when it's ready
266
+ # TODO do a HEAD request to see when it's ready?
266
267
  @repo.push('origin')
267
268
  end
268
-
269
- # FIXME This was borked awhile ago, and even more so with gems being disabled
270
- def enable_gem_for_repo
271
- $stdout.puts "Visit #{homepage}/edit and click 'Enable RubyGems'"
272
- #url = "https://github.com/#{github_username}/#{project_name}/update"
273
- #`curl -F 'login=#{github_username}' -F 'token=#{github_token}' -F 'field=repository_rubygem' -F 'value=1' #{url} 2>/dev/null`
274
-
275
- # FIXME use NET::HTTP instead of curl
276
- #Net::HTTP.post_form URI.parse(url),
277
- #'login' => github_username,
278
- #'token' => github_token,
279
- #'field' => 'repository_rubygem',
280
- #'value' => '1'
281
- end
282
-
283
269
  end
284
270
  end