gumdrop 1.1.1 → 1.1.2

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 CHANGED
@@ -4,4 +4,6 @@ output
4
4
  .sass-cache
5
5
  *.log
6
6
  old_*
7
- Gemfile.lock
7
+ Gemfile.lock
8
+ templates/blank/output
9
+ templates/default/output
@@ -1,3 +1,9 @@
1
+ # v1.1.2
2
+ - Added helper for checksums, good for:
3
+ - Added cache busting support for uris. e.g. "/theme/screen.css?v=HASHHERE445435435ETC"
4
+ - Added support for `Gumdrop#no_render(*paths)`. Treats all matched paths as binary.
5
+ - Fixed sprockets load_paths issue.
6
+
1
7
  # v1.1.1
2
8
  - Cleaned up dependencies.
3
9
  - Some performance and memory optimizations.
data/Notes.md CHANGED
@@ -2,4 +2,7 @@
2
2
 
3
3
  - Flesh out the test/specs
4
4
  - Support Compass for sass
5
- - Support nib for stylus
5
+ - Support nib for stylus
6
+ - Remove `Pageset#uri`? Or else make it work right (including/especially via generators)
7
+ - Update to latest Tilt? Or wait for v2?
8
+ - Add support for template paths. Will load only layouts and partials from those directories.
@@ -62,6 +62,7 @@ module Gumdrop
62
62
  log.debug " blackout: #{ uri }" and next if site.in_blacklist? uri
63
63
  output_path= site.output_path / content.uri
64
64
  if content.binary?
65
+ # log.info "BINARY: #{content.path}"
65
66
  @copy_files << { content.source_path => output_path }
66
67
  else
67
68
  rendered_content= renderer.draw content
@@ -32,6 +32,7 @@ module Gumdrop::CLI
32
32
  desc 'server', 'Run development server'
33
33
  method_option :browser, aliases:'-b', default:false, desc:"Launch a browser to the site address."
34
34
  method_option :port, aliases:'-p', default:4567, desc:"Port to run the server on."
35
+ method_option :env, default:'production', aliases:'-e'
35
36
  def server
36
37
  Gumdrop.configure do |c|
37
38
  c.server_port= options[:port]
@@ -75,7 +75,7 @@ module Gumdrop
75
75
  @is_binary ||= begin
76
76
  if generated? or has_block? or missing?
77
77
  false
78
- elsif KNOWN_BINARY.include? ext
78
+ elsif KNOWN_BINARY.include? ext or site.unrenderable? path
79
79
  true
80
80
  else
81
81
  # from ptools
@@ -189,6 +189,8 @@ module Gumdrop
189
189
  end
190
190
  end
191
191
 
192
+
193
+
192
194
  class ContentList < Hash
193
195
 
194
196
  def initialize
@@ -54,6 +54,18 @@ module Gumdrop
54
54
  page_size= opts.fetch(:page_size, 5)
55
55
  Util::Pager.new( data, base_path, page_size )
56
56
  end
57
+
58
+ # Not used internally, but useful for external usage
59
+ def parse_file(path, target_ext=nil)
60
+ return nil if path.nil?
61
+ return nil if File.directory? path
62
+ _load_from_file path, target_ext
63
+ # if File.directory? path
64
+ # _load_from_directory path
65
+ # else
66
+ # _load_from_file path, target_ext
67
+ # end
68
+ end
57
69
 
58
70
  private
59
71
 
@@ -71,8 +83,8 @@ module Gumdrop
71
83
  end
72
84
  end
73
85
 
74
- def _load_from_file( filename )
75
- ext=File.extname(filename)[1..-1]
86
+ def _load_from_file( filename, target_ext=nil )
87
+ ext= target_ext || File.extname(filename)[1..-1]
76
88
  provider= Data::Provider.for ext
77
89
  case
78
90
  when provider.nil?
@@ -25,14 +25,14 @@ module Gumdrop
25
25
  set :port, site.config.server_port if site.config.server_port
26
26
 
27
27
  if site.config.proxy_enabled
28
- require 'gumdrop/server/proxy_handler'
28
+ require 'gumdrop/util/proxy_handler'
29
29
  get '/-proxy/*' do handle_proxy(params, env) end
30
30
  post '/-proxy/*' do handle_proxy(params, env) end
31
31
  put '/-proxy/*' do handle_proxy(params, env) end
32
32
  delete '/-proxy/*' do handle_proxy(params, env) end
33
33
  patch '/-proxy/*' do handle_proxy(params, env) end
34
34
  options '/-proxy/*' do handle_proxy(params, env) end
35
- log.info 'Enabled proxy at /-proxy/*'
35
+ # log.info 'Enabled proxy at /-proxy/*'
36
36
  end
37
37
 
38
38
  get '/*' do
@@ -16,6 +16,7 @@ module Gumdrop
16
16
  log_level: :info,
17
17
  ignore: JETSAM_FILES,
18
18
  blacklist: [],
19
+ no_render: [],
19
20
  server_timeout: 5,
20
21
  server_port: 4567,
21
22
  env: :production,
@@ -116,6 +117,12 @@ module Gumdrop
116
117
  end
117
118
  end
118
119
 
120
+ def unrenderable?(path)
121
+ config.no_render.any? do |pattern|
122
+ path.path_match? pattern
123
+ end
124
+ end
125
+
119
126
  def source_path
120
127
  @source_path ||= source_dir.expand_path(root)
