pieces 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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/examples/boilerplate/Gemfile +3 -0
- data/examples/boilerplate/config/routes.yml +10 -0
- data/examples/boilerplate/pieces/application/footer.html.erb +3 -0
- data/examples/boilerplate/pieces/application/header.html.erb +3 -0
- data/examples/boilerplate/pieces/layouts/application.html.erb +11 -0
- data/{example → examples/original}/config/routes.yml +0 -0
- data/{example → examples/original}/pieces/application/footer.html.mustache +0 -0
- data/{example → examples/original}/pieces/application/header.html.erb +0 -0
- data/{example → examples/original}/pieces/layouts/layout.html.mustache +0 -0
- data/{example → examples/original}/pieces/posts/post.css +0 -0
- data/{example → examples/original}/pieces/posts/post.html.mustache +0 -0
- data/{example → examples/original}/pieces/posts/posts.html.erb +0 -0
- data/lib/pieces/builder.rb +5 -2
- data/lib/pieces/generator.rb +3 -1
- data/lib/pieces/version.rb +1 -1
- metadata +14 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64cbce7a11d487d3cd6ba5b28592c05777238d69
|
4
|
+
data.tar.gz: 7372e016548ffafb26cccfa147c9b929079fcd13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd1f4366fdb91cbea5628c12b8516c278d627414c55cef67dd6df71c4ac49c5447a35cd0222ce0dae28237aabfa4ba6b749d3d6a6f428c727762e7deb6e141f9
|
7
|
+
data.tar.gz: 64f235649c1c8b096f11f0d642183e05645a7a0c7022d70fc6c94fa52bcb8c0ec92426920e12f90745a63953aa8ccb3dd360fc7f3122f958f80043b1729ea8fa
|
data/README.md
CHANGED
@@ -121,6 +121,10 @@ The child pieces will be rendered in order and passed into the parent
|
|
121
121
|
</html>
|
122
122
|
```
|
123
123
|
|
124
|
+
## More Examples
|
125
|
+
|
126
|
+
For more examples please see: https://github.com/drpheltright/pieces/tree/master/example
|
127
|
+
|
124
128
|
## Contributing
|
125
129
|
|
126
130
|
1. Fork it ( https://github.com/drpheltright/pieces/fork )
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/pieces/builder.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'yaml'
|
2
3
|
|
3
4
|
module Pieces
|
@@ -37,7 +38,8 @@ module Pieces
|
|
37
38
|
end
|
38
39
|
|
39
40
|
files["#{name}.html"] = { contents: '', type: 'html' } unless files.has_key?("#{name}.html")
|
40
|
-
|
41
|
+
view_model = OpenStruct.new(data['_global'].merge(data))
|
42
|
+
content = Tilt.new(piece_path(piece)).render(view_model) { yield_route_pieces(data) }
|
41
43
|
files["#{name}.html"][:contents] << content
|
42
44
|
|
43
45
|
files
|
@@ -54,7 +56,8 @@ module Pieces
|
|
54
56
|
parent_data['_pieces'].reduce('') do |content, piece|
|
55
57
|
piece, data = piece.keys.first, piece.values.first
|
56
58
|
data['_global'] = (parent_data['_global'] || {}).merge(data['_global'] || {})
|
57
|
-
|
59
|
+
view_model = OpenStruct.new(data['_global'].merge(data))
|
60
|
+
content << Tilt.new(piece_path(piece)).render(view_model) { yield_route_pieces(data) }
|
58
61
|
end
|
59
62
|
end
|
60
63
|
|
data/lib/pieces/generator.rb
CHANGED
@@ -6,12 +6,14 @@ module Pieces
|
|
6
6
|
Dir["#{example_path}/{config,layouts,pieces}"].each do |dir|
|
7
7
|
FileUtils.cp_r(dir, config[:path])
|
8
8
|
end
|
9
|
+
|
10
|
+
FileUtils.cp("#{example_path}/Gemfile", "#{config[:path]}/Gemfile")
|
9
11
|
end
|
10
12
|
|
11
13
|
private
|
12
14
|
|
13
15
|
def example_path
|
14
|
-
File.dirname(__FILE__) + '/../../
|
16
|
+
File.dirname(__FILE__) + '/../../examples/boilerplate'
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/pieces/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pieces
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Morton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -112,13 +112,18 @@ files:
|
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
114
|
- bin/pieces
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
115
|
+
- examples/boilerplate/Gemfile
|
116
|
+
- examples/boilerplate/config/routes.yml
|
117
|
+
- examples/boilerplate/pieces/application/footer.html.erb
|
118
|
+
- examples/boilerplate/pieces/application/header.html.erb
|
119
|
+
- examples/boilerplate/pieces/layouts/application.html.erb
|
120
|
+
- examples/original/config/routes.yml
|
121
|
+
- examples/original/pieces/application/footer.html.mustache
|
122
|
+
- examples/original/pieces/application/header.html.erb
|
123
|
+
- examples/original/pieces/layouts/layout.html.mustache
|
124
|
+
- examples/original/pieces/posts/post.css
|
125
|
+
- examples/original/pieces/posts/post.html.mustache
|
126
|
+
- examples/original/pieces/posts/posts.html.erb
|
122
127
|
- lib/pieces.rb
|
123
128
|
- lib/pieces/builder.rb
|
124
129
|
- lib/pieces/generator.rb
|