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
@@ -1,98 +1,164 @@
1
1
 
2
- configure do
2
+ Gumdrop.configure do|config|
3
3
 
4
- set :site_title, "My Site"
5
- set :site_tagline, "My home on thar intarwebs!"
6
- set :site_author, "Me"
7
- set :site_url, "http://www.mysite.com"
8
-
9
- # All the supported build configuration settings and their defaults:
10
- # set :relative_paths, true
11
- # set :proxy_enabled, false
12
- # set :output_dir, "./output"
13
- # set :source_dir, "./source"
14
- # set :data_dir, './data'
15
- # set :log, './logs/build.log'
16
- # set :ignore, %w(.DS_Store .gitignore .git .svn .sass-cache)
17
- # set :server_timeout, 15
18
- # set :server_port, 4567
19
-
20
- end
4
+ # You can add whatever custom config options you'd like:
21
5
 
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"
22
10
 
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/**/*.*'
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
+ })
29
47
 
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)
48
+ end
32
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
33
98
 
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
99
+ end
49
100
 
50
- # Maybe for a tumblr-like pager
51
- # pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
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
52
113
 
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
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'
59
119
  # 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
-
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
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
72
146
  end
73
147
 
74
- # All Gumdrop Hooks: on_start, on_before_scan, on_scan, on_before_generate, on_generate, on_before_render, on_render, on_end
75
- 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|
76
151
  puts "Gumdrop v#{Gumdrop::VERSION} building..."
77
- end
78
- # on_end do |site| end
79
152
 
80
-
81
- # Example of using a content filter to compress CSS output
82
- # require 'yui/compressor'
83
- # content_filter do |content, info|
84
- # if info.ext == '.css'
85
- # puts " Compress: #{info.filename}"
86
- # compressor= YUI::CssCompressor.new
87
- # compressor.compress( content )
88
- # else
89
- # content
90
- # end
91
- # end
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
157
+ end
92
158
 
93
159
 
94
- # View helpers (available in rendering context):
95
- view_helpers do
160
+ # View helpers (available in the rendering context and generators):
161
+ Gumdrop.view_helpers do
96
162
 
97
163
  # Calculate the years for a copyright
98
164
  def copyright_years(start_year, divider="&#8211;")
@@ -110,26 +176,31 @@ view_helpers do
110
176
 
111
177
  end
112
178
 
113
- # Add (thor) tasks to gumdrop command
114
- # for more: https://github.com/wycats/thor/wiki
115
- # tasks do
179
+ # Add your own commands to the gumdrop command line interface (for this site)!
180
+ # For more, see: https://github.com/wycats/thor/wiki
181
+ Gumdrop.cli do
116
182
 
117
- # desc 'sync', "Syncs with public server using rsync (if configured)"
118
- # method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
119
- # method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
120
- # def sync
121
- # SITE.build if options[:build]
122
- # config= SITE.config
123
- # output= SITE.config.output_dir
124
- # cmd= "rsync -avz --delete #{output} #{config.server_user}@#{config.server}:#{config.server_path}"
125
- # puts "Running:\n#{cmd}\n"
126
- # system(cmd) unless options[:dry_run]
127
- # end
183
+ desc 'sync', "Syncs with public server using rsync (if configured)"
184
+ method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
185
+ method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
186
+ def sync
187
+ Gumdrop.site.build if options[:build]
188
+ config= Gumdrop.site.config
189
+ output= Gumdrop.site.output_path
190
+ dry_run= options[:dry_run] ? 'n' : ''
191
+ unless config.server.nil? or config.server == 'example-server.com'
192
+ cmd= "rsync -avz#{ dry_run } --delete #{ output } #{ config.server_user }@#{ config.server }:#{ config.server_path }"
193
+ say "Running:\n#{ cmd }\n"
194
+ system(cmd)
195
+ else
196
+ say "To use this command, please configure your server info in the Gumdrop file!"
197
+ end
198
+ end
128
199
 
129
- # end
200
+ end
130
201
 
131
202
 
132
- # Any specialized code for your site goes here...
203
+ # Any other code you'd like to run... This is just a ruby file, after all!
133
204
 
134
205
  require 'slim'
135
206
  Slim::Engine.set_default_options pretty:true
