gumdrop 0.8.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. data/.gitignore +3 -0
  2. data/ChangeLog.md +13 -0
  3. data/Gemfile +6 -2
  4. data/Gemfile.lock +43 -3
  5. data/Rakefile +37 -21
  6. data/Readme.md +60 -158
  7. data/bin/gumdrop +2 -1
  8. data/gumdrop.gemspec +11 -4
  9. data/lib/gumdrop/builder.rb +164 -0
  10. data/lib/gumdrop/cli/external.rb +14 -9
  11. data/lib/gumdrop/cli/internal.rb +54 -22
  12. data/lib/gumdrop/cli.rb +21 -0
  13. data/lib/gumdrop/content.rb +195 -132
  14. data/lib/gumdrop/data.rb +185 -0
  15. data/lib/gumdrop/data_providers/csv.rb +18 -0
  16. data/lib/gumdrop/data_providers/pstore.rb +25 -0
  17. data/lib/gumdrop/data_providers/sqlite.rb +43 -0
  18. data/lib/gumdrop/data_providers/xml.rb +15 -0
  19. data/lib/gumdrop/data_providers/yaml_and_json.rb +18 -0
  20. data/lib/gumdrop/data_providers/yamldb.rb +18 -0
  21. data/lib/gumdrop/data_providers/yamldoc.rb +12 -0
  22. data/lib/gumdrop/generator.rb +118 -94
  23. data/lib/gumdrop/renderer.rb +272 -0
  24. data/lib/gumdrop/server.rb +36 -27
  25. data/lib/gumdrop/site.rb +283 -338
  26. data/lib/gumdrop/support/compressor.rb +52 -0
  27. data/lib/gumdrop/support/sprockets.rb +14 -23
  28. data/lib/gumdrop/support/stitch.rb +25 -14
  29. data/lib/gumdrop/support/yaml_doc_template.rb +29 -0
  30. data/lib/gumdrop/util/configurable.rb +44 -0
  31. data/lib/gumdrop/util/core_ex.rb +84 -0
  32. data/lib/gumdrop/util/eventable.rb +35 -0
  33. data/lib/gumdrop/util/hash_object.rb +70 -0
  34. data/lib/gumdrop/util/loggable.rb +44 -0
  35. data/lib/gumdrop/util/pager.rb +51 -0
  36. data/lib/gumdrop/{support → util}/proxy_handler.rb +7 -6
  37. data/lib/gumdrop/util/scanner.rb +47 -0
  38. data/lib/gumdrop/util/site_access.rb +16 -0
  39. data/lib/gumdrop/util/view_helpers.rb +50 -0
  40. data/lib/gumdrop/util/yaml_doc.rb +51 -0
  41. data/lib/gumdrop/version.rb +2 -2
  42. data/lib/gumdrop.rb +40 -77
  43. data/specs/content_spec.rb +83 -73
  44. data/specs/fixtures/expected/data-access/from-csv.html +4 -0
  45. data/specs/fixtures/expected/data-access/from-json.html +6 -0
  46. data/specs/fixtures/expected/data-access/from-sqlite.html +5 -0
  47. data/specs/fixtures/expected/data-access/from-xml.html +4 -0
  48. data/specs/fixtures/expected/data-access/from-yaml.html +5 -0
  49. data/specs/fixtures/expected/data-access/from-yamldb.html +5 -0
  50. data/specs/fixtures/expected/data-access/from-yamldoc.html +2 -0
  51. data/specs/fixtures/expected/gen-with-block/as-file.html +1 -0
  52. data/specs/fixtures/expected/gen-with-block/as-plain.html +1 -0
  53. data/specs/fixtures/expected/gen-with-block/layout-nested.html +1 -0
  54. data/specs/fixtures/expected/gen-with-block/layout-nil.html +1 -0
  55. data/specs/fixtures/expected/gen-with-block/layout-wrap.html +1 -0
  56. data/specs/fixtures/expected/gen-with-inline-render/0-as-file.html +4 -0
  57. data/specs/fixtures/expected/gen-with-inline-render/0-as-plain.html +4 -0
  58. data/specs/fixtures/expected/gen-with-inline-render/0-layout-nil.html +4 -0
  59. data/specs/fixtures/expected/gen-with-inline-render/0-layout-sub.html +4 -0
  60. data/specs/fixtures/expected/gen-with-inline-render/0-layout-wrap.html +4 -0
  61. data/specs/fixtures/expected/gen-with-inline-render/1-as-file.html +4 -0
  62. data/specs/fixtures/expected/gen-with-inline-render/1-as-plain.html +4 -0
  63. data/specs/fixtures/expected/gen-with-inline-render/1-layout-nil.html +4 -0
  64. data/specs/fixtures/expected/gen-with-inline-render/1-layout-sub.html +4 -0
  65. data/specs/fixtures/expected/gen-with-inline-render/1-layout-wrap.html +4 -0
  66. data/specs/fixtures/expected/goodbye.html +1 -0
  67. data/specs/fixtures/expected/hello.html +1 -0
  68. data/specs/fixtures/expected/image.png +0 -0
  69. data/specs/fixtures/expected/index.html +47 -0
  70. data/specs/fixtures/expected/js/sprockets-app.js +7 -0
  71. data/specs/fixtures/expected/js/stitch-app.js +65 -0
  72. data/specs/fixtures/expected/js/stitch-app.min.js +5 -0
  73. data/specs/fixtures/expected/js/stitch-app.min.src.js +65 -0
  74. data/specs/fixtures/expected/js/straight.js +8 -0
  75. data/specs/fixtures/expected/js/test-coffee.js +5 -0
  76. data/specs/fixtures/expected/pages/docs/force-abs.html +2 -0
  77. data/specs/fixtures/expected/pages/docs/index.html +2 -0
  78. data/specs/fixtures/expected/partials/hoisted-data.html +3 -0
  79. data/specs/fixtures/expected/partials/nested.html +7 -0
  80. data/specs/fixtures/expected/partials/params.html +1 -0
  81. data/specs/fixtures/expected/partials/with-layouts.html +1 -0
  82. data/specs/fixtures/expected/robots.txt +1 -0
  83. data/specs/fixtures/expected/test-multi-procs.html +4 -0
  84. data/specs/fixtures/expected/test-nested-layout.html +1 -0
  85. data/specs/fixtures/expected/test-no-layout.html +2 -0
  86. data/specs/fixtures/expected/test-yamldoc.html +1 -0
  87. data/specs/fixtures/expected/test.html +2 -0
  88. data/{templates/backbone → specs/fixtures/source}/Gemfile +8 -4
  89. data/specs/fixtures/source/Gemfile.lock +84 -0
  90. data/specs/fixtures/source/Gumdrop +60 -9
  91. data/specs/fixtures/source/data/csv_data.csv +2 -0
  92. data/specs/fixtures/source/data/json_data.json +13 -0
  93. data/specs/fixtures/source/data/sql_data.sqlite +0 -0
  94. data/specs/fixtures/source/data/xml_data.xml +4 -0
  95. data/specs/fixtures/source/data/yaml_db.yamldb +9 -0
  96. data/specs/fixtures/source/data/yaml_items.yaml +2 -0
  97. data/specs/fixtures/source/data/yamldoc.yamldoc +4 -0
  98. data/specs/fixtures/source/data-access/from-csv.html.erb +4 -0
  99. data/specs/fixtures/source/data-access/from-json.html.erb +6 -0
  100. data/specs/fixtures/source/data-access/from-sqlite.html.erb +5 -0
  101. data/specs/fixtures/source/data-access/from-xml.html.erb +5 -0
  102. data/specs/fixtures/source/data-access/from-yaml.html.erb +5 -0
  103. data/specs/fixtures/source/data-access/from-yamldb.html.erb +5 -0
  104. data/specs/fixtures/source/data-access/from-yamldoc.html.erb +2 -0
  105. data/specs/fixtures/source/gen-with-inline-render.generator +7 -0
  106. data/specs/fixtures/source/goodbye.html.erb +1 -0
  107. data/specs/fixtures/source/hello.html +1 -0
  108. data/specs/fixtures/source/image.png +0 -0
  109. data/specs/fixtures/source/index.html.erb +6 -0
  110. data/specs/fixtures/source/js/sprockets/app.js +2 -0
  111. data/specs/fixtures/source/js/sprockets/view.js.coffee +1 -0
  112. data/specs/fixtures/source/js/stitch/app.js +1 -0
  113. data/specs/fixtures/source/js/stitch/view.js.coffee +1 -0
  114. data/specs/fixtures/source/js/straight.js +8 -0
  115. data/specs/fixtures/source/js/test-coffee.js.coffee +1 -0
  116. data/specs/fixtures/source/layouts/site.layout.erb +1 -0
  117. data/specs/fixtures/source/layouts/sub.layout.erb +1 -0
  118. data/specs/fixtures/source/layouts/wrap.layout.erb +1 -0
  119. data/specs/fixtures/source/pages/_users-nested.html.erb +7 -0
  120. data/specs/fixtures/source/pages/docs/force-abs.html.erb +2 -0
  121. data/specs/fixtures/source/pages/docs/index.html.erb +2 -0
  122. data/specs/fixtures/source/partials/_post_entry.html.erb +4 -0
  123. data/specs/fixtures/source/partials/_provides_name.html.erb +1 -0
  124. data/specs/fixtures/source/partials/_user-params.html.erb +1 -0
  125. data/specs/fixtures/source/partials/_user.html.erb +1 -0
  126. data/specs/fixtures/source/partials/_user_sets_layout.html.erb +1 -0
  127. data/specs/fixtures/source/partials/hoisted-data.html.erb +6 -0
  128. data/specs/fixtures/source/partials/nested.html.erb +1 -0
  129. data/specs/fixtures/source/partials/params.html.erb +1 -0
  130. data/specs/fixtures/source/partials/with-layouts.html.erb +1 -0
  131. data/specs/fixtures/source/test-multi-procs.html.markdown.erb +3 -0
  132. data/specs/fixtures/source/test-nested-layout.html.erb +1 -0
  133. data/specs/fixtures/source/test-no-layout.html.erb +2 -0
  134. data/specs/fixtures/source/test-yamldoc.html.erb.yamldoc +4 -0
  135. data/specs/fixtures/source/test.html.erb +2 -0
  136. data/specs/hash_object_spec.rb +53 -8
  137. data/specs/render_spec.rb +10 -0
  138. data/specs/site_spec.rb +79 -0
  139. data/specs/spec_helper.rb +59 -0
  140. data/templates/blank/Gemfile +0 -4
  141. data/templates/blank/Gumdrop +180 -113
  142. data/templates/default/Gemfile +3 -8
  143. data/templates/default/Gumdrop +166 -95
  144. data/templates/default/ReadMe.md +14 -0
  145. data/templates/default/config.ru +1 -0
  146. data/templates/default/data/news/20120703.yamldoc +14 -0
  147. data/templates/default/data/news/20120704.yamldoc +8 -0
  148. data/templates/{backbone/source/feed.xml.builder.txt → default/source/feed.xml.builder} +4 -4
  149. data/templates/default/source/index.html.erb +10 -1
  150. data/templates/default/source/theme/layout/_sidebar.html +1 -0
  151. data/templates/{backbone/source/theme/templates/site.template.slim → default/source/theme/layout/site.layout.slim} +3 -3
  152. metadata +212 -63
  153. data/lib/gumdrop/context.rb +0 -135
  154. data/lib/gumdrop/data_manager.rb +0 -214
  155. data/lib/gumdrop/support/base_packager.rb +0 -60
  156. data/lib/gumdrop/support/callbacks.rb +0 -30
  157. data/lib/gumdrop/support/hash_object.rb +0 -22
  158. data/lib/gumdrop/view_helpers.rb +0 -25
  159. data/notes.md +0 -347
  160. data/specs/deferred_loader_spec.rb +0 -31
  161. data/specs/fixtures/expected/posts/post1.html +0 -1
  162. data/specs/fixtures/expected/posts/post1.js +0 -14
  163. data/specs/fixtures/expected/posts/post2.html +0 -5
  164. data/specs/fixtures/expected/sub/sub/sub/test.html +0 -5
  165. data/specs/fixtures/expected/sub/sub/sub/test2.html +0 -5
  166. data/specs/fixtures/expected/test.js +0 -14
  167. data/specs/fixtures/source/posts/post1.html.slim +0 -6
  168. data/specs/fixtures/source/posts/post1.js.coffee +0 -3
  169. data/specs/fixtures/source/posts/post2.html.erb +0 -5
  170. data/specs/fixtures/source/sub/sub/sub/test.html +0 -5
  171. data/specs/fixtures/source/sub/sub/sub/test2.html.erb +0 -5
  172. data/specs/fixtures/source/test.js.coffee +0 -4
  173. data/specs/fixtures/source/test.js.erb.coffee +0 -3
  174. data/templates/backbone/Gumdrop +0 -123
  175. data/templates/backbone/Rakefile +0 -38
  176. data/templates/backbone/app/app.js.coffee +0 -49
  177. data/templates/backbone/app/init.js.coffee +0 -10
  178. data/templates/backbone/app/models/.gitkeep +0 -0
  179. data/templates/backbone/app/utils/index.js.coffee +0 -27
  180. data/templates/backbone/app/views/home.js.coffee +0 -17
  181. data/templates/backbone/app/views/styles/home.scss +0 -8
  182. data/templates/backbone/app/views/templates/home.mustache +0 -2
  183. data/templates/backbone/config.ru +0 -20
  184. data/templates/backbone/lib/all.js.coffee +0 -18
  185. data/templates/backbone/lib/backbone.js +0 -1158
  186. data/templates/backbone/lib/hogan.js +0 -509
  187. data/templates/backbone/lib/jquery.js +0 -9266
  188. data/templates/backbone/lib/underscore.js +0 -981
  189. data/templates/backbone/powrc +0 -2
  190. data/templates/backbone/source/default.htaccess.erb +0 -27
  191. data/templates/backbone/source/favicon.ico +0 -0
  192. data/templates/backbone/source/index.html.erb +0 -2
  193. data/templates/backbone/source/theme/screen.css.sass +0 -9
  194. data/templates/backbone/source/theme/scripts/app.js.coffee +0 -4
  195. data/templates/backbone/source/theme/styles/_tools.scss +0 -434
  196. data/templates/backbone/source/theme/templates/app.template.slim +0 -14
  197. data/templates/default/Rakefile +0 -38
  198. data/templates/default/powrc +0 -2
  199. data/templates/default/source/default.htaccess.erb +0 -27
  200. data/templates/default/source/feed.xml.builder.txt +0 -23
  201. data/templates/default/source/theme/templates/site.template.slim +0 -33
