jeweler2 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/.document +8 -0
  2. data/ChangeLog.markdown +177 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +47 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.markdown +217 -0
  7. data/Rakefile +80 -0
  8. data/bin/jeweler +5 -0
  9. data/features/generator/cucumber.feature +103 -0
  10. data/features/generator/directory_layout.feature +86 -0
  11. data/features/generator/dotdocument.feature +13 -0
  12. data/features/generator/env_options.feature +9 -0
  13. data/features/generator/gemfile.feature +71 -0
  14. data/features/generator/git.feature +102 -0
  15. data/features/generator/license.feature +20 -0
  16. data/features/generator/rakefile.feature +158 -0
  17. data/features/generator/readme.feature +12 -0
  18. data/features/generator/test.feature +54 -0
  19. data/features/generator/test_helper.feature +149 -0
  20. data/features/placeholder.feature +5 -0
  21. data/features/step_definitions/debug_steps.rb +6 -0
  22. data/features/step_definitions/filesystem_steps.rb +70 -0
  23. data/features/step_definitions/generator_steps.rb +380 -0
  24. data/features/step_definitions/task_steps.rb +6 -0
  25. data/features/support/env.rb +42 -0
  26. data/features/tasks/build_gem.feature +9 -0
  27. data/features/tasks/version.feature +31 -0
  28. data/features/tasks/version_bumping.feature +49 -0
  29. data/jeweler.gemspec +245 -0
  30. data/jeweler2.gemspec +233 -0
  31. data/lib/jeweler/commands/build_gem.rb +36 -0
  32. data/lib/jeweler/commands/check_dependencies.rb +66 -0
  33. data/lib/jeweler/commands/install_gem.rb +31 -0
  34. data/lib/jeweler/commands/release_gemspec.rb +82 -0
  35. data/lib/jeweler/commands/release_to_git.rb +59 -0
  36. data/lib/jeweler/commands/release_to_rubygems.rb +28 -0
  37. data/lib/jeweler/commands/validate_gemspec.rb +30 -0
  38. data/lib/jeweler/commands/version/base.rb +55 -0
  39. data/lib/jeweler/commands/version/bump_major.rb +13 -0
  40. data/lib/jeweler/commands/version/bump_minor.rb +12 -0
  41. data/lib/jeweler/commands/version/bump_patch.rb +14 -0
  42. data/lib/jeweler/commands/version/write.rb +12 -0
  43. data/lib/jeweler/commands/write_gemspec.rb +39 -0
  44. data/lib/jeweler/commands.rb +20 -0
  45. data/lib/jeweler/errors.rb +8 -0
  46. data/lib/jeweler/gemcutter_tasks.rb +8 -0
  47. data/lib/jeweler/gemspec_helper.rb +87 -0
  48. data/lib/jeweler/generator/application.rb +61 -0
  49. data/lib/jeweler/generator/bacon_mixin.rb +43 -0
  50. data/lib/jeweler/generator/github_mixin.rb +29 -0
  51. data/lib/jeweler/generator/micronaut_mixin.rb +41 -0
  52. data/lib/jeweler/generator/minitest_mixin.rb +42 -0
  53. data/lib/jeweler/generator/options.rb +163 -0
  54. data/lib/jeweler/generator/rdoc_mixin.rb +9 -0
  55. data/lib/jeweler/generator/riot_mixin.rb +42 -0
  56. data/lib/jeweler/generator/rspec_mixin.rb +42 -0
  57. data/lib/jeweler/generator/shindo_mixin.rb +44 -0
  58. data/lib/jeweler/generator/shoulda_mixin.rb +42 -0
  59. data/lib/jeweler/generator/testspec_mixin.rb +42 -0
  60. data/lib/jeweler/generator/testunit_mixin.rb +39 -0
  61. data/lib/jeweler/generator/yard_mixin.rb +14 -0
  62. data/lib/jeweler/generator.rb +295 -0
  63. data/lib/jeweler/rubyforge_tasks.rb +95 -0
  64. data/lib/jeweler/rubygems_dot_org_tasks.rb +38 -0
  65. data/lib/jeweler/rubygems_tasks.rb +38 -0
  66. data/lib/jeweler/specification.rb +110 -0
  67. data/lib/jeweler/tasks.rb +224 -0
  68. data/lib/jeweler/templates/.document +5 -0
  69. data/lib/jeweler/templates/.gitignore +48 -0
  70. data/lib/jeweler/templates/Gemfile +12 -0
  71. data/lib/jeweler/templates/LICENSE.txt +20 -0
  72. data/lib/jeweler/templates/README.rdoc +19 -0
  73. data/lib/jeweler/templates/Rakefile +9 -0
  74. data/lib/jeweler/templates/bacon/flunking.rb +7 -0
  75. data/lib/jeweler/templates/bacon/helper.rb +9 -0
  76. data/lib/jeweler/templates/bundler_setup.erb +10 -0
  77. data/lib/jeweler/templates/features/default.feature +9 -0
  78. data/lib/jeweler/templates/features/support/env.rb +10 -0
  79. data/lib/jeweler/templates/jeweler_tasks.erb +31 -0
  80. data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
  81. data/lib/jeweler/templates/micronaut/helper.rb +18 -0
  82. data/lib/jeweler/templates/minitest/flunking.rb +7 -0
  83. data/lib/jeweler/templates/minitest/helper.rb +12 -0
  84. data/lib/jeweler/templates/other_tasks.erb +86 -0
  85. data/lib/jeweler/templates/riot/flunking.rb +11 -0
  86. data/lib/jeweler/templates/riot/helper.rb +4 -0
  87. data/lib/jeweler/templates/rspec/.rspec +1 -0
  88. data/lib/jeweler/templates/rspec/flunking.rb +7 -0
  89. data/lib/jeweler/templates/rspec/helper.rb +12 -0
  90. data/lib/jeweler/templates/shindo/flunking.rb +8 -0
  91. data/lib/jeweler/templates/shindo/helper.rb +6 -0
  92. data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
  93. data/lib/jeweler/templates/shoulda/helper.rb +11 -0
  94. data/lib/jeweler/templates/testspec/flunking.rb +7 -0
  95. data/lib/jeweler/templates/testspec/helper.rb +7 -0
  96. data/lib/jeweler/templates/testunit/flunking.rb +7 -0
  97. data/lib/jeweler/templates/testunit/helper.rb +10 -0
  98. data/lib/jeweler/version.rb +10 -0
  99. data/lib/jeweler/version_helper.rb +141 -0
  100. data/lib/jeweler.rb +177 -0
  101. data/test/fixtures/bar/VERSION.yml +4 -0
  102. data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
  103. data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
  104. data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
  105. data/test/fixtures/existing-project-with-version-constant/.document +5 -0
  106. data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
  107. data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
  108. data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
  109. data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
  110. data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
  111. data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
  112. data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
  113. data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
  114. data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
  115. data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
  116. data/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt +20 -0
  117. data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
  118. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
  119. data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
  120. data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
  121. data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
  122. data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
  123. data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
  124. data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
  125. data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
  126. data/test/fixtures/existing-project-with-version-yaml/LICENSE.txt +20 -0
  127. data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
  128. data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
  129. data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
  130. data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
  131. data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
  132. data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
  133. data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
  134. data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
  135. data/test/geminstaller.yml +12 -0
  136. data/test/jeweler/commands/test_build_gem.rb +103 -0
  137. data/test/jeweler/commands/test_install_gem.rb +35 -0
  138. data/test/jeweler/commands/test_release_to_gemcutter.rb +39 -0
  139. data/test/jeweler/commands/test_release_to_git.rb +198 -0
  140. data/test/jeweler/commands/test_release_to_github.rb +390 -0
  141. data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
  142. data/test/jeweler/commands/test_write_gemspec.rb +101 -0
  143. data/test/jeweler/commands/version/test_base.rb +32 -0
  144. data/test/jeweler/commands/version/test_bump_major.rb +22 -0
  145. data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
  146. data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
  147. data/test/jeweler/commands/version/test_write.rb +22 -0
  148. data/test/jeweler/generator/test_application.rb +120 -0
  149. data/test/jeweler/generator/test_options.rb +225 -0
  150. data/test/jeweler/test_gemspec_helper.rb +44 -0
  151. data/test/jeweler/test_generator.rb +141 -0
  152. data/test/jeweler/test_generator_initialization.rb +164 -0
  153. data/test/jeweler/test_generator_mixins.rb +23 -0
  154. data/test/jeweler/test_specification.rb +237 -0
  155. data/test/jeweler/test_tasks.rb +50 -0
  156. data/test/jeweler/test_version_helper.rb +214 -0
  157. data/test/shoulda_macros/jeweler_macros.rb +35 -0
  158. data/test/test_helper.rb +178 -0
  159. data/test/test_jeweler.rb +175 -0
  160. metadata +343 -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
