gumdrop 0.7.4 → 0.7.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/ChangeLog.md +8 -0
- data/Readme.md +2 -0
- data/lib/gumdrop/content.rb +72 -44
- data/lib/gumdrop/context.rb +4 -4
- data/lib/gumdrop/generator.rb +6 -6
- data/lib/gumdrop/server.rb +10 -3
- data/lib/gumdrop/site.rb +14 -12
- data/lib/gumdrop/version.rb +1 -1
- data/specs/content_spec.rb +1 -1
- data/specs/fixtures/expected/posts/post1.js +1 -1
- data/templates/blank/Gemfile +33 -0
- data/templates/blank/Gumdrop +118 -0
- data/templates/blank/Rakefile +38 -0
- data/templates/default/Gemfile +2 -0
- data/templates/default/Gumdrop +1 -1
- metadata +6 -3
data/ChangeLog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.7.5
|
2
|
+
- Gumdrop dev server will serve up files from output_dir if the file isn't found in the source tree.
|
3
|
+
- Added new template: blank
|
4
|
+
- Coerces content into UTF-8, if it can, when relativizing paths (to work around encoding bugs).
|
5
|
+
- Content class defers a lot of stuff from the initializer (for slightly faster startup).
|
6
|
+
- Changed site.node_tree to site.content_hash. More representative of what it is.
|
7
|
+
- Paths aren't relativized for pages that set force_absolute
|
8
|
+
|
1
9
|
# v0.7.4
|
2
10
|
- All rendered content (including layouts) will relativize paths starting with / on href="" and src="" for html files. Can be set to array of file exts to process at `config.relative_paths_for= ['.html']` or sett to process all files `config.relative_paths_for= :all` or turned off entirely by `config.relative_paths= false`
|
3
11
|
- Proxy server is disabled by default. Enable it `configure.proxy = true`
|
data/Readme.md
CHANGED
@@ -182,6 +182,8 @@ Here's the `Gumdrop` file created by the default template:
|
|
182
182
|
- Project Templates
|
183
183
|
|
184
184
|
# Todo / Ideas / Changes
|
185
|
+
- Create guard-gumdrop.
|
186
|
+
- Add automatic sqlite loading to `data_manager`?
|
185
187
|
- New/Update Doc site.
|
186
188
|
- Need test coverage.
|
187
189
|
- Some kind of admin? What would that even do?
|
data/lib/gumdrop/content.rb
CHANGED
@@ -4,48 +4,75 @@ module Gumdrop
|
|
4
4
|
class Content
|
5
5
|
|
6
6
|
MUNGABLE_RE= Regexp.new(%Q<(href|data|src)([\s]*)=([\s]*)('|"|"|"|')?\\/([\\/]?)>, 'i')
|
7
|
+
LAYOUTLESS_EXTS= %w(.css .js .xml)
|
7
8
|
|
8
|
-
|
9
|
-
:level,
|
10
|
-
:filename,
|
11
|
-
:source_filename,
|
12
|
-
:type,
|
13
|
-
:ext,
|
14
|
-
:uri,
|
15
|
-
:slug,
|
16
|
-
:template,
|
17
|
-
:params,
|
18
|
-
:site,
|
19
|
-
:ignored,
|
20
|
-
:generated,
|
21
|
-
:full_path
|
9
|
+
attr_reader :full_path, :path, :params, :site
|
22
10
|
|
23
11
|
def initialize(path, site, params={})
|
24
12
|
@site= site
|
25
13
|
@params= HashObject.new params
|
26
14
|
@full_path= path
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
@
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@
|
35
|
-
|
36
|
-
|
37
|
-
@
|
38
|
-
|
15
|
+
end
|
16
|
+
|
17
|
+
def slug
|
18
|
+
@slug ||= uri.gsub('/', '-').gsub(ext, '')
|
19
|
+
end
|
20
|
+
|
21
|
+
def ignored
|
22
|
+
@ignored ||= false
|
23
|
+
end
|
24
|
+
def ignore(state=true)
|
25
|
+
@ignored= state
|
26
|
+
end
|
27
|
+
|
28
|
+
def generated
|
29
|
+
@generated ||= false
|
30
|
+
end
|
31
|
+
|
32
|
+
def path
|
33
|
+
@path ||= get_source_path
|
34
|
+
end
|
35
|
+
|
36
|
+
def level
|
37
|
+
@level ||= (path.split('/').length - 1)
|
38
|
+
end
|
39
|
+
|
40
|
+
def source_filename
|
41
|
+
@source_filename ||= File.basename @full_path
|
42
|
+
end
|
43
|
+
|
44
|
+
def filename
|
45
|
+
@filename ||= get_target_filename
|
46
|
+
end
|
47
|
+
|
48
|
+
def type
|
49
|
+
@type ||= File.extname source_filename
|
50
|
+
end
|
51
|
+
|
52
|
+
def ext
|
53
|
+
@ext ||= File.extname filename
|
54
|
+
end
|
55
|
+
|
56
|
+
def uri
|
57
|
+
@uri ||= get_uri
|
58
|
+
end
|
59
|
+
|
60
|
+
def template
|
61
|
+
@template ||= unless Tilt[@full_path].nil?
|
62
|
+
Tilt.new @full_path
|
39
63
|
else
|
40
64
|
nil
|
41
65
|
end
|
42
66
|
end
|
67
|
+
def template=(t)
|
68
|
+
@template = t
|
69
|
+
end
|
43
70
|
|
44
71
|
def render(context=nil, ignore_layout=false, reset_context=true, locals={})
|
45
|
-
context=
|
72
|
+
context= site.render_context if context.nil?
|
46
73
|
if reset_context
|
47
|
-
default_layout= (
|
48
|
-
context.reset_data 'current_depth'
|
74
|
+
default_layout= LAYOUTLESS_EXTS.include?(ext) ? nil : 'site'
|
75
|
+
context.reset_data 'current_depth'=>level, 'current_slug'=>slug, 'page'=>self, 'layout'=>default_layout, 'params'=>params
|
49
76
|
end
|
50
77
|
context.set_content self, locals
|
51
78
|
content= render_all(context)
|
@@ -60,7 +87,7 @@ module Gumdrop
|
|
60
87
|
|
61
88
|
def renderTo(context, output_path, filters=[], opts={})
|
62
89
|
return copyTo(output_path, opts) unless useLayout?
|
63
|
-
|
90
|
+
site.report " rendering: #{uri}", :warning
|
64
91
|
output= render(context)
|
65
92
|
filters.each {|f| output= f.call(output, self) }
|
66
93
|
File.open output_path, 'w' do |f|
|
@@ -68,7 +95,7 @@ module Gumdrop
|
|
68
95
|
end
|
69
96
|
end
|
70
97
|
|
71
|
-
|
98
|
+
# This probably belongs to the BUILD, not here
|
72
99
|
def copyTo(output, layout=nil, opts={})
|
73
100
|
do_copy= if File.exists? output
|
74
101
|
!FileUtils.identical? @full_path, output
|
@@ -76,10 +103,10 @@ module Gumdrop
|
|
76
103
|
true
|
77
104
|
end
|
78
105
|
if do_copy
|
79
|
-
|
106
|
+
site.report " copying: #{uri}", :warning
|
80
107
|
FileUtils.cp_r @full_path, output, opts
|
81
108
|
else
|
82
|
-
|
109
|
+
site.report " (same): #{uri}", :info
|
83
110
|
end
|
84
111
|
end
|
85
112
|
|
@@ -92,21 +119,21 @@ module Gumdrop
|
|
92
119
|
end
|
93
120
|
|
94
121
|
def useLayout?
|
95
|
-
|
122
|
+
!template.nil?
|
96
123
|
end
|
97
124
|
|
98
125
|
def ignore?
|
99
|
-
|
126
|
+
ignored
|
100
127
|
end
|
101
128
|
|
102
129
|
def to_s
|
103
|
-
|
130
|
+
uri
|
104
131
|
end
|
105
132
|
|
106
133
|
private
|
107
134
|
|
108
135
|
def get_source_path
|
109
|
-
path= @full_path.sub
|
136
|
+
path= @full_path.sub site.src_path, ''
|
110
137
|
if path[0] == '/'
|
111
138
|
path[1..-1]
|
112
139
|
else
|
@@ -115,7 +142,7 @@ module Gumdrop
|
|
115
142
|
end
|
116
143
|
|
117
144
|
def get_target_filename
|
118
|
-
filename_parts=
|
145
|
+
filename_parts= source_filename.split('.')
|
119
146
|
ext= filename_parts.pop
|
120
147
|
while !Tilt[ext].nil?
|
121
148
|
ext= filename_parts.pop
|
@@ -125,11 +152,11 @@ module Gumdrop
|
|
125
152
|
end
|
126
153
|
|
127
154
|
def render_all(ctx)
|
128
|
-
if
|
129
|
-
content=
|
155
|
+
if generated or !File.exists?(@full_path)
|
156
|
+
content= template.render(ctx)
|
130
157
|
else
|
131
158
|
content= File.read @full_path
|
132
|
-
exts=
|
159
|
+
exts= source_filename.gsub filename, ''
|
133
160
|
exts.split('.').reverse.each do |ext|
|
134
161
|
unless ext.blank?
|
135
162
|
templateClass= Tilt[".#{ext}"]
|
@@ -144,7 +171,7 @@ module Gumdrop
|
|
144
171
|
end
|
145
172
|
|
146
173
|
def get_uri
|
147
|
-
uri= File.join File.dirname(
|
174
|
+
uri= File.join File.dirname(path), filename
|
148
175
|
if uri.starts_with? './'
|
149
176
|
uri[2..-1]
|
150
177
|
else
|
@@ -153,9 +180,10 @@ module Gumdrop
|
|
153
180
|
end
|
154
181
|
|
155
182
|
def relativize(content, ctx)
|
156
|
-
if site.config.relative_paths
|
157
|
-
if site.config.relative_paths_for == :all or site.config.relative_paths_for.include?(
|
183
|
+
if site.config.relative_paths and !ctx.force_absolute
|
184
|
+
if site.config.relative_paths_for == :all or site.config.relative_paths_for.include?(ext)
|
158
185
|
path_to_root= ctx.path_to_root
|
186
|
+
content.force_encoding("UTF-8") if content.respond_to? :force_encoding
|
159
187
|
content = content.gsub MUNGABLE_RE do |match|
|
160
188
|
if $5 == '/'
|
161
189
|
"#{ $1 }#{ $2 }=#{ $3 }#{ $4 }/"
|
data/lib/gumdrop/context.rb
CHANGED
@@ -18,8 +18,8 @@ module Gumdrop
|
|
18
18
|
else
|
19
19
|
"#{ path_to_root }#{ path }"
|
20
20
|
end
|
21
|
-
if opts[:fresh] and @site.
|
22
|
-
uri_string += "?v=#{ @site.
|
21
|
+
if opts[:fresh] and @site.content_hash.has_key?(path)
|
22
|
+
uri_string += "?v=#{ @site.content_hash[path].mtime.to_i }"
|
23
23
|
end
|
24
24
|
uri_string = "/" if uri_string == ""
|
25
25
|
uri_string
|
@@ -123,8 +123,8 @@ module Gumdrop
|
|
123
123
|
protected
|
124
124
|
|
125
125
|
def get_page(path)
|
126
|
-
page= @site.
|
127
|
-
page= @site.
|
126
|
+
page= @site.content_hash[path]
|
127
|
+
page= @site.content_hash["#{path}.html"] if page.nil? # Bit of a hack...
|
128
128
|
page= @site.partials[path] if page.nil?
|
129
129
|
page= @site.layouts[path] if page.nil? # ???
|
130
130
|
page
|
data/lib/gumdrop/generator.rb
CHANGED
@@ -58,12 +58,12 @@ module Gumdrop
|
|
58
58
|
@site.layouts[ "#{opts[:template]}.template" ]
|
59
59
|
end.template
|
60
60
|
end
|
61
|
-
content.
|
61
|
+
content.ignore site.greylist.any? {|pattern| site.path_match name, pattern }
|
62
62
|
unless content.ignored
|
63
|
-
content.
|
63
|
+
content.ignore site.blacklist.any? {|pattern| site.path_match name, pattern }
|
64
64
|
end
|
65
65
|
@site.report " generated: #{content.uri}", :info
|
66
|
-
@site.
|
66
|
+
@site.content_hash[content.uri]= content
|
67
67
|
end
|
68
68
|
|
69
69
|
# FIXME: Does redirect require abs-paths?
|
@@ -157,9 +157,9 @@ module Gumdrop
|
|
157
157
|
rp = File.expand_path(opts[:root])
|
158
158
|
relative_root = rp.gsub(sp, '')[1..-1]
|
159
159
|
rrlen= relative_root.length - 1
|
160
|
-
@site.
|
160
|
+
@site.content_hash.keys.each do |path|
|
161
161
|
if path[0..rrlen] == relative_root and name != path
|
162
|
-
@site.
|
162
|
+
@site.content_hash.delete path
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
@@ -185,7 +185,7 @@ module Gumdrop
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def useLayout?
|
188
|
-
!@content_block.nil? or
|
188
|
+
!@content_block.nil? or !template.nil?
|
189
189
|
end
|
190
190
|
|
191
191
|
end
|
data/lib/gumdrop/server.rb
CHANGED
@@ -31,6 +31,7 @@ module Gumdrop
|
|
31
31
|
|
32
32
|
file_path= get_content_path params[:splat].join('/'), site
|
33
33
|
site.report "[#{$$}] GET /#{params[:splat].join('/')} -> #{file_path}"
|
34
|
+
|
34
35
|
unless static_asset file_path
|
35
36
|
since_last_build= Time.now.to_i - site.last_run.to_i
|
36
37
|
# site.report "!>!>>>>> since_last_build: #{since_last_build}"
|
@@ -40,8 +41,8 @@ module Gumdrop
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
if site.
|
44
|
-
content= site.
|
44
|
+
if site.content_hash.has_key? file_path
|
45
|
+
content= site.content_hash[file_path]
|
45
46
|
if content.useLayout?
|
46
47
|
site.report "[#{$$}] *Dynamic: #{file_path} (#{content.ext})"
|
47
48
|
content_type :css if content.ext == '.css' # Meh?
|
@@ -54,6 +55,11 @@ module Gumdrop
|
|
54
55
|
site.report "[#{$$}] *Static: #{file_path}"
|
55
56
|
send_file File.join( site.src_path, file_path)
|
56
57
|
end
|
58
|
+
|
59
|
+
elsif File.exists? File.join(site.config.output_dir, file_path)
|
60
|
+
site.report "[#{$$}] *Static (from OUTPUT): #{file_path}"
|
61
|
+
send_file File.join(site.config.output_dir, file_path)
|
62
|
+
|
57
63
|
else
|
58
64
|
site.report "[#{$$}] *Missing: #{file_path}", :error
|
59
65
|
"#{file_path} Not Found"
|
@@ -69,7 +75,7 @@ module Gumdrop
|
|
69
75
|
if file_path == ""
|
70
76
|
"index.html"
|
71
77
|
else
|
72
|
-
keys.detect {|k| site.
|
78
|
+
keys.detect {|k| site.content_hash.has_key?(k) } or file_path
|
73
79
|
end
|
74
80
|
end
|
75
81
|
|
@@ -84,6 +90,7 @@ module Gumdrop
|
|
84
90
|
end
|
85
91
|
|
86
92
|
def static_asset(file_path)
|
93
|
+
return false if file_path.nil? or File.extname(file_path).nil?
|
87
94
|
STATIC_ASSETS.include? File.extname(file_path).to_s
|
88
95
|
end
|
89
96
|
|
data/lib/gumdrop/site.rb
CHANGED
@@ -31,7 +31,7 @@ module Gumdrop
|
|
31
31
|
:config,
|
32
32
|
:data,
|
33
33
|
:sitefile,
|
34
|
-
:
|
34
|
+
:content_hash,
|
35
35
|
:last_run
|
36
36
|
|
37
37
|
extend Callbacks
|
@@ -55,21 +55,23 @@ module Gumdrop
|
|
55
55
|
|
56
56
|
def contents(*args)
|
57
57
|
opts= args.extract_options!
|
58
|
-
pattern= args
|
58
|
+
pattern= args.first || nil
|
59
|
+
|
59
60
|
if pattern.nil?
|
60
61
|
if opts[:as] == :hash
|
61
|
-
@
|
62
|
+
@content_hash
|
62
63
|
else
|
63
|
-
@
|
64
|
+
@content_hash.values
|
64
65
|
end
|
66
|
+
|
65
67
|
else
|
66
68
|
nodes = opts[:as] == :hash ? {} : []
|
67
|
-
@
|
69
|
+
@content_hash.keys.each do |path|
|
68
70
|
if path_match path, pattern
|
69
71
|
if opts[:as] == :hash
|
70
|
-
nodes[path]= @
|
72
|
+
nodes[path]= @content_hash[path]
|
71
73
|
else
|
72
|
-
nodes << @
|
74
|
+
nodes << @content_hash[path]
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
@@ -135,7 +137,7 @@ module Gumdrop
|
|
135
137
|
@greylist = []
|
136
138
|
@redirects = []
|
137
139
|
|
138
|
-
@
|
140
|
+
@content_hash = Hash.new {|h,k| h[k]= nil }
|
139
141
|
@layouts = Hash.new {|h,k| h[k]= nil }
|
140
142
|
@partials = Hash.new {|h,k| h[k]= nil }
|
141
143
|
@generators = Hash.new {|h,k| h[k]= nil }
|
@@ -212,7 +214,7 @@ module Gumdrop
|
|
212
214
|
if blacklist.any? {|pattern| path_match path, pattern }
|
213
215
|
report " excluding: #{path}", :info
|
214
216
|
else
|
215
|
-
node.
|
217
|
+
node.ignore greylist.any? {|pattern| path_match path, pattern }
|
216
218
|
# Sort out Layouts, Generators, and Partials
|
217
219
|
if File.extname(path) == ".template"
|
218
220
|
layouts[path]= node
|
@@ -229,7 +231,7 @@ module Gumdrop
|
|
229
231
|
partials[partial_node_path]= node
|
230
232
|
|
231
233
|
else
|
232
|
-
@
|
234
|
+
@content_hash[path]= node
|
233
235
|
end
|
234
236
|
end
|
235
237
|
end
|
@@ -250,8 +252,8 @@ module Gumdrop
|
|
250
252
|
unless opts[:dry_run]
|
251
253
|
report "[Compiling to #{@out_path}]", :info
|
252
254
|
on_before_render(self)
|
253
|
-
@
|
254
|
-
node= @
|
255
|
+
@content_hash.keys.sort.each do |path|
|
256
|
+
node= @content_hash[path]
|
255
257
|
unless node.ignore?
|
256
258
|
output_path= File.join(@out_path, node.to_s)
|
257
259
|
FileUtils.mkdir_p File.dirname(output_path)
|
data/lib/gumdrop/version.rb
CHANGED
data/specs/content_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe Gumdrop::Content do
|
|
44
44
|
|
45
45
|
it "should relativize all absolute paths (when starts with /)" do
|
46
46
|
site= get_test_site
|
47
|
-
# puts site.
|
47
|
+
# puts site.content_hash.keys
|
48
48
|
|
49
49
|
page= site.contents('posts/post1.html').first
|
50
50
|
content= page.render
|
@@ -0,0 +1,33 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "i18n"
|
4
|
+
gem "sinatra"
|
5
|
+
gem "active_support"
|
6
|
+
gem "rake"
|
7
|
+
gem "gumdrop"
|
8
|
+
|
9
|
+
# Add your dependencies here:
|
10
|
+
|
11
|
+
# For template support:
|
12
|
+
# gem "less"
|
13
|
+
# gem "haml"
|
14
|
+
# gem "slim"
|
15
|
+
# gem "sass"
|
16
|
+
# gem "coffee-script"
|
17
|
+
|
18
|
+
# For JavaScript stitching and compressing:
|
19
|
+
# gem 'packr'
|
20
|
+
# gem 'uglifier'
|
21
|
+
# gem 'yui-compressor'
|
22
|
+
# gem 'jsmin'
|
23
|
+
# gem 'stitch-rb'
|
24
|
+
# gem 'sprockets'
|
25
|
+
|
26
|
+
# For markdown support, a couple of options:
|
27
|
+
# gem "redcarpet"
|
28
|
+
# gem "kramdown", :git => "git://github.com/darthapo/kramdown.git"
|
29
|
+
# gem "rdiscount"
|
30
|
+
# gem 'maruku'
|
31
|
+
|
32
|
+
# For xml generation support:
|
33
|
+
# gem 'builder'
|
@@ -0,0 +1,118 @@
|
|
1
|
+
puts "Gumdrop v#{Gumdrop::VERSION} building..."
|
2
|
+
|
3
|
+
configure do
|
4
|
+
|
5
|
+
# All the supported build configuration settings and their defaults:
|
6
|
+
|
7
|
+
# set :relative_paths, true
|
8
|
+
# set :proxy_enabled, false
|
9
|
+
# set :output_dir, "./output"
|
10
|
+
# set :source_dir, "./source"
|
11
|
+
# set :data_dir, './data'
|
12
|
+
# set :log, './logs/build.log'
|
13
|
+
# set :ignore, %w(.DS_Store .gitignore .git .svn .sass-cache)
|
14
|
+
# set :server_timeout, 15
|
15
|
+
# set :server_port, 4567
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Skipping files entirely from build process... Like they don't exist.
|
21
|
+
# skip 'file-to-ignore.html'
|
22
|
+
# skip 'dont-show/**/*'
|
23
|
+
|
24
|
+
# Ignores source file(s) from compilation, but does load the content into memory
|
25
|
+
# ignore 'pages/**/*.*'
|
26
|
+
|
27
|
+
# NOTE: Skipping and ignoring matches like a file glob (it use File.fnmatch in fact)
|
28
|
+
# (this doesn't work for files detected by stitch)
|
29
|
+
|
30
|
+
|
31
|
+
# Example site-level generator
|
32
|
+
generate do
|
33
|
+
|
34
|
+
# Requires a about.template.XX file
|
35
|
+
# page "about.html",
|
36
|
+
# :template=>'about',
|
37
|
+
# :passthru=>'Available in the template'
|
38
|
+
|
39
|
+
# page 'robots.txt' do
|
40
|
+
# # And content returned will be put in the file
|
41
|
+
# """
|
42
|
+
# User-Agent: *
|
43
|
+
# Disallow: /
|
44
|
+
# """
|
45
|
+
# end
|
46
|
+
|
47
|
+
# Maybe for a tumblr-like pager
|
48
|
+
# pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
|
49
|
+
|
50
|
+
# pager.each do |page|
|
51
|
+
# page "#{page.uri}.html",
|
52
|
+
# template:'post_page',
|
53
|
+
# posts:page.items,
|
54
|
+
# pager:pager,
|
55
|
+
# current_page:pager.current_page
|
56
|
+
# end
|
57
|
+
|
58
|
+
# Assemble javscript files in a CommonJS-like way with stitch-rb
|
59
|
+
# stitch 'app.js', # JavaScript to assemble
|
60
|
+
# :identifier=>'app', # variable name for the library
|
61
|
+
# :paths=>['./app'],
|
62
|
+
# :root=>'./app',
|
63
|
+
# :dependencies=>[], # List of scripts to prepend to top of file (non moduled)
|
64
|
+
# :prune=>false, # If true, removes the source files from Gumdrop.site hash
|
65
|
+
# :compress=>:jsmin, # Options are :jsmin, :yuic, :uglify
|
66
|
+
# :obfuscate=>false, # For compressors that support munging/mangling
|
67
|
+
# :keep_src=>true # Creates another file, ex: app-src.js
|
68
|
+
|
69
|
+
# Or use sprockets
|
70
|
+
# sprockets 'app.js',
|
71
|
+
# :src=>'app/index.js',
|
72
|
+
# :paths=>['./lib'],
|
73
|
+
# :prune=>true,
|
74
|
+
# :root=>'./src',
|
75
|
+
# :compress=>:packr,
|
76
|
+
# :keep_src=>true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Example of using a content filter to compress CSS output
|
80
|
+
# require 'yui/compressor'
|
81
|
+
# content_filter do |content, info|
|
82
|
+
# if info.ext == '.css'
|
83
|
+
# puts " Compress: #{info.filename}"
|
84
|
+
# compressor= YUI::CssCompressor.new
|
85
|
+
# compressor.compress( content )
|
86
|
+
# else
|
87
|
+
# content
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
|
91
|
+
# All Gumdrop Hooks: on_start, on_before_scan, on_scan, on_before_generate, on_generate, on_before_render, on_render, on_end
|
92
|
+
# on_start do |site| end
|
93
|
+
# on_end do |site| end
|
94
|
+
|
95
|
+
|
96
|
+
# View helpers (available in rendering context):
|
97
|
+
view_helpers do
|
98
|
+
|
99
|
+
# Calculate the years for a copyright
|
100
|
+
def copyright_years(start_year, divider="–")
|
101
|
+
end_year = Date.today.year
|
102
|
+
if start_year == end_year
|
103
|
+
"#{start_year}"
|
104
|
+
else
|
105
|
+
"#{start_year}#{divider}#{end_year}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
#
|
110
|
+
# Your custom helpers go here!
|
111
|
+
#
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
# Any specialized code for your site goes here...
|
116
|
+
|
117
|
+
# require 'slim'
|
118
|
+
# Slim::Engine.set_default_options pretty:true
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "bundler/setup"
|
3
|
+
require 'gumdrop'
|
4
|
+
|
5
|
+
# For the SYNC task
|
6
|
+
USER='user'
|
7
|
+
SERVER='server.com'
|
8
|
+
FOLDER="~/#{SERVER}"
|
9
|
+
|
10
|
+
site= Gumdrop::Site.new "./Gumdrop"
|
11
|
+
OUTPUT=site.config.output_dir
|
12
|
+
|
13
|
+
desc "Build source files into output_dir"
|
14
|
+
task :build do
|
15
|
+
system("bundle exec gumdrop -b")
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run development server"
|
19
|
+
task :serve do
|
20
|
+
system("bundle exec gumdrop -s")
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Syncs with public server using rsync (if configured)"
|
24
|
+
task :sync do
|
25
|
+
cmd= "rsync -avz --delete #{OUTPUT} #{USER}@#{SERVER}:#{FOLDER}"
|
26
|
+
puts "Running:\n#{cmd}\n"
|
27
|
+
system(cmd)
|
28
|
+
puts "Done."
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Outputs the Gumdrop version"
|
32
|
+
task :version do
|
33
|
+
puts Gumdrop::VERSION
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default do
|
37
|
+
puts `rake -T`
|
38
|
+
end
|
data/templates/default/Gemfile
CHANGED
data/templates/default/Gumdrop
CHANGED
@@ -9,7 +9,7 @@ configure do
|
|
9
9
|
|
10
10
|
# All the supported build configuration settings and their defaults:
|
11
11
|
# set :relative_paths, true
|
12
|
-
# set :proxy_enabled,
|
12
|
+
# set :proxy_enabled, false
|
13
13
|
# set :output_dir, "./output"
|
14
14
|
# set :source_dir, "./source"
|
15
15
|
# set :data_dir, './data'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 5
|
9
|
+
version: 0.7.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt McCray
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-06-
|
17
|
+
date: 2012-06-27 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -170,6 +170,9 @@ files:
|
|
170
170
|
- templates/backbone/source/theme/styles/_tools.scss
|
171
171
|
- templates/backbone/source/theme/templates/app.template.slim
|
172
172
|
- templates/backbone/source/theme/templates/site.template.slim
|
173
|
+
- templates/blank/Gemfile
|
174
|
+
- templates/blank/Gumdrop
|
175
|
+
- templates/blank/Rakefile
|
173
176
|
- templates/default/Gemfile
|
174
177
|
- templates/default/Gumdrop
|
175
178
|
- templates/default/Rakefile
|