@@ -0,0 +1,10 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Gumdrop::Renderer do
4
+
5
+ it 'should be instantiatable' do
6
+ r= Gumdrop::Renderer.new
7
+ r.wont_be_nil
8
+ end
9
+
10
+ end
@@ -0,0 +1,79 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Gumdrop::Site do
4
+
5
+ it 'should be configured with default settings' do
6
+ site= site_for_source
7
+ site.config.wont_be_nil
8
+ end
9
+
10
+ it 'should have accessors for paths' do
11
+ site= site_for_source
12
+ site.config.source_dir.wont_be_nil
13
+ site.config.source_dir.must_equal '.'
14
+ site.source_dir.wont_be_nil
15
+ site.source_dir.must_equal site.config.source_dir
16
+
17
+ site.output_dir.wont_be_nil
18
+ site.output_dir.must_equal '../output'
19
+
20
+ site.data_dir.wont_be_nil
21
+ site.data_dir.must_equal './data'
22
+ end
23
+
24
+ it 'should allow changing config settings' do
25
+ site= site_for_source
26
+ site.source_dir.must_equal '.'
27
+ site.source_dir.must_equal site.config.source_dir
28
+
29
+ site.config.source_dir= './crap'
30
+ site.config.source_dir.must_equal './crap'
31
+ site.source_dir.must_equal site.config.source_dir
32
+ end
33
+
34
+ it 'should allow listening for events' do
35
+ site= site_for_source
36
+ scanned= 0
37
+ site.on :scan do |event|
38
+ scanned += 1
39
+ end
40
+ site.clear
41
+ site.scan_only #true
42
+ scanned.must_equal 1
43
+ end
44
+
45
+ it 'should allow listening for events from Gumdrop too' do
46
+ site= site_for_source
47
+ scanned= 0
48
+ Gumdrop.site.clear
49
+ Gumdrop.site.on :scan do |event|
50
+ scanned += 1
51
+ end
52
+ Gumdrop.on :before_scan do |event|
53
+ scanned += 1
54
+ end
55
+ Gumdrop.on :scan do |event|
56
+ scanned += 1
57
+ end
58
+ Gumdrop.on :after_scan do |event|
59
+ scanned += 1
60
+ #puts "#{event.data[:payload]} Items Scanned"
61
+ end
62
+ Gumdrop.site.scan_only
63
+ scanned.must_equal 4
64
+ end
65
+
66
+ # it 'should allow changing config settings via block' do
67
+ # site= site_for_source
68
+ # site.source_dir.must_equal './source'
69
+ # site.source_dir.must_equal site.config.source_dir
70
+
71
+ # Gumdrop::Site.configure do |c|
72
+ # c.source_dir= './junk'
73
+ # end
74
+
75
+ # site.config.source_dir.must_equal './junk'
76
+ # site.source_dir.must_equal site.config.source_dir
77
+ # end
78
+
79
+ end
@@ -0,0 +1,59 @@
1
+ require 'pp'
2
+ require 'fileutils'
3
+ require 'minitest/spec'
4
+ require 'minitest/autorun'
5
+ require 'bundler/setup'
6
+
7
+ HERE= File.dirname(__FILE__)
8
+ $LOAD_PATH << File.expand_path(File.join(HERE, '..', 'lib'))
9
+
10
+ require 'gumdrop'
11
+
12
+ # Paths
13
+
14
+ def fixture_path(path)
15
+ (HERE / 'fixtures' / path).expand_path
16
+ end
17
+
18
+ def fixture_src(path)
19
+ fixture_path 'source' / path
20
+ end
21
+
22
+ def fixture_exp(path)
23
+ fixture_path 'expected' / path
24
+ end
25
+
26
+ # Content Objects
27
+
28
+ def content_for_source(path, opts={})
29
+ # content_for fixture_src(path), site_for_source, opts
30
+ # site_for_source.scan_only.contents.get path
31
+ if opts[:generated]
32
+ site_for_source.scan_only
33
+ generator= Gumdrop::Generator.new(nil) { }
34
+ content= Gumdrop::Content.new(path, generator) { }
35
+ content
36
+ else
37
+ site_for_source.scan_only.contents.get path
38
+ end
39
+ end
40
+
41
+ # Site
42
+
43
+ def site_for_source()
44
+ Gumdrop::Site.new fixture_src('Gumdrop'), mode:'test', env:'test'
45
+ end
46
+
47
+ # Custom Assertions
48
+
49
+ module MiniTest::Assertions
50
+ WHITESPACE_RE= Regexp.new('[\s]*', 'im')
51
+ def assert_sorta_like(expected, source)
52
+ exp= expected.gsub(WHITESPACE_RE, '')
53
+ src= source.gsub(WHITESPACE_RE, '')
54
+ assert exp == src, "Expected source to match source (ignoring whitespace)\n#{ exp }\n<=>\n#{ src }"
55
+ end
56
+ end
57
+
58
+ String.infect_an_assertion :assert_sorta_like, :must_be_sorta_like
59
+
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "i18n"
4
- gem "sinatra", :require=>false
5
- gem "active_support"
6
- gem "thor", :require=>false
7
3
  gem "gumdrop"