@@ -0,0 +1,177 @@
1
+ # jeweler 1.6.4, 2011-07-07
2
+
3
+ * Generator can now take an path to generate into, rather than just the name of the directory, ie `jeweler /path/to/awesomeness', not `jeweler --directory /path/to awesomeness`. Thanks invadersmustdie! #187
4
+ * Generator's --directory is deprecated and will be removed for 2.0.0
5
+
6
+ # jeweler 1.6.3
7
+
8
+ * Fix typo in Rake tasks, thanks yehezkielbs! #193
9
+ * Fix deprecation warnings for `Gem.activate`, thanks tickmichaeledgar! #191
10
+
11
+ # jeweler 1.6.2
12
+
13
+ * Loosen bundler dependency to work with 1.x #180
14
+
15
+ # jeweler 1.6.1
16
+
17
+ * Fix "undefined method 'sh'" when using rake 0.9.0 #181, #182, #184
18
+
19
+ # jeweler 1.6.0
20
+
21
+ * Fix generated RCov task to exclude gems
22
+ * Generated .gitignore includes example for rubinius and redcar
23
+ * Generated Rakefile includes magic utf-8 comment for better UTF-8 support #20
24
+ * Generated Jeweler::Tasks now correctly documents that dependencies are managed in the Gemfile
25
+ * Workaround issues with ruby 1.9.2 and psych #169
26
+ * No longer deals with `test_files` #178
27
+ * JEWELER_OPTS are overridden by command line flags #178
28
+
29
+ # jeweler 1.5.1
30
+
31
+ * TODO
32
+
33
+ # jeweler 1.5.0
34
+
35
+ * TODO
36
+
37
+ # jeweler 1.4.0 2009-11-19
38
+
39
+ * Generator now adds gemcutter support by default. Disable it with --no-gemcutter
40
+ * 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'
41
+ * Generator now exits with the correct exit code
42
+ * `rake install` no longer uses `sudo` to install. If your ruby configuration needs sudo to install, use `sudo rake install` instead.
43
+ * `rake install` now correctly installs dependencies as well
44
+ * `rake install` should correctly figure out which `gem` binary to invoke now
45
+ * `rake build` now will regenerate the gemspec as well
46
+ * `rake gemspec` now eliminates duplicates for gemspec.files, gemspec.rdoc_files, etc
47
+ * `rake gemspec` now automatically populates gemspec.extensions with any extconf.rb files you have in `ext`
48
+ * Releasing to Rubyforge is now deprecated in favor of Gemcutter.
49
+
50
+ # jeweler 1.3.0
51
+
52
+ * 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.
53
+ * Jeweler now lazily loads, to avoid causing side-effects when running other rake tasks
54
+ * Version can now be set explicitly on the gemspec, rather than relying on a VERSION file
55
+ * Rubyforge and Gemcutter support now hooks into `rake release`
56
+ * `rake build` now uses an in-memory copy of the gemspec, rather than the filesystem persisted one
57
+ * Rubyforge support no longer forces the uploading of documentation
58
+ * Generator:
59
+ * Allow arbitrary homepage and git remotes, to decouple a bit from GitHub
60
+ * Support for the riot testing framework: http://github.com/thumblemonks/riot/
61
+ * Support for test/spec
62
+ * .gitignore now ignores emacs temporary files
63
+ * rspec support now creates a spec.opts with support for color and other stuff
64
+ * Updated minitest support (formally miniunit)
65
+ * Improved support for autotest
66
+
67
+ # jeweler 1.2.0 2009-08-06
68
+ * Generator now adds development dependencies appropriate to your testing framework
69
+ * Added check_dependencies tasks for verifying gem dependencies are installed
70
+ * Fixed typo in generated yard task
71
+ * Fixed generator from having a lot of extra newlines
72
+
73
+ # jeweler 1.1.0 2009-08-05
74
+
75
+ * Support for generating a project that uses yard instead of rdoc
76
+ * Generated gemspec now includes comments about it being generated by jeweler
77
+ * Only use sudo for installing on non-windows platforms [#1]
78
+ * Fixed rake release to be repeatable on the same version [#16]
79
+ * Fixed rake rubyforge:setup to not create duplicate packages
80
+ * Use a more recent version of ruby-git
81
+ * Fixes various issues with reading values out of ~/.gitconfig [#26] [#21] [#19]
82
+ * Experimenting with a rake task to check development time dependencies [#22]
83
+ * Fixed generated rdoc task to load from VERSION instead of VERSION.yml
84
+
85
+ # jeweler 1.0.2 2009-07-29
86
+
87
+ * Don't include git ignored files for default gemspec's files and test_files
88
+ * Fixed rspec generator to allow specs to be run directly
89
+ * Removed misleading docstring for version_required rake task [#17]
90
+ * Includes some notes about contributed in generated README
91
+ * Added support for generating a project to use reek and roodi
92
+
93
+ # jeweler 1.0.1 2009-05-15
94
+
95
+ # jeweler 0.11.1
96
+
97
+ * Lots of internal refactorings to how project generation happens
98
+ * Fixed missing dependency on rubyforge
99
+ * Depend on a recent version of schacon-git which works on ruby 1.9
100
+ * Updated cucumber support for 0.3.x
101
+ * Tested on Ruby 1.9
102
+
103
+ # jeweler 0.11.0 2009-04-05
104
+
105
+ * generator will respect JEWELER_OPTS, as a way to provide default options
106
+ (pat-maddox)
107
+ * Include 'examples' and 'rails' directories by default in gemspec files
108
+ * generated gemspec now will only include files (not directories). also, they are listed one per line, and sorted.
109
+ * Jeweler::Tasks's intializer has been improved:
110
+ * You can now pass it an existing gemspec (othewise a new one will be created)
111
+ * Jeweler sets its defaults before yielding the gemspec to you. This allows you to append to its defaults, so you aren't forced to entirely overwrite them just to add one value.
112
+ * 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.
113
+
114
+ # jeweler 0.10.2 2009-03-26
115
+
116
+ * 'rake install' now will 'rake build' first
117
+ * Support for releasing to RubyForge, thanks to jtrupiano
118
+ * Steps towards Ruby 1.9 support, thanks to rsanheim
119
+
120
+ # jeweler 0.9.1 2009-03-05
121
+
122
+ * Tasks:
123
+ * Fixed populating default spec's extra_rdoc_files
124
+ * Removed redundant gem building/installing tasks. Use rake build and rake install
125
+ * Generator:
126
+ * Added support for micronaut
127
+ * Generate nicer block variable names in Rakefile
128
+ * Cucumber generation now places steps in features/step_features, to follow cucumber standards
129
+
130
+ * shoulda and test/unit test_helpers no longer require mocha
131
+ * Rakefile uses more readable block variable names
132
+ * .gitignore now includes pkg and coverage directories
133
+ * Avoid puts'ing in Rakefile when LoadError occurs. Instead, define a task that aborts with instructions to install.
134
+ * Cucumber is now optional. Generate stories using --cucumber
135
+ * Bacon's 'test' task is now 'spec'
136
+ * Generate README.rdoc instead of just a plain text README
137
+ * Updated year in README.rdoc and COPYRIGHT to be based on the current year instead of hardcoded
138
+
139
+ # jeweler 0.8.1 2009-02-03
140
+
141
+ * Fixed minitest generator
142
+
143
+ # jeweler 0.8.0 2009-02-03
144
+
145
+ * Generator:
146
+ * Supports these new testing frameworks:
147
+ * test/unit
148
+ * minitest
149
+ * rspec
150
+ * Added support for cucumber
151
+ * Creating a new gem is now more verbose, and will show files/directories created
152
+ * Binaries will now be automatically detected in 'bin'
153
+
154
+ # jeweler 0.7.2 2009-01-29
155
+
156
+ * Added rake task 'version:bump' which is shorthand for 'version:bump:patch'
157
+ * Generated projects no longer assume RCov is installed.
158
+
159
+ # jeweler 0.7.1 2009-01-26
160
+
161
+ * Fixed yaml not being required
162
+ * Automatically add files in bin as executables in gemspec
163
+
164
+ # jeweler 0.7.0 2009-01-19
165
+
166
+ * Added support to generator for specifying a description
167
+ * Condensed README.markdown to be less novel-like
168
+ * RDoc is now included in your gemspec
169
+ * Rescue errors that raise in the generator, and display better error message, and exit with a non-zero exit status
170
+
171
+ # jeweler 0.6.5 2009-01-14
172
+
173
+ * `jeweler --create-repo foo` now enables gem creation in addition to creating the repository
174
+
175
+ # jeweler 0.6.4 2009-01-13
176
+
177
+ * Added tasks `build` and `install` as shortcuts for `gem:build` and `gem:install`
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "git", ">= 1.2.5"
4
+
5
+ group :development do
6
+ gem "shoulda"
7
+ #gem "mhennemeyer-output_catcher"
8
+ gem "rr"
9
+ gem "mocha"
10
+ gem "redgreen"
11
+ gem "test-construct"
12
+ gem "yard"
13
+ gem "bluecloth"
14
+ gem "cucumber"
15
+ gem "rcov"
16
+ gem "timecop"
17
+ gem "activesupport", "~> 3"
18
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,47 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.1.1)
5
+ multi_json (~> 1.0)
6
+ bluecloth (2.2.0)
7
+ builder (3.0.0)
8
+ cucumber (1.1.1)
9
+ builder (>= 2.1.2)
10
+ diff-lcs (>= 1.1.2)
11
+ gherkin (~> 2.6.0)
12
+ json (>= 1.4.6)
13
+ term-ansicolor (>= 1.0.6)
14
+ diff-lcs (1.1.3)
15
+ gherkin (2.6.2)
16
+ json (>= 1.4.6)
17
+ git (1.2.5)
18
+ json (1.6.1)
19
+ metaclass (0.0.1)
20
+ mocha (0.10.0)
21
+ metaclass (~> 0.0.1)
22
+ multi_json (1.0.3)
23
+ rcov (0.9.11)
24
+ redgreen (1.2.2)
25
+ rr (1.0.4)
26
+ shoulda (2.11.3)
27
+ term-ansicolor (1.0.7)
28
+ test-construct (1.2.0)
29
+ timecop (0.3.5)
30
+ yard (0.7.3)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ activesupport (~> 3)
37
+ bluecloth
38
+ cucumber
39
+ git (>= 1.2.5)
40
+ mocha
41
+ rcov
42
+ redgreen
43
+ rr
44
+ shoulda
45
+ test-construct
46
+ timecop
47
+ yard
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Josh Nichols
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,217 @@
1
+ # Jeweler: Craft the perfect RubyGem
2
+
3
+ Jeweler provides the noble ruby developer with two primary features:
4
+
5
+ * a library for managing and releasing RubyGem projects
6
+ * a scaffold generator for starting new RubyGem projects
7
+
8
+ ## Hello, world
9
+
10
+ Use RubyGems to install the heck out of jeweler to get started:
11
+
12
+ $ gem install jeweler
13
+
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:
15
+
16
+ $ jeweler hello-gem
17
+
18
+ This requires some Git configuration (like name, email, GitHub account, etc), but `jeweler` will prompt along the way.
19
+
20
+ Your new `hello-gem` gem is ready in the `hello-gem` directory. Take a peek, and you'll see several files and directories
21
+
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)
28
+
29
+
30
+ ### More `jeweler` options
31
+
32
+ The `jeweler` command supports a lot of options. Mostly, they are for generating baked in support for this test framework, or that.
33
+
34
+ Check out `jeweler --help` for the most up to date options.
35
+
36
+ ## Hello, rake tasks
37
+
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:
39
+
40
+ $ rake -T
41
+
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
43
+
44
+ $ rake version:write MAJOR=0 MINOR=1 PATCH=0
45
+
46
+ You can now go forth and develop, now that there's an initial version defined. Eventually, you should install and test the gem:
47
+
48
+ $ rake install
49
+
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:
51
+
52
+ $ sudo rake install
53
+
54
+ ### Releasing
55
+
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:
57
+
58
+ $ rake release
59
+
60
+ This will automatically:
61
+
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/)
65
+
66
+ ### Version bumping
67
+
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:
69
+
70
+ # version:write like before
71
+ $ rake version:write MAJOR=0 MINOR=3 PATCH=0
72
+
73
+ # bump just major, ie 0.1.0 -> 1.0.0
74
+ $ rake version:bump:major
75
+
76
+ # bump just minor, ie 0.1.0 -> 0.2.0
77
+ $ rake version:bump:minor
78
+
79
+ # bump just patch, ie 0.1.0 -> 0.1.1
80
+ $ rake version:bump:patch
81
+
82
+ Then it's the same `release` we used before:
83
+
84
+ $ rake release
85
+
86
+ ## Customizing your gem
87
+
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.
89
+
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"]
101
+ end
102
+ Jeweler::RubygemsDotOrgTasks.new
103
+
104
+ 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.
105
+
106
+ ### Project information
107
+
108
+ gem.name = "whatwhatwhat"
109
+
110
+ 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)
111
+
112
+ gem.summary = %Q{TODO: one-line summary of your gem}
113
+
114
+ 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/).
115
+
116
+ gem.description = %Q{TODO: longer description of your gem}
117
+
118
+ Description is a longer description. Scholars ascertain that knowledge of where the description is used was lost centuries ago.
119
+
120
+ gem.email = "josh@technicalpickles.com"
121
+
122
+ This should be a way to get a hold of you regarding the gem.
123
+
124
+ gem.homepage = "http://github.com/technicalpickles/whatwhatwhat"
125
+
126
+ 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.
127
+
128
+ gem.authors = ["Joshua Nichols"]
129
+
130
+ 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.
131
+
132
+ ### Files
133
+
134
+ 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.
135
+
136
+ 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:
137
+
138
+ gem.files.exclude 'tmp' # exclude temporary directory
139
+ gem.files.include 'lib/foo/bar.rb' # explicitly include lib/foo/bar.rb
140
+
141
+ If that's not enough, you can just set `gem.files` outright
142
+
143
+ gem.files = Dir.glob('lib/**/*.rb')
144
+
145
+ ### Dependencies
146
+
147
+ 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)
148
+
149
+ gem.add_dependency 'nokogiri'
150
+
151
+ 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:
152
+
153
+ gem.add_dependency 'nokogiri', '= 1.2.1' # exactly version 1.2.1
154
+ 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
155
+ gem.add_dependency 'nokogiri', '>= 1.2.1', '< 1.3.0' # greater than or equal to 1.2.1, but less than 1.3.0
156
+ gem.add_dependency 'nokogiri', '~> 1.2.1' # same thing, but more concise
157
+
158
+ 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`.
159
+
160
+ ### Executables
161
+
162
+ 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.
163
+
164
+ When you need more finely grained control over it, you can set it yourself:
165
+
166
+ gem.executables = ['foo'] # note, it's the file name relative to `bin/`, not the project root
167
+
168
+ ### Versioning
169
+
170
+ 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`.
171
+
172
+ `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:
173
+
174
+ gem.version = '1.2.3'
175
+
176
+ 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.
177
+
178
+ # in lib/foo/version.rb
179
+ class Foo
180
+ module Version
181
+ MAJOR = 1
182
+ MINOR = 2
183
+ PATCH = 3
184
+ BUILD = 'pre3'
185
+
186
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
187
+ end
188
+ end
189
+
190
+ # in Rakefile
191
+ require 'jeweler'
192
+ require './lib/foo/version.rb'
193
+ Jeweler::Tasks.new do |gem|
194
+ # snip
195
+ gem.version = Foo::Version::STRING
196
+ end
197
+
198
+ ### Rake tasks
199
+
200
+ Jeweler lives inside of Rake. As a result, they are dear friends. But, that friendship doesn't interfere with typical Rake operations.
201
+
202
+ That means you can define your own namespaces, tasks, or use third party Rake libraries without cause for concern.
203
+
204
+ ## Contributing to Jeweler
205
+
206
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
207
+ * Ask on the [mailing list](http://groups.google.com/group/jeweler-rb) for feedback on your proposal, to see if somebody else has done it.
208
+ * Check out the [issue tracker](http://github.com/technicalpickles/jeweler/issues) to make sure someone already hasn't requested it and/or contributed it
209
+ * Fork the project
210
+ * Start a feature/bugfix branch
211
+ * Commit and push until you are happy with your contribution
212
+ * Make sure to add tests for the feature/bugfix. This is important so I don't break it in a future version unintentionally.
213
+ * 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.
214
+
215
+ ## Copyright
216
+
217
+ Copyright (c) 2008-2010 Josh Nichols. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+
13
+ #$LOAD_PATH.unshift('lib')
14
+
15
+ #require 'rake'
16
+ require_relative 'lib/jeweler'
17
+
18
+ Jeweler::Tasks.new do |gem|
19
+ gem.name = "jeweler2"
20
+ gem.version = Jeweler::Version::STRING
21
+ gem.homepage = "http://github.com/appoxy/jeweler"
22
+ gem.summary = "Opinionated tool for creating and managing RubyGem projects"
23
+ gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
24
+ gem.license = "MIT"
25
+ gem.authors = ["Josh Nichols"]
26
+ gem.email = "josh@technicalpickles.com"
27
+ gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
28
+
29
+ # dependencies defined in Gemfile
30
+ end
31
+
32
+ Jeweler::RubygemsDotOrgTasks.new
33
+
34
+ require 'rake/testtask'
35
+ Rake::TestTask.new(:test) do |test|
36
+ test.test_files = FileList.new('test/**/test_*.rb') do |list|
37
+ list.exclude 'test/test_helper.rb'
38
+ list.exclude 'test/fixtures/**/*.rb'
39
+ end
40
+ test.libs << 'test'
41
+ test.verbose = true
42
+ end
43
+
44
+ namespace :test do
45
+ task :gemspec_dup do
46
+ gemspec = Rake.application.jeweler.gemspec
47
+ dupped_gemspec = gemspec.dup
48
+ cloned_gemspec = gemspec.clone
49
+ puts gemspec.to_ruby
50
+ puts dupped_gemspec.to_ruby
51
+ end
52
+ end
53
+
54
+ require 'yard'
55
+ YARD::Rake::YardocTask.new do |t|
56
+ t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb')
57
+ end
58
+
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
+
65
+ require 'cucumber/rake/task'
66
+ Cucumber::Rake::Task.new(:features) do |features|
67
+ features.cucumber_opts = "features --format progress"
68
+ end
69
+ namespace :features do
70
+ Cucumber::Rake::Task.new(:pretty) do |features|
71
+ features.cucumber_opts = "features --format progress"
72
+ end
73
+ end
74
+
75
+ if ENV["RUN_CODE_RUN"] == "true"
76
+ task :default => [:test, :features]
77
+ else
78
+ task :default => :test
79
+ end
80
+
data/bin/jeweler ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'jeweler/generator'
4
+
5
+ exit Jeweler::Generator::Application.run!(*ARGV)
@@ -0,0 +1,103 @@
1
+ Feature: generating cucumber stories
2
+ In order to get started using cucumber in a project
3
+ A user should be able to
4
+ generate a project setup for their testing framework of choice
5
+
6
+ Scenario: sans cucumber setup
7
+ Given a working directory
8
+ And I have configured git sanely
9
+ And I do not want cucumber stories
10
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
11
+
12
+ And a file named 'the-perfect-gem/features/the-perfect-gem.feature' is not created
13
+ And a file named 'the-perfect-gem/features/support/env.rb' is not created
14
+ And a file named 'the-perfect-gem/features/steps/the-perfect-gem_steps.rb' is not created
15
+
16
+ Scenario: basic cucumber setup
17
+ Given a working directory
18
+ And I have configured git sanely
19
+ And I want cucumber stories
20
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
21
+
22
+ Then cucumber directories are created
23
+
24
+ And a file named 'the-perfect-gem/features/the-perfect-gem.feature' is created
25
+ And a file named 'the-perfect-gem/features/support/env.rb' is created
26
+ And a file named 'the-perfect-gem/features/step_definitions/the-perfect-gem_steps.rb' is created
27
+
28
+ And 'features/support/env.rb' requires 'bundler'
29
+ And 'features/support/env.rb' sets up bundler using the default and development groups
30
+ And 'features/support/env.rb' requires 'the-perfect-gem'
31
+
32
+ Scenario: bundler
33
+ Given a working directory
34
+ And I want bundler
35
+ And I have configured git sanely
36
+ And I want cucumber stories
37
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
38
+ And 'features/support/env.rb' requires 'bundler'
39
+ And 'features/support/env.rb' sets up bundler using the default and development groups
40
+
41
+ Scenario: no bundler
42
+ Given a working directory
43
+ And I have configured git sanely
44
+ And I do not want bundler
45
+ And I want cucumber stories
46
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
47
+ And 'features/support/env.rb' does not require 'bundler'
48
+ And 'features/support/env.rb' does not setup bundler
49
+
50
+ Scenario: cucumber setup for bacon
51
+ Given a working directory
52
+ And I have configured git sanely
53
+ And I want cucumber stories
54
+ When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
55
+
56
+ Then 'features/support/env.rb' requires 'test/unit/assertions'
57
+ And cucumber world extends "Test::Unit::Assertions"
58
+
59
+ Scenario: cucumber setup for shoulda
60
+ Given a working directory
61
+ And I have configured git sanely
62
+ And I want cucumber stories
63
+ When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good'
64
+
65
+ Then 'features/support/env.rb' requires 'test/unit/assertions'
66
+ And cucumber world extends "Test::Unit::Assertions"
67
+
68
+ Scenario: cucumber setup for testunit
69
+ Given a working directory
70
+ And I have configured git sanely
71
+ And I want cucumber stories
72
+ When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
73
+
74
+ Then 'features/support/env.rb' requires 'test/unit/assertions'
75
+ And cucumber world extends "Test::Unit::Assertions"
76
+
77
+ Scenario: cucumber setup for minitest
78
+ Given a working directory
79
+ And I have configured git sanely
80
+ And I want cucumber stories
81
+ When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
82
+
83
+ Then 'features/support/env.rb' requires 'minitest/unit'
84
+ And cucumber world extends "MiniTest::Assertions"
85
+
86
+ Scenario: cucumber setup for rspec
87
+ Given a working directory
88
+ And I have configured git sanely
89
+ And I want cucumber stories
90
+ When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
91
+
92
+ Then 'features/support/env.rb' requires 'the-perfect-gem'
93
+ And 'features/support/env.rb' requires 'rspec/expectations'
94
+
95
+ Scenario: cucumber setup for mirconaut
96
+ Given a working directory
97
+ And I have configured git sanely
98
+ And I want cucumber stories
99
+ When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
100
+
101
+ Then 'features/support/env.rb' requires 'the-perfect-gem'
102
+ And 'features/support/env.rb' requires 'micronaut/expectations'
103
+ And cucumber world extends "Micronaut::Matchers"