jeweler 1.4.0 → 1.5.0.pre6

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.
Files changed (88) hide show
  1. data/.document +8 -0
  2. data/ChangeLog.markdown +8 -8
  3. data/Gemfile +22 -0
  4. data/Gemfile.lock +59 -0
  5. data/README.markdown +138 -131
  6. data/Rakefile +39 -54
  7. data/features/generator/cucumber.feature +21 -1
  8. data/features/generator/directory_layout.feature +10 -0
  9. data/features/generator/dotdocument.feature +2 -3
  10. data/features/generator/gemfile.feature +71 -0
  11. data/features/generator/git.feature +9 -1
  12. data/features/generator/license.feature +11 -2
  13. data/features/generator/rakefile.feature +32 -27
  14. data/features/generator/test.feature +6 -0
  15. data/features/generator/test_helper.feature +104 -11
  16. data/features/step_definitions/filesystem_steps.rb +5 -3
  17. data/features/step_definitions/generator_steps.rb +83 -5
  18. data/features/support/env.rb +27 -14
  19. data/jeweler.gemspec +230 -212
  20. data/lib/jeweler/commands/check_dependencies.rb +3 -5
  21. data/lib/jeweler/commands/install_gem.rb +1 -2
  22. data/lib/jeweler/commands/{release_to_github.rb → release_gemspec.rb} +26 -10
  23. data/lib/jeweler/commands/release_to_git.rb +5 -3
  24. data/lib/jeweler/commands/{release_to_gemcutter.rb → release_to_rubygems.rb} +1 -2
  25. data/lib/jeweler/commands/version/base.rb +16 -2
  26. data/lib/jeweler/commands/write_gemspec.rb +0 -1
  27. data/lib/jeweler/commands.rb +2 -4
  28. data/lib/jeweler/errors.rb +4 -16
  29. data/lib/jeweler/gemcutter_tasks.rb +4 -32
  30. data/lib/jeweler/gemspec_helper.rb +3 -6
  31. data/lib/jeweler/generator/options.rb +17 -14
  32. data/lib/jeweler/generator/rspec_mixin.rb +2 -2
  33. data/lib/jeweler/generator/shindo_mixin.rb +44 -0
  34. data/lib/jeweler/generator/shoulda_mixin.rb +1 -1
  35. data/lib/jeweler/generator/yard_mixin.rb +1 -1
  36. data/lib/jeweler/generator.rb +24 -7
  37. data/lib/jeweler/rubyforge_tasks.rb +6 -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 +38 -13
  41. data/lib/jeweler/tasks.rb +78 -33
  42. data/lib/jeweler/templates/.document +2 -2
  43. data/lib/jeweler/templates/.gitignore +36 -15
  44. data/lib/jeweler/templates/Gemfile +12 -0
  45. data/lib/jeweler/templates/{LICENSE → LICENSE.txt} +1 -1
  46. data/lib/jeweler/templates/README.rdoc +11 -9
  47. data/lib/jeweler/templates/Rakefile +1 -0
  48. data/lib/jeweler/templates/bacon/helper.rb +1 -0
  49. data/lib/jeweler/templates/bundler_setup.erb +10 -0
  50. data/lib/jeweler/templates/features/support/env.rb +2 -0
  51. data/lib/jeweler/templates/jeweler_tasks.erb +22 -22
  52. data/lib/jeweler/templates/micronaut/helper.rb +1 -0
  53. data/lib/jeweler/templates/minitest/helper.rb +1 -0
  54. data/lib/jeweler/templates/other_tasks.erb +27 -59
  55. data/lib/jeweler/templates/riot/helper.rb +1 -0
  56. data/lib/jeweler/templates/rspec/helper.rb +5 -5
  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/lib/jeweler.rb +9 -7
  64. data/test/fixtures/existing-project-with-version-constant/Rakefile +4 -2
  65. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +4 -2
  66. data/test/fixtures/existing-project-with-version-yaml/Rakefile +4 -2
  67. data/test/jeweler/commands/test_install_gem.rb +2 -2
  68. data/test/jeweler/commands/test_release_to_gemcutter.rb +4 -4
  69. data/test/jeweler/commands/test_release_to_git.rb +32 -25
  70. data/test/jeweler/commands/test_release_to_github.rb +115 -32
  71. data/test/jeweler/generator/test_options.rb +16 -22
  72. data/test/jeweler/test_generator.rb +6 -1
  73. data/test/jeweler/test_specification.rb +24 -11
  74. data/test/jeweler/test_tasks.rb +1 -1
  75. data/test/test_helper.rb +12 -14
  76. data/test/test_jeweler.rb +3 -15
  77. metadata +217 -76
  78. data/.gitignore +0 -10
  79. data/VERSION.yml +0 -5
  80. data/lib/jeweler/commands/release_to_rubyforge.rb +0 -52
  81. data/lib/jeweler/commands/setup_rubyforge.rb +0 -63
  82. data/test/jeweler/commands/test_release_to_rubyforge.rb +0 -153
  83. data/test/jeweler/commands/test_setup_rubyforge.rb +0 -178
  84. /data/{LICENSE → LICENSE.txt} +0 -0
  85. /data/lib/jeweler/templates/rspec/{spec.opts → .rspec} +0 -0
  86. /data/test/fixtures/existing-project-with-version-constant/{LICENSE → LICENSE.txt} +0 -0
  87. /data/test/fixtures/existing-project-with-version-plaintext/{LICENSE → LICENSE.txt} +0 -0
  88. /data/test/fixtures/existing-project-with-version-yaml/{LICENSE → LICENSE.txt} +0 -0