8
4
 
9
5
  # Add your dependencies here:
@@ -1,141 +1,208 @@
1
1
 
2
- configure do
2
+ Gumdrop.configure do|config|
3
3
 
4
- # All the supported build configuration settings and their defaults:
4
+ # You can add whatever custom config options you'd like:
5
5
 
6
- # set :relative_paths, true
7
- # set :proxy_enabled, false
8
- # set :output_dir, "./output"
9
- # set :source_dir, "./source"
10
- # set :data_dir, './data'
11
- # set :log, './logs/build.log'
12
- # set :ignore, %w(.DS_Store .gitignore .git .svn .sass-cache)
13
- # set :server_timeout, 15
14
- # set :server_port, 4567
6
+ # config.site_title= "My Site"
7
+ # config.site_tagline= "My home on thar intarwebs!"
8
+ # config.site_author= "Me"
9
+ # config.site_url= "http://www.mysite.com"
15
10
 
16
- # set :server, "REMOTE_USERNAME"
17
- # set :server_user, 'server.com'
18
- # set :server_path, '~/server.com'
11
+ # config.redirects= [
12
+ # { from:"old-path.html", to:"new-path.html" }
13
+ # ]
14
+
15
+ # You can modify how Gumdrop runs and where it looks for things by
16
+ # modifying these configuration settings (included below are their
17
+ # default values):
18
+
19
+ # config.output_dir= "./output"
20
+ # config.source_dir= "./source"
21
+ # config.data_dir= './data'
22
+ # config.relative_paths= true
23
+ # config.relative_paths_exts= %w(.html .htm)
24
+ # config.default_layout= 'site'
25
+ # config.layout_exts= %w(.html .htm)
26
+ # config.proxy_enabled= false
27
+ # config.log= STDOUT
28
+ # config.log_level= :info
29
+ # config.server_timeout= 5
30
+ # config.server_port= 4567
31
+ # config.env= :production
32
+ # config.file_change_test= :checksum
33
+
34
+ # You can set ignore/blacklist here, but it'd be better to use the gumdrop
35
+ # methods `Gumdrop.ignore(*paths)` and `Gumdrop.blacklist(*paths)`
36
+ # config.ignore= %w(**/.DS_Store .git* .git/**/* .svn/**/* **/.sass-cache/**/* Gumdrop)
37
+ # config.blacklist= []
38
+
39
+ # Optional, if you want to use the example 'sync' command below.
40
+
41
+ # You can call config.set and pass a hash, if you prefer that format:
42
+ # config.set({
43
+ # server: 'example-server.com',
44
+ # server_user: 'example-username',
45
+ # server_path: '~/example-server.com'
46
+ # })
19
47
 