@@ -0,0 +1,14 @@
1
+ # Welcome to Gumdrop!
2
+
3
+ This is an example site that you can use as a starting point. Or you can just
4
+ poke around and see what all can be done and then start with an empty project
5
+ by running this (in a non-Gumdrop site folder):
6
+
7
+ $ gumdrop new -t blank MY_NEW_SITE
8
+
9
+ ## Lots More
10
+
11
+ Gumdrop can do quite a lot and is very configurable. Be sure and read the wiki
12
+ for documentation and more examples!
13
+
14
+ [https://github.com/darthapo/gumdrop/wiki](https://github.com/darthapo/gumdrop/wiki)
@@ -5,6 +5,7 @@ require 'bundler'
5
5
 
6
6
  begin
7
7
  Bundler.setup(:default, :development)
8
+ Bundler.require if File.exists?('Gemfile')
8
9
  rescue Bundler::BundlerError => e
9
10
  $stderr.puts e.message
10
11
  $stderr.puts "Run `bundle install` to install missing gems"
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Getting Ready for Release
3
+ slug: getting-ready-for-release
4
+ date: 2012-07-03 16:05:00 -0500
5
+ ---
6
+ # <%= title %>
7
+
8
+ Updating the docs and templates, hopeful for a launch of Gumdrop 1.0 later this week!
9
+
10
+ ```ruby
11
+ Gumdrop.on :start do |event|
12
+ puts "Throw a party!"
13
+ end
14
+ ```
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Uncle Sam Turns 236!
3
+ slug: uncle-sam-turns-236
4
+ date: 2012-07-04 01:00:00 -0500
5
+ ---
6
+ # <%= title %>
7
+
8
+ And looks better than you will at that age!
@@ -5,19 +5,19 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
5
5
  xml.id config.site_url
6
6
  xml.link "href" => config.site_url
7
7
  xml.link "href" => "#{config.site_url}/feed.xml", "rel" => "self"
8
- xml.updated data.blog.first.date.to_time.iso8601
8
+ xml.updated data.news.first.date.to_time.iso8601
9
9
  xml.author { xml.name config.site_author }
10
10
 
11
- data.blog.each do |post|
11
+ site.contents.find("news/**/*").each do |post|
12
12
  xml.entry do
13
- url= "#{config.site_url}/posts/#{post.slug}"
13
+ url= "#{config.site_url}/news/#{post._id}-#{post.slug}.html"
14
14
  xml.title post.title
15
15
  xml.link "rel" => "alternate", "href" => url
16
16
  xml.id url
17
17
  xml.published post.date.to_time.iso8601
18
18
  xml.updated post.date.to_time.iso8601
19
19
  xml.author { xml.name config.site_author }
20
- xml.content post.body, "type" => "html"
20
+ xml.content render(post), "type" => "html"
21
21
  end
22
22
  end
23
23
  end
@@ -1 +1,10 @@
1
- <p>Welcome to <%= config.site_title %></p>
1
+ <p>Welcome to <%= config.site_title %></p>
2
+ <h4>News</h4>
3
+ <ul>
4
+ <%
5
+ # We can query Gumdrop for the contents of the source_tree:
6
+ site.contents.find('news/**/*').each do |page|
7
+ %>
8
+ <li><a href="<%= page.uri %>"><%= page.title %></a></li>
9
+ <% end %>
10
+ </ul>
@@ -0,0 +1 @@
1
+ <p>I'm the sidebar partial!</p>
@@ -5,8 +5,8 @@ html lang="en"
5
5
  title= config.site_title
6
6
  /[if le IE 9]
7
7
  script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
8
- link rel="stylesheet" href==uri('theme/screen.css') type="text/css" media="screen" charset="utf-8"
9
- script src==uri('theme/scripts/app.js')
8
+ link rel="stylesheet" href='/theme/screen.css' type="text/css" media="screen" charset="utf-8"
9
+ script src='/theme/scripts/app.js'
10
10
  body
11
11
  div.row
12
12
  div.col.span-12
@@ -18,7 +18,7 @@ html lang="en"
18
18
  nav
19
19
  ul
20
20
  li
21
- a href==uri('/') Home
21
+ a href='/index.html' Home
22
22
  article
23
23
  div.row
24
24
  div.col.span-8