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/specs/site_spec.rb
ADDED
@@ -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
|
+
|
data/templates/blank/Gemfile
CHANGED
data/templates/blank/Gumdrop
CHANGED
@@ -1,141 +1,208 @@
|
|
1
1
|
|
2
|
-
configure do
|
2
|
+
Gumdrop.configure do|config|
|
3
3
|
|
4
|
-
#
|
4
|
+
# You can add whatever custom config options you'd like:
|
5
5
|
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
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
|
-
#
|
17
|
-
#
|
18
|
-
#
|
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
|
-
#
|
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
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
|
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
|
-
#
|
95
|
-
|
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
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
163
|
+
# # Calculate the years for a copyright
|
164
|
+
# def copyright_years(start_year, divider="–")
|
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
|
-
|
116
|
-
|
173
|
+
# #
|
174
|
+
# # Your custom helpers go here!
|
175
|
+
# #
|
176
|
+
|
177
|
+
# end
|
117
178
|
|
118
|
-
end
|
119
179
|
|
120
|
-
# Add
|
121
|
-
#
|
122
|
-
#
|
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
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
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
|
+
|
data/templates/default/Gemfile
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "
|
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
|
-
|
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
|
-
|
29
|
+
gem 'builder'
|
35
30
|
|