20
48
  end
21
49
 
50
+ # Ignored files are not read from the source_dir into memory.
51
+ # Use file glob pattern:
52
+ # Gumdrop.ignore "**/ignore.me"
53
+
54
+ # Blacklisted files will not be render to output_dir (even generated pages).
55
+ # Use file glob pattern:
56
+ # Gumdrop.blacklist "**/wont.render"
57
+
58
+ # Generators are a way of dynamically creating pages.
59
+ # You can create generators like the following example or in the source tree
60
+ # by creating a file with the extension `.generator`. The only difference is
61
+ # that generators in the source_dir will assume the `base_path` of the
62
+ # `.generator` file path.
63
+ # Gumdrop.generate 'Apache Specific Stuff (Example)' do
64
+ # page '.htaccess.erb' do
65
+ # # The return value will be used as the file content.
66
+ # # Since we give the filename (above) an .erb extension,
67
+ # # the rendering engine will run the following content
68
+ # # through erb before being saved to disk as `.htaccess`.
69
+ # <<-EOF
70
+ # # For clean urls
71
+ # DirectoryIndex index.html
72
+
73
+ # <IfModule mod_rewrite.c>
74
+ # RewriteEngine On
75
+ # RewriteBase /
76
+
77
+ # # Do not do anything for already existing files and folders
78
+ # RewriteCond %{REQUEST_FILENAME} -f [OR]
79
+ # RewriteCond %{REQUEST_FILENAME} -d
80
+ # RewriteRule .+ - [L]
81
+
82
+ # # add .html file extension (if such file does exist)
83
+ # RewriteCond %{DOCUMENT_ROOT}/$1\.html -f
84
+ # RewriteRule ^(.+[^/])/?$ $1.html [L,QSA]
85
+ # </IfModule>
86
+
87
+ # # BEGIN Gzip
88
+ # <IfModule mod_deflate.c>
89
+ # AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
90
+ # </IfModule>
91
+ # # END Gzip
92
+
93
+ # <% config.redirects.each do |opts| %>
94
+ # Redirect <%= opts[:from] %> <%= opts[:to] %>
95
+ # <% end %>
96
+ # EOF
97
+ # end
22
98
 
