gumdrop 0.2.1 → 0.2.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/Readme.md +59 -0
- data/lib/gumdrop/context.rb +11 -1
- data/lib/gumdrop/server.rb +13 -1
- data/lib/gumdrop/template/Gemfile +2 -3
- data/lib/gumdrop/template/lib/view_helpers.rb +10 -0
- data/lib/gumdrop/template/source/theme/screen.css.scss +8 -1
- data/lib/gumdrop/template/source/theme/styles/_tools.scss +52 -2
- data/lib/gumdrop/template/source/theme/templates/site.template.haml +33 -0
- data/lib/gumdrop/version.rb +1 -1
- data/lib/gumdrop/view_helpers.rb +3 -13
- data/lib/gumdrop.rb +6 -2
- metadata +3 -3
- data/lib/gumdrop/template/source/theme/templates/site.template.erb +0 -25
data/Readme.md
CHANGED
@@ -1,3 +1,62 @@
|
|
1
1
|
# Gumdrop
|
2
2
|
|
3
3
|
Gumdrop is a small and sweet cms/prototype tool. It can generate static html with relative paths, and includes a dev server that can be run via any rack server (including POW!).
|
4
|
+
|
5
|
+
## Create New Site
|
6
|
+
|
7
|
+
gumdrop -c my_new_site
|
8
|
+
|
9
|
+
|
10
|
+
## Build Static HTML
|
11
|
+
|
12
|
+
gumdrop -b
|
13
|
+
|
14
|
+
Or, you can use Rake:
|
15
|
+
|
16
|
+
rake build
|
17
|
+
|
18
|
+
|
19
|
+
## Start Dev Server
|
20
|
+
|
21
|
+
gumdrop -s
|
22
|
+
|
23
|
+
Or, using Rake again:
|
24
|
+
|
25
|
+
rake serve
|
26
|
+
|
27
|
+
# Gumdrop Site Structure
|
28
|
+
|
29
|
+
This is the file structure that is generated when you run `gumdrop --create site_root`. You can change whatever you'd like under `source/`, this is just a starting point.
|
30
|
+
|
31
|
+
site_root/
|
32
|
+
data/
|
33
|
+
config.yml
|
34
|
+
lib/
|
35
|
+
view_helpers.rb
|
36
|
+
source/
|
37
|
+
favicon.ico
|
38
|
+
index.html.erb
|
39
|
+
theme/
|
40
|
+
screen.css.scss
|
41
|
+
scripts/
|
42
|
+
app.js.coffee
|
43
|
+
styles/
|
44
|
+
_tools.css.scss
|
45
|
+
templates/
|
46
|
+
site.template.erb
|
47
|
+
Gemfile
|
48
|
+
config.ru
|
49
|
+
Rakefile
|
50
|
+
|
51
|
+
|
52
|
+
When you run `gumdrop --build` or `rake build` it will generate an `output/` folder.
|
53
|
+
|
54
|
+
site_root/
|
55
|
+
output/ (** GENERATED CONTENT **)
|
56
|
+
index.html
|
57
|
+
theme/
|
58
|
+
screen.css
|
59
|
+
scripts/
|
60
|
+
app.js
|
61
|
+
|
62
|
+
You'll notice the templates and partials aren't included in the output.
|
data/lib/gumdrop/context.rb
CHANGED
@@ -100,7 +100,7 @@ module Gumdrop
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def render(path)
|
103
|
-
page=
|
103
|
+
page= get_page path
|
104
104
|
unless page.nil?
|
105
105
|
#TODO: nested state for an inline rendered page?
|
106
106
|
old_layout= @state['layout']
|
@@ -126,6 +126,16 @@ module Gumdrop
|
|
126
126
|
@state[name]
|
127
127
|
end
|
128
128
|
end
|
129
|
+
|
130
|
+
protected
|
131
|
+
|
132
|
+
def get_page(path)
|
133
|
+
page= Gumdrop.site[path]
|
134
|
+
page= Gumdrop.site["#{path}.html"] if page.nil? # Bit of a hack...
|
135
|
+
page= Gumdrop.partials[path] if page.nil?
|
136
|
+
page
|
137
|
+
end
|
138
|
+
|
129
139
|
end
|
130
140
|
end
|
131
141
|
|
data/lib/gumdrop/server.rb
CHANGED
@@ -22,7 +22,7 @@ module Gumdrop
|
|
22
22
|
matches= Dir["source/#{file_path}*"]
|
23
23
|
if matches.length > 0
|
24
24
|
|
25
|
-
Gumdrop.site
|
25
|
+
Gumdrop.site= Gumdrop.layouts= Gumdrop.generators= Hash.new do |hash, key|
|
26
26
|
templates= Dir["source/**/#{key}*"]
|
27
27
|
if templates.length > 0
|
28
28
|
Content.new( templates[0] )
|
@@ -31,10 +31,22 @@ module Gumdrop
|
|
31
31
|
nil
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
Gumdrop.partials= Hash.new do |hash, key|
|
36
|
+
templates= Dir["source/**/_#{key}*"]
|
37
|
+
if templates.length > 0
|
38
|
+
Content.new( templates[0] )
|
39
|
+
else
|
40
|
+
puts "NOT FOUND: #{key}"
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
end
|
34
44
|
|
35
45
|
content= Content.new matches[0]
|
36
46
|
if content.useLayout?
|
37
47
|
content_type :css if content.ext == '.css' # Meh?
|
48
|
+
content_type :js if content.ext == '.js' # Meh?
|
49
|
+
content_type :xml if content.ext == '.xml' # Meh?
|
38
50
|
content.render
|
39
51
|
else
|
40
52
|
send_file matches[0]
|
@@ -4,15 +4,14 @@ gem "sinatra"
|
|
4
4
|
gem "active_support"
|
5
5
|
gem "i18n"
|
6
6
|
gem "rake"
|
7
|
-
gem "gumdrop"
|
7
|
+
gem "gumdrop"
|
8
8
|
|
9
|
-
#
|
10
9
|
# Add your dependencies here:
|
11
10
|
|
12
11
|
gem "sass"
|
13
|
-
gem "haml"
|
14
12
|
gem "coffee-script"
|
15
13
|
|
16
14
|
# gem "rdiscount"
|
17
15
|
# gem "less"
|
16
|
+
# gem "haml"
|
18
17
|
|
@@ -1,5 +1,15 @@
|
|
1
1
|
module Gumdrop::ViewHelpers
|
2
2
|
|
3
|
+
# Calculate the years for a copyright
|
4
|
+
def copyright_years(start_year, divider="–")
|
5
|
+
end_year = Date.today.year
|
6
|
+
if start_year == end_year
|
7
|
+
"#{start_year}"
|
8
|
+
else
|
9
|
+
"#{start_year}#{divider}#{end_year}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
#
|
4
14
|
# Your custom helpers go here!
|
5
15
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Layout Tools v 1.
|
1
|
+
// Layout Tools v 1.2
|
2
2
|
|
3
3
|
// Sample Usage:
|
4
4
|
// #container {
|
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
// CSS RESET
|
77
77
|
|
78
|
-
@mixin css-
|
78
|
+
@mixin css-clear($boxmodel:'border-box') {
|
79
79
|
* {
|
80
80
|
@include box-model($boxmodel);
|
81
81
|
}
|
@@ -115,6 +115,56 @@
|
|
115
115
|
}
|
116
116
|
}
|
117
117
|
|
118
|
+
@mixin css-reset($size:14px, $boxmodel:'border-box') {
|
119
|
+
@include css-clear($boxmodel);
|
120
|
+
body {
|
121
|
+
font-size: $size;
|
122
|
+
line-height: 1.3em;
|
123
|
+
}
|
124
|
+
h1, h2, h3, h4, h5, h6 {
|
125
|
+
font-weight: bold;
|
126
|
+
}
|
127
|
+
h1 {
|
128
|
+
font-size: 175%;
|
129
|
+
}
|
130
|
+
h2 {
|
131
|
+
font-size: 155%;
|
132
|
+
}
|
133
|
+
h3 {
|
134
|
+
font-size: 135%;
|
135
|
+
}
|
136
|
+
h4 {
|
137
|
+
font-size: 120%;
|
138
|
+
}
|
139
|
+
h5 {
|
140
|
+
font-size: 105%;
|
141
|
+
}
|
142
|
+
h6 {
|
143
|
+
font-size: 100%;
|
144
|
+
}
|
145
|
+
p, blockquote, h1, h2, h3, h4, h5, h6, pre, ol, ul {
|
146
|
+
padding: 0.5em 0;
|
147
|
+
}
|
148
|
+
b, strong {
|
149
|
+
font-weight: bold;
|
150
|
+
}
|
151
|
+
i, em {
|
152
|
+
font-style: italic;
|
153
|
+
}
|
154
|
+
ul, ol {
|
155
|
+
padding-left: 2em;
|
156
|
+
}
|
157
|
+
ul {
|
158
|
+
list-style: circle;
|
159
|
+
}
|
160
|
+
ol {
|
161
|
+
list-style: decimal;
|
162
|
+
}
|
163
|
+
blockquote {
|
164
|
+
padding-left: 4em;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
118
168
|
@mixin debug-hover($color:'red') {
|
119
169
|
&:hover {
|
120
170
|
outline: 1px solid $color;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html( lang="en" )
|
3
|
+
%head
|
4
|
+
%meta( charset="utf-8" )
|
5
|
+
%title= data.config.title
|
6
|
+
/[if le IE 9]
|
7
|
+
%script( src="http://html5shiv.googlecode.com/svn/trunk/html5.js" )
|
8
|
+
%link( rel="stylesheet" href="#{uri 'theme/screen.css'}" type="text/css" media="screen" charset="utf-8")
|
9
|
+
%script( src="#{uri 'theme/scripts/app.js'}" )
|
10
|
+
%body
|
11
|
+
.row
|
12
|
+
.col.span-12
|
13
|
+
%header
|
14
|
+
%h1= data.config.title
|
15
|
+
%h4= data.config.tagline
|
16
|
+
.row
|
17
|
+
.col.span-12
|
18
|
+
%nav
|
19
|
+
%ul
|
20
|
+
%li
|
21
|
+
%a(href="#{uri 'index.html'}") Home
|
22
|
+
%article
|
23
|
+
.row
|
24
|
+
.col.span-8
|
25
|
+
%section
|
26
|
+
= content
|
27
|
+
.col.span-4
|
28
|
+
%aside
|
29
|
+
= render 'sidebar'
|
30
|
+
.row
|
31
|
+
.col.span-12
|
32
|
+
%footer
|
33
|
+
= copyright_years 2011
|
data/lib/gumdrop/version.rb
CHANGED
data/lib/gumdrop/view_helpers.rb
CHANGED
@@ -2,20 +2,10 @@ module Gumdrop
|
|
2
2
|
|
3
3
|
module ViewHelpers
|
4
4
|
|
5
|
-
# Calculate the years for a copyright
|
6
|
-
def copyright_years(start_year, divider="–")
|
7
|
-
end_year = Date.today.year
|
8
|
-
if start_year == end_year
|
9
|
-
"#{start_year}"
|
10
|
-
else
|
11
|
-
"#{start_year}#{divider}#{end_year}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
5
|
# Handy for hiding a block of unfinished code
|
16
|
-
def hidden(&block)
|
17
|
-
|
18
|
-
end
|
6
|
+
# def hidden(&block)
|
7
|
+
# #no-op
|
8
|
+
# end
|
19
9
|
|
20
10
|
def gumdrop_version
|
21
11
|
::Gumdrop::VERSION
|
data/lib/gumdrop.rb
CHANGED
@@ -42,14 +42,18 @@ module Gumdrop
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
45
|
+
# Layouts, Generators, and Partials
|
46
46
|
@site.keys.each do |path|
|
47
47
|
if File.extname(path) == ".template"
|
48
48
|
@layouts[File.basename(path)]= @site.delete(path)
|
49
|
+
|
49
50
|
elsif File.extname(path) == ".generator"
|
50
51
|
@generators[File.basename(path)]= @site.delete(path)
|
52
|
+
|
51
53
|
elsif File.basename(path).starts_with?("_")
|
52
|
-
|
54
|
+
partial_name= File.basename(path)[1..-1].gsub(File.extname(File.basename(path)), '')
|
55
|
+
# puts "Creating partial #{partial_name} from #{path}"
|
56
|
+
@partials[partial_name]= @site.delete(path)
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt McCray
|
@@ -44,7 +44,7 @@ files:
|
|
44
44
|
- lib/gumdrop/template/source/theme/screen.css.scss
|
45
45
|
- lib/gumdrop/template/source/theme/scripts/app.js.coffee
|
46
46
|
- lib/gumdrop/template/source/theme/styles/_tools.scss
|
47
|
-
- lib/gumdrop/template/source/theme/templates/site.template.
|
47
|
+
- lib/gumdrop/template/source/theme/templates/site.template.haml
|
48
48
|
- lib/gumdrop/version.rb
|
49
49
|
- lib/gumdrop/view_helpers.rb
|
50
50
|
- lib/gumdrop.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8" />
|
5
|
-
<title><%= data.config.title %></title>
|
6
|
-
<!--[if lt IE 9]>
|
7
|
-
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
8
|
-
<![endif]-->
|
9
|
-
<script type="text/javascript" src="<%= uri 'theme/scripts/app.js' %>"></script>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<header>
|
13
|
-
<h1><%= data.config.title %></h1>
|
14
|
-
<h4><%= data.config.tagline %></h4>
|
15
|
-
</header>
|
16
|
-
<nav></nav>
|
17
|
-
<article>
|
18
|
-
<section>
|
19
|
-
<%= content %>
|
20
|
-
</section>
|
21
|
-
</article>
|
22
|
-
<aside></aside>
|
23
|
-
<footer><%= copyright_years 2009 %></footer>
|
24
|
-
</body>
|
25
|
-
</html>
|