monad 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.markdown +91 -0
  3. data/Gemfile +1 -1
  4. data/History.markdown +772 -0
  5. data/{README.md → README.markdown} +5 -2
  6. data/Rakefile +163 -1
  7. data/bin/monad +86 -30
  8. data/features/create_sites.feature +54 -25
  9. data/features/data.feature +65 -0
  10. data/features/data_sources.feature +10 -10
  11. data/features/drafts.feature +5 -5
  12. data/features/embed_filters.feature +10 -10
  13. data/features/include_tag.feature +48 -0
  14. data/features/markdown.feature +5 -5
  15. data/features/pagination.feature +38 -10
  16. data/features/permalinks.feature +31 -11
  17. data/features/post_data.feature +41 -41
  18. data/features/post_excerpts.feature +50 -0
  19. data/features/site_configuration.feature +47 -26
  20. data/features/site_data.feature +30 -24
  21. data/features/step_definitions/{monad_steps.rb → jekyll_steps.rb} +66 -52
  22. data/features/support/env.rb +27 -8
  23. data/lib/jekyll.rb +99 -0
  24. data/lib/jekyll/cleaner.rb +73 -0
  25. data/lib/{monad → jekyll}/command.rb +6 -6
  26. data/lib/{monad → jekyll}/commands/build.rb +9 -9
  27. data/lib/jekyll/commands/doctor.rb +67 -0
  28. data/lib/jekyll/commands/new.rb +67 -0
  29. data/lib/jekyll/commands/serve.rb +65 -0
  30. data/lib/{monad → jekyll}/configuration.rb +60 -18
  31. data/lib/{monad → jekyll}/converter.rb +1 -1
  32. data/lib/{monad → jekyll}/converters/identity.rb +1 -1
  33. data/lib/{monad → jekyll}/converters/markdown.rb +2 -2
  34. data/lib/jekyll/converters/markdown/kramdown_parser.rb +29 -0
  35. data/lib/{monad → jekyll}/converters/markdown/maruku_parser.rb +12 -8
  36. data/lib/{monad → jekyll}/converters/markdown/rdiscount_parser.rb +4 -2
  37. data/lib/{monad → jekyll}/converters/markdown/redcarpet_parser.rb +1 -1
  38. data/lib/{monad → jekyll}/converters/textile.rb +1 -1
  39. data/lib/{monad → jekyll}/convertible.rb +39 -17
  40. data/lib/{monad → jekyll}/core_ext.rb +22 -4
  41. data/lib/jekyll/deprecator.rb +36 -0
  42. data/lib/{monad → jekyll}/draft.rb +1 -1
  43. data/lib/{monad → jekyll}/drivers/json_driver.rb +1 -1
  44. data/lib/{monad → jekyll}/drivers/yaml_driver.rb +1 -1
  45. data/lib/{monad → jekyll}/errors.rb +1 -1
  46. data/lib/jekyll/excerpt.rb +113 -0
  47. data/lib/{monad → jekyll}/filters.rb +16 -6
  48. data/lib/{monad → jekyll}/generator.rb +1 -1
  49. data/lib/jekyll/generators/pagination.rb +214 -0
  50. data/lib/{monad → jekyll}/layout.rb +4 -1
  51. data/lib/{monad → jekyll}/mime.types +0 -0
  52. data/lib/{monad → jekyll}/page.rb +36 -39
  53. data/lib/{monad → jekyll}/plugin.rb +1 -1
  54. data/lib/{monad → jekyll}/post.rb +58 -123
  55. data/lib/jekyll/related_posts.rb +59 -0
  56. data/lib/{monad → jekyll}/site.rb +120 -123
  57. data/lib/{monad → jekyll}/static_file.rb +1 -1
  58. data/lib/jekyll/stevenson.rb +89 -0
  59. data/lib/jekyll/tags/gist.rb +48 -0
  60. data/lib/{monad → jekyll}/tags/highlight.rb +3 -3
  61. data/lib/jekyll/tags/include.rb +135 -0
  62. data/lib/{monad → jekyll}/tags/post_url.rb +8 -6
  63. data/lib/jekyll/url.rb +67 -0
  64. data/lib/monad.rb +36 -27
  65. data/lib/site_template/_config.yml +2 -1
  66. data/lib/site_template/_layouts/default.html +21 -23
  67. data/lib/site_template/_layouts/post.html +1 -1
  68. data/lib/site_template/_posts/{0000-00-00-welcome-to-monad.markdown.erb → 0000-00-00-welcome-to-jekyll.markdown.erb} +6 -6
  69. data/lib/site_template/css/main.css +22 -27
  70. data/lib/site_template/index.html +2 -2
  71. data/monad.gemspec +153 -52
  72. data/site/.gitignore +4 -0
  73. data/site/CNAME +1 -0
  74. data/site/README +1 -0
  75. data/site/_config.yml +6 -0
  76. data/site/_includes/analytics.html +32 -0
  77. data/site/_includes/docs_contents.html +16 -0
  78. data/site/_includes/docs_contents_mobile.html +23 -0
  79. data/site/_includes/docs_option.html +11 -0
  80. data/site/_includes/docs_ul.html +20 -0
  81. data/site/_includes/footer.html +15 -0
  82. data/site/_includes/header.html +18 -0
  83. data/site/_includes/news_contents.html +23 -0
  84. data/site/_includes/news_contents_mobile.html +11 -0
  85. data/site/_includes/news_item.html +24 -0
  86. data/site/_includes/primary-nav-items.html +14 -0
  87. data/site/_includes/section_nav.html +22 -0
  88. data/site/_includes/top.html +17 -0
  89. data/site/_layouts/default.html +12 -0
  90. data/site/_layouts/docs.html +23 -0
  91. data/site/_layouts/news.html +19 -0
  92. data/site/_layouts/news_item.html +27 -0
  93. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
  94. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
  95. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
  96. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
  97. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
  98. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
  99. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
  100. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
  101. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
  102. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
  103. data/site/css/gridism.css +110 -0
  104. data/site/css/normalize.css +1 -0
  105. data/site/css/pygments.css +70 -0
  106. data/site/css/style.css +946 -0
  107. data/site/docs/configuration.md +373 -0
  108. data/site/docs/contributing.md +128 -0
  109. data/site/docs/datafiles.md +63 -0
  110. data/site/docs/deployment-methods.md +109 -0
  111. data/site/docs/drafts.md +20 -0
  112. data/site/docs/extras.md +56 -0
  113. data/site/docs/frontmatter.md +180 -0
  114. data/site/docs/github-pages.md +91 -0
  115. data/site/docs/heroku.md +9 -0
  116. data/site/docs/history.md +722 -0
  117. data/site/docs/index.md +52 -0
  118. data/site/docs/installation.md +76 -0
  119. data/site/docs/migrations.md +257 -0
  120. data/site/docs/pages.md +86 -0
  121. data/site/docs/pagination.md +211 -0
  122. data/site/docs/permalinks.md +180 -0
  123. data/site/docs/plugins.md +508 -0
  124. data/site/docs/posts.md +181 -0
  125. data/site/docs/quickstart.md +32 -0
  126. data/site/docs/resources.md +46 -0
  127. data/site/docs/sites.md +29 -0
  128. data/site/docs/structure.md +190 -0
  129. data/site/docs/templates.md +319 -0
  130. data/site/docs/troubleshooting.md +150 -0
  131. data/site/docs/upgrading.md +146 -0
  132. data/site/docs/usage.md +63 -0
  133. data/site/docs/variables.md +322 -0
  134. data/site/favicon.png +0 -0
  135. data/site/feed.xml +36 -0
  136. data/site/freenode.txt +1 -0
  137. data/site/img/article-footer.png +0 -0
  138. data/site/img/footer-arrow.png +0 -0
  139. data/site/img/footer-logo.png +0 -0
  140. data/site/img/logo-2x.png +0 -0
  141. data/site/img/octojekyll.png +0 -0
  142. data/site/img/tube.png +0 -0
  143. data/site/img/tube1x.png +0 -0
  144. data/site/index.html +90 -0
  145. data/site/js/modernizr-2.5.3.min.js +4 -0
  146. data/site/news/index.html +10 -0
  147. data/site/news/releases/index.html +10 -0
  148. data/test/helper.rb +6 -3
  149. data/test/source/+/foo.md +7 -0
  150. data/test/source/_data/languages.yml +2 -0
  151. data/test/source/_data/members.yaml +7 -0
  152. data/test/source/_data/products.yml +4 -0
  153. data/test/source/_includes/params.html +7 -0
  154. data/test/source/_layouts/default.html +1 -1
  155. data/test/source/_layouts/post/simple.html +1 -0
  156. data/test/source/_plugins/dummy.rb +1 -1
  157. data/test/source/_posts/2013-01-02-post-excerpt.markdown +1 -1
  158. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
  159. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  160. data/test/source/deal.with.dots.html +1 -1
  161. data/test/source/products.yml +4 -0
  162. data/test/test_configuration.rb +46 -11
  163. data/test/test_convertible.rb +2 -2
  164. data/test/test_excerpt.rb +78 -0
  165. data/test/test_filters.rb +4 -4
  166. data/test/test_generated_site.rb +13 -13
  167. data/test/test_json_driver.rb +9 -9
  168. data/test/test_kramdown.rb +32 -5
  169. data/test/test_new_command.rb +8 -8
  170. data/test/test_page.rb +12 -3
  171. data/test/test_pager.rb +34 -33
  172. data/test/test_post.rb +34 -26
  173. data/test/test_redcloth.rb +3 -3
  174. data/test/test_related_posts.rb +47 -0
  175. data/test/test_site.rb +102 -44
  176. data/test/test_tags.rb +168 -23
  177. data/test/test_url.rb +28 -0
  178. data/test/test_yaml_driver.rb +6 -6
  179. metadata +215 -137
  180. data/lib/monad/commands/doctor.rb +0 -29
  181. data/lib/monad/commands/new.rb +0 -50
  182. data/lib/monad/commands/serve.rb +0 -33
  183. data/lib/monad/converters/markdown/kramdown_parser.rb +0 -44
  184. data/lib/monad/deprecator.rb +0 -32
  185. data/lib/monad/generators/pagination.rb +0 -143
  186. data/lib/monad/logger.rb +0 -54
  187. data/lib/monad/tags/gist.rb +0 -30
  188. data/lib/monad/tags/include.rb +0 -37