23
- # Skipping files entirely from build process... Like they don't exist.
24
- # skip 'file-to-ignore.html'
25
- # skip 'dont-show/**/*'
26
-
27
- # Ignores source file(s) from compilation, but does load the content into memory
28
- # ignore 'pages/**/*.*'
29
-
30
- # NOTE: Skipping and ignoring matches like a file glob (it use File.fnmatch in fact)
31
- # (this doesn't work for files detected by stitch)
32
-
99
+ # end
33
100
 
34
- # Example site-level generator
35
- generate do
36
-
37
- # Requires a about.template.XX file
38
- # page "about.html",
39
- # :template=>'about',
40
- # :passthru=>'Available in the template'
41
-
42
- # page 'robots.txt' do
43
- # # And content returned will be put in the file
44
- # """
45
- # User-Agent: *
46
- # Disallow: /
47
- # """
48
- # end
49
-
50
- # Maybe for a tumblr-like pager
51
- # pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
52
-
53
- # pager.each do |page|
54
- # page "#{page.uri}.html",
55
- # template:'post_page',
56
- # posts:page.items,
57
- # pager:pager,
58
- # current_page:pager.current_page
59
- # end
60
-
61
- # Assemble javscript files in a CommonJS-like way with stitch-rb
62
- # stitch 'app.js', # JavaScript to assemble
63
- # :identifier=>'app', # variable name for the library
64
- # :paths=>['./app'],
65
- # :root=>'./app',
66
- # :dependencies=>[], # List of scripts to prepend to top of file (non moduled)
67
- # :prune=>false, # If true, removes the source files from Gumdrop.site hash
68
- # :compress=>:jsmin, # Options are :jsmin, :yuic, :uglify
69
- # :obfuscate=>false, # For compressors that support munging/mangling
70
- # :keep_src=>true # Creates another file, ex: app-src.js
71
-
72
- # Or use sprockets
73
- # sprockets 'app.js',
74
- # :src=>'app/index.js',
75
- # :paths=>['./lib'],
76
- # :prune=>true,
77
- # :root=>'./src',
78
- # :compress=>:packr,
79
- # :keep_src=>true
80
- end
101
+ # Gumdrop.generate 'Other Examples' do
102
+ # # Renders the about_site partial to about.html.
103
+ # # It passes any other params on to the partial.
104
+ # # page "about.html", :render=>'about_site', :passthru=>'Available to the partial'
105
+
106
+ # # If a block is passed in to `page`, the return value will be used as the file contents.
107
+ # page 'robots.txt' do
108
+ # """
109
+ # User-Agent: *
110
+ # Disallow: /
111
+ # """
112
+ # end
81
113
 
