gumdrop 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/ChangeLog.md +6 -0
- data/Readme.md +7 -0
- data/gumdrop.gemspec +2 -2
- data/lib/gumdrop/content.rb +53 -23
- data/lib/gumdrop/generator.rb +6 -4
- data/lib/gumdrop/site.rb +1 -7
- data/lib/gumdrop/{stitch_compilers.rb → stitch_support.rb} +16 -0
- data/lib/gumdrop/version.rb +1 -1
- data/lib/gumdrop.rb +5 -0
- data/templates/default/source/theme/templates/site.template.slim +1 -1
- metadata +5 -7
- data/Notes.md +0 -38
- data/lib/gumdrop/stitch_ex.rb +0 -14
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# v0.6.2
|
2
|
+
- Consolidated stitch support code into single file
|
3
|
+
- Bugfix: Generates better relative paths for Content objects
|
4
|
+
- Cleaned up paths in Content
|
5
|
+
- Updated project templates
|
6
|
+
|
1
7
|
# v0.6.1
|
2
8
|
- Content filters are run for dev server requests now too.
|
3
9
|
- Added config.env, defaults to 'production' (override from cli with -e)
|
data/Readme.md
CHANGED
@@ -180,3 +180,10 @@ Here's the `Gumdrop` file created by the default template:
|
|
180
180
|
- Partials
|
181
181
|
- Config and using in pages
|
182
182
|
- Project Templates
|
183
|
+
|
184
|
+
# Todo / Ideas / Changes
|
185
|
+
- New/Update Doc site.
|
186
|
+
- Need test coverage.
|
187
|
+
- Some kind of admin? What would that even do?
|
188
|
+
- If you could specify a 'prototype' for data collections, could be cool.
|
189
|
+
- Add YamlDoc support for nodes? (Tilt compiler? or in Content)
|
data/gumdrop.gemspec
CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.authors = ["Matt McCray"]
|
15
15
|
s.email = %q{matt@elucidata.net}
|
16
|
-
s.summary = %q{
|
16
|
+
s.summary = %q{The sweet 'n simple cms/prototyping tool.}
|
17
17
|
s.homepage = %q{https://github.com/darthapo/gumdrop}
|
18
|
-
s.description = %q{
|
18
|
+
s.description = %q{The sweet 'n simple cms/prototyping tool for creating static html websites and webapps.}
|
19
19
|
|
20
20
|
s.files = `git ls-files`.split("\n")
|
21
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/lib/gumdrop/content.rb
CHANGED
@@ -3,32 +3,32 @@ module Gumdrop
|
|
3
3
|
|
4
4
|
class Content
|
5
5
|
|
6
|
-
attr_accessor :path,
|
6
|
+
attr_accessor :path,
|
7
|
+
:level,
|
8
|
+
:filename,
|
9
|
+
:source_filename,
|
10
|
+
:type,
|
11
|
+
:ext,
|
12
|
+
:uri,
|
13
|
+
:slug,
|
14
|
+
:template,
|
15
|
+
:params,
|
16
|
+
:site,
|
17
|
+
:ignored,
|
18
|
+
:full_path
|
7
19
|
|
8
20
|
def initialize(path, site, params={})
|
9
21
|
@site= site
|
10
22
|
@params= HashObject.new params
|
11
|
-
@
|
12
|
-
@level= (@path.split('/').length - 2)
|
13
|
-
@source_filename= File.basename path
|
23
|
+
@full_path= path
|
14
24
|
@ignored= false
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
ext= filename_parts.pop
|
20
|
-
end
|
21
|
-
filename_parts << ext # push the last file ext back on there!
|
22
|
-
@filename= filename_parts.join('.')
|
23
|
-
|
24
|
-
path_parts= @path.split('/')
|
25
|
-
path_parts.shift
|
26
|
-
path_parts.pop
|
27
|
-
path_parts.push @filename
|
28
|
-
|
25
|
+
@path= get_source_path
|
26
|
+
@level= (@path.split('/').length - 1)
|
27
|
+
@source_filename= File.basename path
|
28
|
+
@filename= get_target_filename
|
29
29
|
@type= File.extname @source_filename
|
30
30
|
@ext= File.extname @filename
|
31
|
-
@uri=
|
31
|
+
@uri= get_uri
|
32
32
|
@slug=@uri.gsub('/', '-').gsub(@ext, '')
|
33
33
|
@template= unless Tilt[path].nil?
|
34
34
|
Tilt.new path
|
@@ -67,21 +67,21 @@ module Gumdrop
|
|
67
67
|
|
68
68
|
def copyTo(output, layout=nil, opts={})
|
69
69
|
do_copy= if File.exists? output
|
70
|
-
!FileUtils.identical? @
|
70
|
+
!FileUtils.identical? @full_path, output
|
71
71
|
else
|
72
72
|
true
|
73
73
|
end
|
74
74
|
if do_copy
|
75
75
|
@site.report " Copying: #{@uri}", :warning
|
76
|
-
FileUtils.cp_r @
|
76
|
+
FileUtils.cp_r @full_path, output, opts
|
77
77
|
else
|
78
78
|
@site.report " (same): #{@uri}", :info
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
def mtime
|
83
|
-
if File.exists? @
|
84
|
-
File.new(@
|
83
|
+
if File.exists? @full_path
|
84
|
+
File.new(@full_path).mtime
|
85
85
|
else
|
86
86
|
Time.now
|
87
87
|
end
|
@@ -94,6 +94,36 @@ module Gumdrop
|
|
94
94
|
def to_s
|
95
95
|
@uri
|
96
96
|
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def get_source_path
|
101
|
+
path= @full_path.sub @site.src_path, ''
|
102
|
+
if path[0] == '/'
|
103
|
+
path[1..-1]
|
104
|
+
else
|
105
|
+
path
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_target_filename
|
110
|
+
filename_parts= @source_filename.split('.')
|
111
|
+
ext= filename_parts.pop
|
112
|
+
while !Tilt[ext].nil?
|
113
|
+
ext= filename_parts.pop
|
114
|
+
end
|
115
|
+
filename_parts << ext # push the last file ext back on there!
|
116
|
+
filename_parts.join('.')
|
117
|
+
end
|
118
|
+
|
119
|
+
def get_uri
|
120
|
+
uri= File.join File.dirname(@path), @filename # path_parts.join('/')
|
121
|
+
if uri.starts_with? './'
|
122
|
+
uri[2..-1]
|
123
|
+
else
|
124
|
+
uri
|
125
|
+
end
|
126
|
+
end
|
97
127
|
|
98
128
|
end
|
99
129
|
|
data/lib/gumdrop/generator.rb
CHANGED
@@ -17,6 +17,7 @@ module Gumdrop
|
|
17
17
|
@pages= []
|
18
18
|
end
|
19
19
|
|
20
|
+
# This should probably not be accessible to the generators
|
20
21
|
def execute
|
21
22
|
if @content.is_a? Proc
|
22
23
|
run_dsl_from_proc @content
|
@@ -41,9 +42,9 @@ module Gumdrop
|
|
41
42
|
name= name[1..-1] if name.starts_with?('/')
|
42
43
|
opts= params.reverse_merge(opts)
|
43
44
|
filepath= if @base_path.empty?
|
44
|
-
|
45
|
+
File.join @site.src_path, name
|
45
46
|
else
|
46
|
-
|
47
|
+
File.join @site.src_path, @base_path, @name
|
47
48
|
end
|
48
49
|
content= GeneratedContent.new(filepath, block, @site, opts)
|
49
50
|
if opts.has_key? :template and !opts[:template].nil?
|
@@ -74,8 +75,7 @@ module Gumdrop
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def stitch(name, opts)
|
77
|
-
require 'gumdrop/
|
78
|
-
require 'gumdrop/stitch_compilers'
|
78
|
+
require 'gumdrop/stitch_support'
|
79
79
|
content= Stitch::Package.new(opts).compile
|
80
80
|
page name do
|
81
81
|
case opts[:compress]
|
@@ -120,6 +120,8 @@ module Gumdrop
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
123
|
+
|
124
|
+
private
|
123
125
|
|
124
126
|
def run_dsl_from_source(source)
|
125
127
|
# puts source
|
data/lib/gumdrop/site.rb
CHANGED
@@ -21,9 +21,7 @@ module Gumdrop
|
|
21
21
|
|
22
22
|
attr_reader :opts,
|
23
23
|
:root_path,
|
24
|
-
:root_path_parts,
|
25
24
|
:src_path,
|
26
|
-
:src_path_parts,
|
27
25
|
:blacklist,
|
28
26
|
:greylist,
|
29
27
|
:redirects,
|
@@ -41,7 +39,6 @@ module Gumdrop
|
|
41
39
|
def initialize(sitefile, opts={})
|
42
40
|
@sitefile = File.expand_path sitefile
|
43
41
|
@root_path = File.dirname @sitefile
|
44
|
-
@root_path_parts = @root_path.split('/')
|
45
42
|
@opts = opts
|
46
43
|
reset_all()
|
47
44
|
end
|
@@ -175,14 +172,12 @@ module Gumdrop
|
|
175
172
|
#puts "Running in: #{root}"
|
176
173
|
Dir.glob("#{src_path}/**/*", File::FNM_DOTMATCH).each do |path|
|
177
174
|
unless File.directory? path or @config.ignore.include?( File.basename(path) )
|
178
|
-
|
179
|
-
node= Content.new(file_path, self)
|
175
|
+
node= Content.new(path, self)
|
180
176
|
path= node.to_s
|
181
177
|
if blacklist.any? {|pattern| path_match path, pattern }
|
182
178
|
report "-excluding: #{path}", :info
|
183
179
|
else
|
184
180
|
node.ignored= greylist.any? {|pattern| path_match path, pattern }
|
185
|
-
|
186
181
|
# Sort out Layouts, Generators, and Partials
|
187
182
|
if File.extname(path) == ".template"
|
188
183
|
layouts[path]= node
|
@@ -203,7 +198,6 @@ module Gumdrop
|
|
203
198
|
end
|
204
199
|
end
|
205
200
|
end
|
206
|
-
|
207
201
|
end
|
208
202
|
|
209
203
|
def run_generators
|
@@ -1,4 +1,19 @@
|
|
1
|
+
|
1
2
|
require 'stitch-rb'
|
3
|
+
# require 'stitch'
|
4
|
+
|
5
|
+
class Stitch::Source
|
6
|
+
# Patch for gumdrop style filenames
|
7
|
+
def name
|
8
|
+
name = path.relative_path_from(root)
|
9
|
+
name = name.dirname + name.basename(".*")
|
10
|
+
name.to_s.gsub(".js", '')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
# Custom Compilers
|
16
|
+
|
2
17
|
|
3
18
|
class SerenadeCompiler < Stitch::Compiler
|
4
19
|
|
@@ -14,6 +29,7 @@ class SerenadeCompiler < Stitch::Compiler
|
|
14
29
|
|
15
30
|
end
|
16
31
|
|
32
|
+
# Not so sure on this one...
|
17
33
|
class HoganCompiler < Stitch::Compiler
|
18
34
|
# List of supported extensions
|
19
35
|
extensions :mustache
|
data/lib/gumdrop/version.rb
CHANGED
data/lib/gumdrop.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 2
|
9
|
+
version: 0.6.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt McCray
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
version: "0"
|
96
96
|
type: :runtime
|
97
97
|
version_requirements: *id006
|
98
|
-
description:
|
98
|
+
description: The sweet 'n simple cms/prototyping tool for creating static html websites and webapps.
|
99
99
|
email: matt@elucidata.net
|
100
100
|
executables:
|
101
101
|
- gumdrop
|
@@ -108,7 +108,6 @@ files:
|
|
108
108
|
- ChangeLog.md
|
109
109
|
- Gemfile
|
110
110
|
- License
|
111
|
-
- Notes.md
|
112
111
|
- Rakefile
|
113
112
|
- Readme.md
|
114
113
|
- bin/gumdrop
|
@@ -123,8 +122,7 @@ files:
|
|
123
122
|
- lib/gumdrop/proxy_handler.rb
|
124
123
|
- lib/gumdrop/server.rb
|
125
124
|
- lib/gumdrop/site.rb
|
126
|
-
- lib/gumdrop/
|
127
|
-
- lib/gumdrop/stitch_ex.rb
|
125
|
+
- lib/gumdrop/stitch_support.rb
|
128
126
|
- lib/gumdrop/version.rb
|
129
127
|
- lib/gumdrop/view_helpers.rb
|
130
128
|
- specs/content_spec.rb
|
@@ -200,6 +198,6 @@ rubyforge_project: gumdrop
|
|
200
198
|
rubygems_version: 1.3.7
|
201
199
|
signing_key:
|
202
200
|
specification_version: 3
|
203
|
-
summary:
|
201
|
+
summary: The sweet 'n simple cms/prototyping tool.
|
204
202
|
test_files: []
|
205
203
|
|
data/Notes.md
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# Future Features/Changes
|
2
|
-
- Some kind of admin? What would that even do?
|
3
|
-
- If you could specify a 'prototype' for data collections, could be cool.
|
4
|
-
- Multiple source_dir?
|
5
|
-
- `set :source_dir, ['./source/a', './source/b']
|
6
|
-
- What would happen with conflicts, last one in wins?
|
7
|
-
- Multiple data_dir too?
|
8
|
-
- Add YamlDoc support for nodes? (Tilt compiler? or in Content)
|
9
|
-
- configure block for each env/mode?
|
10
|
-
|
11
|
-
# TODO:
|
12
|
-
- New/Update Doc Site
|
13
|
-
- API for retrieving pages and pages under a path (simple query)
|
14
|
-
- Need test coverage.
|
15
|
-
|
16
|
-
- Extract Build class into a Site class that can be instansiated (so multiple site can be loaded/run in memory)
|
17
|
-
|
18
|
-
|
19
|
-
# Possible New Internals
|
20
|
-
- Gumdrop (module)
|
21
|
-
- Site (class)
|
22
|
-
- SiteFileDSL (was DSL)
|
23
|
-
- Node (was Content)
|
24
|
-
- NodeGenerator (was Generator)
|
25
|
-
- Data (module)
|
26
|
-
- Manager (was DataManager)
|
27
|
-
- Collection
|
28
|
-
- Object
|
29
|
-
- Pager
|
30
|
-
- Server (module)
|
31
|
-
- NodeHandler
|
32
|
-
- ProxyHandler
|
33
|
-
- Render (module)
|
34
|
-
- Context
|
35
|
-
- ViewHelpers
|
36
|
-
- StitchCompilers
|
37
|
-
- Utils (module)
|
38
|
-
- Logging
|
data/lib/gumdrop/stitch_ex.rb
DELETED