@@ -12,6 +12,9 @@ The main feature it adds is as follows:
12
12
  Data Source enables you to load data from external sources, such as web, file system,
13
13
  databases and then use them inside views.
14
14
 
15
+ Note that Jekyll now automatically load yaml files under `_data` directory.
16
+ You're recommended to use that [feature](https://github.com/mojombo/jekyll/pull/1003)) unless it can't fulfill your requirements.
17
+
15
18
  Monad supports two built-in data sources:
16
19
 
17
20
  - `YAML` from local file system
@@ -44,7 +47,7 @@ To define a yaml data source, set following in `_config.yml` file:
44
47
  data_sources:
45
48
  - name: products # will be used as site.products to access data, no spaces allowed
46
49
  type: yaml
47
- path: _data/products.yml # must be on local file system
50
+ path: _database/products.yml # must be on local file system
48
51
  ```
49
52
 
50
53
  Then, inside html you can access the data as following:
@@ -58,7 +61,7 @@ Then, inside html you can access the data as following:
58
61
  The skeleton of your driver should be as follows:
59
62
 
60
63
  ``` ruby
61
- module Monad
64
+ module Jekyll
62
65
  module Drivers
63
66
  class XxxDriver
64
67
  # source options are passed in as an Hash
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'rdoc'
4
4
  require 'date'