82
- # Example of using a content filter to compress CSS output
83
- # require 'yui/compressor'
84
- # content_filter do |content, info|
85
- # if info.ext == '.css'
86
- # puts " Compress: #{info.filename}"
87
- # compressor= YUI::CssCompressor.new
88
- # compressor.compress( content )
89
- # else
90
- # content
114
+ # # Building a webapp and want to use Sprockets to assemble the JS? Gumdrop
115
+ # # supplies a sprockets helper (and a stitch one, if you'd prefer).
116
+ # # file 'app.js' do
117
+ # # # file generators will not render with any layouts
118
+ # # sprocket 'js/main.js'
119
+ # # end
120
+ # # You might want to keep the source .js files from being generated:
121
+ # # Gumdrop.blacklist "js/**/*.js"
122
+
123
+ # # You can access data from the "./data" folder (by default, it's configurable
124
+ # # of course) so you can create data-driven static pages... If that makes sense.
125
+ # data.news.each do |item|
126
+
127
+ # page "news/#{ item._id }-#{ item.slug }.html.markdown.erb", params:item do
128
+ # # The data manager adds item._id to the resultset. It is
129
+ # # the file's basename minus extname.
130
+ # #
131
+ # # Since we added '.markdown' and '.erb' to the end of the filename,
132
+ # # when this page is rendered, it'll be passed through erb first,
133
+ # # then a markdown engine (which we've included in our Gemfile).
134
+ # #
135
+ # # Notice the params:#object option above, that will take
136
+ # # whatever hash values are there and merge them into the
137
+ # # the Content object's params -- so we can use access that
138
+ # # data elsewhere (see source/index.html.erb).
139
+ # item.content
140
+ # end
91
141
  # end
