gumdrop 0.3.3 → 0.3.4
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/ChangeLog.md +5 -0
- data/lib/gumdrop/cli.rb +2 -0
- data/lib/gumdrop/generator.rb +1 -0
- data/lib/gumdrop/stitch_compilers.rb +99 -0
- data/lib/gumdrop/template/backbone/app/views/home.js.coffee +17 -0
- data/lib/gumdrop/template/backbone/app/views/{views/styles → styles}/home.scss +0 -0
- data/lib/gumdrop/template/backbone/app/views/{views/templates → templates}/home.mustache +0 -0
- data/lib/gumdrop/template/backbone/config.ru +2 -2
- data/lib/gumdrop/template/backbone/lib/site.rb +2 -1
- data/lib/gumdrop/template/backbone/lib/stitch_compilers.rb +1 -85
- data/lib/gumdrop/template/default/Gemfile +1 -1
- data/lib/gumdrop/template/default/config.ru +2 -2
- data/lib/gumdrop/version.rb +1 -1
- metadata +17 -16
- data/lib/gumdrop/template/backbone/app/views/views/home.js.coffee +0 -17
data/ChangeLog.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.3.4
|
2
|
+
- Fixed a bug in the default template
|
3
|
+
- Added custom Stitch compilers for hogan, css/sass, and serenade files.
|
4
|
+
- Added -r --reload switches to commandline to force reloading on server, per request.
|
5
|
+
|
1
6
|
# v0.3.3
|
2
7
|
- Updated Backbone template to include a default view (and some core bugfixes)
|
3
8
|
|
data/lib/gumdrop/cli.rb
CHANGED
@@ -22,6 +22,7 @@ EOS
|
|
22
22
|
opt :build, "Build HTML output"
|
23
23
|
opt :server, "Runs development server"
|
24
24
|
opt :port, "Specifies port to run server on", :type=>:int
|
25
|
+
opt :reload, "Force reloading on dev server"
|
25
26
|
end
|
26
27
|
|
27
28
|
# Trollop::die :volume, "must be non-negative" if opts[:volume] < 0
|
@@ -58,6 +59,7 @@ elsif opts[:build_given]
|
|
58
59
|
|
59
60
|
elsif opts[:server_given]
|
60
61
|
Gumdrop.config.auto_run= true
|
62
|
+
Gumdrop.config.force_reload= opts[:reload_given]
|
61
63
|
Gumdrop::Server
|
62
64
|
|
63
65
|
else
|
data/lib/gumdrop/generator.rb
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'stitch-rb'
|
2
|
+
|
3
|
+
class SerenadeCompiler < Stitch::Compiler
|
4
|
+
|
5
|
+
extensions :serenade
|
6
|
+
|
7
|
+
def compile(path)
|
8
|
+
content= File.read(path)
|
9
|
+
viewname= File.basename(path).gsub('.serenade', '').gsub('.html', '').gsub('.', '_')
|
10
|
+
%{
|
11
|
+
Serenade.view(#{ viewname.to_json }, #{content.to_json});
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
class HoganCompiler < Stitch::Compiler
|
18
|
+
# List of supported extensions
|
19
|
+
extensions :mustache
|
20
|
+
|
21
|
+
# A compile method which takes a file path,
|
22
|
+
# and returns a compiled string
|
23
|
+
def compile(path)
|
24
|
+
content = File.read(path)
|
25
|
+
%{
|
26
|
+
var template = Hogan.compile(#{content.to_json});
|
27
|
+
module.exports = (function(data){ return template.render(data); });
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module CssJsCode
|
33
|
+
|
34
|
+
def export_js_code(path)
|
35
|
+
content= File.read(path)
|
36
|
+
%{
|
37
|
+
var css = #{ transpile(content, File.extname(path)).to_json },
|
38
|
+
node = null;
|
39
|
+
module.exports= {
|
40
|
+
content: css,
|
41
|
+
add: function(to){
|
42
|
+
if(node != null) return;
|
43
|
+
if(to == null) to= document.getElementsByTagName('HEAD')[0] || document.body;
|
44
|
+
node= document.createElement('style');
|
45
|
+
node.innerHTML= css;
|
46
|
+
to.appendChild(node);
|
47
|
+
return this;
|
48
|
+
},
|
49
|
+
remove: function() {
|
50
|
+
if(node != null) {
|
51
|
+
node.parentNode.removeChild(node);
|
52
|
+
node = null;
|
53
|
+
}
|
54
|
+
return this;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def transpile(content, ext)
|
61
|
+
content
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
class CssCompiler < Stitch::Compiler
|
67
|
+
include CssJsCode
|
68
|
+
|
69
|
+
extensions :css
|
70
|
+
|
71
|
+
def compile(path)
|
72
|
+
export_js_code path
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
begin
|
79
|
+
require 'sass'
|
80
|
+
|
81
|
+
class SassCompiler < Stitch::Compiler
|
82
|
+
include CssJsCode
|
83
|
+
|
84
|
+
extensions :sass, :scss
|
85
|
+
|
86
|
+
def compile(path)
|
87
|
+
export_js_code path
|
88
|
+
end
|
89
|
+
|
90
|
+
def transpile(content, ext)
|
91
|
+
type = (ext == '.sass') ? :sass : :scss
|
92
|
+
Sass::Engine.new(content, :syntax=>type).render
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
rescue
|
97
|
+
# Sass Not available
|
98
|
+
end
|
99
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{log}= require 'utils'
|
2
|
+
|
3
|
+
|
4
|
+
class HomeView extends Backbone.View
|
5
|
+
className: 'home'
|
6
|
+
|
7
|
+
src:
|
8
|
+
template: require('./templates/home')
|
9
|
+
styles: require('./styles/home')
|
10
|
+
|
11
|
+
render: ->
|
12
|
+
@src.styles.add()
|
13
|
+
@el.innerHTML= @src.template({})
|
14
|
+
@
|
15
|
+
|
16
|
+
|
17
|
+
module.exports= HomeView
|
File without changes
|
File without changes
|
@@ -13,9 +13,9 @@ require 'gumdrop'
|
|
13
13
|
Gumdrop.config.auto_run= false
|
14
14
|
Gumdrop.config.force_reload= true
|
15
15
|
|
16
|
-
require 'rack/static'
|
16
|
+
#require 'rack/static'
|
17
17
|
#use Rack::Static, :urls => ["/media"], :root => "source"
|
18
|
-
use Rack::Static, :urls => ["/theme/images"], :root => "source"
|
18
|
+
#use Rack::Static, :urls => ["/theme/images"], :root => "source"
|
19
19
|
|
20
20
|
|
21
21
|
run Gumdrop::Server
|
@@ -1,85 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class HoganCompiler < Stitch::Compiler
|
4
|
-
# List of supported extensions
|
5
|
-
extensions :mustache
|
6
|
-
|
7
|
-
# A compile method which takes a file path,
|
8
|
-
# and returns a compiled string
|
9
|
-
def compile(path)
|
10
|
-
content = File.read(path)
|
11
|
-
%{
|
12
|
-
var template = Hogan.compile(#{content.to_json});
|
13
|
-
module.exports = (function(data){ return template.render(data); });
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
module CssJsCode
|
19
|
-
|
20
|
-
def export_js_code(path)
|
21
|
-
content= File.read(path)
|
22
|
-
%{
|
23
|
-
var css = #{ transpile(content, File.extname(path)).to_json },
|
24
|
-
node = null;
|
25
|
-
module.exports= {
|
26
|
-
content: css,
|
27
|
-
add: function(to){
|
28
|
-
if(node != null) return;
|
29
|
-
if(to == null) to= document.getElementsByTagName('HEAD')[0] || document.body;
|
30
|
-
node= document.createElement('style');
|
31
|
-
node.innerHTML= css;
|
32
|
-
to.appendChild(node);
|
33
|
-
return this;
|
34
|
-
},
|
35
|
-
remove: function() {
|
36
|
-
if(node != null) {
|
37
|
-
node.parentNode.removeChild(node);
|
38
|
-
node = null;
|
39
|
-
}
|
40
|
-
return this;
|
41
|
-
}
|
42
|
-
};
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
def transpile(content, ext)
|
47
|
-
content
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
class CssCompiler < Stitch::Compiler
|
53
|
-
include CssJsCode
|
54
|
-
|
55
|
-
extensions :css
|
56
|
-
|
57
|
-
def compile(path)
|
58
|
-
export_js_code path
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
begin
|
65
|
-
require 'sass'
|
66
|
-
|
67
|
-
class SassCompiler < Stitch::Compiler
|
68
|
-
include CssJsCode
|
69
|
-
|
70
|
-
extensions :sass, :scss
|
71
|
-
|
72
|
-
def compile(path)
|
73
|
-
export_js_code path
|
74
|
-
end
|
75
|
-
|
76
|
-
def transpile(content, ext)
|
77
|
-
type = (ext == '.sass') ? :sass : :scss
|
78
|
-
Sass::Engine.new(content, :syntax=>type).render
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
rescue
|
83
|
-
# Sass Not available
|
84
|
-
end
|
85
|
-
|
1
|
+
# You can add your own stitch compilers here...
|
@@ -13,9 +13,9 @@ require 'gumdrop'
|
|
13
13
|
Gumdrop.config.auto_run= false
|
14
14
|
Gumdrop.config.force_reload= true
|
15
15
|
|
16
|
-
require 'rack/static'
|
16
|
+
#require 'rack/static'
|
17
17
|
#use Rack::Static, :urls => ["/media"], :root => "source"
|
18
|
-
use Rack::Static, :urls => ["/theme/images"], :root => "source"
|
18
|
+
#use Rack::Static, :urls => ["/theme/images"], :root => "source"
|
19
19
|
|
20
20
|
|
21
21
|
run Gumdrop::Server
|
data/lib/gumdrop/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.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: &
|
16
|
+
requirement: &70198988300240 !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: *
|
24
|
+
version_requirements: *70198988300240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tilt
|
27
|
-
requirement: &
|
27
|
+
requirement: &70198988298660 !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: *
|
35
|
+
version_requirements: *70198988298660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: active_support
|
38
|
-
requirement: &
|
38
|
+
requirement: &70198988297060 !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: *
|
46
|
+
version_requirements: *70198988297060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: trollop
|
49
|
-
requirement: &
|
49
|
+
requirement: &70198988296220 !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: *
|
57
|
+
version_requirements: *70198988296220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: haml
|
60
|
-
requirement: &
|
60
|
+
requirement: &70198988295160 !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: *
|
68
|
+
version_requirements: *70198988295160
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sass
|
71
|
-
requirement: &
|
71
|
+
requirement: &70198988293960 !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: *
|
79
|
+
version_requirements: *70198988293960
|
80
80
|
description: A simple cms/prototyping tool.
|
81
81
|
email: matt@elucidata.net
|
82
82
|
executables:
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/gumdrop/logging.rb
|
128
128
|
- lib/gumdrop/pager.rb
|
129
129
|
- lib/gumdrop/server.rb
|
130
|
+
- lib/gumdrop/stitch_compilers.rb
|
130
131
|
- lib/gumdrop/stitch_ex.rb
|
131
132
|
- lib/gumdrop/template/backbone/Gemfile
|
132
133
|
- lib/gumdrop/template/backbone/Rakefile
|
@@ -134,9 +135,9 @@ files:
|
|
134
135
|
- lib/gumdrop/template/backbone/app/init.js.coffee
|
135
136
|
- lib/gumdrop/template/backbone/app/models/.gitkeep
|
136
137
|
- lib/gumdrop/template/backbone/app/utils/index.js.coffee
|
137
|
-
- lib/gumdrop/template/backbone/app/views/
|
138
|
-
- lib/gumdrop/template/backbone/app/views/
|
139
|
-
- lib/gumdrop/template/backbone/app/views/
|
138
|
+
- lib/gumdrop/template/backbone/app/views/home.js.coffee
|
139
|
+
- lib/gumdrop/template/backbone/app/views/styles/home.scss
|
140
|
+
- lib/gumdrop/template/backbone/app/views/templates/home.mustache
|
140
141
|
- lib/gumdrop/template/backbone/config.ru
|
141
142
|
- lib/gumdrop/template/backbone/data/config.yml
|
142
143
|
- lib/gumdrop/template/backbone/lib/javascript/all.js.coffee
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{log}= require 'utils'
|
2
|
-
|
3
|
-
|
4
|
-
class HomeView extends Backbone.View
|
5
|
-
className: 'home'
|
6
|
-
|
7
|
-
template: require('./templates/home')
|
8
|
-
styles: require('./styles/home')
|
9
|
-
|
10
|
-
render: ->
|
11
|
-
log @styles
|
12
|
-
@styles.add()
|
13
|
-
@el.innerHTML= @template({})
|
14
|
-
@
|
15
|
-
|
16
|
-
|
17
|
-
module.exports= HomeView
|