5
+ require 'yaml'
5
6
 
6
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
7
8
 
@@ -24,6 +25,10 @@ def date
24
25
  Date.today.to_s
25
26
  end
26
27
 
28
+ def file_date
29
+ Date.today.strftime("%F")
30
+ end
31
+
27
32
  def rubyforge_project
28
33
  name
29
34
  end
@@ -40,13 +45,53 @@ def replace_header(head, header_name)
40
45
  head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
41
46
  end
42
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
+
43
81
  #############################################################################
44
82
  #
45
83
  # Standard tasks
46
84
  #
47
85
  #############################################################################
48
86
 
49
- task :default => [:test, :features]
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
50
95
 
51
96
  require 'rake/testtask'
52
97
  Rake::TestTask.new(:test) do |test|
@@ -83,6 +128,123 @@ task :console do
83
128
  sh "irb -rubygems -r ./lib/#{name}.rb"
84
129
  end
85
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: #{version}")
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
+
86
248
  #############################################################################
87
249
  #
88
250
  # Packaging tasks
data/bin/monad CHANGED
@@ -4,24 +4,24 @@ STDOUT.sync = true
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
5
5
 
6
6
  require 'commander/import'
7
- require 'monad'
7
+ require 'jekyll'
8
8
 
9
- Monad::Deprecator.process(ARGV)
9
+ Jekyll::Deprecator.process(ARGV)
10
10
 