142
+
143
+ # # With all these generated pages, you might be curious what all will be
144
+ # # built by Gumdrop. To see an overview run:
145
+ # # $ gumdrop uris
92
146
  # end
93
147
 
94
- # All Gumdrop Hooks: on_start, on_before_scan, on_scan, on_before_generate, on_generate, on_before_render, on_render, on_end
95
- on_start do |site|
148
+ # Throughout the life of Gumdrop, several events are fired. You can listen
149
+ # for them like this:
150
+ Gumdrop.on :start do |event|
96
151
  puts "Gumdrop v#{Gumdrop::VERSION} building..."
152
+
153
+ # Some Gumdrop events you can listen for:
154
+ # start, scan, generate, generate_item, render, render_item, end
155
+ #
156
+ # For more, see: https://github.com/darthapo/gumdrop/wiki/Gumdrop-Events
97
157
  end
98
- # on_end do |site| end
99
158
 
100
159
 
101
- # View helpers (available in rendering context):
102
- view_helpers do
160
+ # View helpers (available in the rendering context and generators):
161
+ # Gumdrop.view_helpers do
103
162
 
104
- # Calculate the years for a copyright
105
- def copyright_years(start_year, divider="&#8211;")
106
- end_year = Date.today.year
107
- if start_year == end_year
108
- "#{start_year}"
109
- else
110
- "#{start_year}#{divider}#{end_year}"
111
- end
112
- end
163
+ # # Calculate the years for a copyright
164
+ # def copyright_years(start_year, divider="&#8211;")
165
+ # end_year = Date.today.year
166
+ # if start_year == end_year
167
+ # "#{start_year}"
168
+ # else
169
+ # "#{start_year}#{divider}#{end_year}"
170
+ # end
171
+ # end
113
172
 