data/.document ADDED
@@ -0,0 +1,8 @@
1
+ lib/jeweler.rb
2
+ lib/jeweler/*.rb
3
+ lib/jeweler/commands/*.rb
4
+ lib/jeweler/generator/*.rb
5
+ bin/*
6
+ -
7
+ features/**/*.feature
8
+ LICENSE.txt
data/ChangeLog.markdown CHANGED
@@ -8,12 +8,12 @@
8
8
  * `rake install` should correctly figure out which `gem` binary to invoke now
9
9
  * `rake build` now will regenerate the gemspec as well
10
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`
11
+ * `rake gemspec` now automatically populates gemspec.extensions with any extconf.rb files you have in `ext`
12
12
  * Releasing to Rubyforge is now deprecated in favor of Gemcutter.
13
13
 
14
14
  # jeweler 1.3.0
15
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.
16
+ * Now supports an additional version type, build. This can be used to add a fourth segment of the version that's arbitrary. One example use is having prereleases.
17
17
  * Jeweler now lazily loads, to avoid causing side-effects when running other rake tasks
18
18
  * Version can now be set explicitly on the gemspec, rather than relying on a VERSION file
19
19
  * Rubyforge and Gemcutter support now hooks into `rake release`
@@ -21,7 +21,7 @@
21
21
  * Rubyforge support no longer forces the uploading of documentation
22
22
  * Generator:
23
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/
24
+ * Support for the riot testing framework: http://github.com/thumblemonks/riot/
25
25
  * Support for test/spec
26
26
  * .gitignore now ignores emacs temporary files
27
27
  * rspec support now creates a spec.opts with support for color and other stuff
@@ -76,7 +76,7 @@
76
76
  * Managing a gemspec's files, test_files, and extra_rdoc_files is now more flexible. They are now wrapped in a FileList, so you can easily 'include' or 'exclude' patterns.
77
77
 
78
78
  # jeweler 0.10.2 2009-03-26
79
-
79
+
80
80
  * 'rake install' now will 'rake build' first
81
81
  * Support for releasing to RubyForge, thanks to jtrupiano
82
82
  * Steps towards Ruby 1.9 support, thanks to rsanheim
@@ -85,19 +85,19 @@
85
85
 
86
86
  * Tasks:
87
87
  * Fixed populating default spec's extra_rdoc_files
88
- * Removed redudant gem building/installing tasks. Use rake build and rake install
88
+ * Removed redundant gem building/installing tasks. Use rake build and rake install
89
89
  * Generator:
90
90
  * Added support for micronaut
91
91
  * Generate nicer block variable names in Rakefile
92
92
  * Cucumber generation now places steps in features/step_features, to follow cucumber standards
93
93
 
94
- * shoulda and test/unit test_helpers no longers require mocha
94
+ * shoulda and test/unit test_helpers no longer require mocha
95
95
  * Rakefile uses more readable block variable names
96
96
  * .gitignore now includes pkg and coverage directories
97
97
  * Avoid puts'ing in Rakefile when LoadError occurs. Instead, define a task that aborts with instructions to install.
98
98
  * Cucumber is now optional. Generate stories using --cucumber
99
99
  * Bacon's 'test' task is now 'spec'
100
- * Generate README.rdoc instead of just a plain text README
100
+ * Generate README.rdoc instead of just a plain text README
101
101
  * Updated year in README.rdoc and COPYRIGHT to be based on the current year instead of hardcoded
102
102
 
103
103
  # jeweler 0.8.1 2009-02-03
@@ -114,7 +114,7 @@
114
114
  * Added support for cucumber
115
115
  * Creating a new gem is now more verbose, and will show files/directories created
116
116
  * Binaries will now be automatically detected in 'bin'
117
-
117
+
118
118
  # jeweler 0.7.2 2009-01-29
119
119
 
120
120
  * Added rake task 'version:bump' which is shorthand for 'version:bump:patch'
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "http://rubygems.org"
2
+ source "http://gems.github.com"
3
+
4
+ gem "rake"
5
+ gem "git", ">= 1.2.5"
6
+ gem "bundler", "~> 1.0.0"
7
+
8
+ group :development do
9
+ gem "shoulda"
10
+ gem "mhennemeyer-output_catcher"
11
+ gem "rr"
12
+ gem "mocha"
13
+ gem "redgreen"
14
+ gem "test-construct"
15
+ gem "yard", "~> 0.6.0"
16
+ gem "bluecloth"
17
+ gem "cucumber"
18
+ gem "rcov"
19
+ gem "timecop"
20
+ gem "activesupport", "~> 2.3.5"
21
+ gem (RUBY_VERSION =~ /^1\.9/ ? "ruby-debug19" : "ruby-debug")
22
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ remote: http://gems.github.com/
4
+ specs:
5
+ activesupport (2.3.8)
6
+ bluecloth (2.0.7)
7
+ builder (2.1.2)
8
+ columnize (0.3.1)
9
+ cucumber (0.8.5)
10
+ builder (~> 2.1.2)
11
+ diff-lcs (~> 1.1.2)
12
+ gherkin (~> 2.1.4)
13
+ json_pure (~> 1.4.3)
14
+ term-ansicolor (~> 1.0.4)
15
+ diff-lcs (1.1.2)
16
+ gherkin (2.1.5)
17
+ trollop (~> 1.16.2)
18
+ git (1.2.5)
19
+ json_pure (1.4.6)
20
+ linecache (0.43)
21
+ mhennemeyer-output_catcher (1.0.1)
22
+ mocha (0.9.8)
23
+ rake
24
+ rake (0.8.7)
25
+ rcov (0.9.8)
26
+ redgreen (1.2.2)
27
+ rr (0.10.11)
28
+ ruby-debug (0.10.3)
29
+ columnize (>= 0.1)
30
+ ruby-debug-base (~> 0.10.3.0)
31
+ ruby-debug-base (0.10.3)
32
+ linecache (>= 0.3)
33
+ shoulda (2.11.3)
34
+ term-ansicolor (1.0.5)
35
+ test-construct (1.2.0)
36
+ timecop (0.3.5)
37
+ trollop (1.16.2)
38
+ yard (0.6.1)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ activesupport (~> 2.3.5)
45
+ bluecloth
46
+ bundler (~> 1.0.0)
47
+ cucumber
48
+ git (>= 1.2.5)
49
+ mhennemeyer-output_catcher
50
+ mocha
51
+ rake
52
+ rcov
53
+ redgreen
54
+ rr
55
+ ruby-debug
56
+ shoulda
57
+ test-construct
58
+ timecop
59
+ yard (~> 0.6.0)
data/README.markdown CHANGED
@@ -1,208 +1,215 @@
1
1
  # Jeweler: Craft the perfect RubyGem
2
2
 
3
- Jeweler provides two things:
3
+ Jeweler provides the noble ruby developer with two primary features:
4
4
 
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
5
+ * a library for managing and releasing RubyGem projects
6
+ * a scaffold generator for starting new RubyGem projects
7
7
 
8
- ## Quick Links
8
+ ## Hello, world
9
9
 
10
- * [Wiki](http://wiki.github.com/technicalpickles/jeweler)
11
- * [Mailing List](http://groups.google.com/group/jeweler-rb)
12
- * [Bugs](http://github.com/technicalpickles/jeweler/issues)
13
- * [Donate](http://pledgie.org/campaigns/2604)
10
+ Use RubyGems to install the heck out of jeweler to get started:
14
11
 
15
- ## Installing
12
+ $ gem install jeweler
16
13
 
17
- # Install the gem:
18
- sudo gem install jeweler
14
+ With jeweler installed, you can use the `jeweler` command to generate a new project. For the most basic use, just give it a name:
19
15
 
20
- ## Using in an existing project
16
+ $ jeweler hello-gem
21
17
 
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.
18
+ This requires some Git configuration (like name, email, GitHub account, etc), but `jeweler` will prompt along the way.
23
19
 
24
- begin
25
- require 'jeweler'
26
- Jeweler::Tasks.new do |gemspec|
27
- gemspec.name = "the-perfect-gem"
28
- gemspec.summary = "One line summary of your gem"
29
- gemspec.description = "A different and possibly longer explanation of"
30
- gemspec.email = "josh@technicalpickles.com"
31
- gemspec.homepage = "http://github.com/technicalpickles/the-perfect-gem"
32
- gemspec.authors = ["Josh Nichols"]
33
- end
34
- rescue LoadError
35
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
36
- end
20
+ Your new `hello-gem` gem is ready in the `hello-gem` directory. Take a peek, and you'll see several files and directories
37
21
 
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.
22
+ * `Rakefile` setup for jeweler, running tests, generating documentation, and releasing to [rubygems.org](http://rubygems.org/)
23
+ * `README.rdoc` with contribution guidelines and copyright info crediting you
24
+ * `LICENSE` with the MIT licensed crediting you
25
+ * `Gemfile` with development dependencies filled in
26
+ * `lib/hello-gem.rb` waiting for you to code
27
+ * `test/` containing a (failing) shoulda test suite [shoulda](http://github.com/thoughtbot/shoulda)
39
28
 
40
- ## Using to start a new project
41
29
 
42
- Jeweler provides a generator. It requires you to [setup your name and email for git](http://help.github.com/git-email-settings/) and [your username and token for GitHub](http://github.com/guides/local-github-config).
30
+ ### More `jeweler` options
43
31
 
44
- jeweler the-perfect-gem
32
+ The `jeweler` command supports a lot of options. Mostly, they are for generating baked in support for this test framework, or that.
45
33
 
46
- This will prepare a project in the 'the-perfect-gem' directory, setup to use Jeweler.
34
+ Check out `jeweler --help` for the most up to date options.
47
35
 
48
- It supports a number of options. Here's a taste, but `jeweler --help` will give you the most up-to-date listing:
36
+ ## Hello, rake tasks
49
37
 
50
- * --create-repo: in addition to preparing a project, it create an repo up on GitHub and enable RubyGem generation
51
- * --testunit: generate test_helper.rb and test ready for test/unit
52
- * --minitest: generate test_helper.rb and test ready for minitest
53
- * --shoulda: generate test_helper.rb and test ready for shoulda (this is the default)
54
- * --rspec: generate spec_helper.rb and spec ready for rspec
55
- * --bacon: generate spec_helper.rb and spec ready for bacon
56
- * --gemcutter: setup releasing to gemcutter
57
- * --rubyforge: setup releasing to rubyforge
38
+ Beyond just editing source code, you'll be interacting with your gem using `rake` a lot. To see all the tasks available with a brief description, you can run:
58
39
 
59
- ### Default options
40
+ $ rake -T
60
41
 
61
- Jeweler respects the JEWELER_OPTS environment variable. Want to always use RSpec, and you're using bash? Add this to ~/.bashrc:
42
+ You'll need a version before you can start installing your gem locally. The easiest way is with the `version:write` Rake task. Let's imagine you start with 0.1.0
62
43
 
63
- export JEWELER_OPTS="--rspec"
44
+ $ rake version:write MAJOR=0 MINOR=1 PATCH=0
64
45
 
65
- ## Gemspec
46
+ You can now go forth and develop, now that there's an initial version defined. Eventually, you should install and test the gem:
66
47
 
67
- Jeweler handles generating a gemspec file for your project:
48
+ $ rake install
68
49
 
69
- rake gemspec
50
+ The `install` rake task builds the gem and `gem install`s it. You're all set if you're using [RVM](http://rvm.beginrescueend.com/), but you may need to run it with sudo if you have a system-installed ruby:
70
51
 
71
- This creates a gemspec for your project. It's based on the info you give `Jeweler::Tasks`, the current version of your project, and some defaults that Jeweler provides.
52
+ $ sudo rake install
72
53
 
73
- ## Gem
54
+ ### Releasing
74
55
 
75
- Jeweler gives you tasks for building and installing your gem.
56
+ At last, it's time to [ship it](http://img.skitch.com/20100310-nrgxbwqm58tibiq2un6mujqmm5.png)! Make sure you have everything committed and pushed, then go wild:
76
57
 
77
- rake install
58
+ $ rake release
78
59
 
79
- To build the gem (which will end up in `pkg`), run:
60
+ This will automatically:
80
61
 
81
- rake build
62
+ * Generate `hello-gem.gemspec` and commit it
63
+ * Use `git` to tag `v0.1.0` and push it
64
+ * Build `hello-gem-0.1.0.gem` and push it to [rubygems.org](http://rubygems.org/gems/)
82
65
 
83
- To install the gem (and build if necessary), i.e. using gem install, run:
66
+ ### Version bumping
84
67
 
85
- rake install
68
+ It feels good to release code. Do it, do it often. But before that, bump the version. Then release it. There's a few ways to update the version:
86
69
 
87
- Note, this does not use `sudo` to install it, so if your ruby setup needs that, you should prefix it with sudo:
70
+ # version:write like before
71
+ $ rake version:write MAJOR=0 MINOR=3 PATCH=0
88
72
 
89
- sudo rake install
73
+ # bump just major, ie 0.1.0 -> 1.0.0
74
+ $ rake version:bump:major
90
75
 
91
- ## Versioning
76
+ # bump just minor, ie 0.1.0 -> 0.2.0
77
+ $ rake version:bump:minor
92
78
 
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.
79
+ # bump just patch, ie 0.1.0 -> 0.1.1
80
+ $ rake version:bump:patch
94
81
 
95
- Initially, your project starts out at 0.0.0. Jeweler provides Rake tasks for bumping the version:
82
+ Then it's the same `release` we used before:
96
83
 
97
- rake version:bump:major
98
- rake version:bump:minor
99
- rake version:bump:patch
84
+ $ rake release
100
85
 
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.
86
+ ## Customizing your gem
102
87
 
103
- require File.dirname(__FILE__) + "/lib/my_project/version.rb"
88
+ If you've been following along so far, your gem is just a blank slate. You're going to need to make it colorful and full of metadata.
104
89
 
105
- Jeweler::Tasks.new do |gemspec|
106
- gemspec.version = MyProject::VERSION
107
- # more stuff
90
+ You can customize your gem by updating your `Rakefile`. With a newly generated project, it will look something like this:
91
+
92
+ require 'jeweler'
93
+ Jeweler::Tasks.new do |gem|
94
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
95
+ gem.name = "whatwhatwhat"
96
+ gem.summary = %Q{TODO: one-line summary of your gem}
97
+ gem.description = %Q{TODO: longer description of your gem}
98
+ gem.email = "josh@technicalpickles.com"
99
+ gem.homepage = "http://github.com/technicalpickles/whatwhatwhat"
100
+ gem.authors = ["Joshua Nichols"]
108
101
  end
109
102
 
110
- ### Prerelease versioning
103
+ It's crucial to understand the `gem` object is just a Gem::Specification. You can read up about it at [docs.rubygems.org/read/chapter/20](http://docs.rubygems.org/read/chapter/20). This is the most basic way of specifying a gem, Jeweler-managed or not. Jeweler just exposes this to you, in addition to providing some reasonable defaults, which we'll explore now.
111
104
 
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.
105
+ ### Project information
113
106
 
114
- You have two ways of doing this:
107
+ gem.name = "whatwhatwhat"
115
108
 
116
- * Use `version:write` and specify `BUILD=pre1`
117
- * Edit VERSION by hand to add a fourth version segment
109
+ Every gem has a name. Among other things, the gem name is how you are able to `gem install` it. [Reference](http://docs.rubygems.org/read/chapter/20#name)
118
110
 
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.
111
+ gem.summary = %Q{TODO: longer description of your gem}
120
112
 
121
- ## Releasing
113
+ This is a one line summary of your gem. This is displayed, for example, when you use `gem list --details` or view it on [rubygems.org](http://rubygems.org/gems/).
122
114
 
123
- Jeweler handles releasing your gem into the wild:
115
+ gem.description = %Q{TODO: longer description of your gem}
124
116
 
125
- rake release
117
+ Description is a longer description. Scholars ascertain that knowledge of where the description is used was lost centuries ago.
126
118
 
127
- It does the following for you:
119
+ gem.email = "josh@technicalpickles.com"
128
120
 
129
- * Regenerate the gemspec to the latest version of your project
130
- * git pushes to origin/master branch
131
- * git tags the version and pushes to the origin remote
121
+ This should be a way to get a hold of you regarding the gem.
132
122
 
133
- As is though, it doesn't actually get your gem anywhere. To do that, you'll need to use rubyforge or gemcutter.
123
+ gem.homepage = "http://github.com/technicalpickles/whatwhatwhat"
134
124
 
135
- ### Releasing to Gemcutter
125
+ The homepage should have more information about your gem. The jeweler generator guesses this based on the assumption your code lives on [GitHub](http://github.com/), using your Git configuration to find your GitHub username. This is displayed by `gem list --details` and on rubygems.org.
136
126
 
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:
127
+ gem.authors = ["Joshua Nichols"]
138
128
 
139
- * [Create an account on Gemcutter](http://gemcutter.org/sign_up)
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
142
- * Update your Rakefile to make an instance of `Jeweler::GemcutterTasks`
129
+ Hey, this is you, the author (or me in this case). The `jeweler` generator also guesses this from your Git configuration. This is displayed by `gem list --details` and on rubygems.org.
143
130
 
131
+ ### Files
144
132
 
145
- A Rakefile setup for gemcutter would include something like this:
133
+ The quickest way to add more files is to `git add` them. Jeweler uses your Git repository to populate your gem's files by including added and committed and excluding `.gitignore`d. In most cases, this is reasonable enough.
146
134
 
147
- begin
148
- require 'jeweler'
149
- Jeweler::Tasks.new do |gemspec|
150
- # omitted for brevity
151
- end
152
- Jeweler::GemcutterTasks.new
153
- rescue LoadError
154
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
155
- end
135
+ If you need to tweak the files, that's cool. Jeweler populates `gem.files` as a `Rake::FileList`. It's like a normal array, except you can `include` and `exclude` file globs:
156
136
 
137
+ gem.files.exclude 'tmp' # exclude temporary directory
138
+ gem.files.include 'lib/foo/bar.rb' # explicitly include lib/foo/bar.rb
157
139
 
158
- After you have configured this, `rake release` will now also release to Gemcutter.
140
+ If that's not enough, you can just set `gem.files` outright
159
141
 
160
- If you need to release it without the rest of the release task, you can run:
142
+ gem.files = Dir.glob('lib/**/*.rb')
161
143
 
162
- $ rake gemcutter:release
144
+ ### Dependencies
163
145
 
164
- ### Releasing to RubyForge
146
+ Dependencies let you define other gems that your gem needs to function. `gem install your-gem` will install your-gem's dependencies along with it, and when you use your-gem in an application, the dependencies will be made available. Use `gem.add_dependency` to register them. [Reference](http://docs.rubygems.org/read/chapter/20#dependencies)
165
147
 
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:
148
+ gem.add_dependency 'nokogiri'
167
149
 
168
- * [Create an account on RubyForge](http://rubyforge.org/account/register.php)
169
- * Request a project on RubyForge.
170
- * Install the RubyForge gem: sudo gem install rubyforge
171
- * Run 'rubyforge setup' and fill in your username and password for RubyForge
172
- * Run 'rubyforge config' to pull down information about your projects
173
- * Run 'rubyforge login' to make sure you are able to login
174
- * In Jeweler::Tasks, you must set `rubyforge_project` to the project you just created
175
- * Add Jeweler::RubyforgeTasks to bring in the appropriate tasks.
176
- * Note, using `jeweler --rubyforge` when generating the project does this for you automatically.
150
+ This will ensure a version of `nokogiri` is installed, but it doesn't require anything more than that. You can provide extra args to be more specific:
177
151
 
178
- A Rakefile setup for rubyforge would include something like this:
152
+ gem.add_dependency 'nokogiri', '= 1.2.1' # exactly version 1.2.1
153
+ gem.add_dependency 'nokogiri', '>= 1.2.1' # greater than or equal to 1.2.1, ie, 1.2.1, 1.2.2, 1.3.0, 2.0.0, etc
154
+ gem.add_dependency 'nokogiri', '>= 1.2.1', '< 1.3.0' # greater than or equal to 1.2.1, but less than 1.3.0
155
+ gem.add_dependency 'nokogiri', '~> 1.2.1' # same thing, but more concise
179
156
 
180
- begin
181
- require 'jeweler'
182
- Jeweler::Tasks.new do |gemspec|
183
- # ommitted for brevity
184
- gemspec.rubyforge_project = 'the-perfect-gem' # This line would be new
185
- end
157
+ When specifying which version is required, there's a bit of the condunrum. You want to allow the most versions possible, but you want to be sure they are compatible. Using `>= 1.2.1` is fine most of the time, except until the point that 2.0.0 comes out and totally breaks backwards the API. That's when it's good to use `~> 1.2.1`, which requires any version in the `1.2` family, starting with `1.2.1`.
158
+
159
+ ### Executables
160
+
161
+ Executables let your gem install shell commands. Just put any executable scripts in the `bin/` directory, make sure they are added using `git`, and Jeweler will take care of the rest.
186
162
 
187
- Jeweler::RubyforgeTasks.new do |rubyforge|
188
- rubyforge.doc_task = "rdoc"
163
+ When you need more finely grained control over it, you can set it yourself:
164
+
165
+ gem.executables = ['foo'] # note, it's the file name relative to `bin/`, not the project root
166
+
167
+ ### Versioning
168
+
169
+ We discussed earlier how to bump the version. The rake tasks are really just convience methods for manipulating the `VERSION` file. It just contains a version string, like `1.2.3`.
170
+
171
+ `VERSION` is a convention used by Jeweler, and is used to populate `gem.version`. You can actually set this yourself, and Jeweler won't try to override it:
172
+
173
+ gem.version = '1.2.3'
174
+
175
+ A common pattern is to have this in a version constant in your library. This is convenient, because users of the library can query the version they are using at runtime.
176
+
177
+ # in lib/foo/version.rb
178
+ class Foo
179
+ module Version
180
+ MAJOR = 1
181
+ MINOR = 2
182
+ PATCH = 3
183
+ BUILD = 'pre3'
184
+
185
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
189
186
  end
190
- rescue LoadError
191
- puts "Jeweler, or a dependency, not available. Install it with: sudo gem install jeweler"
192
187
  end
193
188
 
194
- Now you must initially create a 'package' for your gem in your RubyForge 'project':
189
+ # in Rakefile
190
+ require 'jeweler'
191
+ require './lib/foo/version.rb'
192
+ Jeweler::Tasks.new do |gem|
193
+ # snip
194
+ gem.version = Foo::Version::STRING
195
+ end
195
196
 
196
- $ rake rubyforge:setup
197
+ ### Rake tasks
197
198
 
198
- After you have configured this, `rake release` will now also release to RubyForge.
199
+ Jeweler lives inside of Rake. As a result, they are dear friends. But, that friendship doesn't interfere with typical Rake operations.
199
200
 
200
- If you need to release it without the rest of the release task, you can run:
201
+ That means you can define your own namespaces, tasks, or use third party Rake libraries without cause for concern.
202
+
203
+ ## Contributing to Jeweler
201
204
 
202
- $ rake rubyforge:release
205
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
206
+ * Check out the [issue tracker](http://github.com/technicalpickles/jeweler/issues) to make sure someone already hasn't requested it and/or contributed it
207
+ * Fork the project
208
+ * Start a feature/bugfix branch
209
+ * Commit and push until you are happy with your contribution
210
+ * Make sure to add tests for the feature/bugfix. This is important so I don't break it in a future version unintentionally.
211
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate it to its own commit so I can cherry-pick around it.
203
212
 
204
- ## Development and Release Workflow
213
+ ## Copyright
205
214
 
206
- * Hack, commit, hack, commit, etc, etc
207
- * `rake version:bump:patch release` to do the actual version bump and release
208
- * Have a delicious beverage (I suggest scotch)
215
+ Copyright (c) 2008-2010 Josh Nichols. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,40 +1,34 @@
1
- require 'rake'
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
2
11
 
3
12
  $LOAD_PATH.unshift('lib')
4
13
 
14
+ require 'rake'
5
15
  require 'jeweler'
16
+
6
17
  Jeweler::Tasks.new do |gem|
7
18
  gem.name = "jeweler"
8
- gem.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
9
- gem.email = "josh@technicalpickles.com"
19
+ gem.version = Jeweler::Version::STRING
10
20
  gem.homepage = "http://github.com/technicalpickles/jeweler"
21
+ gem.summary = "Opinionated tool for creating and managing RubyGem projects"
11
22
  gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
23
+ gem.license = "MIT"
12
24
  gem.authors = ["Josh Nichols"]
25
+ gem.email = "josh@technicalpickles.com"
13
26
  gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
14
27
 
15
- gem.add_dependency "git", ">= 1.2.5"
16
- gem.add_dependency "rubyforge", ">= 2.0.0"
17
- gem.add_dependency "gemcutter", ">= 0.1.0"
18
-
19
- gem.rubyforge_project = "pickles"
20
-
21
- gem.add_development_dependency "thoughtbot-shoulda"
22
- gem.add_development_dependency "mhennemeyer-output_catcher"
23
- gem.add_development_dependency "rr"
24
- gem.add_development_dependency "mocha"
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"
30
- end
31
-
32
- Jeweler::GemcutterTasks.new
33
-
34
- Jeweler::RubyforgeTasks.new do |t|
35
- t.doc_task = :yardoc
28
+ # dependencies defined in Gemfile
36
29
  end
37
30
 
31
+ Jeweler::RubygemsDotOrgTasks.new
38
32
 
39
33
  require 'rake/testtask'
40
34
  Rake::TestTask.new(:test) do |test|
@@ -45,41 +39,35 @@ Rake::TestTask.new(:test) do |test|
45
39
  test.verbose = true
46
40
  end
47
41
 
48
- begin
49
- require 'yard'
50
- YARD::Rake::YardocTask.new(:yardoc) do |t|
51
- t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb')
42
+ namespace :test do
43
+ task :gemspec_dup do
44
+ gemspec = Rake.application.jeweler.gemspec
45
+ dupped_gemspec = gemspec.dup
46
+ cloned_gemspec = gemspec.clone
47
+ puts gemspec.to_ruby
48
+ puts dupped_gemspec.to_ruby
52
49
  end
53
- rescue LoadError
54
- task :yardoc => :check_dependencies
55
50
  end
56
51
 
52
+ require 'yard'
53
+ YARD::Rake::YardocTask.new do |t|
54
+ t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb')
55
+ end
57
56
 
58
- begin
59
- require 'rcov/rcovtask'
60
- Rcov::RcovTask.new(:rcov => :check_dependencies) do |rcov|
61
- rcov.libs << 'test'
62
- rcov.pattern = 'test/**/test_*.rb'
63
- end
64
- rescue
65
- task :rcov => :check_dependencies
57
+ require 'rcov/rcovtask'
58
+ Rcov::RcovTask.new(:rcov => :check_dependencies) do |rcov|
59
+ rcov.libs << 'test'
60
+ rcov.pattern = 'test/**/test_*.rb'
66
61
  end
67
62
 
68
- begin
69
- require 'cucumber/rake/task'
70
- Cucumber::Rake::Task.new(:features) do |features|
63
+ require 'cucumber/rake/task'
64
+ Cucumber::Rake::Task.new(:features) do |features|
65
+ features.cucumber_opts = "features --format progress"
66
+ end
67
+ namespace :features do
68
+ Cucumber::Rake::Task.new(:pretty) do |features|
71
69
  features.cucumber_opts = "features --format progress"
72
70
  end
73
- namespace :features do
74
- Cucumber::Rake::Task.new(:pretty) do |features|
75
- features.cucumber_opts = "features --format progress"
76
- end
77
- end
78
- rescue LoadError
79
- task :features => :check_dependencies
80
- namespace :features do
81
- task :pretty => :check_dependencies
82
- end
83
71
  end
84
72
 
85
73
  if ENV["RUN_CODE_RUN"] == "true"
@@ -88,6 +76,3 @@ else
88
76
  task :default => :test
89
77
  end
90
78
 
91
-
92
- task :test => :check_dependencies
93
- task :features => :check_dependencies