tigefa 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.markdown +91 -0
  3. data/Gemfile +2 -0
  4. data/History.markdown +871 -0
  5. data/LICENSE +15 -14
  6. data/README.markdown +59 -0
  7. data/Rakefile +298 -0
  8. data/bin/tigefa +158 -0
  9. data/cucumber.yml +3 -0
  10. data/features/create_sites.feature +141 -0
  11. data/features/data.feature +65 -0
  12. data/features/drafts.feature +25 -0
  13. data/features/embed_filters.feature +60 -0
  14. data/features/include_tag.feature +57 -0
  15. data/features/markdown.feature +67 -0
  16. data/features/pagination.feature +82 -0
  17. data/features/permalinks.feature +85 -0
  18. data/features/post_data.feature +214 -0
  19. data/features/post_excerpts.feature +50 -0
  20. data/features/site_configuration.feature +235 -0
  21. data/features/site_data.feature +107 -0
  22. data/features/step_definitions/tigefa_steps.rb +189 -0
  23. data/features/support/env.rb +75 -0
  24. data/lib/site_template/.gitignore +1 -0
  25. data/lib/site_template/_config.yml +3 -0
  26. data/lib/site_template/_layouts/default.html +44 -0
  27. data/lib/site_template/_layouts/post.html +9 -0
  28. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +24 -0
  29. data/lib/site_template/css/main.css +160 -0
  30. data/lib/site_template/css/syntax.css +60 -0
  31. data/lib/site_template/index.html +13 -0
  32. data/lib/tigefa/cleaner.rb +73 -0
  33. data/lib/tigefa/command.rb +27 -0
  34. data/lib/tigefa/commands/build.rb +70 -0
  35. data/lib/tigefa/commands/doctor.rb +67 -0
  36. data/lib/tigefa/commands/new.rb +67 -0
  37. data/lib/tigefa/commands/serve.rb +65 -0
  38. data/lib/tigefa/configuration.rb +238 -0
  39. data/lib/tigefa/converter.rb +48 -0
  40. data/lib/tigefa/converters/identity.rb +21 -0
  41. data/lib/tigefa/converters/markdown/kramdown_parser.rb +29 -0
  42. data/lib/tigefa/converters/markdown/maruku_parser.rb +56 -0
  43. data/lib/tigefa/converters/markdown/rdiscount_parser.rb +37 -0
  44. data/lib/tigefa/converters/markdown/redcarpet_parser.rb +70 -0
  45. data/lib/tigefa/converters/markdown.rb +43 -0
  46. data/lib/tigefa/converters/textile.rb +50 -0
  47. data/lib/tigefa/convertible.rb +174 -0
  48. data/lib/tigefa/core_ext.rb +90 -0
  49. data/lib/tigefa/deprecator.rb +36 -0
  50. data/lib/tigefa/draft.rb +35 -0
  51. data/lib/tigefa/entry_filter.rb +35 -0
  52. data/lib/tigefa/errors.rb +4 -0
  53. data/lib/tigefa/excerpt.rb +113 -0
  54. data/lib/tigefa/filters.rb +174 -0
  55. data/lib/tigefa/generator.rb +4 -0
  56. data/lib/tigefa/generators/pagination.rb +217 -0
  57. data/lib/tigefa/layout.rb +45 -0
  58. data/lib/tigefa/mime.types +85 -0
  59. data/lib/tigefa/page.rb +160 -0
  60. data/lib/tigefa/plugin.rb +75 -0
  61. data/lib/tigefa/post.rb +312 -0
  62. data/lib/tigefa/related_posts.rb +59 -0
  63. data/lib/tigefa/site.rb +427 -0
  64. data/lib/tigefa/static_file.rb +70 -0
  65. data/lib/tigefa/stevenson.rb +89 -0
  66. data/lib/tigefa/tags/gist.rb +48 -0
  67. data/lib/tigefa/tags/highlight.rb +85 -0
  68. data/lib/tigefa/tags/include.rb +134 -0
  69. data/lib/tigefa/tags/post_url.rb +63 -0
  70. data/lib/tigefa/url.rb +69 -0
  71. data/lib/tigefa.rb +98 -4
  72. data/script/bootstrap +2 -0
  73. data/site/.gitignore +4 -0
  74. data/site/CNAME +1 -0
  75. data/site/README +1 -0
  76. data/site/_config.yml +6 -0
  77. data/site/_includes/analytics.html +32 -0
  78. data/site/_includes/docs_contents.html +16 -0
  79. data/site/_includes/docs_contents_mobile.html +23 -0
  80. data/site/_includes/docs_option.html +11 -0
  81. data/site/_includes/docs_ul.html +20 -0
  82. data/site/_includes/footer.html +15 -0
  83. data/site/_includes/header.html +18 -0
  84. data/site/_includes/news_contents.html +23 -0
  85. data/site/_includes/news_contents_mobile.html +11 -0
  86. data/site/_includes/news_item.html +24 -0
  87. data/site/_includes/primary-nav-items.html +14 -0
  88. data/site/_includes/section_nav.html +22 -0
  89. data/site/_includes/top.html +17 -0
  90. data/site/_layouts/default.html +12 -0
  91. data/site/_layouts/docs.html +23 -0
  92. data/site/_layouts/news.html +19 -0
  93. data/site/_layouts/news_item.html +27 -0
  94. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
  95. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
  96. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
  97. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
  98. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
  99. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
  100. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
  101. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
  102. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
  103. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
  104. data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +19 -0
  105. data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +43 -0
  106. data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +21 -0
  107. data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +30 -0
  108. data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +18 -0
  109. data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +27 -0
  110. data/site/css/gridism.css +110 -0
  111. data/site/css/normalize.css +1 -0
  112. data/site/css/pygments.css +70 -0
  113. data/site/css/style.css +946 -0
  114. data/site/docs/configuration.md +375 -0
  115. data/site/docs/contributing.md +128 -0
  116. data/site/docs/datafiles.md +63 -0
  117. data/site/docs/deployment-methods.md +109 -0
  118. data/site/docs/drafts.md +21 -0
  119. data/site/docs/extras.md +56 -0
  120. data/site/docs/frontmatter.md +180 -0
  121. data/site/docs/github-pages.md +91 -0
  122. data/site/docs/heroku.md +9 -0
  123. data/site/docs/history.md +866 -0
  124. data/site/docs/index.md +52 -0
  125. data/site/docs/installation.md +76 -0
  126. data/site/docs/migrations.md +11 -0
  127. data/site/docs/pages.md +86 -0
  128. data/site/docs/pagination.md +211 -0
  129. data/site/docs/permalinks.md +180 -0
  130. data/site/docs/plugins.md +534 -0
  131. data/site/docs/posts.md +181 -0
  132. data/site/docs/quickstart.md +32 -0
  133. data/site/docs/resources.md +46 -0
  134. data/site/docs/sites.md +29 -0
  135. data/site/docs/structure.md +190 -0
  136. data/site/docs/templates.md +339 -0
  137. data/site/docs/troubleshooting.md +150 -0
  138. data/site/docs/upgrading.md +146 -0
  139. data/site/docs/usage.md +63 -0
  140. data/site/docs/variables.md +322 -0
  141. data/site/favicon.png +0 -0
  142. data/site/feed.xml +36 -0
  143. data/site/freenode.txt +1 -0
  144. data/site/img/article-footer.png +0 -0
  145. data/site/img/footer-arrow.png +0 -0
  146. data/site/img/footer-logo.png +0 -0
  147. data/site/img/logo-2x.png +0 -0
  148. data/site/img/octojekyll.png +0 -0
  149. data/site/img/tube.png +0 -0
  150. data/site/img/tube1x.png +0 -0
  151. data/site/index.html +90 -0
  152. data/site/js/modernizr-2.5.3.min.js +4 -0
  153. data/site/news/index.html +10 -0
  154. data/site/news/releases/index.html +10 -0
  155. data/test/fixtures/broken_front_matter1.erb +5 -0
  156. data/test/fixtures/broken_front_matter2.erb +4 -0
  157. data/test/fixtures/broken_front_matter3.erb +7 -0
  158. data/test/fixtures/exploit_front_matter.erb +4 -0
  159. data/test/fixtures/front_matter.erb +4 -0
  160. data/test/helper.rb +65 -0
  161. data/test/source/+/foo.md +7 -0
  162. data/test/source/.htaccess +8 -0
  163. data/test/source/_config.dev.toml +2 -0
  164. data/test/source/_data/languages.yml +2 -0
  165. data/test/source/_data/members.yaml +7 -0
  166. data/test/source/_data/products.yml +1 -0
  167. data/test/source/_includes/params.html +7 -0
  168. data/test/source/_includes/sig.markdown +3 -0
  169. data/test/source/_includes/tmp +1 -0
  170. data/test/source/_layouts/default.html +27 -0
  171. data/test/source/_layouts/post/simple.html +1 -0
  172. data/test/source/_layouts/simple.html +1 -0
  173. data/test/source/_plugins/dummy.rb +8 -0
  174. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  175. data/test/source/_posts/2008-02-02-published.textile +8 -0
  176. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  177. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  178. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  179. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  180. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  181. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  182. data/test/source/_posts/2009-01-27-category.textile +7 -0
  183. data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
  184. data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
  185. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  186. data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
  187. data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
  188. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  189. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  190. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  191. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  192. data/test/source/_posts/2010-01-08-triple-dash.markdown +5 -0
  193. data/test/source/_posts/2010-01-09-date-override.textile +7 -0
  194. data/test/source/_posts/2010-01-09-time-override.textile +7 -0
  195. data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
  196. data/test/source/_posts/2010-01-16-override-data.textile +4 -0
  197. data/test/source/_posts/2011-04-12-md-extension.md +7 -0
  198. data/test/source/_posts/2011-04-12-text-extension.text +0 -0
  199. data/test/source/_posts/2013-01-02-post-excerpt.markdown +14 -0
  200. data/test/source/_posts/2013-01-12-nil-layout.textile +6 -0
  201. data/test/source/_posts/2013-01-12-no-layout.textile +5 -0
  202. data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
  203. data/test/source/_posts/2013-04-11-custom-excerpt.markdown +10 -0
  204. data/test/source/_posts/2013-05-10-number-category.textile +7 -0
  205. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
  206. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  207. data/test/source/_posts/2014-01-06-permalink-traversal.md +5 -0
  208. data/test/source/_posts/es/2008-11-21-nested.textile +8 -0
  209. data/test/source/about.html +6 -0
  210. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  211. data/test/source/contacts/bar.html +5 -0
  212. data/test/source/contacts/index.html +5 -0
  213. data/test/source/contacts.html +5 -0
  214. data/test/source/css/screen.css +76 -0
  215. data/test/source/deal.with.dots.html +7 -0
  216. data/test/source/exploit.md +5 -0
  217. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  218. data/test/source/index.html +22 -0
  219. data/test/source/products.yml +4 -0
  220. data/test/source/sitemap.xml +32 -0
  221. data/test/source/symlink-test/_data +1 -0
  222. data/test/source/symlink-test/symlinked-dir +1 -0
  223. data/test/source/symlink-test/symlinked-file +1 -0
  224. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  225. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  226. data/test/suite.rb +11 -0
  227. data/test/test_command.rb +39 -0
  228. data/test/test_configuration.rb +181 -0
  229. data/test/test_convertible.rb +51 -0
  230. data/test/test_core_ext.rb +88 -0
  231. data/test/test_entry_filter.rb +74 -0
  232. data/test/test_excerpt.rb +78 -0
  233. data/test/test_filters.rb +113 -0
  234. data/test/test_generated_site.rb +83 -0
  235. data/test/test_kramdown.rb +62 -0
  236. data/test/test_new_command.rb +104 -0
  237. data/test/test_page.rb +212 -0
  238. data/test/test_pager.rb +116 -0
  239. data/test/test_post.rb +592 -0
  240. data/test/test_rdiscount.rb +22 -0
  241. data/test/test_redcarpet.rb +61 -0
  242. data/test/test_redcloth.rb +86 -0
  243. data/test/test_related_posts.rb +47 -0
  244. data/test/test_site.rb +333 -0
  245. data/test/test_tags.rb +490 -0
  246. data/test/test_url.rb +28 -0
  247. data/tigefa.gemspec +306 -0
  248. metadata +575 -45
  249. data/README.md +0 -4
