gumdrop 0.4.0 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -2
- data/ChangeLog.md +17 -0
- data/Notes.md +8 -1
- data/lib/gumdrop.rb +82 -45
- data/lib/gumdrop/build.rb +10 -0
- data/lib/gumdrop/cli.rb +119 -33
- data/lib/gumdrop/context.rb +6 -1
- data/lib/gumdrop/deferred_loader.rb +54 -15
- data/lib/gumdrop/dsl.rb +8 -2
- data/lib/gumdrop/generator.rb +41 -2
- data/lib/gumdrop/version.rb +1 -1
- data/{lib/gumdrop/template/default → templates/backbone}/Gemfile +6 -4
- data/templates/backbone/Gumdrop +119 -0
- data/{lib/gumdrop/template → templates}/backbone/Rakefile +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/app.js.coffee +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/init.js.coffee +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/models/.gitkeep +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/utils/index.js.coffee +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/views/home.js.coffee +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/views/styles/home.scss +0 -0
- data/{lib/gumdrop/template → templates}/backbone/app/views/templates/home.mustache +0 -0
- data/{lib/gumdrop/template → templates}/backbone/config.ru +0 -0
- data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/all.js.coffee +0 -0
- data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/backbone.js +0 -0
- data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/hogan.js +0 -0
- data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/jquery.js +0 -0
- data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/underscore.js +0 -0
- data/{lib/gumdrop/template → templates}/backbone/powrc +0 -0
- data/{lib/gumdrop/template/backbone/source/default.htaccess → templates/backbone/source/default.htaccess.erb} +4 -0
- data/{examples/simple → templates/backbone}/source/favicon.ico +0 -0
- data/{lib/gumdrop/template → templates}/backbone/source/feed.xml.builder.txt +8 -8
- data/{lib/gumdrop/template → templates}/backbone/source/index.html.erb +0 -0
- data/{lib/gumdrop/template → templates}/backbone/source/theme/screen.css.sass +0 -0
- data/{lib/gumdrop/template → templates}/backbone/source/theme/scripts/app.js.coffee +0 -0
- data/{examples/simple → templates/backbone}/source/theme/styles/_tools.scss +0 -0
- data/{lib/gumdrop/template → templates}/backbone/source/theme/templates/app.template.slim +1 -1
- data/{lib/gumdrop/template → templates}/backbone/source/theme/templates/site.template.slim +3 -3
- data/{lib/gumdrop/template/backbone → templates/default}/Gemfile +6 -4
- data/templates/default/Gumdrop +109 -0
- data/{lib/gumdrop/template → templates}/default/Rakefile +0 -0
- data/{lib/gumdrop/template → templates}/default/config.ru +0 -0
- data/{lib/gumdrop/template → templates}/default/powrc +0 -0
- data/{lib/gumdrop/template/default/source/default.htaccess → templates/default/source/default.htaccess.erb} +11 -1
- data/{lib/gumdrop/template/backbone → templates/default}/source/favicon.ico +0 -0
- data/{lib/gumdrop/template → templates}/default/source/feed.xml.builder.txt +8 -8
- data/templates/default/source/index.html.erb +1 -0
- data/{lib/gumdrop/template → templates}/default/source/theme/screen.css.sass +0 -0
- data/{lib/gumdrop/template → templates}/default/source/theme/scripts/app.js.coffee +0 -0
- data/{lib/gumdrop/template/backbone → templates/default}/source/theme/styles/_tools.scss +0 -0
- data/{lib/gumdrop/template → templates}/default/source/theme/templates/site.template.slim +3 -3
- metadata +56 -83
- data/examples/simple/Gemfile +0 -22
- data/examples/simple/Rakefile +0 -42
- data/examples/simple/config.ru +0 -15
- data/examples/simple/data/config.yml +0 -10
- data/examples/simple/data/posts.yamldb +0 -28
- data/examples/simple/lib/site.rb +0 -24
- data/examples/simple/lib/view_helpers.rb +0 -17
- data/examples/simple/source/.htaccess +0 -16
- data/examples/simple/source/_pager_control.html.erb +0 -14
- data/examples/simple/source/_sidebar.html.haml +0 -2
- data/examples/simple/source/feed.xml.builder +0 -23
- data/examples/simple/source/index.html.erb +0 -4
- data/examples/simple/source/posts.generator.rb +0 -11
- data/examples/simple/source/posts/index.html.erb +0 -6
- data/examples/simple/source/theme/screen.css.scss +0 -10
- data/examples/simple/source/theme/scripts/app.js.coffee +0 -0
- data/examples/simple/source/theme/templates/post.template.haml +0 -3
- data/examples/simple/source/theme/templates/post_page.template.haml +0 -6
- data/examples/simple/source/theme/templates/site.template.haml +0 -33
- data/examples/simple/source/theme/templates/test.template.erb +0 -1
- data/lib/gumdrop/template/backbone/data/config.yml +0 -4
- data/lib/gumdrop/template/backbone/lib/site.rb +0 -62
- data/lib/gumdrop/template/backbone/lib/stitch_compilers.rb +0 -1
- data/lib/gumdrop/template/backbone/lib/view_helpers.rb +0 -17
- data/lib/gumdrop/template/default/data/config.yml +0 -4
- data/lib/gumdrop/template/default/lib/site.rb +0 -50
- data/lib/gumdrop/template/default/lib/view_helpers.rb +0 -17
- data/lib/gumdrop/template/default/source/favicon.ico +0 -0
- data/lib/gumdrop/template/default/source/index.html.erb +0 -1
- data/lib/gumdrop/template/default/source/theme/styles/_tools.scss +0 -434
data/lib/gumdrop/dsl.rb
CHANGED
|
@@ -11,14 +11,20 @@ module Gumdrop
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.skip(path)
|
|
14
|
-
Gumdrop.report " blacklist: #{path}", :info
|
|
15
14
|
Gumdrop.blacklist << path
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def self.ignore(path)
|
|
19
|
-
Gumdrop.report " greylist: #{path}", :info
|
|
20
18
|
Gumdrop.greylist << path
|
|
21
19
|
end
|
|
20
|
+
|
|
21
|
+
def self.view_helpers(&block)
|
|
22
|
+
Gumdrop::ViewHelpers.class_eval &block
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.configure(&block)
|
|
26
|
+
Gumdrop::Configurator.instance_eval &block
|
|
27
|
+
end
|
|
22
28
|
|
|
23
29
|
end
|
|
24
30
|
end
|
data/lib/gumdrop/generator.rb
CHANGED
|
@@ -51,16 +51,55 @@ module Gumdrop
|
|
|
51
51
|
|
|
52
52
|
Gumdrop.site[content.uri]= content
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
# FIXME: Does redirect require abs-paths?
|
|
56
|
+
def redirect(from, opts={})
|
|
57
|
+
if opts[:to]
|
|
58
|
+
page from do
|
|
59
|
+
<<-EOF
|
|
60
|
+
<meta http-equiv="refresh" content="0;url=#{ opts[:to] }">
|
|
61
|
+
<script> window.location.href='#{ opts[:to] }'; </script>
|
|
62
|
+
EOF
|
|
63
|
+
end
|
|
64
|
+
opts[:from]= from
|
|
65
|
+
Gumdrop.redirects << opts
|
|
66
|
+
else
|
|
67
|
+
Gumdrop.report "You must specify :to in a redirect", :warning
|
|
68
|
+
end
|
|
69
|
+
end
|
|
54
70
|
|
|
55
71
|
def stitch(name, opts)
|
|
56
72
|
require 'gumdrop/stitch_ex'
|
|
57
73
|
require 'gumdrop/stitch_compilers'
|
|
74
|
+
content= Stitch::Package.new(opts).compile
|
|
58
75
|
page name do
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
case opts[:compress]
|
|
77
|
+
|
|
78
|
+
when true, :jsmin
|
|
61
79
|
require 'jsmin'
|
|
62
80
|
JSMin.minify content
|
|
81
|
+
|
|
82
|
+
when :yuic
|
|
83
|
+
require "yui/compressor"
|
|
84
|
+
compressor = YUI::JavaScriptCompressor.new(:munge => opts[:obfuscate])
|
|
85
|
+
compressor.compress(content)
|
|
86
|
+
|
|
87
|
+
when :uglify
|
|
88
|
+
require "uglifier"
|
|
89
|
+
Uglifier.compile( content, :mangle=>opts[:obfuscate])
|
|
90
|
+
|
|
91
|
+
when false
|
|
92
|
+
content
|
|
93
|
+
|
|
63
94
|
else
|
|
95
|
+
# UNKNOWN Compressor type!
|
|
96
|
+
Gumdrop.report "Unknown javascript compressor type! (#{ opts[:compressor] })", :warning
|
|
97
|
+
content
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
if opts[:keep_src] or opts[:keep_source]
|
|
101
|
+
ext= File.extname name
|
|
102
|
+
page name.gsub(ext, "#{opts.fetch(:source_postfix, '-src')}#{ext}") do
|
|
64
103
|
content
|
|
65
104
|
end
|
|
66
105
|
end
|
data/lib/gumdrop/version.rb
CHANGED
|
@@ -9,10 +9,16 @@ gem "gumdrop"
|
|
|
9
9
|
|
|
10
10
|
# Add your dependencies here:
|
|
11
11
|
|
|
12
|
+
# For template support:
|
|
13
|
+
# gem "less"
|
|
14
|
+
# gem "haml"
|
|
12
15
|
gem "slim"
|
|
13
16
|
gem "sass"
|
|
14
17
|
gem "coffee-script"
|
|
15
18
|
|
|
19
|
+
# For JavaScript stitching and compressing:
|
|
20
|
+
#gem 'uglifier'
|
|
21
|
+
#gem 'yui-compressor'
|
|
16
22
|
gem 'jsmin'
|
|
17
23
|
gem 'stitch-rb'
|
|
18
24
|
|
|
@@ -20,10 +26,6 @@ gem 'stitch-rb'
|
|
|
20
26
|
# gem "rdiscount"
|
|
21
27
|
# gem 'maruku'
|
|
22
28
|
|
|
23
|
-
# For template support:
|
|
24
|
-
# gem "less"
|
|
25
|
-
# gem "haml"
|
|
26
|
-
|
|
27
29
|
# For xml generation support:
|
|
28
30
|
# gem 'builder'
|
|
29
31
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
puts "Gumdrop v#{Gumdrop::VERSION} building..."
|
|
2
|
+
|
|
3
|
+
configure do
|
|
4
|
+
|
|
5
|
+
set :site_title, "My Site"
|
|
6
|
+
set :site_tagline, "My home on thar intarwebs!"
|
|
7
|
+
set :site_author, "Me"
|
|
8
|
+
set :site_url, "http://www.mysite.com"
|
|
9
|
+
|
|
10
|
+
# All the supported build configuration settings and their defaults:
|
|
11
|
+
|
|
12
|
+
# set :output_dir, "./output"
|
|
13
|
+
# set :lib_dir, "./lib"
|
|
14
|
+
# set :source_dir, "./source"
|
|
15
|
+
# set :data_dir, './data'
|
|
16
|
+
# set :relative_paths, true
|
|
17
|
+
# set :proxy_enabled, true
|
|
18
|
+
# set :log_level, :info
|
|
19
|
+
# set :log, 'logs/build.log'
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
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 simply with starts_with?... So if a path, from the
|
|
31
|
+
# source directory, starts with the specified string, it'll skip or ignor it. (this
|
|
32
|
+
# doesn't work for files detected by stitch)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Example site-level generator
|
|
36
|
+
generate do
|
|
37
|
+
|
|
38
|
+
stitch 'app.js', # JavaScript to assemble
|
|
39
|
+
:identifier=>'app', # variable name for the library
|
|
40
|
+
:paths=>['./app'],
|
|
41
|
+
:root=>'./app',
|
|
42
|
+
:dependencies=>[], # List of scripts to prepend to top of file (non moduled)
|
|
43
|
+
:prune=>false, # If true, removes the source files from Gumdrop.site hash
|
|
44
|
+
:compress=>:jsmin, # Options are :jsmin, :yuic, :uglify
|
|
45
|
+
:obfuscate=>false, # For compressors that support munging/mangling
|
|
46
|
+
:keep_src=>true # Creates another file, ex: app-src.js
|
|
47
|
+
|
|
48
|
+
stitch 'lib.js',
|
|
49
|
+
:identifier=>'lib',
|
|
50
|
+
:paths=>['./lib'],
|
|
51
|
+
:root=>'./lib',
|
|
52
|
+
:prune=>true,
|
|
53
|
+
:compress=>false,
|
|
54
|
+
:obfuscate=>false,
|
|
55
|
+
:keep_src=>false
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Requires a about.template.XX file
|
|
59
|
+
# page "about.html",
|
|
60
|
+
# :template=>'about',
|
|
61
|
+
# :passthru=>'Available in the template'
|
|
62
|
+
|
|
63
|
+
# page 'robots.txt' do
|
|
64
|
+
# # And content returned will be put in the file
|
|
65
|
+
# """
|
|
66
|
+
# User-Agent: *
|
|
67
|
+
# Disallow: /
|
|
68
|
+
# """
|
|
69
|
+
# end
|
|
70
|
+
|
|
71
|
+
# Maybe for a tumblr-like pager
|
|
72
|
+
# pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
|
|
73
|
+
|
|
74
|
+
# pager.each do |page|
|
|
75
|
+
# page "#{page.uri}.html",
|
|
76
|
+
# template:'post_page',
|
|
77
|
+
# posts:page.items,
|
|
78
|
+
# pager:pager,
|
|
79
|
+
# current_page:pager.current_page
|
|
80
|
+
# end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Example of using a content filter to compress CSS output
|
|
85
|
+
# require 'yui/compressor'
|
|
86
|
+
# content_filter do |content, info|
|
|
87
|
+
# if info.ext == '.css'
|
|
88
|
+
# puts " Compress: #{info.filename}"
|
|
89
|
+
# compressor= YUI::CssCompressor.new
|
|
90
|
+
# compressor.compress( content )
|
|
91
|
+
# else
|
|
92
|
+
# content
|
|
93
|
+
# end
|
|
94
|
+
# end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# View helpers (available in rendering context):
|
|
98
|
+
view_helpers do
|
|
99
|
+
|
|
100
|
+
# Calculate the years for a copyright
|
|
101
|
+
def copyright_years(start_year, divider="–")
|
|
102
|
+
end_year = Date.today.year
|
|
103
|
+
if start_year == end_year
|
|
104
|
+
"#{start_year}"
|
|
105
|
+
else
|
|
106
|
+
"#{start_year}#{divider}#{end_year}"
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
#
|
|
111
|
+
# Your custom helpers go here!
|
|
112
|
+
#
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Any specialized code for your site goes here...
|
|
117
|
+
|
|
118
|
+
require 'slim'
|
|
119
|
+
Slim::Engine.set_default_options pretty:true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -20,3 +20,7 @@ DirectoryIndex index.html
|
|
|
20
20
|
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
|
|
21
21
|
</IfModule>
|
|
22
22
|
# END Gzip
|
|
23
|
+
|
|
24
|
+
<% Gumdrop.redirects.each do |opts| %>
|
|
25
|
+
# Redirect <%= opts[:from] %> <%= opts[:to] %>
|
|
26
|
+
<% end %>
|
|
File without changes
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
xml.instruct!
|
|
2
2
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
|
3
|
-
xml.title
|
|
4
|
-
xml.subtitle
|
|
5
|
-
xml.id
|
|
6
|
-
xml.link "href" =>
|
|
7
|
-
xml.link "href" => "#{
|
|
3
|
+
xml.title config.site_title
|
|
4
|
+
xml.subtitle config.site_tagline
|
|
5
|
+
xml.id config.site_url
|
|
6
|
+
xml.link "href" => config.site_url
|
|
7
|
+
xml.link "href" => "#{config.site_url}/feed.xml", "rel" => "self"
|
|
8
8
|
xml.updated data.blog.first.date.to_time.iso8601
|
|
9
|
-
xml.author { xml.name
|
|
9
|
+
xml.author { xml.name config.site_author }
|
|
10
10
|
|
|
11
11
|
data.blog.each do |post|
|
|
12
12
|
xml.entry do
|
|
13
|
-
url= "#{
|
|
13
|
+
url= "#{config.site_url}/posts/#{post.slug}"
|
|
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
|
-
xml.author { xml.name
|
|
19
|
+
xml.author { xml.name config.site_author }
|
|
20
20
|
xml.content post.body, "type" => "html"
|
|
21
21
|
end
|
|
22
22
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ doctype html
|
|
|
2
2
|
html lang="en"
|
|
3
3
|
head
|
|
4
4
|
meta charset="utf-8"
|
|
5
|
-
title=
|
|
5
|
+
title= config.site_title
|
|
6
6
|
/[if le IE 9]
|
|
7
7
|
script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
|
|
8
8
|
/link rel="stylesheet" href==uri('theme/screen.css') type="text/css" media="screen" charset="utf-8"
|
|
@@ -2,7 +2,7 @@ doctype html
|
|
|
2
2
|
html lang="en"
|
|
3
3
|
head
|
|
4
4
|
meta charset="utf-8"
|
|
5
|
-
title=
|
|
5
|
+
title= config.site_title
|
|
6
6
|
/[if le IE 9]
|
|
7
7
|
script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
|
|
8
8
|
link rel="stylesheet" href==uri('theme/screen.css') type="text/css" media="screen" charset="utf-8"
|
|
@@ -11,8 +11,8 @@ html lang="en"
|
|
|
11
11
|
div.row
|
|
12
12
|
div.col.span-12
|
|
13
13
|
header
|
|
14
|
-
h1=
|
|
15
|
-
h4=
|
|
14
|
+
h1= config.site_title
|
|
15
|
+
h4= config.site_tagline
|
|
16
16
|
div.row
|
|
17
17
|
div.col.span-12
|
|
18
18
|
nav
|
|
@@ -9,10 +9,16 @@ gem "gumdrop"
|
|
|
9
9
|
|
|
10
10
|
# Add your dependencies here:
|
|
11
11
|
|
|
12
|
+
# For template support:
|
|
13
|
+
# gem "less"
|
|
14
|
+
# gem "haml"
|
|
12
15
|
gem "slim"
|
|
13
16
|
gem "sass"
|
|
14
17
|
gem "coffee-script"
|
|
15
18
|
|
|
19
|
+
# For JavaScript stitching and compressing:
|
|
20
|
+
#gem 'uglifier'
|
|
21
|
+
#gem 'yui-compressor'
|
|
16
22
|
gem 'jsmin'
|
|
17
23
|
gem 'stitch-rb'
|
|
18
24
|
|
|
@@ -20,10 +26,6 @@ gem 'stitch-rb'
|
|
|
20
26
|
# gem "rdiscount"
|
|
21
27
|
# gem 'maruku'
|
|
22
28
|
|
|
23
|
-
# For template support:
|
|
24
|
-
# gem "less"
|
|
25
|
-
# gem "haml"
|
|
26
|
-
|
|
27
29
|
# For xml generation support:
|
|
28
30
|
# gem 'builder'
|
|
29
31
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
puts "Gumdrop v#{Gumdrop::VERSION} building..."
|
|
2
|
+
|
|
3
|
+
configure do
|
|
4
|
+
|
|
5
|
+
set :site_title, "My Site"
|
|
6
|
+
set :site_tagline, "My home on thar intarwebs!"
|
|
7
|
+
set :site_author, "Me"
|
|
8
|
+
set :site_url, "http://www.mysite.com"
|
|
9
|
+
|
|
10
|
+
# All the supported build configuration settings and their defaults:
|
|
11
|
+
# set :output_dir, "./output"
|
|
12
|
+
# set :lib_dir, "./lib"
|
|
13
|
+
# set :source_dir, "./source"
|
|
14
|
+
# set :data_dir, './data'
|
|
15
|
+
# set :relative_paths, true
|
|
16
|
+
# set :proxy_enabled, true
|
|
17
|
+
# set :log_level, :info
|
|
18
|
+
# set :log, 'logs/build.log'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Skipping files entirely from build process... Like they don't exist.
|
|
23
|
+
# skip 'file-to-ignore.html'
|
|
24
|
+
# skip 'dont-show/'
|
|
25
|
+
|
|
26
|
+
# Ignores source file(s) from compilation, but does load the content into memory
|
|
27
|
+
# ignore 'pages/'
|
|
28
|
+
|
|
29
|
+
# NOTE: Skipping and ignoring matches simply with starts_with?... So if a path, from the
|
|
30
|
+
# source directory, starts with the specified string, it'll skip or ignor it. (this
|
|
31
|
+
# doesn't work for files detected by stitch)
|
|
32
|
+
|
|
33
|
+
|
|
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
|
+
end
|
|
73
|
+
|
|
74
|
+
# Example of using a content filter to compress CSS output
|
|
75
|
+
# require 'yui/compressor'
|
|
76
|
+
# content_filter do |content, info|
|
|
77
|
+
# if info.ext == '.css'
|
|
78
|
+
# puts " Compress: #{info.filename}"
|
|
79
|
+
# compressor= YUI::CssCompressor.new
|
|
80
|
+
# compressor.compress( content )
|
|
81
|
+
# else
|
|
82
|
+
# content
|
|
83
|
+
# end
|
|
84
|
+
# end
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# View helpers (available in rendering context):
|
|
88
|
+
view_helpers do
|
|
89
|
+
|
|
90
|
+
# Calculate the years for a copyright
|
|
91
|
+
def copyright_years(start_year, divider="–")
|
|
92
|
+
end_year = Date.today.year
|
|
93
|
+
if start_year == end_year
|
|
94
|
+
"#{start_year}"
|
|
95
|
+
else
|
|
96
|
+
"#{start_year}#{divider}#{end_year}"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Your custom helpers go here!
|
|
102
|
+
#
|
|
103
|
+
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Any specialized code for your site goes here...
|
|
107
|
+
|
|
108
|
+
require 'slim'
|
|
109
|
+
Slim::Engine.set_default_options pretty:true
|