gumdrop 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/ChangeLog.md +13 -0
- data/Gemfile +6 -2
- data/Gemfile.lock +43 -3
- data/Rakefile +37 -21
- data/Readme.md +60 -158
- data/bin/gumdrop +2 -1
- data/gumdrop.gemspec +11 -4
- data/lib/gumdrop/builder.rb +164 -0
- data/lib/gumdrop/cli/external.rb +14 -9
- data/lib/gumdrop/cli/internal.rb +54 -22
- data/lib/gumdrop/cli.rb +21 -0
- data/lib/gumdrop/content.rb +195 -132
- data/lib/gumdrop/data.rb +185 -0
- data/lib/gumdrop/data_providers/csv.rb +18 -0
- data/lib/gumdrop/data_providers/pstore.rb +25 -0
- data/lib/gumdrop/data_providers/sqlite.rb +43 -0
- data/lib/gumdrop/data_providers/xml.rb +15 -0
- data/lib/gumdrop/data_providers/yaml_and_json.rb +18 -0
- data/lib/gumdrop/data_providers/yamldb.rb +18 -0
- data/lib/gumdrop/data_providers/yamldoc.rb +12 -0
- data/lib/gumdrop/generator.rb +118 -94
- data/lib/gumdrop/renderer.rb +272 -0
- data/lib/gumdrop/server.rb +36 -27
- data/lib/gumdrop/site.rb +283 -338
- data/lib/gumdrop/support/compressor.rb +52 -0
- data/lib/gumdrop/support/sprockets.rb +14 -23
- data/lib/gumdrop/support/stitch.rb +25 -14
- data/lib/gumdrop/support/yaml_doc_template.rb +29 -0
- data/lib/gumdrop/util/configurable.rb +44 -0
- data/lib/gumdrop/util/core_ex.rb +84 -0
- data/lib/gumdrop/util/eventable.rb +35 -0
- data/lib/gumdrop/util/hash_object.rb +70 -0
- data/lib/gumdrop/util/loggable.rb +44 -0
- data/lib/gumdrop/util/pager.rb +51 -0
- data/lib/gumdrop/{support → util}/proxy_handler.rb +7 -6
- data/lib/gumdrop/util/scanner.rb +47 -0
- data/lib/gumdrop/util/site_access.rb +16 -0
- data/lib/gumdrop/util/view_helpers.rb +50 -0
- data/lib/gumdrop/util/yaml_doc.rb +51 -0
- data/lib/gumdrop/version.rb +2 -2
- data/lib/gumdrop.rb +40 -77
- data/specs/content_spec.rb +83 -73
- data/specs/fixtures/expected/data-access/from-csv.html +4 -0
- data/specs/fixtures/expected/data-access/from-json.html +6 -0
- data/specs/fixtures/expected/data-access/from-sqlite.html +5 -0
- data/specs/fixtures/expected/data-access/from-xml.html +4 -0
- data/specs/fixtures/expected/data-access/from-yaml.html +5 -0
- data/specs/fixtures/expected/data-access/from-yamldb.html +5 -0
- data/specs/fixtures/expected/data-access/from-yamldoc.html +2 -0
- data/specs/fixtures/expected/gen-with-block/as-file.html +1 -0
- data/specs/fixtures/expected/gen-with-block/as-plain.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-nested.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-nil.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-wrap.html +1 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-as-file.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-as-plain.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-nil.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-sub.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-wrap.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-as-file.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-as-plain.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-nil.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-sub.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-wrap.html +4 -0
- data/specs/fixtures/expected/goodbye.html +1 -0
- data/specs/fixtures/expected/hello.html +1 -0
- data/specs/fixtures/expected/image.png +0 -0
- data/specs/fixtures/expected/index.html +47 -0
- data/specs/fixtures/expected/js/sprockets-app.js +7 -0
- data/specs/fixtures/expected/js/stitch-app.js +65 -0
- data/specs/fixtures/expected/js/stitch-app.min.js +5 -0
- data/specs/fixtures/expected/js/stitch-app.min.src.js +65 -0
- data/specs/fixtures/expected/js/straight.js +8 -0
- data/specs/fixtures/expected/js/test-coffee.js +5 -0
- data/specs/fixtures/expected/pages/docs/force-abs.html +2 -0
- data/specs/fixtures/expected/pages/docs/index.html +2 -0
- data/specs/fixtures/expected/partials/hoisted-data.html +3 -0
- data/specs/fixtures/expected/partials/nested.html +7 -0
- data/specs/fixtures/expected/partials/params.html +1 -0
- data/specs/fixtures/expected/partials/with-layouts.html +1 -0
- data/specs/fixtures/expected/robots.txt +1 -0
- data/specs/fixtures/expected/test-multi-procs.html +4 -0
- data/specs/fixtures/expected/test-nested-layout.html +1 -0
- data/specs/fixtures/expected/test-no-layout.html +2 -0
- data/specs/fixtures/expected/test-yamldoc.html +1 -0
- data/specs/fixtures/expected/test.html +2 -0
- data/{templates/backbone → specs/fixtures/source}/Gemfile +8 -4
- data/specs/fixtures/source/Gemfile.lock +84 -0
- data/specs/fixtures/source/Gumdrop +60 -9
- data/specs/fixtures/source/data/csv_data.csv +2 -0
- data/specs/fixtures/source/data/json_data.json +13 -0
- data/specs/fixtures/source/data/sql_data.sqlite +0 -0
- data/specs/fixtures/source/data/xml_data.xml +4 -0
- data/specs/fixtures/source/data/yaml_db.yamldb +9 -0
- data/specs/fixtures/source/data/yaml_items.yaml +2 -0
- data/specs/fixtures/source/data/yamldoc.yamldoc +4 -0
- data/specs/fixtures/source/data-access/from-csv.html.erb +4 -0
- data/specs/fixtures/source/data-access/from-json.html.erb +6 -0
- data/specs/fixtures/source/data-access/from-sqlite.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-xml.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yaml.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yamldb.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yamldoc.html.erb +2 -0
- data/specs/fixtures/source/gen-with-inline-render.generator +7 -0
- data/specs/fixtures/source/goodbye.html.erb +1 -0
- data/specs/fixtures/source/hello.html +1 -0
- data/specs/fixtures/source/image.png +0 -0
- data/specs/fixtures/source/index.html.erb +6 -0
- data/specs/fixtures/source/js/sprockets/app.js +2 -0
- data/specs/fixtures/source/js/sprockets/view.js.coffee +1 -0
- data/specs/fixtures/source/js/stitch/app.js +1 -0
- data/specs/fixtures/source/js/stitch/view.js.coffee +1 -0
- data/specs/fixtures/source/js/straight.js +8 -0
- data/specs/fixtures/source/js/test-coffee.js.coffee +1 -0
- data/specs/fixtures/source/layouts/site.layout.erb +1 -0
- data/specs/fixtures/source/layouts/sub.layout.erb +1 -0
- data/specs/fixtures/source/layouts/wrap.layout.erb +1 -0
- data/specs/fixtures/source/pages/_users-nested.html.erb +7 -0
- data/specs/fixtures/source/pages/docs/force-abs.html.erb +2 -0
- data/specs/fixtures/source/pages/docs/index.html.erb +2 -0
- data/specs/fixtures/source/partials/_post_entry.html.erb +4 -0
- data/specs/fixtures/source/partials/_provides_name.html.erb +1 -0
- data/specs/fixtures/source/partials/_user-params.html.erb +1 -0
- data/specs/fixtures/source/partials/_user.html.erb +1 -0
- data/specs/fixtures/source/partials/_user_sets_layout.html.erb +1 -0
- data/specs/fixtures/source/partials/hoisted-data.html.erb +6 -0
- data/specs/fixtures/source/partials/nested.html.erb +1 -0
- data/specs/fixtures/source/partials/params.html.erb +1 -0
- data/specs/fixtures/source/partials/with-layouts.html.erb +1 -0
- data/specs/fixtures/source/test-multi-procs.html.markdown.erb +3 -0
- data/specs/fixtures/source/test-nested-layout.html.erb +1 -0
- data/specs/fixtures/source/test-no-layout.html.erb +2 -0
- data/specs/fixtures/source/test-yamldoc.html.erb.yamldoc +4 -0
- data/specs/fixtures/source/test.html.erb +2 -0
- data/specs/hash_object_spec.rb +53 -8
- data/specs/render_spec.rb +10 -0
- data/specs/site_spec.rb +79 -0
- data/specs/spec_helper.rb +59 -0
- data/templates/blank/Gemfile +0 -4
- data/templates/blank/Gumdrop +180 -113
- data/templates/default/Gemfile +3 -8
- data/templates/default/Gumdrop +166 -95
- data/templates/default/ReadMe.md +14 -0
- data/templates/default/config.ru +1 -0
- data/templates/default/data/news/20120703.yamldoc +14 -0
- data/templates/default/data/news/20120704.yamldoc +8 -0
- data/templates/{backbone/source/feed.xml.builder.txt → default/source/feed.xml.builder} +4 -4
- data/templates/default/source/index.html.erb +10 -1
- data/templates/default/source/theme/layout/_sidebar.html +1 -0
- data/templates/{backbone/source/theme/templates/site.template.slim → default/source/theme/layout/site.layout.slim} +3 -3
- metadata +212 -63
- data/lib/gumdrop/context.rb +0 -135
- data/lib/gumdrop/data_manager.rb +0 -214
- data/lib/gumdrop/support/base_packager.rb +0 -60
- data/lib/gumdrop/support/callbacks.rb +0 -30
- data/lib/gumdrop/support/hash_object.rb +0 -22
- data/lib/gumdrop/view_helpers.rb +0 -25
- data/notes.md +0 -347
- data/specs/deferred_loader_spec.rb +0 -31
- data/specs/fixtures/expected/posts/post1.html +0 -1
- data/specs/fixtures/expected/posts/post1.js +0 -14
- data/specs/fixtures/expected/posts/post2.html +0 -5
- data/specs/fixtures/expected/sub/sub/sub/test.html +0 -5
- data/specs/fixtures/expected/sub/sub/sub/test2.html +0 -5
- data/specs/fixtures/expected/test.js +0 -14
- data/specs/fixtures/source/posts/post1.html.slim +0 -6
- data/specs/fixtures/source/posts/post1.js.coffee +0 -3
- data/specs/fixtures/source/posts/post2.html.erb +0 -5
- data/specs/fixtures/source/sub/sub/sub/test.html +0 -5
- data/specs/fixtures/source/sub/sub/sub/test2.html.erb +0 -5
- data/specs/fixtures/source/test.js.coffee +0 -4
- data/specs/fixtures/source/test.js.erb.coffee +0 -3
- data/templates/backbone/Gumdrop +0 -123
- data/templates/backbone/Rakefile +0 -38
- data/templates/backbone/app/app.js.coffee +0 -49
- data/templates/backbone/app/init.js.coffee +0 -10
- data/templates/backbone/app/models/.gitkeep +0 -0
- data/templates/backbone/app/utils/index.js.coffee +0 -27
- data/templates/backbone/app/views/home.js.coffee +0 -17
- data/templates/backbone/app/views/styles/home.scss +0 -8
- data/templates/backbone/app/views/templates/home.mustache +0 -2
- data/templates/backbone/config.ru +0 -20
- data/templates/backbone/lib/all.js.coffee +0 -18
- data/templates/backbone/lib/backbone.js +0 -1158
- data/templates/backbone/lib/hogan.js +0 -509
- data/templates/backbone/lib/jquery.js +0 -9266
- data/templates/backbone/lib/underscore.js +0 -981
- data/templates/backbone/powrc +0 -2
- data/templates/backbone/source/default.htaccess.erb +0 -27
- data/templates/backbone/source/favicon.ico +0 -0
- data/templates/backbone/source/index.html.erb +0 -2
- data/templates/backbone/source/theme/screen.css.sass +0 -9
- data/templates/backbone/source/theme/scripts/app.js.coffee +0 -4
- data/templates/backbone/source/theme/styles/_tools.scss +0 -434
- data/templates/backbone/source/theme/templates/app.template.slim +0 -14
- data/templates/default/Rakefile +0 -38
- data/templates/default/powrc +0 -2
- data/templates/default/source/default.htaccess.erb +0 -27
- data/templates/default/source/feed.xml.builder.txt +0 -23
- data/templates/default/source/theme/templates/site.template.slim +0 -33
data/templates/default/Gumdrop
CHANGED
@@ -1,98 +1,164 @@
|
|
1
1
|
|
2
|
-
configure do
|
2
|
+
Gumdrop.configure do|config|
|
3
3
|
|
4
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
#
|
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
|
-
|
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
|
-
|
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
|
-
|
51
|
-
#
|
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
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
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
|
-
#
|
62
|
-
|
63
|
-
#
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
#
|
75
|
-
|
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
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
|
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="–")
|
@@ -110,26 +176,31 @@ view_helpers do
|
|
110
176
|
|
111
177
|
end
|
112
178
|
|
113
|
-
# Add
|
114
|
-
#
|
115
|
-
|
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
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
200
|
+
end
|
130
201
|
|
131
202
|
|
132
|
-
# Any
|
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)
|
data/templates/default/config.ru
CHANGED
@@ -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
|
+
```
|
@@ -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.
|
8
|
+
xml.updated data.news.first.date.to_time.iso8601
|
9
9
|
xml.author { xml.name config.site_author }
|
10
10
|
|
11
|
-
|
11
|
+
site.contents.find("news/**/*").each do |post|
|
12
12
|
xml.entry do
|
13
|
-
url= "#{config.site_url}/
|
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
|
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
|
9
|
-
script src
|
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
|
21
|
+
a href='/index.html' Home
|
22
22
|
article
|
23
23
|
div.row
|
24
24
|
div.col.span-8
|