gumdrop 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,18 @@
1
+ # v1.1.0
2
+ - Added `Gumdrop.prepare(&block)`, it's a good time to apply data transformations.
3
+ - Added Content#dirname.
4
+ - Fixed `base_path` for file based generators.
5
+ - Updated site templates.
6
+ - Optionally prepare yaml data from content.
7
+ - Lock version numbers of deps in gemspec
8
+ - No longer do a binary check on files when running `uris` command.
9
+ - Added support for caching partials (good for static partials used in layouts).
10
+ - Fixed dev server bug where it would rescan on every request.
11
+ - Fixed relativing urls in partials.
12
+ - Re-enabled support for `content_for` and `content_for?` to rendering context (known to work for ERb).
13
+ - Re-enabled support for `Gumdrop::Util::Pager`.
14
+ - Re-enabled support for `page` in rendering context.
15
+
1
16
  # v1.0.3
2
17
  - Fixed markdown and textile view_helpers.
3
18
  - `Dir.chdir` to `site.root`. (should be able to run gumdrop in any folder of a Gumdrop project)
data/Notes.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Notes and Todos
2
+
3
+ - Flesh out the test/specs
4
+ - Adde support for marking a partial 'cacheable' in the partial
5
+ <%= set :cache=>true %>
data/Rakefile CHANGED
@@ -22,8 +22,8 @@ end
22
22
 
23
23
  desc "generates fixture site then tests output against expected fixture data"
24
24
  task :test_output => :test_output_clear do
25
- sh "cd specs/fixtures/source && bundle exec gumdrop build -f"
26
- diff_results= `diff -w -r -y -N -q --suppress-common-lines specs/fixtures/output specs/fixtures/expected`
25
+ sh "cd specs/fixtures/source && bundle exec gumdrop build -q -f"
26
+ diff_results= `diff -w -r -y -N -q -B -b --suppress-common-lines specs/fixtures/output specs/fixtures/expected`
27
27
  if diff_results.empty?
28
28
  puts "\n\nPASS: All files matched!"
29
29
  puts "#{ diff_results }"
@@ -34,7 +34,7 @@ task :test_output => :test_output_clear do
34
34
  matcher= Regexp.new('Files (.*) and', 'i')
35
35
  diff_results.scan(matcher).flatten.each do |fname|
36
36
  puts "\n\n"
37
- puts `diff -w -C 3 #{fname} #{fname.gsub('fixtures/output', 'fixtures/expected')}`
37
+ puts `diff -w -B -b -C 3 #{fname} #{fname.gsub('fixtures/output', 'fixtures/expected')}`
38
38
  end
39
39
  end
40
40
  puts ""
data/Readme.md CHANGED
@@ -85,12 +85,13 @@ open source projects (in alphabetical order):
85
85
 
86
86
  And will, optionally, leverage these in building your site:
87
87
 
88
+ * coffee-script
89
+ * erb
90
+ * haml/sass
91
+ * jsmin
92
+ * slim
88
93
  * sqlite3
89
94
  * sprockets
90
95
  * stitch
