gumdrop 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  .DS_Store
2
2
  *.gem
3
- *.lock
3
+ *.lock
4
+ examples/**/output
5
+ .sass-cache
@@ -1,3 +1,6 @@
1
+ # v0.2.4
2
+ - Modernized Sinatra usage. Added an example site (just boilerplate at this point).
3
+
1
4
  # v0.2.3
2
5
  - Updated code to use autoload. Added primary dependencies to the gemspec. Version bump.
3
6
 
data/Notes.md CHANGED
@@ -1,3 +1,4 @@
1
1
  # Future Features/Changes
2
2
  - Generator support of some kind... Where you can define how pages can be built from data. Include support for paging and RSS/ATOM feeds.
3
- - Add options to config for `source/` and `output/` folder names. `data/` too?
3
+ - Add options to config for `source/` and `output/` folder names. `data/` too?
4
+ - Some kind of admin? What would that even do?
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+
3
+ here= File.dirname(__FILE__)
4
+
5
+ gem "sinatra"
6
+ gem "active_support"
7
+ gem "i18n"
8
+ gem "rake"
9
+ gem "gumdrop", :path=>"#{here}/../../"
10
+
11
+ # Add your dependencies here:
12
+
13
+ gem "sass"
14
+ gem "coffee-script"
15
+
16
+ # gem "rdiscount"
17
+ # gem "less"
18
+ # gem "haml"
19
+
@@ -0,0 +1,42 @@
1
+ require 'rubygems'
2
+ require "bundler/setup"
3
+ require 'gumdrop'
4
+
5
+ # For the SYNC task
6
+ USER='user'
7
+ SERVER='server.com'
8
+ FOLDER="~/#{SERVER}"
9
+
10
+
11
+ task :default do
12
+ sh 'rake -T'
13
+ end
14
+
15
+ desc "Build source files into output"
16
+ task :build do
17
+ Gumdrop.run()
18
+ end
19
+
20
+
21
+ desc "Run development server"
22
+ task :serve do
23
+ Gumdrop.config.auto_run= true
24
+ Gumdrop::Server
25
+ end
26
+
27
+ desc "Syncs with public server using rsync (if configured)"
28
+ task :sync do
29
+ cmd= "rsync -avz --delete output/ #{USER}@#{SERVER}:#{FOLDER}"
30
+ puts "Running:\n#{cmd}\n"
31
+ system(cmd)
32
+ puts "Done."
33
+ end
34
+
35
+ desc "Outputs the Gumdrop version"
36
+ task :version do
37
+ puts Gumdrop::VERSION
38
+ end
39
+
40
+ task :default do
41
+ `rake -T`
42
+ end
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
11
+ require 'gumdrop'
12
+
13
+ Gumdrop.config.auto_run= false
14
+
15
+ run Gumdrop::Server
@@ -0,0 +1,2 @@
1
+ title: My Site
2
+ tagline: My home on thar intarwebs!
@@ -0,0 +1,17 @@
1
+ module Gumdrop::ViewHelpers
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
+
13
+ #
14
+ # Your custom helpers go here!
15
+ #
16
+
17
+ end
File without changes
@@ -0,0 +1 @@
1
+ <p>Welcome to <%= data.config.title %></p>
@@ -0,0 +1,10 @@
1
+ @import "styles/tools";
2
+
3
+ @include css-reset();
4
+ @include grid();
5
+
6
+ body {
7
+ font-family: Helvetica, Sans-Serif;
8
+ width: 960px;
9
+ margin: 0 auto;
10
+ }
@@ -0,0 +1,434 @@
1
+ // Layout Tools v 1.2
2
+
3
+ // Sample Usage:
4
+ // #container {
5
+ // @include border-radius(5px);
6
+ // }
7
+
8
+ // GRID
9
+
10
+ // = The 1Kb Grid = (slightly modified)
11
+ @mixin grid($columns:12, $column_width:60, $column_margin:20) {
12
+ .row, section {
13
+ overflow: hidden;
14
+ margin: 0 auto;
15
+ width: #{$columns * $column_width + $columns * $column_margin}px;
16
+
17
+ .row {
18
+ margin: 0 #{$column_margin - $column_margin * 1.5}px;
19
+ display: inline-block;
20
+ width: auto;
21
+ }
22
+
23
+ .col {
24
+ margin: 0 #{$column_margin / 2}px;
25
+ overflow: hidden;
26
+ float: left;
27
+ display: inline;
28
+ width: #{$column_width * 1 + $column_margin * (1 - 1)}px;
29
+
30
+ @for $i from 2 through $columns {
31
+ &.span-#{$i} {
32
+ width: #{$column_width * $i + $column_margin * ($i - 1)}px;
33
+ //&:hover
34
+ // outline: 1px solid red
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ // TEST
42
+ @mixin gridTest($columns:12, $column_width:60, $column_margin:20) {
43
+ row {
44
+ display: block;
45
+ overflow: hidden;
46
+ margin: 0 auto;
47
+ width: #{$columns * $column_width + $columns * $column_margin}px;
48
+
49
+ row {
50
+ margin: 0 #{$column_margin - $column_margin * 1.5}px;
51
+ display: inline-block;
52
+ width: auto;
53
+ }
54
+
55
+ col {
56
+ margin: 0 #{$column_margin / 2}px;
57
+ overflow: hidden;
58
+ float: left;
59
+ display: inline;
60
+ width: #{$column_width * 1 + $column_margin * (1 - 1)}px;
61
+ }
62
+ @for $i from 2 through $columns {
63
+ col#{$i} {
64
+ margin: 0 #{$column_margin / 2}px;
65
+ overflow: hidden;
66
+ float: left;
67
+ display: inline;
68
+ width: #{$column_width * $i + $column_margin * ($i - 1)}px;
69
+ //&:hover
70
+ // outline: 1px solid red
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ // CSS RESET
77
+
78
+ @mixin css-clear($boxmodel:'border-box') {
79
+ * {
80
+ @include box-model($boxmodel);
81
+ }
82
+ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
83
+ margin:0;
84
+ padding:0;
85
+ }
86
+ article, aside, dialog, figure, footer, header, hgroup, menu, nav, section {
87
+ display: block;
88
+ }
89
+ table {
90
+ border-collapse:collapse;
91
+ border-spacing:0;
92
+ }
93
+ fieldset,img {
94
+ border:0;
95
+ }
96
+ address,caption,cite,code,dfn,em,strong,th,var {
97
+ font-style:normal;
98
+ font-weight:normal;
99
+ }
100
+ ol,ul {
101
+ list-style:none;
102
+ }
103
+ caption,th {
104
+ text-align:left;
105
+ }
106
+ h1,h2,h3,h4,h5,h6 {
107
+ font-size:100%;
108
+ font-weight:normal;
109
+ }
110
+ q:before,q:after {
111
+ content:'';
112
+ }
113
+ abbr,acronym {
114
+ border:0;
115
+ }
116
+ }
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
+
168
+ @mixin debug-hover($color:'red') {
169
+ &:hover {
170
+ outline: 1px solid $color;
171
+ }
172
+ }
173
+
174
+
175
+ // Vertical Background Gradient
176
+ @mixin vbg-gradient($fc: #FFF, $tc: #FFF) {
177
+ background: $fc;
178
+ background: -webkit-gradient(linear, left top, left bottom, from($fc), to($tc));
179
+ background: -moz-linear-gradient(top, $fc, $tc);
180
+ }
181
+
182
+ // Vertical Background Gradient, 3 color
183
+ @mixin vbg-gradient3($fc: #FFF, $mc: #FFF, $tc: #FFF) {
184
+ background: $fc;
185
+ background: -webkit-gradient(linear, left top, left bottom, from($fc), color-stop(0.5, $mc), to($tc));
186
+ background: -moz-linear-gradient(top, $fc, $mc, $tc);
187
+ }
188
+
189
+ // Horizontal Background Gradient
190
+ @mixin hbg-gradient($fc: #FFF, $tc: #FFF) {
191
+ background: $fc;
192
+ background: -webkit-gradient(linear, left top, right top, from($fc), to($tc));
193
+ background: -moz-linear-gradient(left, $fc, $tc);
194
+ }
195
+
196
+
197
+ // Box Model
198
+ @mixin box-model($type:'border-box') {
199
+ box-sizing: $type;
200
+ -moz-box-sizing: $type;
201
+ -ms-box-sizing: $type;
202
+ -webkit-box-sizing: $type;
203
+ }
204
+
205
+ @mixin hbox ($boxAlign:stretch, $boxPack:left) {
206
+ @include display-box();
207
+ @include box-orient(horizontal);
208
+ @include box-align($boxAlign);
209
+ @include box-pack($boxPack);
210
+ }
211
+
212
+ @mixin vbox ($boxAlign:stretch, $boxPack:left) {
213
+ @include display-box();
214
+ @include box-orient(vertical);
215
+ @include box-align($boxAlign);
216
+ @include box-pack($boxPack);
217
+ }
218
+
219
+ @mixin display-box () {
220
+ display: box;
221
+ display: -webkit-box;
222
+ display: -moz-box;
223
+ }
224
+
225
+
226
+ @mixin box-flex ($s: 0) {
227
+ box-flex: $s;
228
+ -webkit-box-flex: $s;
229
+ -moz-box-flex: $s;
230
+ }
231
+
232
+
233
+ @mixin box-orient($dir:horizontal) {
234
+ box-orient: $dir;
235
+ -webkit-box-orient: $dir;
236
+ -moz-box-orient: $dir;
237
+ }
238
+
239
+ @mixin box-pack($dir:left) {
240
+ box-pack: $dir;
241
+ -webkit-box-pack: $dir;
242
+ -moz-box-pack: $dir;
243
+ }
244
+
245
+ @mixin box-align($dir:stretch) {
246
+ box-align: $dir;
247
+ -webkit-box-align: $dir;
248
+ -moz-box-align: $dir;
249
+ }
250
+
251
+ @mixin box-lines($rows:single) {
252
+ box-lines: $rows;
253
+ -webkit-box-lines: $rows;
254
+ -moz-box-lines: $rows;
255
+ }
256
+
257
+
258
+ // SHADOWS
259
+
260
+ // TEXT shadow
261
+ @mixin text-shadow($props) {
262
+ text-shadow: $props;
263
+ -moz-text-shadow: $props;
264
+ -webkit-text-shadow: $props; }
265
+
266
+ // BOX shadow
267
+ @mixin box-shadow($props) {
268
+ box-shadow: $props;
269
+ -moz-box-shadow: $props;
270
+ -webkit-box-shadow: $props; }
271
+
272
+ @mixin inset-box-shadow ($h: 0px, $v: 0px, $b: 4px, $c: #333) {
273
+ box-shadow: inset $h $v $b $c;
274
+ -moz-box-shadow: inset $h $v $b $c;
275
+ -webkit-box-shadow: inset $h $v $b $c;
276
+ }
277
+
278
+ @mixin border-as-shadow($tlc:#000, $brc:#FFF, $width:1px, $style:solid) {
279
+ border: {
280
+ top: $width $style $tlc;
281
+ left: $width $style $tlc;
282
+ right: $width $style $brc;
283
+ bottom: $width $style $brc;
284
+ };
285
+ }
286
+
287
+
288
+ // BORDER RADIUS
289
+
290
+ // All corners
291
+ @mixin border-radius($radius) {
292
+ border-radius: $radius;
293
+ -moz-border-radius: $radius;
294
+ -webkit-border-radius: $radius; }
295
+
296
+ // Top Right
297
+ @mixin border-radius-top-right($radius) {
298
+ @include border-radius-top-right($radius); }
299
+
300
+ // Bottom Right
301
+ @mixin border-radius-bottom-right($radius) {
302
+ @include border-radius-bottom-right($radius); }
303
+
304
+ // Bottom Left
305
+ @mixin border-radius-bottom-left($radius) {
306
+ @include border-radius-bottom-left($radius); }
307
+
308
+ // Top Left
309
+ @mixin border-radius-top-left($radius) {
310
+ @include border-radius-top-left($radius); }
311
+
312
+ // Top
313
+ @mixin border-radius-top($radius) {
314
+ @include border-radius-top-left($radius);
315
+ @include border-radius-top-right($radius); }
316
+
317
+ // Right
318
+ @mixin border-radius-right($radius) {
319
+ @include border-radius-top-right($radius);
320
+ @include border-radius-bottom-right($radius); }
321
+
322
+ // Bottom
323
+ @mixin border-radius-bottom($radius) {
324
+ @include border-radius-bottom-right($radius);
325
+ @include border-radius-bottom-left($radius); }
326
+
327
+ // Left
328
+ @mixin border-radius-left($radius) {
329
+ @include border-radius-top-left($radius);
330
+ @include border-radius-bottom-left($radius); }
331
+
332
+ // Let's setup the rules so we don't have to repeat ourselves
333
+ // These are mixins for this mixin and are re-used above
334
+ @mixin border-radius-top-right($radius) {
335
+ border-top-right-radius: $radius;
336
+ -moz-border-radius-topright: $radius;
337
+ -webkit-border-top-right-radius: $radius; }
338
+
339
+ @mixin border-radius-bottom-right($radius) {
340
+ border-bottom-right-radius: $radius;
341
+ -moz-border-radius-bottomright: $radius;
342
+ -webkit-border-bottom-right-radius: $radius; }
343
+
344
+ @mixin border-radius-bottom-left($radius) {
345
+ border-bottom-left-radius: $radius;
346
+ -moz-border-radius-bottomleft: $radius;
347
+ -webkit-border-bottom-left-radius: $radius; }
348
+
349
+ @mixin border-radius-top-left($radius) {
350
+ border-top-left-radius: $radius;
351
+ -moz-border-radius-topleft: $radius;
352
+ -webkit-border-top-left-radius: $radius; }
353
+
354
+ @mixin animate($name, $dur:1s, $easing:ease-in-out, $iter:infinite, $dir:alternate) {
355
+ -webkit-animation-name: $name;
356
+ -webkit-animation-duration: $dur;
357
+ -webkit-animation-direction: $dir;
358
+ -webkit-animation-iteration-count: $iter;
359
+ -webkit-animation-timing-function: $easing;
360
+ }
361
+
362
+ @mixin transition($info:all 250 ease-out) {
363
+ -webkit-transition: $info;
364
+ -moz-transition: $info;
365
+ -o-transition: $info;
366
+ transition: $info;
367
+ }
368
+
369
+ @mixin transform( $s:'rotate(45deg)') {
370
+ -moz-transform: $s;
371
+ -webkit-transform: $s;
372
+ -o-transform: $s;
373
+ transform: $s;
374
+ }
375
+
376
+ @mixin box-attrs() {
377
+ *[box-flex="0"] { @include box-flex(0); }
378
+ *[box-flex="1"] { @include box-flex(1); }
379
+ *[box-flex="2"] { @include box-flex(2); }
380
+ *[box-flex="3"] { @include box-flex(3); }
381
+ *[box-flex="4"] { @include box-flex(4); }
382
+ *[box-flex="5"] { @include box-flex(5); }
383
+ *[box-flex="6"] { @include box-flex(6); }
384
+ *[box-flex="7"] { @include box-flex(7); }
385
+ *[box-flex="8"] { @include box-flex(8); }
386
+ *[box-flex="9"] { @include box-flex(9); }
387
+ *[box-flex="10"] { @include box-flex(10); }
388
+
389
+ *[box-align="start"] { @include box-align(start); }
390
+ *[box-align="center"] { @include box-align(center); }
391
+ *[box-align="end"] { @include box-align(end); }
392
+ *[box-align="baseline"] { @include box-align(baseline); }
393
+ *[box-align="stretch"] { @include box-align(stretch); }
394
+
395
+ *[box-pack="start"] { @include box-pack(start); }
396
+ *[box-pack="center"] { @include box-pack(center); }
397
+ *[box-pack="end"] { @include box-pack(end); }
398
+ *[box-pack="justify"] { @include box-pack(justify); }
399
+ *[box-pack="stretch"] { @include box-pack(justify); }
400
+
401
+ *[box-lines="single"] { @include box-lines(single); }
402
+ *[box-lines="multiple"] { @include box-lines(multiple); }
403
+
404
+ *[box-orient="horizontal"] { @include box-orient(horizontal); }
405
+ *[box-orient="vertical"] { @include box-orient(vertical); }
406
+
407
+ }
408
+
409
+ // Font stuff
410
+
411
+ @mixin web-font($family, $url, $format:'truetype') {
412
+ @font-face {
413
+ font-family: $family;
414
+ src: url($url) format($format);
415
+ }
416
+ }
417
+
418
+ // Color stuff
419
+
420
+ @function strengthen($color, $multiplier: 1, $reversed: $reversed-text) {
421
+ @if $reversed {
422
+ @return lighten($color, 20% * $multiplier);
423
+ } @else {
424
+ @return darken($color, 20% * $multiplier);
425
+ }
426
+ }
427
+
428
+ @function soften($color, $multiplier: 1, $reversed: $reversed-text) {
429
+ @if $reversed {
430
+ @return darken($color, 20% * $multiplier);
431
+ } @else {
432
+ @return lighten($color, 20% * $multiplier);
433
+ }
434
+ }
@@ -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
@@ -5,18 +5,20 @@ require 'active_support/all'
5
5
  DEFAULT_OPTIONS= {
6
6
  :cache_data => false,
7
7
  :relative_paths => true,
8
+ :auto_run => false,
8
9
  :root => "."
9
10
  }
10
11
 
11
12
  module Gumdrop
12
13
 
13
- autoload :HashObject, "gumdrop/hash_object"
14
- autoload :VERSION, "gumdrop/version"
15
- autoload :ViewHelpers, "gumdrop/view_helpers"
16
14
  autoload :Context, "gumdrop/context"
17
15
  autoload :Content, "gumdrop/content"
18
- autoload :Server, "gumdrop/server"
19
16
  autoload :Generator, "gumdrop/generator"
17
+ autoload :HashObject, "gumdrop/hash_object"
18
+ autoload :Server, "gumdrop/server"
19
+ autoload :Utils, "gumdrop/utils"
20
+ autoload :VERSION, "gumdrop/version"
21
+ autoload :ViewHelpers, "gumdrop/view_helpers"
20
22
 
21
23
  class << self
22
24
 
@@ -33,17 +35,17 @@ module Gumdrop
33
35
  require 'view_helpers'
34
36
  end
35
37
 
36
- @site= Hash.new {|h,k| h[k]= nil }
37
- @layouts= Hash.new {|h,k| h[k]= nil }
38
- @generators= Hash.new {|h,k| h[k]= nil }
39
- @partials= Hash.new {|h,k| h[k]= nil }
40
- @root_path= root.split '/'
41
- @source_path= src.split '/'
38
+ @site = Hash.new {|h,k| h[k]= nil }
39
+ @layouts = Hash.new {|h,k| h[k]= nil }
40
+ @generators = Hash.new {|h,k| h[k]= nil }
41
+ @partials = Hash.new {|h,k| h[k]= nil }
42
+ @root_path = root.split '/'
43
+ @source_path = src.split '/'
42
44
 
43
45
  # Scan
44
46
  #puts "Running in: #{root}"
45
47
  Dir.glob("#{src}/**/*", File::FNM_DOTMATCH).each do |path|
46
- unless File.directory? path or File.basename(path) == '.DS_Store'
48
+ unless File.directory? path or File.basename(path) == '.DS_Store' # should be smarter about this?
47
49
  file_path = (path.split('/') - @root_path).join '/'
48
50
  node= Content.new(file_path)
49
51
  @site[node.to_s]= node
@@ -76,17 +78,7 @@ module Gumdrop
76
78
  puts "Done."
77
79
  end
78
80
  end
79
-
80
- end
81
81
 
82
- # base= File.dirname(__FILE__)
83
- # require "#{base}/gumdrop/hash_object.rb"
84
-
85
- Gumdrop.config= Gumdrop::HashObject.new(DEFAULT_OPTIONS)
86
-
87
- # require "#{base}/gumdrop/version.rb"
88
- # require "#{base}/gumdrop/view_helpers.rb"
89
- # require "#{base}/gumdrop/context.rb"
90
- # require "#{base}/gumdrop/content.rb"
91
- # require "#{base}/gumdrop/server.rb"
92
- # require "#{base}/gumdrop/generator.rb"
82
+ Gumdrop.config= Gumdrop::HashObject.new(DEFAULT_OPTIONS)
83
+
84
+ end
@@ -38,7 +38,8 @@ elsif opts[:build_given]
38
38
  Gumdrop.run(opts)
39
39
 
40
40
  elsif opts[:server_given]
41
- Gumdrop::Server.start(opts)
41
+ Gumdrop.config.auto_run= true
42
+ Gumdrop::Server
42
43
 
43
44
  else
44
45
  require 'pp'
@@ -1,72 +1,51 @@
1
+ # Rework this to be nicer.. Extend Sintra::Base
2
+
3
+ require 'sinatra/base'
4
+
1
5
  module Gumdrop
2
-
3
- module Server
4
-
5
- class << self
6
-
7
- def start(opts={})
8
- # Opts
9
- opts.reverse_merge! :auto_run => true, :cache_data => false
10
- Gumdrop.config.merge! opts
11
6
 
12
- require 'sinatra'
7
+ class Server < Sinatra::Base
13
8
 
14
- set :port, Gumdrop.config.port if Gumdrop.config.port
15
-
16
- get '/' do
17
- redirect '/index.html'
18
- end
19
-
20
- get '/*' do
21
- file_path= params[:splat].join('/')
22
- matches= Dir["source/#{file_path}*"]
23
- if matches.length > 0
24
-
25
- Gumdrop.site= Gumdrop.layouts= Gumdrop.generators= Hash.new do |hash, key|
26
- templates= Dir["source/**/#{key}*"]
27
- if templates.length > 0
28
- Content.new( templates[0] )
29
- else
30
- puts "NOT FOUND: #{key}"
31
- nil
32
- end
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
44
-
45
- content= Content.new matches[0]
46
- if content.useLayout?
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?
50
- content.render
51
- else
52
- send_file matches[0]
53
- end
54
- else
55
- puts "NOT FOUND: #{file_path}"
56
- "#{file_path} Not Found"
57
- end
58
- end
9
+ set :port, Gumdrop.config.port if Gumdrop.config.port
10
+
11
+ get '/' do
12
+ redirect '/index.html'
13
+ end
14
+
15
+ get '/*' do
16
+ file_path= params[:splat].join('/')
17
+ matches= Dir["source/#{file_path}*"]
18
+ if matches.length > 0
59
19
 
60
- if Gumdrop.config.auto_run
61
- Sinatra::Application.run!
20
+ Gumdrop.site= Gumdrop.layouts= Gumdrop.generators= Utils.content_hash("source/**/")
21
+ Gumdrop.partials= Utils.content_hash("source/**/_")
22
+
23
+ content= Content.new matches[0]
24
+ if content.useLayout?
25
+ content_type :css if content.ext == '.css' # Meh?
26
+ content_type :js if content.ext == '.js' # Meh?
27
+ content_type :xml if content.ext == '.xml' # Meh?
28
+ content.render
62
29
  else
63
- Sinatra::Application
30
+ send_file matches[0]
64
31
  end
32
+ else
33
+ puts "NOT FOUND: #{file_path}"
34
+ "#{file_path} Not Found"
65
35
  end
66
-
67
36
  end
68
37
 
69
-
38
+ if Gumdrop.config.auto_run
39
+ run!
40
+ end
41
+
42
+ def self.start(opts={})
43
+ # Options
44
+ opts.reverse_merge! :auto_run => true, :cache_data => false
45
+ Gumdrop.config.merge! opts
46
+ ::Gumdrop::Server
47
+ end
48
+
70
49
  end
71
-
50
+
72
51
  end
@@ -20,7 +20,8 @@ end
20
20
 
21
21
  desc "Run development server"
22
22
  task :serve do
23
- Gumdrop::Server.start()
23
+ Gumdrop.config.auto_run= true
24
+ Gumdrop::Server
24
25
  end
25
26
 
26
27
  desc "Syncs with public server using rsync (if configured)"
@@ -29,4 +30,13 @@ task :sync do
29
30
  puts "Running:\n#{cmd}\n"
30
31
  system(cmd)
31
32
  puts "Done."
33
+ end
34
+
35
+ desc "Outputs the Gumdrop version"
36
+ task :version do
37
+ puts Gumdrop::VERSION
38
+ end
39
+
40
+ task :default do
41
+ `rake -T`
32
42
  end
@@ -10,4 +10,6 @@ end
10
10
 
11
11
  require 'gumdrop'
12
12
 
13
- run Gumdrop::Server.start( :auto_run=>false)
13
+ Gumdrop.config.auto_run= false
14
+
15
+ run Gumdrop::Server
@@ -0,0 +1,20 @@
1
+
2
+ module Gumdrop
3
+
4
+ module Utils
5
+
6
+ def self.content_hash(base_path)
7
+ Hash.new do |hash, key|
8
+ templates= Dir["#{base_path}#{key}*"]
9
+ if templates.length > 0
10
+ Content.new( templates[0] )
11
+ else
12
+ puts "NOT FOUND: #{key}"
13
+ nil
14
+ end
15
+ end
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION = "0.2.3" unless defined?(::Gumdrop::VERSION)
3
+ VERSION = "0.2.4" unless defined?(::Gumdrop::VERSION)
4
4
 
5
5
  end
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: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-07-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70168329255500 !ruby/object:Gem::Requirement
16
+ requirement: &70163031231440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70168329255500
24
+ version_requirements: *70163031231440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &70168329255080 !ruby/object:Gem::Requirement
27
+ requirement: &70163031231020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70168329255080
35
+ version_requirements: *70163031231020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_support
38
- requirement: &70168329254660 !ruby/object:Gem::Requirement
38
+ requirement: &70163031230600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70168329254660
46
+ version_requirements: *70163031230600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: trollop
49
- requirement: &70168329254240 !ruby/object:Gem::Requirement
49
+ requirement: &70163031230180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70168329254240
57
+ version_requirements: *70163031230180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: haml
60
- requirement: &70168329253820 !ruby/object:Gem::Requirement
60
+ requirement: &70163031229760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70168329253820
68
+ version_requirements: *70163031229760
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sass
71
- requirement: &70168329253400 !ruby/object:Gem::Requirement
71
+ requirement: &70163031229340 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70168329253400
79
+ version_requirements: *70163031229340
80
80
  description: A simple cms/prototyping tool.
81
81
  email: matt@elucidata.net
82
82
  executables:
@@ -92,6 +92,17 @@ files:
92
92
  - Rakefile
93
93
  - Readme.md
94
94
  - bin/gumdrop
95
+ - examples/simple/Gemfile
96
+ - examples/simple/Rakefile
97
+ - examples/simple/config.ru
98
+ - examples/simple/data/config.yml
99
+ - examples/simple/lib/view_helpers.rb
100
+ - examples/simple/source/favicon.ico
101
+ - examples/simple/source/index.html.erb
102
+ - examples/simple/source/theme/screen.css.scss
103
+ - examples/simple/source/theme/scripts/app.js.coffee
104
+ - examples/simple/source/theme/styles/_tools.scss
105
+ - examples/simple/source/theme/templates/site.template.haml
95
106
  - gumdrop.gemspec
96
107
  - lib/gumdrop.rb
97
108
  - lib/gumdrop/cli.rb
@@ -112,6 +123,7 @@ files:
112
123
  - lib/gumdrop/template/source/theme/scripts/app.js.coffee
113
124
  - lib/gumdrop/template/source/theme/styles/_tools.scss
114
125
  - lib/gumdrop/template/source/theme/templates/site.template.haml
126
+ - lib/gumdrop/utils.rb
115
127
  - lib/gumdrop/version.rb
116
128
  - lib/gumdrop/view_helpers.rb
117
129
  homepage: https://github.com/darthapo/gumdrop