121
128
  end
@@ -354,7 +361,7 @@ module Gumdrop
354
361
  end
355
362
  end
356
363
 
357
- # Specified paths will not be renderd to output (matching against
364
+ # Specified paths will not be rendered to output (matching against
358
365
  # the source tree).
359
366
  def blacklist(*paths)
360
367
  paths.each do |path|
@@ -366,6 +373,18 @@ module Gumdrop
366
373
  end
367
374
  end
368
375
 
376
+ # Specified paths will be treated as binary files and copied, not
377
+ # rendered.
378
+ def no_render(*paths)
379
+ paths.each do |path|
380
+ if path.is_a? Array
381
+ config.no_render.concat path
382
+ else
383
+ config.no_render << path
384
+ end
385
+ end
386
+ end
387
+
369
388
  protected
370
389
 
371
390
  # Walks up the filesystem, starting from Dir.pwd, looking for
@@ -7,8 +7,9 @@ module Gumdrop::Support
7
7
  require 'sprockets'
8
8
  source_path = source_file || opt[:main] || opt[:from]
9
9
  env = ::Sprockets::Environment.new site.root
10
+ env.append_path File.expand_path(File.join site.source_path, File.dirname(source_path))
10
11
  env.append_path site.source_path
11
- env.append_path File.dirname(source_path)
12
+ # env.append_path File.dirname(source_path)
12
13
  [opts[:paths]].flatten.each do |path|
13
14
  env.append_path(path) unless path.nil?
14
15
  end
@@ -22,7 +22,9 @@ module Gumdrop::Support
22
22
  stitch_opts= {} #{ root: content.source_path }
23
23
  stitch_opts.merge! opts
24
24
  stitch_opts[:paths] ||= []
25
- stitch_opts[:paths] << File.dirname(path)
25
+ if stitch_opts.fetch(:autorootpath, true)
26
+ stitch_opts[:paths] << File.dirname(path)
27
+ end
26
28
  ::Stitch::Package.new(stitch_opts).compile
27
29
  rescue LoadError
28
30
  raise StandardError, "Stitch can't be loaded. Please add it to your Gemfile."
@@ -22,6 +22,10 @@ module Gumdrop::Util
22
22
  @current_page= nil
23
23
  end
24
24
 
25
+ def current
26
+ @pages.fetch(@current_page, nil)
27
+ end
28
+
25
29
  def length
26
30
  @pages.length
27
31
  end
@@ -98,7 +98,7 @@ module Gumdrop
98
98
  status = response.code # http status code
99
99
  protocol = proxy[:secure] ? 'https' : 'http'
100
100
 
101
- log.log "~ PROXY: #{http_method.upcase} #{status} #{url} -> #{protocol}://#{http_host}:#{http_port}#{http_path}\n"
101
+ log.info "~ PROXY: #{http_method.upcase} #{status} #{url} -> #{protocol}://#{http_host}:#{http_port}#{http_path}\n"
102
102
 
103
103
  # display and construct specific response headers
104
104
  response_headers = {}
@@ -1,3 +1,5 @@
1
+ require 'digest/md5'
2
+
1
3
  module Gumdrop
2
4
 
3
5
  module Util
@@ -31,6 +33,31 @@ module Gumdrop
31
33
  raise StandardError, "Textile is not available: Include a Textile engine in your Gemfile!"
32
34
  end
33
35
  end
36
+
37
+ def uri_fresh(path)
38
+ if (path[0] == '/')
39
+ internal_path= path[1..-1]
40
+ else
41
+ internal_path= path
42
+ path= "/#{path}"
43
+ end
44
+ "#{ path }?v=#{ checksum_for internal_path }"
45
+ end
46
+
47
+ def cache_bust(path)
48
+ uri_fresh(path)
49
+ end
50
+
51
+ def checksum_for(path)
52
+ path= path[1..-1] if path[0] == '/'
53
+ @_checksum_cache ||= {}
54
+ if @_checksum_cache.has_key? path
55
+ @_checksum_cache[path]
56
+ else
57
+ content= render path
58
+ @_checksum_cache[path]= Digest::MD5.hexdigest( content )
59
+ end
60
+ end
34
61
 
35
62
  def config
36
63
  site.config
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION= "1.1.1"
3
+ VERSION= "1.1.2"
4
4
 
5
5
  end
@@ -8,7 +8,8 @@ source "http://rubygems.org"
8
8
  # For template support:
9
9
  # gem "less"
10
10
  # gem "haml"
11
- gem "slim"
11
+ # gem "slim"
12
+ gem "erubis"
12
13
  gem "sass"
13
14
  gem "coffee-script"
14
15
 
@@ -17,8 +18,8 @@ gem "coffee-script"
17
18
  #gem 'yui-compressor'
18
19
  #gem 'packr'
19
20
  gem 'jsmin'
20
- gem 'stitch-rb'
21
- #gem 'sprockets'
21
+ gem 'sprockets'
22
+ # gem 'stitch-rb'
22
23
 
23
24
  # For markdown support, a couple of options:
24
25
  gem "kramdown" #, :git => "git://github.com/darthapo/kramdown.git" #(github code-fence support)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gumdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
12
+ date: 2013-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -360,3 +360,4 @@ signing_key:
360
360
  specification_version: 3
361
361
  summary: The sweet 'n simple cms and prototyping tool.
362
362
  test_files: []
363
+ has_rdoc: false