11
11
  program :name, 'monad'
12
- program :version, Monad::VERSION
13
- program :description, 'Monad is a blog-aware, static site generator in Ruby based on jekyll'
12
+ program :version, Jekyll::VERSION
13
+ program :description, 'Monad is a simple, blog aware, static site generator based on Jekyll'
14
14
 
15
- default_command :help
15
+ default_command :default
16
16
 
17
17
  global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
18
18
  global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
19
19
  global_option '--safe', 'Safe mode (defaults to false)'
20
- global_option '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
21
- global_option '--layouts', 'Layouts directory (defaults to ./_layouts)'
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
22
 
23
23
  # Option names don't always directly match the configuration value we'd like.
24
- # This method will rename options to match what Monad configuration expects.
24
+ # This method will rename options to match what Jekyll configuration expects.
25
25
  #
26
26
  # options - The Hash of options from Commander.
27
27
  #
@@ -33,12 +33,35 @@ def normalize_options(options)
33
33
  options
34
34
  end
35
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
+
36
56
  command :new do |c|
37
57
  c.syntax = 'monad new PATH'
38
58
  c.description = 'Creates a new Monad site scaffold in PATH'
39
59
 
60
+ c.option '--force', 'Force creation even if PATH already exists'
61
+ c.option '--blank', 'Creates scaffolding but with empty files'
62
+
40
63
  c.action do |args, options|
41
- Monad::Commands::New.process(args)
64
+ Jekyll::Commands::New.process(args, options.__hash__)
42
65
  end
43
66
  end
44
67
 
@@ -46,17 +69,12 @@ command :build do |c|
46
69
  c.syntax = 'monad build [options]'
47
70
  c.description = 'Build your site'
48
71
 
49
- c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
50
- c.option '--future', 'Publishes posts with a future date'
51
- c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
52
- c.option '-w', '--watch', 'Watch for changes and rebuild'
53
- c.option '--lsi', 'Use LSI for improved related posts'
54
- c.option '--drafts', 'Render posts in the _drafts folder'
72
+ add_build_options(c)
55
73
 
56
74
  c.action do |args, options|
57
75
  options = normalize_options(options.__hash__)
58
- options = Monad.configuration(options)
59
- Monad::Commands::Build.process(options)
76
+ options = Jekyll.configuration(options)
77
+ Jekyll::Commands::Build.process(options)
60
78
  end
61
79
  end
62
80
 
@@ -64,24 +82,20 @@ command :serve do |c|
64
82
  c.syntax = 'monad serve [options]'
65
83
  c.description = 'Serve your site locally'
66
84
 
67
- c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
68
- c.option '--future', 'Publishes posts with a future date'
69
- c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
70
- c.option '-w', '--watch', 'Watch for changes and rebuild'
71
- c.option '--lsi', 'Use LSI for improved related posts'
72
- c.option '--drafts', 'Render posts in the _drafts folder'
85
+ add_build_options(c)
73
86
 
74
- c.option '-p', '--port [PORT]', 'Port to listen on'
75
- c.option '-h', '--host [HOST]', 'Host to bind to'
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'
76
90
  c.option '-b', '--baseurl [URL]', 'Base URL'
77
91
 
78
92
  c.action do |args, options|
79
93
  options.default :serving => true
80
94
 
81
95
  options = normalize_options(options.__hash__)
