gumdrop 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/ChangeLog.md +13 -0
- data/Gemfile +6 -2
- data/Gemfile.lock +43 -3
- data/Rakefile +37 -21
- data/Readme.md +60 -158
- data/bin/gumdrop +2 -1
- data/gumdrop.gemspec +11 -4
- data/lib/gumdrop/builder.rb +164 -0
- data/lib/gumdrop/cli/external.rb +14 -9
- data/lib/gumdrop/cli/internal.rb +54 -22
- data/lib/gumdrop/cli.rb +21 -0
- data/lib/gumdrop/content.rb +195 -132
- data/lib/gumdrop/data.rb +185 -0
- data/lib/gumdrop/data_providers/csv.rb +18 -0
- data/lib/gumdrop/data_providers/pstore.rb +25 -0
- data/lib/gumdrop/data_providers/sqlite.rb +43 -0
- data/lib/gumdrop/data_providers/xml.rb +15 -0
- data/lib/gumdrop/data_providers/yaml_and_json.rb +18 -0
- data/lib/gumdrop/data_providers/yamldb.rb +18 -0
- data/lib/gumdrop/data_providers/yamldoc.rb +12 -0
- data/lib/gumdrop/generator.rb +118 -94
- data/lib/gumdrop/renderer.rb +272 -0
- data/lib/gumdrop/server.rb +36 -27
- data/lib/gumdrop/site.rb +283 -338
- data/lib/gumdrop/support/compressor.rb +52 -0
- data/lib/gumdrop/support/sprockets.rb +14 -23
- data/lib/gumdrop/support/stitch.rb +25 -14
- data/lib/gumdrop/support/yaml_doc_template.rb +29 -0
- data/lib/gumdrop/util/configurable.rb +44 -0
- data/lib/gumdrop/util/core_ex.rb +84 -0
- data/lib/gumdrop/util/eventable.rb +35 -0
- data/lib/gumdrop/util/hash_object.rb +70 -0
- data/lib/gumdrop/util/loggable.rb +44 -0
- data/lib/gumdrop/util/pager.rb +51 -0
- data/lib/gumdrop/{support → util}/proxy_handler.rb +7 -6
- data/lib/gumdrop/util/scanner.rb +47 -0
- data/lib/gumdrop/util/site_access.rb +16 -0
- data/lib/gumdrop/util/view_helpers.rb +50 -0
- data/lib/gumdrop/util/yaml_doc.rb +51 -0
- data/lib/gumdrop/version.rb +2 -2
- data/lib/gumdrop.rb +40 -77
- data/specs/content_spec.rb +83 -73
- data/specs/fixtures/expected/data-access/from-csv.html +4 -0
- data/specs/fixtures/expected/data-access/from-json.html +6 -0
- data/specs/fixtures/expected/data-access/from-sqlite.html +5 -0
- data/specs/fixtures/expected/data-access/from-xml.html +4 -0
- data/specs/fixtures/expected/data-access/from-yaml.html +5 -0
- data/specs/fixtures/expected/data-access/from-yamldb.html +5 -0
- data/specs/fixtures/expected/data-access/from-yamldoc.html +2 -0
- data/specs/fixtures/expected/gen-with-block/as-file.html +1 -0
- data/specs/fixtures/expected/gen-with-block/as-plain.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-nested.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-nil.html +1 -0
- data/specs/fixtures/expected/gen-with-block/layout-wrap.html +1 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-as-file.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-as-plain.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-nil.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-sub.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/0-layout-wrap.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-as-file.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-as-plain.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-nil.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-sub.html +4 -0
- data/specs/fixtures/expected/gen-with-inline-render/1-layout-wrap.html +4 -0
- data/specs/fixtures/expected/goodbye.html +1 -0
- data/specs/fixtures/expected/hello.html +1 -0
- data/specs/fixtures/expected/image.png +0 -0
- data/specs/fixtures/expected/index.html +47 -0
- data/specs/fixtures/expected/js/sprockets-app.js +7 -0
- data/specs/fixtures/expected/js/stitch-app.js +65 -0
- data/specs/fixtures/expected/js/stitch-app.min.js +5 -0
- data/specs/fixtures/expected/js/stitch-app.min.src.js +65 -0
- data/specs/fixtures/expected/js/straight.js +8 -0
- data/specs/fixtures/expected/js/test-coffee.js +5 -0
- data/specs/fixtures/expected/pages/docs/force-abs.html +2 -0
- data/specs/fixtures/expected/pages/docs/index.html +2 -0
- data/specs/fixtures/expected/partials/hoisted-data.html +3 -0
- data/specs/fixtures/expected/partials/nested.html +7 -0
- data/specs/fixtures/expected/partials/params.html +1 -0
- data/specs/fixtures/expected/partials/with-layouts.html +1 -0
- data/specs/fixtures/expected/robots.txt +1 -0
- data/specs/fixtures/expected/test-multi-procs.html +4 -0
- data/specs/fixtures/expected/test-nested-layout.html +1 -0
- data/specs/fixtures/expected/test-no-layout.html +2 -0
- data/specs/fixtures/expected/test-yamldoc.html +1 -0
- data/specs/fixtures/expected/test.html +2 -0
- data/{templates/backbone → specs/fixtures/source}/Gemfile +8 -4
- data/specs/fixtures/source/Gemfile.lock +84 -0
- data/specs/fixtures/source/Gumdrop +60 -9
- data/specs/fixtures/source/data/csv_data.csv +2 -0
- data/specs/fixtures/source/data/json_data.json +13 -0
- data/specs/fixtures/source/data/sql_data.sqlite +0 -0
- data/specs/fixtures/source/data/xml_data.xml +4 -0
- data/specs/fixtures/source/data/yaml_db.yamldb +9 -0
- data/specs/fixtures/source/data/yaml_items.yaml +2 -0
- data/specs/fixtures/source/data/yamldoc.yamldoc +4 -0
- data/specs/fixtures/source/data-access/from-csv.html.erb +4 -0
- data/specs/fixtures/source/data-access/from-json.html.erb +6 -0
- data/specs/fixtures/source/data-access/from-sqlite.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-xml.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yaml.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yamldb.html.erb +5 -0
- data/specs/fixtures/source/data-access/from-yamldoc.html.erb +2 -0
- data/specs/fixtures/source/gen-with-inline-render.generator +7 -0
- data/specs/fixtures/source/goodbye.html.erb +1 -0
- data/specs/fixtures/source/hello.html +1 -0
- data/specs/fixtures/source/image.png +0 -0
- data/specs/fixtures/source/index.html.erb +6 -0
- data/specs/fixtures/source/js/sprockets/app.js +2 -0
- data/specs/fixtures/source/js/sprockets/view.js.coffee +1 -0
- data/specs/fixtures/source/js/stitch/app.js +1 -0
- data/specs/fixtures/source/js/stitch/view.js.coffee +1 -0
- data/specs/fixtures/source/js/straight.js +8 -0
- data/specs/fixtures/source/js/test-coffee.js.coffee +1 -0
- data/specs/fixtures/source/layouts/site.layout.erb +1 -0
- data/specs/fixtures/source/layouts/sub.layout.erb +1 -0
- data/specs/fixtures/source/layouts/wrap.layout.erb +1 -0
- data/specs/fixtures/source/pages/_users-nested.html.erb +7 -0
- data/specs/fixtures/source/pages/docs/force-abs.html.erb +2 -0
- data/specs/fixtures/source/pages/docs/index.html.erb +2 -0
- data/specs/fixtures/source/partials/_post_entry.html.erb +4 -0
- data/specs/fixtures/source/partials/_provides_name.html.erb +1 -0
- data/specs/fixtures/source/partials/_user-params.html.erb +1 -0
- data/specs/fixtures/source/partials/_user.html.erb +1 -0
- data/specs/fixtures/source/partials/_user_sets_layout.html.erb +1 -0
- data/specs/fixtures/source/partials/hoisted-data.html.erb +6 -0
- data/specs/fixtures/source/partials/nested.html.erb +1 -0
- data/specs/fixtures/source/partials/params.html.erb +1 -0
- data/specs/fixtures/source/partials/with-layouts.html.erb +1 -0
- data/specs/fixtures/source/test-multi-procs.html.markdown.erb +3 -0
- data/specs/fixtures/source/test-nested-layout.html.erb +1 -0
- data/specs/fixtures/source/test-no-layout.html.erb +2 -0
- data/specs/fixtures/source/test-yamldoc.html.erb.yamldoc +4 -0
- data/specs/fixtures/source/test.html.erb +2 -0
- data/specs/hash_object_spec.rb +53 -8
- data/specs/render_spec.rb +10 -0
- data/specs/site_spec.rb +79 -0
- data/specs/spec_helper.rb +59 -0
- data/templates/blank/Gemfile +0 -4
- data/templates/blank/Gumdrop +180 -113
- data/templates/default/Gemfile +3 -8
- data/templates/default/Gumdrop +166 -95
- data/templates/default/ReadMe.md +14 -0
- data/templates/default/config.ru +1 -0
- data/templates/default/data/news/20120703.yamldoc +14 -0
- data/templates/default/data/news/20120704.yamldoc +8 -0
- data/templates/{backbone/source/feed.xml.builder.txt → default/source/feed.xml.builder} +4 -4
- data/templates/default/source/index.html.erb +10 -1
- data/templates/default/source/theme/layout/_sidebar.html +1 -0
- data/templates/{backbone/source/theme/templates/site.template.slim → default/source/theme/layout/site.layout.slim} +3 -3
- metadata +212 -63
- data/lib/gumdrop/context.rb +0 -135
- data/lib/gumdrop/data_manager.rb +0 -214
- data/lib/gumdrop/support/base_packager.rb +0 -60
- data/lib/gumdrop/support/callbacks.rb +0 -30
- data/lib/gumdrop/support/hash_object.rb +0 -22
- data/lib/gumdrop/view_helpers.rb +0 -25
- data/notes.md +0 -347
- data/specs/deferred_loader_spec.rb +0 -31
- data/specs/fixtures/expected/posts/post1.html +0 -1
- data/specs/fixtures/expected/posts/post1.js +0 -14
- data/specs/fixtures/expected/posts/post2.html +0 -5
- data/specs/fixtures/expected/sub/sub/sub/test.html +0 -5
- data/specs/fixtures/expected/sub/sub/sub/test2.html +0 -5
- data/specs/fixtures/expected/test.js +0 -14
- data/specs/fixtures/source/posts/post1.html.slim +0 -6
- data/specs/fixtures/source/posts/post1.js.coffee +0 -3
- data/specs/fixtures/source/posts/post2.html.erb +0 -5
- data/specs/fixtures/source/sub/sub/sub/test.html +0 -5
- data/specs/fixtures/source/sub/sub/sub/test2.html.erb +0 -5
- data/specs/fixtures/source/test.js.coffee +0 -4
- data/specs/fixtures/source/test.js.erb.coffee +0 -3
- data/templates/backbone/Gumdrop +0 -123
- data/templates/backbone/Rakefile +0 -38
- data/templates/backbone/app/app.js.coffee +0 -49
- data/templates/backbone/app/init.js.coffee +0 -10
- data/templates/backbone/app/models/.gitkeep +0 -0
- data/templates/backbone/app/utils/index.js.coffee +0 -27
- data/templates/backbone/app/views/home.js.coffee +0 -17
- data/templates/backbone/app/views/styles/home.scss +0 -8
- data/templates/backbone/app/views/templates/home.mustache +0 -2
- data/templates/backbone/config.ru +0 -20
- data/templates/backbone/lib/all.js.coffee +0 -18
- data/templates/backbone/lib/backbone.js +0 -1158
- data/templates/backbone/lib/hogan.js +0 -509
- data/templates/backbone/lib/jquery.js +0 -9266
- data/templates/backbone/lib/underscore.js +0 -981
- data/templates/backbone/powrc +0 -2
- data/templates/backbone/source/default.htaccess.erb +0 -27
- data/templates/backbone/source/favicon.ico +0 -0
- data/templates/backbone/source/index.html.erb +0 -2
- data/templates/backbone/source/theme/screen.css.sass +0 -9
- data/templates/backbone/source/theme/scripts/app.js.coffee +0 -4
- data/templates/backbone/source/theme/styles/_tools.scss +0 -434
- data/templates/backbone/source/theme/templates/app.template.slim +0 -14
- data/templates/default/Rakefile +0 -38
- data/templates/default/powrc +0 -2
- data/templates/default/source/default.htaccess.erb +0 -27
- data/templates/default/source/feed.xml.builder.txt +0 -23
- data/templates/default/source/theme/templates/site.template.slim +0 -33
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
(function(/*! Stitch !*/) {
|
3
|
+
if (!this.require) {
|
4
|
+
var modules = {}, cache = {};
|
5
|
+
var require = function(name, root) {
|
6
|
+
var path = expand(root, name), indexPath = expand(path, './index'), module, fn;
|
7
|
+
module = cache[path] || cache[indexPath];
|
8
|
+
if (module) {
|
9
|
+
return module;
|
10
|
+
} else if (fn = modules[path] || modules[path = indexPath]) {
|
11
|
+
module = {id: path, exports: {}};
|
12
|
+
cache[path] = module.exports;
|
13
|
+
fn(module.exports, function(name) {
|
14
|
+
return require(name, dirname(path));
|
15
|
+
}, module);
|
16
|
+
return cache[path] = module.exports;
|
17
|
+
} else {
|
18
|
+
throw 'module ' + name + ' not found';
|
19
|
+
}
|
20
|
+
};
|
21
|
+
var expand = function(root, name) {
|
22
|
+
var results = [], parts, part;
|
23
|
+
// If path is relative
|
24
|
+
if (/^\.\.?(\/|$)/.test(name)) {
|
25
|
+
parts = [root, name].join('/').split('/');
|
26
|
+
} else {
|
27
|
+
parts = name.split('/');
|
28
|
+
}
|
29
|
+
for (var i = 0, length = parts.length; i < length; i++) {
|
30
|
+
part = parts[i];
|
31
|
+
if (part == '..') {
|
32
|
+
results.pop();
|
33
|
+
} else if (part != '.' && part != '') {
|
34
|
+
results.push(part);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
return results.join('/');
|
38
|
+
};
|
39
|
+
var dirname = function(path) {
|
40
|
+
return path.split('/').slice(0, -1).join('/');
|
41
|
+
};
|
42
|
+
this.require = function(name) {
|
43
|
+
return require(name, '');
|
44
|
+
};
|
45
|
+
this.require.define = function(bundle) {
|
46
|
+
for (var key in bundle) {
|
47
|
+
modules[key] = bundle[key];
|
48
|
+
}
|
49
|
+
};
|
50
|
+
this.require.modules = modules;
|
51
|
+
this.require.cache = cache;
|
52
|
+
}
|
53
|
+
return this.require.define;
|
54
|
+
}).call(this)({
|
55
|
+
"app": function(exports, require, module) {
|
56
|
+
alert("stitch-app")
|
57
|
+
}, "view.js": function(exports, require, module) {
|
58
|
+
(function() {
|
59
|
+
|
60
|
+
alert("stitch-view");
|
61
|
+
|
62
|
+
}).call(this);
|
63
|
+
|
64
|
+
}
|
65
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
<body class="site"><div>User Matt</div></body>
|
@@ -0,0 +1 @@
|
|
1
|
+
<body class="site"><p><wrap><div>User</div></wrap></p></body>
|
@@ -0,0 +1 @@
|
|
1
|
+
ROBOTS!
|
@@ -0,0 +1 @@
|
|
1
|
+
<body class="site"><article class="sub"><span>Nested.</span></article></body>
|
@@ -0,0 +1 @@
|
|
1
|
+
<body class="site"><p>Hello Matt</p></body>
|
@@ -1,11 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
gem 'sqlite3'
|
3
4
|
gem "i18n"
|
4
5
|
gem "sinatra", :require=>false
|
5
6
|
gem "active_support"
|
6
|
-
|
7
|
+
gem "thor", :require=>false
|
7
8
|
gem "rake"
|
8
|
-
gem "gumdrop"
|
9
|
+
gem "gumdrop", :path=>"../../../"
|
9
10
|
|
10
11
|
# Add your dependencies here:
|
11
12
|
|
@@ -22,12 +23,15 @@ gem "coffee-script"
|
|
22
23
|
#gem 'packr'
|
23
24
|
gem 'jsmin'
|
24
25
|
gem 'stitch-rb'
|
25
|
-
|
26
|
+
gem 'sprockets'
|
26
27
|
|
27
28
|
# For markdown support, a couple of options:
|
29
|
+
# gem "kramdown", :git => "git://github.com/darthapo/kramdown.git"
|
30
|
+
gem 'redcarpet'
|
28
31
|
# gem "rdiscount"
|
29
32
|
# gem 'maruku'
|
30
33
|
|
31
34
|
# For xml generation support:
|
32
35
|
# gem 'builder'
|
33
36
|
|
37
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../../../
|
3
|
+
specs:
|
4
|
+
gumdrop (1.0.0)
|
5
|
+
active_support
|
6
|
+
bundle
|
7
|
+
i18n
|
8
|
+
listen
|
9
|
+
onfire
|
10
|
+
sinatra
|
11
|
+
thor
|
12
|
+
tilt
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: https://rubygems.org/
|
16
|
+
specs:
|
17
|
+
active_support (3.0.0)
|
18
|
+
activesupport (= 3.0.0)
|
19
|
+
activesupport (3.0.0)
|
20
|
+
bundle (0.0.1)
|
21
|
+
bundler
|
22
|
+
coffee-script (2.2.0)
|
23
|
+
coffee-script-source
|
24
|
+
execjs
|
25
|
+
coffee-script-source (1.3.3)
|
26
|
+
execjs (1.4.0)
|
27
|
+
multi_json (~> 1.0)
|
28
|
+
ffi (1.0.11)
|
29
|
+
hike (1.2.1)
|
30
|
+
i18n (0.6.0)
|
31
|
+
jsmin (1.0.1)
|
32
|
+
listen (0.4.7)
|
33
|
+
rb-fchange (~> 0.0.5)
|
34
|
+
rb-fsevent (~> 0.9.1)
|
35
|
+
rb-inotify (~> 0.8.8)
|
36
|
+
multi_json (1.3.6)
|
37
|
+
onfire (0.2.0)
|
38
|
+
rack (1.4.1)
|
39
|
+
rack-protection (1.2.0)
|
40
|
+
rack
|
41
|
+
rake (0.9.2.2)
|
42
|
+
rb-fchange (0.0.5)
|
43
|
+
ffi
|
44
|
+
rb-fsevent (0.9.1)
|
45
|
+
rb-inotify (0.8.8)
|
46
|
+
ffi (>= 0.5.0)
|
47
|
+
redcarpet (2.1.1)
|
48
|
+
sass (3.1.19)
|
49
|
+
sinatra (1.3.2)
|
50
|
+
rack (~> 1.3, >= 1.3.6)
|
51
|
+
rack-protection (~> 1.2)
|
52
|
+
tilt (~> 1.3, >= 1.3.3)
|
53
|
+
slim (1.2.2)
|
54
|
+
temple (~> 0.4.0)
|
55
|
+
tilt (~> 1.3.3)
|
56
|
+
sprockets (2.4.3)
|
57
|
+
hike (~> 1.2)
|
58
|
+
multi_json (~> 1.0)
|
59
|
+
rack (~> 1.0)
|
60
|
+
tilt (~> 1.1, != 1.3.0)
|
61
|
+
sqlite3 (1.3.6)
|
62
|
+
stitch-rb (0.0.8)
|
63
|
+
temple (0.4.0)
|
64
|
+
thor (0.15.3)
|
65
|
+
tilt (1.3.3)
|
66
|
+
|
67
|
+
PLATFORMS
|
68
|
+
ruby
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
active_support
|
72
|
+
coffee-script
|
73
|
+
gumdrop!
|
74
|
+
i18n
|
75
|
+
jsmin
|
76
|
+
rake
|
77
|
+
redcarpet
|
78
|
+
sass
|
79
|
+
sinatra
|
80
|
+
slim
|
81
|
+
sprockets
|
82
|
+
sqlite3
|
83
|
+
stitch-rb
|
84
|
+
thor
|
@@ -1,13 +1,64 @@
|
|
1
|
-
require 'slim'
|
2
1
|
|
3
|
-
configure do
|
4
|
-
|
5
|
-
set :site_title, "Test"
|
6
|
-
set :site_tagline, "a test site"
|
7
|
-
|
8
|
-
set :source_dir, "./"
|
9
2
|
|
10
|
-
|
11
|
-
|
3
|
+
# Ignoring files prevents them from being in the source tree
|
4
|
+
# Blacklisting prevents them from being rendered to output
|
12
5
|
|
6
|
+
Gumdrop.configure do |config|
|
7
|
+
config.source_dir= '.'
|
8
|
+
config.output_dir= '../output'
|
9
|
+
config.data_dir= './data'
|
10
|
+
config.custom_setting= 'yep'
|
11
|
+
config.log_level= :debug
|
12
|
+
config.log= config.mode == :test ? 'test.log' : STDOUT
|
13
|
+
end
|
14
|
+
|
15
|
+
Gumdrop.ignore %w(output/**/* *.log data/**/* Gemfile Gemfile.lock)
|
16
|
+
|
17
|
+
Gumdrop.generate 'robots' do |gen|
|
18
|
+
gen.page 'robots.txt' do
|
19
|
+
"ROBOTS!"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Gumdrop.generate 'sprockets test' do |gen|
|
24
|
+
gen.file 'js/sprockets-app.js' do
|
25
|
+
gen.sprockets 'js/sprockets/app.js'
|
26
|
+
end
|
27
|
+
Gumdrop.blacklist 'js/sprockets/**/*'
|
28
|
+
end
|
29
|
+
|
30
|
+
Gumdrop.generate 'stitch test' do |gen|
|
31
|
+
gen.file 'js/stitch-app.js' do
|
32
|
+
gen.stitch 'js/stitch/app.js'
|
33
|
+
end
|
34
|
+
Gumdrop.blacklist 'js/stitch/**/*'
|
35
|
+
end
|
36
|
+
|
37
|
+
Gumdrop.generate 'compressor test (no block param to Gumdrop.generate)' do
|
38
|
+
# should have the same scope as a .generator file.
|
39
|
+
shared_js= stitch 'js/stitch/app.js'
|
40
|
+
file 'js/stitch-app.min.js' do
|
41
|
+
compress shared_js, :jsmin
|
42
|
+
end
|
43
|
+
file 'js/stitch-app.min.src.js' do
|
44
|
+
shared_js
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Gumdrop.generate 'pages with blocks and layouts' do |gen|
|
49
|
+
gen.page 'gen-with-block/as-plain.html' do
|
50
|
+
"Test Plain"
|
51
|
+
end
|
52
|
+
gen.page 'gen-with-block/layout-wrap.html', layout:'wrap' do
|
53
|
+
"Test Wrap"
|
54
|
+
end
|
55
|
+
gen.page 'gen-with-block/layout-nested.html', layout:'sub' do
|
56
|
+
"Test Nested"
|
57
|
+
end
|
58
|
+
gen.page 'gen-with-block/layout-nil.html', layout:nil do
|
59
|
+
"Test Nil"
|
60
|
+
end
|
61
|
+
gen.file 'gen-with-block/as-file.html' do
|
62
|
+
"Test File"
|
63
|
+
end
|
13
64
|
end
|
Binary file
|
@@ -0,0 +1,7 @@
|
|
1
|
+
data.sql_data.posts.each_with_index do |post,i|
|
2
|
+
page "#{i}-as-plain.html", post:post, render:"post_entry"
|
3
|
+
page "#{i}-layout-wrap.html", post:post, render:"post_entry", layout:'wrap'
|
4
|
+
page "#{i}-layout-sub.html", post:post, render:"post_entry", layout:'sub'
|
5
|
+
page "#{i}-layout-nil.html", post:post, render:"post_entry", layout:nil
|
6
|
+
file "#{i}-as-file.html", post:post, render:"post_entry"
|
7
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<p><%= "Goodbye" %>.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Hello!</p>
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
alert "sprockets-view"
|
@@ -0,0 +1 @@
|
|
1
|
+
alert("stitch-app")
|
@@ -0,0 +1 @@
|
|
1
|
+
alert "stitch-view"
|
@@ -0,0 +1 @@
|
|
1
|
+
alert "test-coffee"
|
@@ -0,0 +1 @@
|
|
1
|
+
<body class="site"><%= yield %></body>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% set layout:'site' %><article class="sub"><%= yield %></article>
|
@@ -0,0 +1 @@
|
|
1
|
+
<wrap><%= yield %></wrap>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% set name:'From Partial' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div>User <%= name %></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div>User</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% set layout:'wrap' %><div>User</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'users-nested', :name=>'Ben' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'user-params', name:"Matt" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p><%= render 'user', layout:'wrap' %></p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% set layout:'sub' %><span>Nested.</span>
|
data/specs/hash_object_spec.rb
CHANGED
@@ -1,31 +1,76 @@
|
|
1
|
-
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'gumdrop'
|
1
|
+
require_relative 'spec_helper'
|
4
2
|
|
5
|
-
describe Gumdrop::HashObject do
|
3
|
+
describe Gumdrop::Util::HashObject do
|
6
4
|
before do
|
7
|
-
@ho= Gumdrop::HashObject.
|
5
|
+
@ho= Gumdrop::Util::HashObject.from one:"ONE", two:"TWO", three:'THREE'
|
8
6
|
end
|
9
7
|
|
10
8
|
it "can be created with no arguments" do
|
11
|
-
Gumdrop::HashObject.new.must_be_instance_of Gumdrop::HashObject
|
9
|
+
Gumdrop::Util::HashObject.new.must_be_instance_of Gumdrop::Util::HashObject
|
12
10
|
end
|
13
11
|
|
14
12
|
it "can be used as a standard hash" do
|
15
13
|
@ho[:one].must_equal "ONE"
|
16
14
|
end
|
17
15
|
|
18
|
-
it "can be used as a standard with either a sym or string key" do
|
16
|
+
it "can be used as a standard hash with either a sym or string key" do
|
19
17
|
@ho[:two].must_equal "TWO"
|
20
18
|
@ho['two'].must_equal "TWO"
|
19
|
+
|
20
|
+
@ho[:two]= "two"
|
21
|
+
@ho[:two].must_equal "two"
|
22
|
+
@ho['two'].must_equal "two"
|
23
|
+
|
24
|
+
@ho['two']= "too"
|
25
|
+
@ho[:two].must_equal "too"
|
26
|
+
@ho['two'].must_equal "too"
|
21
27
|
end
|
22
28
|
|
23
29
|
it "can be accessed like an object" do
|
24
30
|
@ho.three.must_equal "THREE"
|
25
31
|
end
|
26
32
|
|
33
|
+
it "can be assigned like an object" do
|
34
|
+
@ho.stuff= 'junk'
|
35
|
+
@ho.stuff.must_equal "junk"
|
36
|
+
@ho[:stuff].must_equal "junk"
|
37
|
+
@ho['stuff'].must_equal "junk"
|
38
|
+
end
|
39
|
+
|
27
40
|
it "should return nil for an unknown key" do
|
28
41
|
@ho.timmy.must_be_nil
|
42
|
+
@ho[:timmy].must_be_nil
|
43
|
+
@ho['timmy'].must_be_nil
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should store keys as symbols" do
|
47
|
+
@ho.first= 1
|
48
|
+
@ho[:second]= 2
|
49
|
+
@ho['third']= 4
|
50
|
+
@ho.store 'fourth', 4
|
51
|
+
@ho.keys.each do |key|
|
52
|
+
assert key.class == Symbol, "key isn't a symbol"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should store keys as symbols when merge too" do
|
57
|
+
@ho.merge!({ "fifth"=>5 })
|
58
|
+
@ho.keys.each do |key|
|
59
|
+
assert key.class == Symbol , "key isn't a symbol"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "extends Hash with to_symbolized_hash" do
|
64
|
+
h= {"one"=>1, "two"=>2}.to_symbolized_hash
|
65
|
+
h.keys.each do |key|
|
66
|
+
assert key.class == Symbol , "key isn't a symbol"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "extends Hash with to_hash_object" do
|
71
|
+
ho= { "fifth"=>5 }.to_hash_object
|
72
|
+
ho.must_be_instance_of Gumdrop::Util::HashObject
|
73
|
+
ho.fifth.must_equal 5
|
29
74
|
end
|
30
75
|
|
31
|
-
end
|
76
|
+
end
|