cartera-jekyll 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/History.txt +248 -0
  2. data/LICENSE +21 -0
  3. data/README.textile +41 -0
  4. data/Rakefile +159 -0
  5. data/bin/jekyll +178 -0
  6. data/cucumber.yml +1 -0
  7. data/features/create_sites.feature +94 -0
  8. data/features/embed_filters.feature +60 -0
  9. data/features/markdown.feature +30 -0
  10. data/features/pagination.feature +27 -0
  11. data/features/permalinks.feature +65 -0
  12. data/features/post_data.feature +153 -0
  13. data/features/site_configuration.feature +103 -0
  14. data/features/site_data.feature +82 -0
  15. data/features/step_definitions/jekyll_steps.rb +145 -0
  16. data/features/support/env.rb +16 -0
  17. data/jekyll.gemspec +132 -0
  18. data/lib/jekyll.rb +106 -0
  19. data/lib/jekyll/albino.rb +120 -0
  20. data/lib/jekyll/converter.rb +50 -0
  21. data/lib/jekyll/converters/identity.rb +22 -0
  22. data/lib/jekyll/converters/markdown.rb +77 -0
  23. data/lib/jekyll/converters/textile.rb +33 -0
  24. data/lib/jekyll/convertible.rb +82 -0
  25. data/lib/jekyll/core_ext.rb +52 -0
  26. data/lib/jekyll/errors.rb +6 -0
  27. data/lib/jekyll/filters.rb +47 -0
  28. data/lib/jekyll/generator.rb +7 -0
  29. data/lib/jekyll/generators/pagination.rb +87 -0
  30. data/lib/jekyll/layout.rb +36 -0
  31. data/lib/jekyll/migrators/csv.rb +26 -0
  32. data/lib/jekyll/migrators/mephisto.rb +79 -0
  33. data/lib/jekyll/migrators/mt.rb +59 -0
  34. data/lib/jekyll/migrators/textpattern.rb +50 -0
  35. data/lib/jekyll/migrators/typo.rb +49 -0
  36. data/lib/jekyll/migrators/wordpress.rb +55 -0
  37. data/lib/jekyll/page.rb +133 -0
  38. data/lib/jekyll/plugin.rb +76 -0
  39. data/lib/jekyll/post.rb +241 -0
  40. data/lib/jekyll/site.rb +231 -0
  41. data/lib/jekyll/static_file.rb +76 -0
  42. data/lib/jekyll/tags/highlight.rb +73 -0
  43. data/lib/jekyll/tags/include.rb +31 -0
  44. data/test/helper.rb +33 -0
  45. data/test/source/_includes/sig.markdown +3 -0
  46. data/test/source/_layouts/default.html +27 -0
  47. data/test/source/_layouts/simple.html +1 -0
  48. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  49. data/test/source/_posts/2008-02-02-published.textile +8 -0
  50. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  51. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  52. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  53. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  54. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  55. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  56. data/test/source/_posts/2009-01-27-category.textile +7 -0
  57. data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
  58. data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
  59. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  60. data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
  61. data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
  62. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  63. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  64. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  65. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  66. data/test/source/_posts/2010-01-08-triple-dash.markdown +5 -0
  67. data/test/source/_posts/2010-01-09-date-override.textile +7 -0
  68. data/test/source/_posts/2010-01-09-time-override.textile +7 -0
  69. data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
  70. data/test/source/_posts/2010-01-16-override-data.textile +4 -0
  71. data/test/source/about.html +6 -0
  72. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  73. data/test/source/contacts.html +5 -0
  74. data/test/source/css/screen.css +76 -0
  75. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  76. data/test/source/index.html +22 -0
  77. data/test/source/sitemap.xml +32 -0
  78. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  79. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  80. data/test/suite.rb +9 -0
  81. data/test/test_configuration.rb +29 -0
  82. data/test/test_core_ext.rb +66 -0
  83. data/test/test_filters.rb +49 -0
  84. data/test/test_generated_site.rb +44 -0
  85. data/test/test_page.rb +98 -0
  86. data/test/test_pager.rb +113 -0
  87. data/test/test_post.rb +396 -0
  88. data/test/test_site.rb +153 -0
  89. data/test/test_tags.rb +108 -0
  90. metadata +284 -0