82
- options = Monad.configuration(options)
83
- Monad::Commands::Build.process(options)
84
- Monad::Commands::Serve.process(options)
96
+ options = Jekyll.configuration(options)
97
+ Jekyll::Commands::Build.process(options)
98
+ Jekyll::Commands::Serve.process(options)
85
99
  end
86
100
  end
87
101
  alias_command :server, :serve
@@ -94,9 +108,51 @@ command :doctor do |c|
94
108
 
95
109
  c.action do |args, options|
96
110
  options = normalize_options(options.__hash__)
97
- options = Monad.configuration(options)
98
- Monad::Commands::Doctor.process(options)
111
+ options = Jekyll.configuration(options)
112
+ Jekyll::Commands::Doctor.process(options)
99
113
  end
100
114
  end
101
115
  alias_command :hyde, :doctor
102
116
 
117
+ command :docs do |c|
118
+ c.syntax = 'monad 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
+ Jekyll::Commands::Build.process(options)
132
+ Jekyll::Commands::Serve.process(options)
133
+ end
134
+ end
135
+
136
+ command :import do |c|
137
+ c.syntax = 'monad import <platform> [options]'
138
+ c.description = 'Import your old blog to Monad'
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
+
147
+ c.action do |args, options|
148
+ begin
149
+ require 'jekyll-import'
150
+ rescue LoadError
151
+ msg = "You must install the 'jekyll-import' gem before continuing.\n"
152
+ msg += "* Do this by running `gem install jekyll-import`.\n"
153
+ msg += "* Or if you need root privileges, run `sudo gem install jekyll-import`."
154
+ abort msg
155
+ end
156
+ Jekyll::Commands::Import.process(args.first, options)
157
+ end
158
+ end
@@ -3,9 +3,16 @@ Feature: Create sites
3
3
  I want to be able to make a static site
4
4
  In order to share my awesome ideas with the interwebs
5
5
 
6
+ Scenario: Blank site
7
+ Given I do not have a "test_blank" directory
8
+ When I call jekyll new with test_blank --blank
9
+ Then the test_blank/_layouts directory should exist
10
+ And the test_blank/_posts directory should exist
11
+ And the "test_blank/index.html" file should exist
12
+
6
13
  Scenario: Basic site
7
14
  Given I have an "index.html" file that contains "Basic Site"
8
- When I run monad
15
+ When I run jekyll
9
16
  Then the _site directory should exist
10
17
  And I should see "Basic Site" in "_site/index.html"
11
18
 
@@ -13,8 +20,8 @@ Feature: Create sites
13
20
  Given I have a _posts directory
14
21
  And I have the following post:
15
22
  | title | date | content |
16
- | Hackers | 3/27/2009 | My First Exploit |
17
- When I run monad
23
+ | Hackers | 2009-03-27 | My First Exploit |
24
+ When I run jekyll
18
25
  Then the _site directory should exist
19
26
  And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
20
27
 
@@ -22,7 +29,7 @@ Feature: Create sites
22
29
  Given I have a _layouts directory
23
30
  And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
24
31
  And I have a default layout that contains "Page Layout: {{ content }}"
25
- When I run monad
32
+ When I run jekyll
26
33
  Then the _site directory should exist
27
34
  And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
28
35
 
@@ -31,9 +38,20 @@ Feature: Create sites
31
38
  And I have a _posts directory
32
39
  And I have the following posts:
33
40
  | title | date | layout | content |
34
- | Wargames | 3/27/2009 | default | The only winning move is not to play. |
41
+ | Wargames | 2009-03-27 | default | The only winning move is not to play. |
35
42
  And I have a default layout that contains "Post Layout: {{ content }}"
36
- When I run monad
43
+ When I run jekyll
44
+ Then the _site directory should exist
45
+ And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
46
+
47
+ Scenario: Basic site with layout inside a subfolder and a post
48
+ Given I have a _layouts directory
49
+ And I have a _posts directory
50
+ And I have the following posts:
51
+ | title | date | layout | content |
52
+ | Wargames | 2009-03-27 | post/simple | The only winning move is not to play. |
53
+ And I have a post/simple layout that contains "Post Layout: {{ content }}"
54
+ When I run jekyll
37
55
  Then the _site directory should exist
38
56
  And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
39
57
 
@@ -49,14 +67,14 @@ Feature: Create sites
49
67
  And I have a _posts directory