114
- #
115
- # Your custom helpers go here!
116
- #
173
+ # #
174
+ # # Your custom helpers go here!
175
+ # #
176
+
177
+ # end
117
178
 
118
- end
119
179
 
120
- # Add (thor) tasks to gumdrop command
121
- # for more: https://github.com/wycats/thor/wiki
122
- # tasks do
180
+ # Add your own commands to the gumdrop command line interface (for this site)!
181
+ # For more, see: https://github.com/wycats/thor/wiki
182
+ # Gumdrop.cli do
123
183
 
124
- # desc 'sync', "Syncs with public server using rsync (if configured)"
125
- # method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
126
- # method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
127
- # def sync
128
- # SITE.build if options[:build]
129
- # config= SITE.config
130
- # output= SITE.config.output_dir
131
- # cmd= "rsync -avz --delete #{output} #{config.server_user}@#{config.server}:#{config.server_path}"
132
- # puts "Running:\n#{cmd}\n"
133
- # system(cmd) unless options[:dry_run]
134
- # end
184
+ # desc 'sync', "Syncs with public server using rsync (if configured)"
185
+ # method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
186
+ # method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
187
+ # def sync
188
+ # Gumdrop.site.build if options[:build]
189
+ # config= Gumdrop.site.config
190
+ # output= Gumdrop.site.output_path
191
+ # dry_run= options[:dry_run] ? 'n' : ''
192
+ # unless config.server.nil? or config.server == 'example-server.com'
193
+ # cmd= "rsync -avz#{ dry_run } --delete #{ output } #{ config.server_user }@#{ config.server }:#{ config.server_path }"
194
+ # say "Running:\n#{ cmd }\n"
195
+ # system(cmd)
196
+ # else
197
+ # say "To use this command, please configure your server info in the Gumdrop file!"
198
+ # end
199
+ # end
135
200
 
136
201
  # end
137
202
 
138
- # Any specialized code for your site goes here...
203
+
204
+ # Any other code you'd like to run... This is just a ruby file, after all!
139
205
 
140
206
  # require 'slim'
141
207
  # Slim::Engine.set_default_options pretty:true
208
+
@@ -1,11 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "i18n"
4
- gem "sinatra", :require=>false
5
- gem "active_support"
6
- gem "thor", :require=>false
7
- gem "rake"
8
- gem "gumdrop"
3
+ gem "gumdrop", :path=>'../../'
9
4
 
10
5
  # Add your dependencies here:
11
6
 
@@ -25,11 +20,11 @@ gem 'stitch-rb'
25
20
  #gem 'sprockets'
26
21
 
27
22
  # For markdown support, a couple of options:
28
- # gem "kramdown", :git => "git://github.com/darthapo/kramdown.git"
23
+ gem "kramdown", :git => "git://github.com/darthapo/kramdown.git"
29
24
  # gem 'redcarpet'
30
25
  # gem "rdiscount"
31
26
  # gem 'maruku'
32
27
 
33
28
  # For xml generation support:
34
- # gem 'builder'
29
+ gem 'builder'
35
30