gumdrop 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +4 -0
- data/Notes.md +0 -7
- data/Readme.md +113 -36
- data/lib/gumdrop/cli.rb +2 -0
- data/lib/gumdrop/server.rb +3 -1
- data/lib/gumdrop/site.rb +2 -7
- data/lib/gumdrop/version.rb +1 -1
- data/lib/gumdrop.rb +3 -1
- metadata +2 -2
data/ChangeLog.md
CHANGED
data/Notes.md
CHANGED
@@ -5,14 +5,7 @@
|
|
5
5
|
- `set :source_dir, ['./source/a', './source/b']
|
6
6
|
- What would happen with conflicts, last one in wins?
|
7
7
|
- Multiple data_dir too?
|
8
|
-
- Refactor code to not use Gumdrop as a singleton (static really)
|
9
8
|
- Add YamlDoc support for nodes? (Tilt compiler? or in Content)
|
10
|
-
|
11
|
-
|
12
|
-
- `Gumdrop.mode` :build, :serve (other?)
|
13
|
-
- `Gumdrop.env` (specified via -e on cli, default: production)
|
14
|
-
- Easy access to ENV in RenderingContext (MODE as well)
|
15
|
-
|
16
9
|
- configure block for each env/mode?
|
17
10
|
|
18
11
|
# TODO:
|
data/Readme.md
CHANGED
@@ -6,7 +6,7 @@ Gumdrop is a small and sweet cms/prototype tool. It can generate static html wit
|
|
6
6
|
|
7
7
|
gem install gumdrop
|
8
8
|
|
9
|
-
# Quick Ref
|
9
|
+
# CLI Quick Ref
|
10
10
|
|
11
11
|
### Create New Site
|
12
12
|
|
@@ -49,49 +49,126 @@ You can then create new sites based on your local template:
|
|
49
49
|
Local templates are stored under `~/.gumdrop/templates/`.
|
50
50
|
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
site.template.erb
|
70
|
-
Gemfile
|
71
|
-
Gumdrop
|
72
|
-
config.ru
|
73
|
-
Rakefile
|
52
|
+
|
53
|
+
# Gumdrop File
|
54
|
+
|
55
|
+
Gumdrop looks for a file named `Gumdrop` to indicate the root folder of your project. It'll walk up the directory structure looking for one, so you can run Gumdrop commands from sub-folders.
|
56
|
+
|
57
|
+
The `Gumdrop` file is where you configure your site, generate dynamic content, assign view_helpers and more.
|
58
|
+
|
59
|
+
Here's the `Gumdrop` file created by the default template:
|
60
|
+
|
61
|
+
puts "Gumdrop v#{Gumdrop::VERSION} building..."
|
62
|
+
|
63
|
+
configure do
|
64
|
+
|
65
|
+
set :site_title, "My Site"
|
66
|
+
set :site_tagline, "My home on thar intarwebs!"
|
67
|
+
set :site_author, "Me"
|
68
|
+
set :site_url, "http://www.mysite.com"
|
74
69
|
|
70
|
+
# All the supported build configuration settings and their defaults:
|
71
|
+
# set :relative_paths, true
|
72
|
+
# set :proxy_enabled, true
|
73
|
+
# set :output_dir, "./output"
|
74
|
+
# set :source_dir, "./source"
|
75
|
+
# set :data_dir, './data'
|
76
|
+
# set :log, './logs/build.log'
|
77
|
+
# set :ignore, %w(.DS_Store .gitignore .git .svn .sass-cache)
|
78
|
+
# set :server_timeout, 15
|
79
|
+
# set :server_port, 4567
|
75
80
|
|
76
|
-
|
81
|
+
end
|
77
82
|
|
78
|
-
site_root/
|
79
|
-
output/ (** GENERATED CONTENT **)
|
80
|
-
index.html
|
81
|
-
theme/
|
82
|
-
screen.css
|
83
|
-
scripts/
|
84
|
-
app.js
|
85
83
|
|
86
|
-
|
84
|
+
# Skipping files entirely from build process... Like they don't exist.
|
85
|
+
# skip 'file-to-ignore.html'
|
86
|
+
# skip 'dont-show/**/*'
|
87
87
|
|
88
|
-
#
|
88
|
+
# Ignores source file(s) from compilation, but does load the content into memory
|
89
|
+
# ignore 'pages/**/*.*'
|
89
90
|
|
90
|
-
|
91
|
+
# NOTE: Skipping and ignoring matches like a file glob (it use File.fnmatch in fact)
|
92
|
+
# (this doesn't work for files detected by stitch)
|
91
93
|
|
92
|
-
The `Gumdrop` file is where you configure your site, generate dynamic content, assign view_helpers and more.
|
93
94
|
|
94
|
-
|
95
|
+
# Example site-level generator
|
96
|
+
generate do
|
97
|
+
|
98
|
+
# Requires a about.template.XX file
|
99
|
+
# page "about.html",
|
100
|
+
# :template=>'about',
|
101
|
+
# :passthru=>'Available in the template'
|
102
|
+
|
103
|
+
# page 'robots.txt' do
|
104
|
+
# # And content returned will be put in the file
|
105
|
+
# """
|
106
|
+
# User-Agent: *
|
107
|
+
# Disallow: /
|
108
|
+
# """
|
109
|
+
# end
|
110
|
+
|
111
|
+
# Maybe for a tumblr-like pager
|
112
|
+
# pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
|
113
|
+
|
114
|
+
# pager.each do |page|
|
115
|
+
# page "#{page.uri}.html",
|
116
|
+
# template:'post_page',
|
117
|
+
# posts:page.items,
|
118
|
+
# pager:pager,
|
119
|
+
# current_page:pager.current_page
|
120
|
+
# end
|
121
|
+
|
122
|
+
# Assemble javscript files in a CommonJS-like way with stitch-rb
|
123
|
+
# stitch 'app.js', # JavaScript to assemble
|
124
|
+
# :identifier=>'app', # variable name for the library
|
125
|
+
# :paths=>['./app'],
|
126
|
+
# :root=>'./app',
|
127
|
+
# :dependencies=>[], # List of scripts to prepend to top of file (non moduled)
|
128
|
+
# :prune=>false, # If true, removes the source files from Gumdrop.site hash
|
129
|
+
# :compress=>:jsmin, # Options are :jsmin, :yuic, :uglify
|
130
|
+
# :obfuscate=>false, # For compressors that support munging/mangling
|
131
|
+
# :keep_src=>true # Creates another file, ex: app-src.js
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
# Example of using a content filter to compress CSS output
|
136
|
+
# require 'yui/compressor'
|
137
|
+
# content_filter do |content, info|
|
138
|
+
# if info.ext == '.css'
|
139
|
+
# puts " Compress: #{info.filename}"
|
140
|
+
# compressor= YUI::CssCompressor.new
|
141
|
+
# compressor.compress( content )
|
142
|
+
# else
|
143
|
+
# content
|
144
|
+
# end
|
145
|
+
# end
|
146
|
+
|
147
|
+
|
148
|
+
# View helpers (available in rendering context):
|
149
|
+
view_helpers do
|
150
|
+
|
151
|
+
# Calculate the years for a copyright
|
152
|
+
def copyright_years(start_year, divider="–")
|
153
|
+
end_year = Date.today.year
|
154
|
+
if start_year == end_year
|
155
|
+
"#{start_year}"
|
156
|
+
else
|
157
|
+
"#{start_year}#{divider}#{end_year}"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
#
|
162
|
+
# Your custom helpers go here!
|
163
|
+
#
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
# Any specialized code for your site goes here...
|
168
|
+
|
169
|
+
require 'slim'
|
170
|
+
Slim::Engine.set_default_options pretty:true
|
171
|
+
|
95
172
|
|
96
173
|
# Need To Document:
|
97
174
|
|
data/lib/gumdrop/cli.rb
CHANGED
@@ -28,6 +28,7 @@ Examples:
|
|
28
28
|
Options:
|
29
29
|
EOS
|
30
30
|
opt :build, "Build HTML output"
|
31
|
+
opt :environment, "Specify config.env", :type=>String, :default=>'production'
|
31
32
|
opt :new, "Create new data item (specify collection name)", :type=>String
|
32
33
|
opt :server, "Runs development server"
|
33
34
|
opt :port, "Specifies port to run server on", :type=>:int
|
@@ -56,6 +57,7 @@ unless opts[:create_given] or opts[:build_given] or opts[:server_given] or opts[
|
|
56
57
|
Trollop::die "No commands specified"
|
57
58
|
end
|
58
59
|
|
60
|
+
Gumdrop::DEFAULT_OPTIONS[:env]= opts[:environment] || 'production'
|
59
61
|
|
60
62
|
# BUILD
|
61
63
|
|
data/lib/gumdrop/server.rb
CHANGED
@@ -43,7 +43,9 @@ module Gumdrop
|
|
43
43
|
content_type :css if content.ext == '.css' # Meh?
|
44
44
|
content_type :js if content.ext == '.js' # Meh?
|
45
45
|
content_type :xml if content.ext == '.xml' # Meh?
|
46
|
-
content.render
|
46
|
+
output= content.render
|
47
|
+
site.content_filters.each {|f| output= f.call(output, self) }
|
48
|
+
output
|
47
49
|
else
|
48
50
|
site.report "[#{$$}] *Static: #{file_path}"
|
49
51
|
send_file File.join( site.src_path, file_path)
|
data/lib/gumdrop/site.rb
CHANGED
@@ -13,13 +13,8 @@ module Gumdrop
|
|
13
13
|
log: './logs/build.log',
|
14
14
|
ignore: %w(.DS_Store .gitignore .git .svn .sass-cache),
|
15
15
|
server_timeout: 15,
|
16
|
-
# server_port: 4567
|
17
|
-
|
18
|
-
|
19
|
-
LOG_LEVELS = {
|
20
|
-
info: 0,
|
21
|
-
warning: 1,
|
22
|
-
error: 2
|
16
|
+
# server_port: 4567,
|
17
|
+
env: 'production'
|
23
18
|
}
|
24
19
|
|
25
20
|
class Site
|
data/lib/gumdrop/version.rb
CHANGED
data/lib/gumdrop.rb
CHANGED
@@ -13,7 +13,7 @@ module Gumdrop
|
|
13
13
|
autoload :HashObject, "gumdrop/hash_object"
|
14
14
|
autoload :Pager, "gumdrop/data_manager"
|
15
15
|
autoload :Server, "gumdrop/server"
|
16
|
-
autoload :Site, "gumdrop/site"
|
16
|
+
# autoload :Site, "gumdrop/site"
|
17
17
|
autoload :VERSION, "gumdrop/version"
|
18
18
|
autoload :ViewHelpers, "gumdrop/view_helpers"
|
19
19
|
|
@@ -57,3 +57,5 @@ module Gumdrop
|
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
60
|
+
|
61
|
+
require 'gumdrop/site'
|