50
68
  And I have the following posts:
51
69
  | title | date | layout | content |
52
- | entry1 | 3/27/2009 | post | content for entry1. |
53
- | entry2 | 4/27/2009 | post | content for entry2. |
70
+ | entry1 | 2009-03-27 | post | content for entry1. |
71
+ | entry2 | 2009-04-27 | post | content for entry2. |
54
72
  And I have a category/_posts directory
55
73
  And I have the following posts in "category":
56
74
  | title | date | layout | content |
57
- | entry3 | 5/27/2009 | post | content for entry3. |
58
- | entry4 | 6/27/2009 | post | content for entry4. |
59
- When I run monad
75
+ | entry3 | 2009-05-27 | post | content for entry3. |
76
+ | entry4 | 2009-06-27 | post | content for entry4. |
77
+ When I run jekyll
60
78
  Then the _site directory should exist
61
79
  And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
62
80
  And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
@@ -70,28 +88,28 @@ Feature: Create sites
70
88
  Scenario: Basic site with include tag
71
89
  Given I have a _includes directory
72
90
  And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
73
- And I have an "_includes/about.textile" file that contains "Generated by Monad"
74
- When I run monad
91
+ And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
92
+ When I run jekyll
75
93
  Then the _site directory should exist
76
- And I should see "Basic Site with include tag: Generated by Monad" in "_site/index.html"
94
+ And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
77
95
 
78
96
  Scenario: Basic site with subdir include tag
79
97
  Given I have a _includes directory
80
- And I have an "_includes/about.textile" file that contains "Generated by Monad"
98
+ And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
81
99
  And I have an info directory
82
100
  And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}"
83
- When I run monad
101
+ When I run jekyll
84
102
  Then the _site directory should exist
85
- And I should see "Basic Site with subdir include tag: Generated by Monad" in "_site/info/index.html"
103
+ And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html"
86
104
 
87
105
  Scenario: Basic site with nested include tag
88
106
  Given I have a _includes directory
89
- And I have an "_includes/about.textile" file that contains "Generated by {% include monad.textile %}"
90
- And I have an "_includes/monad.textile" file that contains "Monad"
107
+ And I have an "_includes/about.textile" file that contains "Generated by {% include jekyll.textile %}"
108
+ And I have an "_includes/jekyll.textile" file that contains "Jekyll"
91
109
  And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
92
- When I run monad
110
+ When I run jekyll
93
111
  Then the _site directory should exist
94
- And I should see "Basic Site with include tag: Generated by Monad" in "_site/index.html"
112
+ And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
95
113
 
96
114
  Scenario: Basic site with internal post linking
97
115
  Given I have an "index.html" page that contains "URL: {% post_url 2020-01-31-entry2 %}"
@@ -99,14 +117,25 @@ Feature: Create sites
99
117
  And I have a _posts directory
100
118
  And I have the following posts:
101
119
  | title | date | layout | content |
102
- | entry1 | 12/31/2007 | post | content for entry1. |
103
- | entry2 | 01/31/2020 | post | content for entry2. |
104
- When I run monad
120
+ | entry1 | 2007-12-31 | post | content for entry1. |
121
+ | entry2 | 2020-01-31 | post | content for entry2. |
122
+ When I run jekyll
105
123
  Then the _site directory should exist
106
124
  And I should see "URL: /2020/01/31/entry2/" in "_site/index.html"
107
125
 
108
126
  Scenario: Basic site with whitelisted dotfile
109
127
  Given I have an ".htaccess" file that contains "SomeDirective"
110
- When I run monad
128
+ When I run jekyll
111
129
  Then the _site directory should exist
112
130
  And I should see "SomeDirective" in "_site/.htaccess"
131
+
132
+ Scenario: File was replaced by a directory
133
+ Given I have a "test" file that contains "some stuff"
134
+ When I run jekyll
135
+ Then the _site directory should exist
136
+ When I delete the file "test"
137
+ Given I have a test directory
138
+ And I have a "test/index.html" file that contains "some other stuff"
139
+ When I run jekyll
140
+ Then the _site/test directory should exist
141
+ And I should see "some other stuff" in "_site/test/index.html"