91
- * jsmin
92
- * slim
93
- * haml/sass
94
- * coffee-script
95
96
  * and many, many more! (todo: gotta document 'em all!)
96
97
 
data/gumdrop.gemspec CHANGED
@@ -24,19 +24,20 @@ Gem::Specification.new do |s|
24
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
25
  s.require_paths = ["lib"]
26
26
 
27
- s.add_dependency 'thor'
28
- s.add_dependency 'tilt'
29
- s.add_dependency 'active_support'
30
- s.add_dependency 'onfire'
31
- s.add_dependency 'sinatra'
32
- s.add_dependency 'i18n'
33
- s.add_dependency 'launchy'
34
- s.add_dependency 'bundle'
35
-
36
- s.add_development_dependency 'minitest'
37
- s.add_development_dependency 'sqlite3'
38
- s.add_development_dependency 'sprockets'
39
- s.add_development_dependency 'stitch'
40
- s.add_development_dependency 'jsmin'
27
+ s.add_dependency 'thor', '0.15.4'
28
+ s.add_dependency 'tilt', '1.3.3'
29
+ s.add_dependency 'active_support', '3.0.0'
30
+ s.add_dependency 'onfire', '0.2.0'
31
+ s.add_dependency 'sinatra', '1.3.2'
32
+ s.add_dependency 'i18n', '0.6.0'
33
+ s.add_dependency 'launchy', '0.4.0'
34
+ # s.add_dependency 'bundler', ''
35
+ s.add_dependency 'sprockets', '2.4.3'
36
+ s.add_dependency 'stitch', '0.1.6'
37
+ s.add_dependency 'jsmin', '1.0.1'
38
+ s.add_dependency 'json', '~> 1.7.7'
41
39
 
40
+ s.add_development_dependency 'minitest', '3.2.0'
41
+ s.add_development_dependency 'sqlite3', '1.3.6'
42
+
42
43
  end
@@ -78,7 +78,7 @@ module Gumdrop
78
78
  _ensure_path to
79
79
  FileUtils.cp_r from, to
80
80
  else
81
- log.info " unchanged: #{ _rel_path to }"
81
+ log.debug " unchanged: #{ _rel_path to }"
82
82
  end
83
83
  end
84
84
  end
@@ -94,7 +94,7 @@ module Gumdrop
94
94
  f.write rendered_content
95
95
  end
96
96
  else
97
- log.info " unchanged: #{ _rel_path to }"
97
+ log.debug " unchanged: #{ _rel_path to }"
98
98
  end
99
99
  end
100
100
  end
@@ -68,14 +68,15 @@ module Gumdrop::CLI
68
68
  content= Gumdrop.site.contents[uri]
69
69
  blackout= Gumdrop.site.in_blacklist?(uri) ? 'X' : ' '
70
70
  generated= content.generated? ? '*' : ' '
71
- binary= content.binary? ? '!' : ' '
72
- say " #{blackout + generated + binary} #{content.uri}"
71
+ # binary= content.binary? ? '!' : ' '
72
+ # say " #{blackout + generated + binary} #{content.uri}"
73
+ say " #{blackout + generated } #{content.uri}"
73
74
  end
74
75
  say ""
75
76
  say "Legend:"
76
- say " X = On on the blacklist"
77
+ say " X = On the blacklist"
77
78
  say " * = Generated (not on fs)"
78
- say " ! = Binary file"
79
+ # say " ! = Binary file"
79
80
  end
80
81
 
81
82
  desc "version", "Displays Gumdrop version"
@@ -1,9 +1,12 @@
1
1
  module Gumdrop
2
2
 
3
+
3
4
  # All content (layouts, partials, images, html, js css, etc) found in
4
5
  # the source directory are represented as a Content object in memory
5
6
  class Content
6
7
  include Util::SiteAccess
8
+
9
+ KNOWN_BINARY= %w(.jpe .jpeg .jpg .png .tiff .gif)
7
10
 
8
11
  attr_reader :source_path, :params
9
12
 
@@ -25,6 +28,7 @@ module Gumdrop
25
28
 
26
29
  def slug
27
30
  @slug ||= uri.gsub('/', '-').gsub(ext, '')
31
+ @params.slug || @slug
28
32
  end
29
33
 
30
34
  def path
@@ -43,6 +47,10 @@ module Gumdrop
43
47
  @filename ||= _target_filename
44
48
  end
45
49
 
50
+ def dirname
51
+ @dirname ||= File.dirname source_path
52
+ end
53
+
46
54
  def type
47
55
  @type ||= File.extname source_filename
48
56
  end
@@ -55,10 +63,20 @@ module Gumdrop
55
63
  @uri ||= _uri
56
64
  end
57
65
 
66
+ def uripath
67
+ @uripath ||= File.dirname uri
68
+ end
69
+
70
+ def clean_uri
71
+ @clean_uri ||= uri.gsub(ext, '')
72
+ end
73
+
58
74
  def binary?
59
75
  @is_binary ||= begin
60
76
  if generated? or has_block? or missing?
61
77
  false
78
+ elsif KNOWN_BINARY.include? ext
79
+ true
62
80
  else
63
81
  # from ptools
64
82
  s = (File.read(source_path, File.stat(source_path).blksize) || "").split(//)
@@ -109,7 +127,7 @@ module Gumdrop
109
127
 
110
128
  def mtime
111
129
  @mtime ||= if exists? and !generated?
112
- File.new(@source_path).mtime
130
+ File.mtime @source_path
113
131
  else
114
132
  Time.now
115
133
  end
@@ -8,7 +8,7 @@ module Gumdrop
8
8
  @dsl= DSL.new self
9
9
  @pages= []
10
10
  @filename= content.nil? ? (opts[:filename] || '') : content.filename
11
- @base_path= content.nil? ? (opts[:base_path] || '') : content.slug
11
+ @base_path= content.nil? ? (opts[:base_path] || '') : content.dirname
12
12
  end
13
13
 
14
14
  def unload
@@ -66,6 +66,7 @@ module Gumdrop
66
66
  def _render_inline_content(opts)
67
67
  Proc.new {
68
68
  renderer= site.active_renderer || Renderer.new
69
+ raise "Generator: page :render=>'partial' param is missing!" unless opts[:render]
69
70
  content= site.resolve(opts[:render], opts)
70
71
  opts[:inline_render]= true
71
72
  renderer.draw content, opts
@@ -6,12 +6,13 @@ module Gumdrop
6
6
  SPECIAL_OPTS= %w(layout force_partial)
7
7
  MUNGABLE_RE= Regexp.new(%Q<(href|data|src)([\s]*)=([\s]*)('|"|&quot;|&#34;|&#39;)?\\/([\\/]?)>, 'i')
8
8
 
9
- attr_reader :context
9
+ attr_reader :context, :cache
10
10
 
11
11
  def initialize
12
12
  site.active_renderer= self
13
13
  @context, @content, @opts= nil, nil, nil
14
14
  @stack= []
15
+ @cache= {}
15
16
  end
16
17
 
17
18
  def draw(content, opts={})
@@ -22,9 +23,12 @@ module Gumdrop
22
23
  log.warn "Missing content body for: #{ content.uri }"
23
24
  nil
24
25
  else
26
+ opts[:calling_page]= @context unless opts.has_key? :calling_page
25
27
  _in_context(content, opts) do
26
28
  data[:context]= @context
27
29
  data[:output]= _render_content!
30
+ @cache[content.source_path]= data[:output] if @context.cache
31
+ data[:output]
28
32
  end
29
33
  end
30
34
  end
@@ -103,6 +107,7 @@ module Gumdrop
103
107
  def _relativize?
104
108
  return false if !site.config.relative_paths
105
109
  return false if @context.force_absolute
110
+ return false if @content.partial?
106
111
  return true if site.config.relative_paths_exts == :all
107
112
  site.config.relative_paths_exts.include?(@content.ext)
108
113
  end
@@ -216,7 +221,15 @@ module Gumdrop
216
221
  content= site.resolve path, opts
217
222
  raise StandardError, "Content or Partial cannot be found at: #{path} (#{opts})" if content.nil?
218
223
  opts[:force_partial]= true
219
- @renderer.draw content, opts
224
+ opts[:calling_page]= self
225
+ return @renderer.draw content, opts if opts[:cache] == false
226
+ if @renderer.cache.has_key? content.source_path
227
+ @renderer.cache[content.source_path]
228
+ else
229
+ output= @renderer.draw content, opts
230
+ @renderer.cache[content.source_path]= output if opts[:cache]
231
+ output
232
+ end
220
233
  end
221
234
 
222
235
  def get(key)
@@ -233,6 +246,50 @@ module Gumdrop
233
246
  end
234
247
  end
235
248
 
249
+ def page
250
+ @content_page ||= begin
251
+ parent= self
252
+ while !parent.nil? and !parent.calling_page.nil? do
253
+ parent= parent.calling_page
254
+ end
255
+ parent
256
+ end
257
+ end
258
+
259
+ def content_for(key, &block)
260
+ keyname= "_content_#{key}"
261
+ if block_given?
262
+ content= capture &block
263
+ @state[keyname]= content #block
264
+ nil
265
+ else
266
+ if @state.has_key?(keyname)
267
+ # @state[keyname].call
268
+ @state[keyname]
269
+ else
270
+ nil
271
+ end
272
+ end
273
+ end
274
+
275
+ def capture(&block)
276
+ erbout = eval('_erbout', block.binding) rescue nil
277
+ unless erbout.nil?
278
+ erbout_length = erbout.length
279
+ block.call
280
+ content = erbout[erbout_length..-1]
281
+ erbout[erbout_length..-1] = ''
282
+ else
283
+ content= block.call
284
+ end
285
+ content
286
+ end
287
+
288
+ def content_for?(key)
289
+ keyname= "_content_#{key}"
290
+ @state.has_key?(keyname)
291
+ end
292
+
236
293
  def method_missing(sym, *args, &block)
237
294
  if sym.to_s.ends_with? '='
238
295
  key= sym.to_s.chop
@@ -11,9 +11,12 @@ module Gumdrop
11
11
  include Util::Loggable
12
12
 
13
13
  site= Gumdrop.site
14
+ scan_count= 0
14
15
 
15
16
  unless site.nil?
16
17
  site.scan true
18
+ scan_count += 1
19
+ last_scan= Time.now.to_i
17
20
 
18
21
  set :port, site.config.server_port if site.config.server_port
19
22
 
@@ -35,11 +38,17 @@ module Gumdrop
35
38
  log.info "\n\n[#{$$}] GET /#{params[:splat].join('/')} -> #{file_path}"
36
39
 
37
40
  unless static_asset file_path
38
- since_last_build= Time.now.to_i - site.last_run.to_i
41
+ since_last_build= Time.now.to_i - last_scan
39
42
  # site.report "!>!>>>>> since_last_build: #{since_last_build}"
40
43
  if since_last_build > site.config.server_timeout
41
44
  log.info "[#{$$}] Rebuilding from Source (#{since_last_build} > #{site.config.server_timeout})"
42
45
  site.scan true
46
+ scan_count += 1
47
+ last_scan= Time.now.to_i
48
+ if scan_count % 50 == 0
49
+ log.info "<* Initiating Garbage Collection *>"
50
+ GC.start
51
+ end
43
52
  end
44
53
  end
45
54
 
data/lib/gumdrop/site.rb CHANGED
@@ -44,6 +44,7 @@ module Gumdrop
44
44
  _options_updated!
45
45
  @root= File.dirname @sitefile
46
46
  @last_run= 0
47
+ @_preparations= []
47
48
  clear
48
49
  end
49
50
 
@@ -84,6 +85,7 @@ module Gumdrop
84
85
  end
85
86
 
86
87
  def generate
88
+ _execute_preparations
87
89
  _execute_generators
88
90
  self
89
91
  end
@@ -131,6 +133,10 @@ module Gumdrop
131
133
  end
132
134
  end
133
135
 
136
+ def prepare(&block)
137
+ @_preparations << block
138
+ end
139
+
134
140
  # Events stop bubbling here.
135
141
  def parent
136
142
  nil
@@ -196,6 +202,18 @@ module Gumdrop
196
202
  false
197
203
  end
198
204
 
205
+ def _execute_preparations
206
+ log.debug "[Executing Preparations]"
207
+ dsl= Generator::DSL.new nil
208
+ @_preparations.each do |block|
209
+ if block.arity == 1
210
+ block.call dsl
211
+ else
212
+ dsl.instance_eval &block
213
+ end
214
+ end
215
+ end
216
+
199
217
  def _execute_generators
200
218
  log.debug "[Executing Generators]"
201
219
  event_block :generate do
@@ -284,12 +302,16 @@ module Gumdrop
284
302
  site.configure &block
285
303
  end
286
304
 
305
+ def prepare(&block)
306
+ site.prepare &block
307
+ end
308
+
287
309
  # Short cut to the current Site config object.
288
310
  def config
289
311
  site.config
290
312
  end
291
313
 
292
- # The env Gumdrop is run in -- You can set this in the congig
314
+ # The env Gumdrop is run in -- You can set this in the config
293
315
  # or, better, via command line: `gumdrop build -e test`
294
316
  def env
295
317
  site.env
@@ -1,7 +1,7 @@
1
1
  module Gumdrop::Util
2
2
 
3
3
  class Pager
4
- attr_reader :all, :pages, :base_url, :current_page, :page_sets
4
+ attr_reader :all, :pages, :base_path, :current_page, :page_sets
5
5
 
6
6
  def initialize(articles, base_path="/page", page_size=5)
7
7
  @all= articles
@@ -6,6 +6,11 @@ module Gumdrop
6
6
  def hidden(&block)
7
7
  #no-op
8
8
  end
9
+
10
+ def urlencode(string)
11
+ require "erb" unless defined? ERB
12
+ ERB::Util.url_encode(string)
13
+ end
9
14
 
10
15
  def markdown(source)
11
16
  eng_class= Gumdrop::Renderer.for 'markdown'
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION= "1.0.3"
3
+ VERSION= "1.1.0"
4
4
 
5
5
  end
data/lib/gumdrop.rb CHANGED
@@ -25,6 +25,7 @@ module Gumdrop
25
25
  autoload :Eventable, 'gumdrop/util/eventable'
26
26
  autoload :HashObject, 'gumdrop/util/hash_object'
27
27
  autoload :Loggable, 'gumdrop/util/loggable'
28
+ autoload :Pager, 'gumdrop/util/pager'
28
29
  autoload :Scanner, 'gumdrop/util/scanner'
29
30
  autoload :SiteAccess, 'gumdrop/util/site_access'
30
31
  autoload :ViewHelpers, 'gumdrop/util/view_helpers'
@@ -34,6 +34,8 @@
34
34
  <li><a href="js/test-coffee.js">js/test-coffee.js</a></li>
35
35
  <li><a href="pages/docs/force-abs.html">pages/docs/force-abs.html</a></li>
36
36
  <li><a href="pages/docs/index.html">pages/docs/index.html</a></li>
37
+ <li><a href="partials/cached-internally.html">partials/cached-internally.html</a></li>
38
+ <li><a href="partials/cached.html">partials/cached.html</a></li>
37
39
  <li><a href="partials/hoisted-data.html">partials/hoisted-data.html</a></li>
38
40
  <li><a href="partials/nested.html">partials/nested.html</a></li>
39
41
  <li><a href="partials/params.html">partials/params.html</a></li>
@@ -0,0 +1,5 @@
1
+ <body class="site"> <div>Matt</div>
2
+ <div>Matt</div>
3
+ <div>Matt</div>
4
+ <div>Other</div>
5
+ </body>
@@ -0,0 +1,5 @@
1
+ <body class="site"> <div>Matt</div>
2
+ <div>Matt</div>
3
+ <div>Matt</div>
4
+ <div>Other</div>
5
+ </body>
@@ -34,4 +34,4 @@ gem 'redcarpet'
34
34
  # For xml generation support:
35
35
  # gem 'builder'
36
36
 
37
-
37
+ gem 'json', '~> 1.7.7'
@@ -0,0 +1 @@
1
+ <% set :cache=>true %><div><%= name %></div>
@@ -0,0 +1 @@
1
+ <div><%= name %></div>
@@ -0,0 +1,4 @@
1
+ <%= render 'params-internally-cached', name:'Matt' %>
2
+ <%= render 'params-internally-cached', name:'Dan' %>
3
+ <%= render 'params-internally-cached', name:'Sam' %>
4
+ <%= render 'params-internally-cached', name:'Other', :cache=>false %>
@@ -0,0 +1,4 @@
1
+ <%= render 'params', name:'Matt', :cache=>true %>
2
+ <%= render 'params', name:'Dan' %>
3
+ <%= render 'params', name:'Sam' %>
4
+ <%= render 'params', name:'Other', :cache=>false %>
@@ -3,10 +3,12 @@ Gumdrop.configure do|config|
3
3
 
4
4
  # You can add whatever custom config options you'd like:
5
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"
6
+ # config.site= {
7
+ # title: 'My Site',
8
+ # tagline: 'My home on thar intarwebs!',
9
+ # author: 'Me',
10
+ # url: 'http://www.mysite.com'
11
+ # }
10
12
 
11
13
  # config.redirects= [
12
14
  # { from:"old-path.html", to:"new-path.html" }
@@ -37,13 +39,11 @@ Gumdrop.configure do|config|
37
39
  # config.blacklist= []
38
40
 
39
41
  # 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
- # })
42
+ # config.remote= {
43
+ # host: 'example-server.com',
44
+ # user: 'example-username',
45
+ # path: '~/example-server.com'
46
+ # }
47
47
 
48
48
  end
49
49
 
@@ -181,22 +181,23 @@ end
181
181
  # For more, see: https://github.com/wycats/thor/wiki
182
182
  # Gumdrop.cli do
183
183
 
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
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
+ # config= Gumdrop.site.config
189
+ # output= Gumdrop.site.output_path
190
+ # remote= config.remote
191
+ # dry_run= options[:dry_run] ? 'n' : ''
192
+ # unless remote.nil? or remote.host.nil? or remote.host == 'example-server.com'
193
+ # Gumdrop.build if options[:build]
194
+ # cmd= "rsync -avz#{ dry_run } --delete #{ output } #{ remote.user }@#{ remote.host }:#{ remote.path }"
195
+ # say "Running:\n#{ cmd }\n"
196
+ # system(cmd)
197
+ # else
198
+ # say "To use this command, please configure your server info in the Gumdrop file!"
199
+ # end
200
+ # end
200
201
 
201
202
  # desc 'watch', "Watches the filesystem and recompiles whenever a source file changes."
202
203
  # method_option :quiet, default:false, aliases:'-q', type: :boolean
@@ -1,7 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "gumdrop"
4
-
5
3
  # for the watch command
6
4
  # gem "listen"
7
5
 
@@ -31,3 +29,4 @@ gem "kramdown" #, :git => "git://github.com/darthapo/kramdown.git" #(github code
31
29
  # For xml generation support:
32
30
  gem 'builder'
33
31
 
32
+ gem 'json', '~> 1.7.7'
@@ -2,12 +2,14 @@
2
2
  Gumdrop.configure do|config|
3
3
 
4
4
  # You can add whatever custom config options you'd like:
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"
10
-
5
+ config.site= {
6
+ title: 'My Site',
7
+ tagline: 'My home on thar intarwebs!',
8
+ author: 'Me',
9
+ url: 'http://www.mysite.com'
10
+ }
11
+
12
+ # See the "Apache Stuff" generator below on how to use custom config info
11
13
  config.redirects= [
12
14
  { from:"old-path.html", to:"new-path.html" }
13
15
  ]
@@ -37,13 +39,11 @@ Gumdrop.configure do|config|
37
39
  # config.blacklist= []
38
40
 
39
41
  # 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
- })
42
+ config.remote= {
43
+ host: 'example-server.com',
44
+ user: 'example-username',
45
+ path: '~/example-server.com'
46
+ }
47
47
 
48
48
  end
49
49
 
@@ -90,7 +90,10 @@ DirectoryIndex index.html
90
90
  </IfModule>
91
91
  # END Gzip
92
92
 
93
- <% config.redirects.each do |opts| %>
93
+ <%
94
+ # It's the custom config setting! We have access to all config info here:
95
+ config.redirects.each do |opts|
96
+ %>
94
97
  Redirect <%= opts[:from] %> <%= opts[:to] %>
95
98
  <% end %>
96
99
  EOF
@@ -184,12 +187,13 @@ Gumdrop.cli do
184
187
  method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
185
188
  method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
186
189
  def sync
187
- Gumdrop.site.build if options[:build]
188
190
  config= Gumdrop.site.config
189
191
  output= Gumdrop.site.output_path
192
+ remote= config.remote
190
193
  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 }"
194
+ unless remote.nil? or remote.host.nil? or remote.host == 'example-server.com'
195
+ Gumdrop.build if options[:build]
196
+ cmd= "rsync -avz#{ dry_run } --delete #{ output } #{ remote.user }@#{ remote.host }:#{ remote.path }"
193
197
  say "Running:\n#{ cmd }\n"
194
198
  system(cmd)
195
199
  else
@@ -1,22 +1,22 @@
1
1
  xml.instruct!
2
2
  xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
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"
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.news.first.date.to_time.iso8601
9
- xml.author { xml.name config.site_author }
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}/news/#{post._id}-#{post.slug}.html"
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
- xml.author { xml.name config.site_author }
19
+ xml.author { xml.name config.site.author }
20
20
  xml.content render(post), "type" => "html"
21
21
  end
22
22
  end
@@ -1,4 +1,4 @@
1
- <p>Welcome to <%= config.site_title %></p>
1
+ <p>Welcome to <%= config.site.title %></p>
2
2
  <h4>News</h4>
3
3
  <ul>
4
4
  <%
@@ -2,7 +2,7 @@ doctype html
2
2
  html lang="en"
3
3
  head
4
4
  meta charset="utf-8"
5
- title= config.site_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='/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= config.site_title
15
- h4= config.site_tagline
14
+ h1= config.site.title
15
+ h4= config.site.tagline
16
16
  div.row
17
17
  div.col.span-12
18
18
  nav
metadata CHANGED
@@ -1,204 +1,237 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gumdrop
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 3
9
- version: 1.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Matt McCray
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-07-04 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: thor
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.15.4
31
22
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: tilt
35
23
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
37
25
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.15.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: tilt
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - '='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.3.3
44
38
  type: :runtime
45
- version_requirements: *id002
46
- - !ruby/object:Gem::Dependency
47
- name: active_support
48
39
  prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
50
41
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: active_support
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 3.0.0
57
54
  type: :runtime
58
- version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
60
- name: onfire
61
55
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: onfire
64
+ requirement: !ruby/object:Gem::Requirement
63
65
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.2.0
70
70
  type: :runtime
71
- version_requirements: *id004
72
- - !ruby/object:Gem::Dependency
73
- name: sinatra
74
71
  prerelease: false
75
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: sinatra
80
+ requirement: !ruby/object:Gem::Requirement
76
81
  none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
82
+ requirements:
83
+ - - '='
84
+ - !ruby/object:Gem::Version
85
+ version: 1.3.2
83
86
  type: :runtime
84
- version_requirements: *id005
85
- - !ruby/object:Gem::Dependency
86
- name: i18n
87
87
  prerelease: false
88
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 1.3.2
94
+ - !ruby/object:Gem::Dependency
95
+ name: i18n
96
+ requirement: !ruby/object:Gem::Requirement
89
97
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
- version: "0"
98
+ requirements:
99
+ - - '='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.6.0
96
102
  type: :runtime
97
- version_requirements: *id006
98
- - !ruby/object:Gem::Dependency
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.6.0
110
+ - !ruby/object:Gem::Dependency
99
111
  name: launchy
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.4.0
118
+ type: :runtime
100
119
  prerelease: false
101
- requirement: &id007 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
102
121
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- segments:
107
- - 0
108
- version: "0"
122
+ requirements:
123
+ - - '='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.4.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: sprockets
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - '='
132
+ - !ruby/object:Gem::Version
133
+ version: 2.4.3
109
134
  type: :runtime
110
- version_requirements: *id007
111
- - !ruby/object:Gem::Dependency
112
- name: bundle
113
135
  prerelease: false
114
- requirement: &id008 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - '='
140
+ - !ruby/object:Gem::Version
141
+ version: 2.4.3
142
+ - !ruby/object:Gem::Dependency
143
+ name: stitch
144
+ requirement: !ruby/object:Gem::Requirement
115
145
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- segments:
120
- - 0
121
- version: "0"
146
+ requirements:
147
+ - - '='
148
+ - !ruby/object:Gem::Version
149
+ version: 0.1.6
122
150
  type: :runtime
123
- version_requirements: *id008
124
- - !ruby/object:Gem::Dependency
125
- name: minitest
126
151
  prerelease: false
127
- requirement: &id009 !ruby/object:Gem::Requirement
152
+ version_requirements: !ruby/object:Gem::Requirement
128
153
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- segments:
133
- - 0
134
- version: "0"
135
- type: :development
136
- version_requirements: *id009
137
- - !ruby/object:Gem::Dependency
138
- name: sqlite3
154
+ requirements:
155
+ - - '='
156
+ - !ruby/object:Gem::Version
157
+ version: 0.1.6
158
+ - !ruby/object:Gem::Dependency
159
+ name: jsmin
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - '='
164
+ - !ruby/object:Gem::Version
165
+ version: 1.0.1
166
+ type: :runtime
139
167
  prerelease: false
140
- requirement: &id010 !ruby/object:Gem::Requirement
168
+ version_requirements: !ruby/object:Gem::Requirement
141
169
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- segments:
146
- - 0
147
- version: "0"
148
- type: :development
149
- version_requirements: *id010
150
- - !ruby/object:Gem::Dependency
151
- name: sprockets
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 1.0.1
174
+ - !ruby/object:Gem::Dependency
175
+ name: json
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ~>
180
+ - !ruby/object:Gem::Version
181
+ version: 1.7.7
182
+ type: :runtime
152
183
  prerelease: false
153
- requirement: &id011 !ruby/object:Gem::Requirement
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: 1.7.7
190
+ - !ruby/object:Gem::Dependency
191
+ name: minitest
192
+ requirement: !ruby/object:Gem::Requirement
154
193
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- segments:
159
- - 0
160
- version: "0"
194
+ requirements:
195
+ - - '='
196
+ - !ruby/object:Gem::Version
197
+ version: 3.2.0
161
198
  type: :development
162
- version_requirements: *id011
163
- - !ruby/object:Gem::Dependency
164
- name: stitch
165
199
  prerelease: false
166
- requirement: &id012 !ruby/object:Gem::Requirement
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - '='
204
+ - !ruby/object:Gem::Version
205
+ version: 3.2.0
206
+ - !ruby/object:Gem::Dependency
207
+ name: sqlite3
208
+ requirement: !ruby/object:Gem::Requirement
167
209
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- segments:
172
- - 0
173
- version: "0"
210
+ requirements:
211
+ - - '='
212
+ - !ruby/object:Gem::Version
213
+ version: 1.3.6
174
214
  type: :development
175
- version_requirements: *id012
176
- - !ruby/object:Gem::Dependency
177
- name: jsmin
178
215
  prerelease: false
179
- requirement: &id013 !ruby/object:Gem::Requirement
216
+ version_requirements: !ruby/object:Gem::Requirement
180
217
  none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- segments:
185
- - 0
186
- version: "0"
187
- type: :development
188
- version_requirements: *id013
189
- description: The sweet 'n simple cms and prototyping tool for creating static html websites and webapps.
218
+ requirements:
219
+ - - '='
220
+ - !ruby/object:Gem::Version
221
+ version: 1.3.6
222
+ description: The sweet 'n simple cms and prototyping tool for creating static html
223
+ websites and webapps.
190
224
  email: matt@elucidata.net
191
- executables:
225
+ executables:
192
226
  - gumdrop
193
227
  extensions: []
194
-
195
228
  extra_rdoc_files: []
196
-
197
- files:
229
+ files:
198
230
  - .gitignore
199
231
  - ChangeLog.md
200
232
  - Gemfile
201
233
  - License
234
+ - Notes.md
202
235
  - Rakefile
203
236
  - Readme.md
204
237
  - bin/gumdrop
@@ -272,6 +305,8 @@ files:
272
305
  - specs/fixtures/expected/js/test-coffee.js
273
306
  - specs/fixtures/expected/pages/docs/force-abs.html
274
307
  - specs/fixtures/expected/pages/docs/index.html
308
+ - specs/fixtures/expected/partials/cached-internally.html
309
+ - specs/fixtures/expected/partials/cached.html
275
310
  - specs/fixtures/expected/partials/hoisted-data.html
276
311
  - specs/fixtures/expected/partials/nested.html
277
312
  - specs/fixtures/expected/partials/params.html
@@ -298,7 +333,7 @@ files:
298
333
  - specs/fixtures/source/data/yaml_db.yamldb
299
334
  - specs/fixtures/source/data/yaml_items.yaml
300
335
  - specs/fixtures/source/data/yamldoc.yamldoc
301
- - specs/fixtures/source/gen-with-inline-render.generator
336
+ - specs/fixtures/source/gen-with-inline-render/gen-with-inline-render.generator
302
337
  - specs/fixtures/source/goodbye.html.erb
303
338
  - specs/fixtures/source/hello.html
304
339
  - specs/fixtures/source/image.png
@@ -315,11 +350,15 @@ files:
315
350
  - specs/fixtures/source/pages/_users-nested.html.erb
316
351
  - specs/fixtures/source/pages/docs/force-abs.html.erb
317
352
  - specs/fixtures/source/pages/docs/index.html.erb
353
+ - specs/fixtures/source/partials/_params-internally-cached.html.erb
354
+ - specs/fixtures/source/partials/_params.html.erb
318
355
  - specs/fixtures/source/partials/_post_entry.html.erb
319
356
  - specs/fixtures/source/partials/_provides_name.html.erb
320
357
  - specs/fixtures/source/partials/_user-params.html.erb
321
358
  - specs/fixtures/source/partials/_user.html.erb
322
359
  - specs/fixtures/source/partials/_user_sets_layout.html.erb
360
+ - specs/fixtures/source/partials/cached-internally.html.erb
361
+ - specs/fixtures/source/partials/cached.html.erb
323
362
  - specs/fixtures/source/partials/hoisted-data.html.erb
324
363
  - specs/fixtures/source/partials/nested.html.erb
325
364
  - specs/fixtures/source/partials/params.html.erb
@@ -349,37 +388,28 @@ files:
349
388
  - templates/default/source/theme/screen.css.sass
350
389
  - templates/default/source/theme/scripts/app.js.coffee
351
390
  - templates/default/source/theme/styles/_tools.scss
352
- has_rdoc: true
353
391
  homepage: https://github.com/darthapo/gumdrop
354
392
  licenses: []
355
-
356
393
  post_install_message:
357
394
  rdoc_options: []
358
-
359
- require_paths:
395
+ require_paths:
360
396
  - lib
361
- required_ruby_version: !ruby/object:Gem::Requirement
397
+ required_ruby_version: !ruby/object:Gem::Requirement
362
398
  none: false
363
- requirements:
364
- - - ">="
365
- - !ruby/object:Gem::Version
366
- segments:
367
- - 0
368
- version: "0"
369
- required_rubygems_version: !ruby/object:Gem::Requirement
399
+ requirements:
400
+ - - ! '>='
401
+ - !ruby/object:Gem::Version
402
+ version: '0'
403
+ required_rubygems_version: !ruby/object:Gem::Requirement
370
404
  none: false
371
- requirements:
372
- - - ">="
373
- - !ruby/object:Gem::Version
374
- segments:
375
- - 0
376
- version: "0"
405
+ requirements:
406
+ - - ! '>='
407
+ - !ruby/object:Gem::Version
408
+ version: '0'
377
409
  requirements: []
378
-
379
410
  rubyforge_project: gumdrop
380
- rubygems_version: 1.3.7
411
+ rubygems_version: 1.8.24
381
412
  signing_key:
382
413
  specification_version: 3
383
414
  summary: The sweet 'n simple cms and prototyping tool.
384
415
  test_files: []
385
-