data/History.txt ADDED
@@ -0,0 +1,248 @@
1
+ == 0.6.2 / 2010-06-25
2
+ * Bug Fixes
3
+ * Fix Rakefile 'release' task (tag pushing was missing origin)
4
+ * Ensure that RedCloth is loaded when textilize filter is used (#183)
5
+ * Expand source, destination, and plugin paths (#180)
6
+ * Fix page.url to include full relative path (#181)
7
+
8
+ == 0.6.1 / 2010-06-24
9
+ * Bug Fixes
10
+ * Fix Markdown Pygments prefix and suffix (#178)
11
+
12
+ == 0.6.0 / 2010-06-23
13
+ * Major Enhancements
14
+ * Proper plugin system (#19, #100)
15
+ * Add safe mode so unsafe converters/generators can be added
16
+ * Maruku is now the only processor dependency installed by default.
17
+ Other processors will be lazy-loaded when necessary (and prompt the
18
+ user to install them when necessary) (#57)
19
+ * Minor Enhancements
20
+ * Inclusion/exclusion of future dated posts (#59)
21
+ * Generation for a specific time (#59)
22
+ * Allocate site.time on render not per site_payload invocation (#59)
23
+ * Pages now present in the site payload and can be used through the
24
+ site.pages and site.html_pages variables
25
+ * Generate phase added to site#process and pagination is now a generator
26
+ * Switch to RakeGem for build/test process
27
+ * Only regenerate static files when they have changed (#142)
28
+ * Allow arbitrary options to Pygments (#31)
29
+ * Allow URL to be set via command line option (#147)
30
+ * Bug Fixes
31
+ * Render highlighted code for non markdown/textile pages (#116)
32
+ * Fix highlighting on Ruby 1.9 (#65)
33
+ * Fix extension munging when pretty permalinks are enabled (#64)
34
+ * Stop sorting categories (#33)
35
+ * Preserve generated attributes over front matter (#119)
36
+ * Fix source directory binding using Dir.pwd (#75)
37
+
38
+ == 0.5.7 / 2010-01-12
39
+ * Minor Enhancements
40
+ * Allow overriding of post date in the front matter (#62, #38)
41
+ * Bug Fixes
42
+ * Categories isn't always an array (#73)
43
+ * Empty tags causes error in read_posts (#84)
44
+ * Fix pagination to adhere to read/render/write paradigm
45
+ * Test Enhancement
46
+ * cucumber features no longer use site.ports.first where a better
47
+ alternative is available
48
+
49
+ == 0.5.6 / 2010-01-08
50
+ * Bug Fixes
51
+ * Require redcloth >= 4.2.1 in tests (#92)
52
+ * Don't break on triple dashes in yaml frontmatter (#93)
53
+ * Minor Enhancements
54
+ * Allow .mkd as markdown extension
55
+ * Use $stdout/err instead of constants (#99)
56
+ * Properly wrap code blocks (#91)
57
+ * Add javascript mime type for webrick (#98)
58
+
59
+ == 0.5.5 / 2010-01-08
60
+ * Bug Fixes
61
+ * Fix pagination % 0 bug (#78)
62
+ * Ensure all posts are processed first (#71)
63
+
64
+ == NOTE
65
+ * After this point I will no longer be giving credit in the history;
66
+ that is what the commit log is for.
67
+
68
+ == 0.5.4 / 2009-08-23
69
+ * Bug Fixes
70
+ * Do not allow symlinks (security vulnerability)
71
+
72
+ == 0.5.3 / 2009-07-14
73
+ * Bug Fixes
74
+ * Solving the permalink bug where non-html files wouldn't work
75
+ [github.com/jeffrydegrande]
76
+
77
+ == 0.5.2 / 2009-06-24
78
+ * Enhancements
79
+ * Added --paginate option to the executable along with a paginator object
80
+ for the payload [github.com/calavera]
81
+ * Upgraded RedCloth to 4.2.1, which makes <notextile> tags work once
82
+ again.
83
+ * Configuration options set in config.yml are now available through the
84
+ site payload [github.com/vilcans]
85
+ * Posts can now have an empty YAML front matter or none at all
86
+ [github.com/bahuvrihi]
87
+ * Bug Fixes
88
+ * Fixing Ruby 1.9 issue that requires to_s on the err object
89
+ [github.com/Chrononaut]
90
+ * Fixes for pagination and ordering posts on the same day [github.com/ujh]
91
+ * Made pages respect permalinks style and permalinks in yml front matter
92
+ [github.com/eugenebolshakov]
93
+ * Index.html file should always have index.html permalink
94
+ [github.com/eugenebolshakov]
95
+ * Added trailing slash to pretty permalink style so Apache is happy
96
+ [github.com/eugenebolshakov]
97
+ * Bad markdown processor in config fails sooner and with better message
98
+ [github.com/gcnovus]
99
+ * Allow CRLFs in yaml frontmatter [github.com/juretta]
100
+ * Added Date#xmlschema for Ruby versions < 1.9
101
+
102
+ == 0.5.1 / 2009-05-06
103
+ * Major Enhancements
104
+ * Next/previous posts in site payload [github.com/pantulis,
105
+ github.com/tomo]
106
+ * Permalink templating system
107
+ * Moved most of the README out to the GitHub wiki
108
+ * Exclude option in configuration so specified files won't be brought over
109
+ with generated site [github.com/duritong]
110
+ * Bug Fixes
111
+ * Making sure config.yaml references are all gone, using only config.yml
112
+ * Fixed syntax highlighting breaking for UTF-8 code [github.com/henrik]
113
+ * Worked around RDiscount bug that prevents Markdown from getting parsed
114
+ after highlight [github.com/henrik]
115
+ * CGI escaped post titles [github.com/Chrononaut]
116
+
117
+ == 0.5.0 / 2009-04-07
118
+ * Minor Enhancements
119
+ * Ability to set post categories via YAML [github.com/qrush]
120
+ * Ability to set prevent a post from publishing via YAML
121
+ [github.com/qrush]
122
+ * Add textilize filter [github.com/willcodeforfoo]
123
+ * Add 'pretty' permalink style for wordpress-like urls
124
+ [github.com/dysinger]
125
+ * Made it possible to enter categories from YAML as an array
126
+ [github.com/Chrononaut]
127
+ * Ignore Emacs autosave files [github.com/Chrononaut]
128
+ * Bug Fixes
129
+ * Use block syntax of popen4 to ensure that subprocesses are properly
130
+ disposed [github.com/jqr]
131
+ * Close open4 streams to prevent zombies [github.com/rtomayko]
132
+ * Only query required fields from the WP Database [github.com/ariejan]
133
+ * Prevent _posts from being copied to the destination directory
134
+ [github.com/bdimcheff]
135
+ * Refactors
136
+ * Factored the filtering code into a method [github.com/Chrononaut]
137
+ * Fix tests and convert to Shoulda [github.com/qrush,
138
+ github.com/technicalpickles]
139
+ * Add Cucumber acceptance test suite [github.com/qrush,
140
+ github.com/technicalpickles]
141
+
142
+ == 0.4.1
143
+ * Minor Enhancements
144
+ * Changed date format on wordpress converter (zeropadding)
145
+ [github.com/dysinger]
146
+ * Bug Fixes
147
+ * Add jekyll binary as executable to gemspec [github.com/dysinger]
148
+
149
+ == 0.4.0 / 2009-02-03
150
+ * Major Enhancements
151
+ * Switch to Jeweler for packaging tasks
152
+ * Minor Enhancements
153
+ * Type importer [github.com/codeslinger]
154
+ * site.topics accessor [github.com/baz]
155
+ * Add array_to_sentence_string filter [github.com/mchung]
156
+ * Add a converter for textpattern [github.com/PerfectlyNormal]
157
+ * Add a working Mephisto / MySQL converter [github.com/ivey]
158
+ * Allowing .htaccess files to be copied over into the generated site
159
+ [github.com/briandoll]
160
+ * Add option to not put file date in permalink URL [github.com/mreid]
161
+ * Add line number capabilities to highlight blocks [github.com/jcon]
162
+ * Bug Fixes
163
+ * Fix permalink behavior [github.com/cavalle]
164
+ * Fixed an issue with pygments, markdown, and newlines
165
+ [github.com/zpinter]
166
+ * Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
167
+ * Test and fix the site.categories hash [github.com/zzot]
168
+ * Fix site payload available to files [github.com/matrix9180]
169
+
170
+ == 0.3.0 / 2008-12-24
171
+ * Major Enhancements
172
+ * Added --server option to start a simple WEBrick server on destination
173
+ directory [github.com/johnreilly and github.com/mchung]
174
+ * Minor Enhancements
175
+ * Added post categories based on directories containing _posts
176
+ [github.com/mreid]
177
+ * Added post topics based on directories underneath _posts
178
+ * Added new date filter that shows the full month name [github.com/mreid]
179
+ * Merge Post's YAML front matter into its to_liquid payload
180
+ [github.com/remi]
181
+ * Restrict includes to regular files underneath _includes
182
+ * Bug Fixes
183
+ * Change YAML delimiter matcher so as to not chew up 2nd level markdown
184
+ headers [github.com/mreid]
185
+ * Fix bug that meant page data (such as the date) was not available in
186
+ templates [github.com/mreid]
187
+ * Properly reject directories in _layouts
188
+
189
+ == 0.2.1 / 2008-12-15
190
+ * Major Changes
191
+ * Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
192
+ * Allow use of RDiscount with --rdiscount flag
193
+ * Minor Enhancements
194
+ * Don't load directory_watcher unless it's needed [github.com/pjhyett]
195
+
196
+ == 0.2.0 / 2008-12-14
197
+ * Major Changes
198
+ * related_posts is now found in site.related_posts
199
+
200
+ == 0.1.6 / 2008-12-13
201
+ * Major Features
202
+ * Include files in _includes with {% include x.textile %}
203
+
204
+ == 0.1.5 / 2008-12-12
205
+ * Major Features
206
+ * Code highlighting with Pygments if --pygments is specified
207
+ * Disable true LSI by default, enable with --lsi
208
+ * Minor Enhancements
209
+ * Output informative message if RDiscount is not available
210
+ [github.com/JackDanger]
211
+ * Bug Fixes
212
+ * Prevent Jekyll from picking up the output directory as a source
213
+ [github.com/JackDanger]
214
+ * Skip related_posts when there is only one post [github.com/JackDanger]
215
+
216
+ == 0.1.4 / 2008-12-08
217
+ * Bug Fixes
218
+ * DATA does not work properly with rubygems
219
+
220
+ == 0.1.3 / 2008-12-06
221
+ * Major Features
222
+ * Markdown support [github.com/vanpelt]
223
+ * Mephisto and CSV converters [github.com/vanpelt]
224
+ * Code hilighting [github.com/vanpelt]
225
+ * Autobuild
226
+ * Bug Fixes
227
+ * Accept both \r\n and \n in YAML header [github.com/vanpelt]
228
+
229
+ == 0.1.2 / 2008-11-22
230
+ * Major Features
231
+ * Add a real "related posts" implementation using Classifier
232
+ * Command Line Changes
233
+ * Allow cli to be called with 0, 1, or 2 args intuiting dir paths
234
+ if they are omitted
235
+
236
+ == 0.1.1 / 2008-11-22
237
+ * Minor Additions
238
+ * Posts now support introspectional data e.g. {{ page.url }}
239
+
240
+ == 0.1.0 / 2008-11-05
241
+ * First release
242
+ * Converts posts written in Textile
243
+ * Converts regular site pages
244
+ * Simple copy of binary files
245
+
246
+ == 0.0.0 / 2008-10-19
247
+ * Birthday!
248
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2008 Tom Preston-Werner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the 'Software'), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,41 @@
1
+ h1. Jekyll
2
+
3
+ By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
4
+
5
+ Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind "GitHub Pages":http://pages.github.com, which you can use to host your project's page or blog right here from GitHub.
6
+
7
+ h2. Getting Started
8
+
9
+ * "Install":http://wiki.github.com/mojombo/jekyll/install the gem
10
+ * Read up about its "Usage":http://wiki.github.com/mojombo/jekyll/usage and "Configuration":http://wiki.github.com/mojombo/jekyll/configuration
11
+ * Take a gander at some existing "Sites":http://wiki.github.com/mojombo/jekyll/sites
12
+ * Fork and "Contribute":http://wiki.github.com/mojombo/jekyll/contribute your own modifications
13
+ * Have questions? Post them on the "Mailing List":http://groups.google.com/group/jekyll-rb
14
+
15
+ h2. Diving In
16
+
17
+ * "Migrate":http://wiki.github.com/mojombo/jekyll/blog-migrations from your previous system
18
+ * Learn how the "YAML Front Matter":http://wiki.github.com/mojombo/jekyll/yaml-front-matter works
19
+ * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
20
+ * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
21
+ * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
22
+
23
+ h2. Runtime Dependencies
24
+
25
+ * RedCloth: Textile support (Ruby)
26
+ * Liquid: Templating system (Ruby)
27
+ * Classifier: Generating related posts (Ruby)
28
+ * Maruku: Default markdown engine (Ruby)
29
+ * Directory Watcher: Auto-regeneration of sites (Ruby)
30
+ * Open4: Talking to pygments for syntax highlighting (Ruby)
31
+ * Pygments: Syntax highlighting (Python)
32
+
33
+ h2. Developer Dependencies
34
+
35
+ * Shoulda: Test framework (Ruby)
36
+ * RR: Mocking (Ruby)
37
+ * RedGreen: Nicer test output (Ruby)
38
+
39
+ h2. License
40
+
41
+ See LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,159 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ def date
21
+ Date.today.to_s
22
+ end
23
+
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
+ end
39
+
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ task :default => [:test, :features]
47
+
48
+ require 'rake/testtask'
49
+ Rake::TestTask.new(:test) do |test|
50
+ test.libs << 'lib' << 'test'
51
+ test.pattern = 'test/**/test_*.rb'
52
+ test.verbose = true
53
+ end
54
+
55
+ desc "Generate RCov test coverage and open in your browser"
56
+ task :coverage do
57
+ require 'rcov'
58
+ sh "rm -fr coverage"
59
+ sh "rcov test/test_*.rb"
60
+ sh "open coverage/index.html"
61
+ end
62
+
63
+ require 'rake/rdoctask'
64
+ Rake::RDocTask.new do |rdoc|
65
+ rdoc.rdoc_dir = 'rdoc'
66
+ rdoc.title = "#{name} #{version}"
67
+ rdoc.rdoc_files.include('README*')
68
+ rdoc.rdoc_files.include('lib/**/*.rb')
69
+ end
70
+
71
+ desc "Open an irb session preloaded with this library"
72
+ task :console do
73
+ sh "irb -rubygems -r ./lib/#{name}.rb"
74
+ end
75
+
76
+ #############################################################################
77
+ #
78
+ # Custom tasks (add your own tasks here)
79
+ #
80
+ #############################################################################
81
+
82
+ namespace :migrate do
83
+ desc "Migrate from mephisto in the current directory"
84
+ task :mephisto do
85
+ sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
86
+ end
87
+ desc "Migrate from Movable Type in the current directory"
88
+ task :mt do
89
+ sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
90
+ end
91
+ desc "Migrate from Typo in the current directory"
92
+ task :typo do
93
+ sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
94
+ end
95
+ end
96
+
97
+ begin
98
+ require 'cucumber/rake/task'
99
+ Cucumber::Rake::Task.new(:features) do |t|
100
+ t.cucumber_opts = "--format progress"
101
+ end
102
+ rescue LoadError
103
+ desc 'Cucumber rake task not available'
104
+ task :features do
105
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
106
+ end
107
+ end
108
+
109
+ #############################################################################
110
+ #
111
+ # Packaging tasks
112
+ #
113
+ #############################################################################
114
+
115
+ task :release => :build do
116
+ unless `git branch` =~ /^\* master$/
117
+ puts "You must be on the master branch to release!"
118
+ exit!
119
+ end
120
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
121
+ sh "git tag v#{version}"
122
+ sh "git push origin master"
123
+ sh "git push origin v#{version}"
124
+ sh "gem push pkg/#{name}-#{version}.gem"
125
+ end
126
+
127
+ task :build => :gemspec do
128
+ sh "mkdir -p pkg"
129
+ sh "gem build #{gemspec_file}"
130
+ sh "mv #{gem_file} pkg"
131
+ end
132
+
133
+ task :gemspec do
134
+ # read spec file and split out manifest section
135
+ spec = File.read(gemspec_file)
136
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
137
+
138
+ # replace name version and date
139
+ replace_header(head, :name)
140
+ replace_header(head, :version)
141
+ replace_header(head, :date)
142
+ #comment this out if your rubyforge_project has a different name
143
+ replace_header(head, :rubyforge_project)
144
+
145
+ # determine file list from git ls-files
146
+ files = `git ls-files`.
147
+ split("\n").
148
+ sort.
149
+ reject { |file| file =~ /^\./ }.
150
+ reject { |file| file =~ /^(rdoc|pkg|coverage)/ }.
151
+ map { |file| " #{file}" }.
152
+ join("\n")
153
+
154
+ # piece file back together and write
155
+ manifest = " s.files = %w[\n#{files}\n ]\n"
156
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
157
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
158
+ puts "Updated #{gemspec_file}"
159
+ end