data/LICENSE CHANGED
@@ -1,20 +1,21 @@
1
- The MIT License (MIT)
1
+ (The MIT License)
2
2
 
3
- Copyright (c) 2013 sugeng tigefa
3
+ Copyright (c) 2008 Tom Preston-Werner
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
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
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
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, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.markdown ADDED
@@ -0,0 +1,59 @@
1
+ # Tigefa Gem
2
+
3
+ > This Generator site jekyll powered but command line changed from `jekyll new <site name>` replaced `tigefa new <site name>`
4
+ > Hand from hand, eye from eye.
5
+ >> Thanks for visiting.
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/tigefa.png)](http://badge.fury.io/rb/tigefa)
8
+
9
+ [![Build Status](https://secure.travis-ci.org/tigefa4u/tigefa-gem.png?branch=master)](https://travis-ci.org/tigefa4u/tigefa-gem)
10
+ [![Code Climate](https://codeclimate.com/github/tigefa4u/tigefa-gem.png)](https://codeclimate.com/github/tigefa4u/tigefa-gem)
11
+ [![Coverage Status](https://coveralls.io/repos/tigefa4u/tigefa-gem/badge.png)](https://coveralls.io/r/tigefa4u/tigefa-gem)
12
+
13
+ By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
14
+
15
+ 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.
16
+
17
+ ## Getting Started
18
+
19
+ * [Install](http://jekyllrb.com/docs/installation/) the gem
20
+ * Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
21
+ * Take a gander at some existing [Sites](http://wiki.github.com/mojombo/jekyll/sites)
22
+ * Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
23
+ * Have questions? Check out `#jekyll` on irc.freenode.net.
24
+
25
+ ## Diving In
26
+
27
+ * [Migrate](http://jekyllrb.com/docs/migrations/) from your previous system
28
+ * Learn how the [YAML Front Matter](http://jekyllrb.com/docs/frontmatter/) works
29
+ * Put information on your site with [Variables](http://jekyllrb.com/docs/variables/)
30
+ * Customize the [Permalinks](http://jekyllrb.com/docs/permalinks/) your posts are generated with
31
+ * Use the built-in [Liquid Extensions](http://jekyllrb.com/docs/templates/) to make your life easier
32
+ * Use custom [Plugins](http://jekyllrb.com/docs/plugins/) to generate content specific to your site
33
+
34
+ ## Runtime Dependencies
35
+
36
+ * Commander: Command-line interface constructor (Ruby)
37
+ * Colorator: Colorizes command line output (Ruby)
38
+ * Classifier: Generating related posts (Ruby)
39
+ * Directory Watcher: Auto-regeneration of sites (Ruby)
40
+ * Liquid: Templating system (Ruby)
41
+ * Maruku: Default markdown engine (Ruby)
42
+ * Pygments.rb: Syntax highlighting (Ruby/Python)
43
+ * RedCarpet: Markdown engine (Ruby)
44
+ * Safe YAML: YAML Parser built for security (Ruby)
45
+
46
+ ## Developer Dependencies
47
+
48
+ * Kramdown: Markdown-superset converter (Ruby)
49
+ * Launchy: Cross-platform file launcher (Ruby)
50
+ * RDiscount: Discount Markdown Processor (Ruby)
51
+ * RedCloth: Textile support (Ruby)
52
+ * RedGreen: Nicer test output (Ruby)
53
+ * RR: Mocking (Ruby)
54
+ * Shoulda: Test framework (Ruby)
55
+ * SimpleCov: Coverage framework (Ruby)
56
+
57
+ ## License
58
+
59
+ See [LICENSE](https://github.com/mojombo/jekyll/blob/master/LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,298 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rdoc'
4
+ require 'date'
5
+ require 'yaml'
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
8
+
9
+ #############################################################################
10
+ #
11
+ # Helper functions
12
+ #
13
+ #############################################################################
14
+
15
+ def name
16
+ @name ||= Dir['*.gemspec'].first.split('.').first
17
+ end
18
+
19
+ def version
20
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
21
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
22
+ end
23
+
24
+ def date
25
+ Date.today.to_s
26
+ end
27
+
28
+ def file_date
29
+ Date.today.strftime("%F")
30
+ end
31
+
32
+ def rubyforge_project
33
+ name
34
+ end
35
+
36
+ def gemspec_file
37
+ "#{name}.gemspec"
38
+ end
39
+
40
+ def gem_file
41
+ "#{name}-#{version}.gem"
42
+ end
43
+
44
+ def replace_header(head, header_name)
45
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
46
+ end
47
+
48
+ def normalize_bullets(markdown)
49
+ markdown.gsub(/\s{2}\*{1}/, "-")
50
+ end
51
+
52
+ def linkify_prs(markdown)
53
+ markdown.gsub(/#(\d+)/) do |word|
54
+ "[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
55
+ end
56
+ end
57
+
58
+ def linkify_users(markdown)
59
+ markdown.gsub(/(@\w+)/) do |username|
60
+ "[#{username}](https://github.com/#{username.delete("@")})"
61
+ end
62
+ end
63
+
64
+ def linkify(markdown)
65
+ linkify_users(linkify_prs(markdown))
66
+ end
67
+
68
+ def liquid_escape(markdown)
69
+ markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
70
+ end
71
+
72
+ def remove_head_from_history(markdown)
73
+ index = markdown =~ /^##\s+\d+\.\d+\.\d+/
74
+ markdown[index..-1]
75
+ end
76
+
77
+ def converted_history(markdown)
78
+ remove_head_from_history(liquid_escape(linkify(normalize_bullets(markdown))))
79
+ end
80
+
81
+ #############################################################################
82
+ #
83
+ # Standard tasks
84
+ #
85
+ #############################################################################
86
+
87
+ if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true"
88
+ require 'coveralls/rake/task'
89
+ Coveralls::RakeTask.new
90
+
91
+ task :default => [:test, :features, 'coveralls:push']
92
+ else
93
+ task :default => [:test, :features]
94
+ end
95
+
96
+ require 'rake/testtask'
97
+ Rake::TestTask.new(:test) do |test|
98
+ test.libs << 'lib' << 'test'
99
+ test.pattern = 'test/**/test_*.rb'
100
+ test.verbose = true
101
+ end
102
+
103
+ require 'rdoc/task'
104
+ Rake::RDocTask.new do |rdoc|
105
+ rdoc.rdoc_dir = 'rdoc'
106
+ rdoc.title = "#{name} #{version}"
107
+ rdoc.rdoc_files.include('README*')
108
+ rdoc.rdoc_files.include('lib/**/*.rb')
109
+ end
110
+
111
+ begin
112
+ require 'cucumber/rake/task'
113
+ Cucumber::Rake::Task.new(:features) do |t|
114
+ t.profile = "travis"
115
+ end
116
+ Cucumber::Rake::Task.new(:"features:html", "Run Cucumber features and produce HTML output") do |t|
117
+ t.profile = "html_report"
118
+ end
119
+ rescue LoadError
120
+ desc 'Cucumber rake task not available'
121
+ task :features do
122
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
123
+ end
124
+ end
125
+
126
+ desc "Open an irb session preloaded with this library"
127
+ task :console do
128
+ sh "irb -rubygems -r ./lib/#{name}.rb"
129
+ end
130
+
131
+ #############################################################################
132
+ #
133
+ # Site tasks - http://jekyllrb.com
134
+ #
135
+ #############################################################################
136
+
137
+ namespace :site do
138
+ desc "Generate and view the site locally"
139
+ task :preview do
140
+ require "launchy"
141
+
142
+ # Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
143
+ # then open it in a browser. Someday we can do better than this, I hope.
144
+ Thread.new do
145
+ sleep 4
146
+ puts "Opening in browser..."
147
+ Launchy.open("http://localhost:4000")
148
+ end
149
+
150
+ # Generate the site in server mode.
151
+ puts "Running Jekyll..."
152
+ Dir.chdir("site") do
153
+ sh "#{File.expand_path('bin/jekyll', File.dirname(__FILE__))} serve --watch"
154
+ end
155
+ end
156
+
157
+ desc "Update normalize.css library to the latest version and minify"
158
+ task :update_normalize_css do
159
+ Dir.chdir("site/css") do
160
+ sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
161
+ sh 'sass "normalize.scss":"normalize.css" --style compressed'
162
+ sh 'rm "normalize.scss"'
163
+ end
164
+ end
165
+
166
+ desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
167
+ task :publish => [:history] do
168
+ # Ensure the gh-pages dir exists so we can generate into it.
169
+ puts "Checking for gh-pages dir..."
170
+ unless File.exist?("./gh-pages")
171
+ puts "No gh-pages directory found. Run the following commands first:"
172
+ puts " `git clone git@github.com:mojombo/jekyll gh-pages"
173
+ puts " `cd gh-pages"
174
+ puts " `git checkout gh-pages`"
175
+ exit(1)
176
+ end
177
+
178
+ # Ensure gh-pages branch is up to date.
179
+ Dir.chdir('gh-pages') do
180
+ sh "git pull origin gh-pages"
181
+ end
182
+
183
+ # Copy to gh-pages dir.
184
+ puts "Copying site to gh-pages branch..."
185
+ Dir.glob("site/*") do |path|
186
+ next if path.include? "_site"
187
+ sh "cp -R #{path} gh-pages/"
188
+ end
189
+
190
+ # Commit and push.
191
+ puts "Committing and pushing to GitHub Pages..."
192
+ sha = `git log`.match(/[a-z0-9]{40}/)[0]
193
+ Dir.chdir('gh-pages') do
194
+ sh "git add ."
195
+ sh "git commit -m 'Updating to #{sha}.'"
196
+ sh "git push origin gh-pages"
197
+ end
198
+ puts 'Done.'
199
+ end
200
+
201
+ desc "Create a nicely formatted history page for the jekyll site based on the repo history."
202
+ task :history do
203
+ if File.exist?("History.markdown")
204
+ history_file = File.read("History.markdown")
205
+ front_matter = {
206
+ "layout" => "docs",
207
+ "title" => "History",
208
+ "permalink" => "/docs/history/",
209
+ "prev_section" => "contributing"
210
+ }
211
+ Dir.chdir('site/docs/') do
212
+ File.open("history.md", "w") do |file|
213
+ file.write("#{front_matter.to_yaml}---\n\n")
214
+ file.write(converted_history(history_file))
215
+ end
216
+ end
217
+ else
218
+ abort "You seem to have misplaced your History.markdown file. I can haz?"
219
+ end
220
+ end
221
+
222
+ namespace :releases do
223
+ desc "Create new release post"
224
+ task :new, :version do |t, args|
225
+ raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
226
+ today = Time.new.strftime('%Y-%m-%d')
227
+ release = args.version.to_s
228
+ filename = "site/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
229
+
230
+ File.open(filename, "wb") do |post|
231
+ post.puts("---")
232
+ post.puts("layout: news_item")
233
+ post.puts("title: 'Jekyll #{release} Released'")
234
+ post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}")
235
+ post.puts("author: ")
236
+ post.puts("version: #{release}")
237
+ post.puts("categories: [release]")
238
+ post.puts("---")
239
+ post.puts
240
+ post.puts
241
+ end
242
+
243
+ puts "Created #{filename}"
244
+ end
245
+ end
246
+ end
247
+
248
+ #############################################################################
249
+ #
250
+ # Packaging tasks
251
+ #
252
+ #############################################################################
253
+
254
+ task :release => :build do
255
+ unless `git branch` =~ /^(\* master|\* v1-stable)$/
256
+ puts "You must be on the master branch or the v1-stable branch to release!"
257
+ exit!
258
+ end
259
+ sh "git commit --allow-empty -m 'Release #{version}'"
260
+ sh "git tag v#{version}"
261
+ sh "git push origin master"
262
+ sh "git push origin v#{version}"
263
+ sh "gem push pkg/#{name}-#{version}.gem"
264
+ end
265
+
266
+ task :build => :gemspec do
267
+ sh "mkdir -p pkg"
268
+ sh "gem build #{gemspec_file}"
269
+ sh "mv #{gem_file} pkg"
270
+ end
271
+
272
+ task :gemspec do
273
+ # read spec file and split out manifest section
274
+ spec = File.read(gemspec_file)
275
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
276
+
277
+ # replace name version and date
278
+ replace_header(head, :name)
279
+ replace_header(head, :version)
280
+ replace_header(head, :date)
281
+ #comment this out if your rubyforge_project has a different name
282
+ replace_header(head, :rubyforge_project)
283
+
284
+ # determine file list from git ls-files
285
+ files = `git ls-files`.
286
+ split("\n").
287
+ sort.
288
+ reject { |file| file =~ /^\./ }.
289
+ reject { |file| file =~ /^(rdoc|pkg|coverage)/ }.
290
+ map { |file| " #{file}" }.
291
+ join("\n")
292
+
293
+ # piece file back together and write
294
+ manifest = " s.files = %w[\n#{files}\n ]\n"
295
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
296
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
297
+ puts "Updated #{gemspec_file}"
298
+ end
data/bin/tigefa ADDED
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env ruby
2
+ STDOUT.sync = true
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
5
+
6
+ require 'commander/import'
7
+ require 'tigefa'
8
+
9
+ Jekyll::Deprecator.process(ARGV)
10
+
11
+ program :name, 'tigefa'
12
+ program :version, Tigefa::VERSION
13
+ program :description, 'tigefa is a blog-aware, static site generator in Ruby'
14
+
15
+ default_command :default
16
+
17
+ global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
18
+ global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
19
+ global_option '--safe', 'Safe mode (defaults to false)'
20
+ global_option '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
21
+ global_option '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
22
+
23
+ # Option names don't always directly match the configuration value we'd like.
24
+ # This method will rename options to match what Jekyll configuration expects.
25
+ #
26
+ # options - The Hash of options from Commander.
27
+ #
28
+ # Returns the normalized Hash.
29
+ def normalize_options(options)
30
+ if drafts_state = options.delete(:drafts)
31
+ options[:show_drafts] = drafts_state
32
+ end
33
+ options
34
+ end
35
+
36
+ def add_build_options(c)
37
+ c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
38
+ c.option '--future', 'Publishes posts with a future date'
39
+ c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
40
+ c.option '-w', '--watch', 'Watch for changes and rebuild'
41
+ c.option '--lsi', 'Use LSI for improved related posts'
42
+ c.option '-D', '--drafts', 'Render posts in the _drafts folder'
43
+ c.option '-V', '--verbose', 'Print verbose output.'
44
+ end
45
+
46
+ command :default do |c|
47
+ c.action do |args, options|
48
+ if args.empty?
49
+ command(:help).run
50
+ else
51
+ Jekyll.logger.abort_with "Invalid command. Use --help for more information"
52
+ end
53
+ end
54
+ end
55
+
56
+ command :new do |c|
57
+ c.syntax = 'jekyll new PATH'
58
+ c.description = 'Creates a new Jekyll site scaffold in PATH'
59
+
60
+ c.option '--force', 'Force creation even if PATH already exists'
61
+ c.option '--blank', 'Creates scaffolding but with empty files'
62
+
63
+ c.action do |args, options|
64
+ Jekyll::Commands::New.process(args, options.__hash__)
65
+ end
66
+ end
67
+
68
+ command :build do |c|
69
+ c.syntax = 'tigefa build [options]'
70
+ c.description = 'Build your site'
71
+
72
+ add_build_options(c)
73
+
74
+ c.action do |args, options|
75
+ options = normalize_options(options.__hash__)
76
+ options = Tigefa.configuration(options)
77
+ Tigefa::Commands::Build.process(options)
78
+ end
79
+ end
80
+
81
+ command :serve do |c|
82
+ c.syntax = 'tigefa serve [options]'
83
+ c.description = 'Serve your site locally'
84
+
85
+ add_build_options(c)
86
+
87
+ c.option '-B', '--detach', 'Run the server in the background (detach)'
88
+ c.option '-P', '--port [PORT]', 'Port to listen on'
89
+ c.option '-H', '--host [HOST]', 'Host to bind to'
90
+ c.option '-b', '--baseurl [URL]', 'Base URL'
91
+
92
+ c.action do |args, options|
93
+ options.default :serving => true
94
+
95
+ options = normalize_options(options.__hash__)
96
+ options = Tigefa.configuration(options)
97
+ Tigefa::Commands::Build.process(options)
98
+ Tigefa::Commands::Serve.process(options)
99
+ end
100
+ end
101
+ alias_command :server, :serve
102
+
103
+ command :doctor do |c|
104
+ c.syntax = 'tigefa doctor'
105
+ c.description = 'Search site and print specific deprecation warnings'
106
+
107
+ c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
108
+
109
+ c.action do |args, options|
110
+ options = normalize_options(options.__hash__)
111
+ options = Tigefa.configuration(options)
112
+ Jekyll::Commands::Doctor.process(options)
113
+ end
114
+ end
115
+ alias_command :hyde, :doctor
116
+
117
+ command :docs do |c|
118
+ c.syntax = 'tigefa docs'
119
+ c.description = "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
120
+
121
+ c.option '-p', '--port [PORT]', 'Port to listen on'
122
+ c.option '-u', '--host [HOST]', 'Host to bind to'
123
+
124
+ c.action do |args, options|
125
+ options = normalize_options(options.__hash__)
126
+ options = Jekyll.configuration(options.merge!({
127
+ 'source' => File.expand_path("../site", File.dirname(__FILE__)),
128
+ 'destination' => File.expand_path("../site/_site", File.dirname(__FILE__))
129
+ }))
130
+ puts options
131
+ Tigefa::Commands::Build.process(options)
132
+ Tigefa::Commands::Serve.process(options)
133
+ end
134
+ end
135
+
136
+ command :import do |c|
137
+ c.syntax = 'tigefa import <platform> [options]'
138
+ c.description = 'Import your old blog to Tigefa'
139
+
140
+ c.option '--source STRING', 'Source file or URL to migrate from'
141
+ c.option '--file STRING', 'File to migrate from'
142
+ c.option '--dbname STRING', 'Database name to migrate from'
143
+ c.option '--user STRING', 'Username to use when migrating'
144
+ c.option '--pass STRING', 'Password to use when migrating'
145
+ c.option '--host STRING', 'Host address to use when migrating'
146
+ c.option '--prefix STRING', 'Database table prefix to use when migrating'
147
+
148
+ c.action do |args, options|
149
+ begin
150
+ require 'jekyll-import'
151
+ rescue LoadError
152
+ msg = "You must install the 'jekyll-import' gem before continuing.\n"
153
+ msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
154
+ abort msg
155
+ end
156
+ Jekyll::Commands::Import.process(args.first, options)
157
+ end
158
+ end
data/cucumber.yml ADDED
@@ -0,0 +1,3 @@
1
+ default: --format pretty
2
+ travis: --format progress
3
+ html_report: --format progress --format html --out=features_report.html