pakyow-presenter 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pakyow-presenter/CHANGES +11 -1
- data/pakyow-presenter/lib/presenter/attributes.rb +18 -15
- data/pakyow-presenter/lib/presenter/base.rb +8 -2
- data/pakyow-presenter/lib/presenter/binder.rb +53 -43
- data/pakyow-presenter/lib/presenter/binder_set.rb +18 -27
- data/pakyow-presenter/lib/presenter/binding_eval.rb +23 -0
- data/pakyow-presenter/lib/presenter/config/presenter.rb +36 -61
- data/pakyow-presenter/lib/presenter/doc_helpers.rb +6 -66
- data/pakyow-presenter/lib/presenter/helpers.rb +26 -3
- data/pakyow-presenter/lib/presenter/nokogiri_doc.rb +321 -0
- data/pakyow-presenter/lib/presenter/page.rb +5 -14
- data/pakyow-presenter/lib/presenter/presenter.rb +14 -13
- data/pakyow-presenter/lib/presenter/string_doc.rb +287 -0
- data/pakyow-presenter/lib/presenter/string_doc_parser.rb +124 -0
- data/pakyow-presenter/lib/presenter/string_doc_renderer.rb +18 -0
- data/pakyow-presenter/lib/presenter/template.rb +13 -37
- data/pakyow-presenter/lib/presenter/view.rb +192 -424
- data/pakyow-presenter/lib/presenter/view_collection.rb +70 -112
- data/pakyow-presenter/lib/presenter/view_composer.rb +2 -47
- data/pakyow-presenter/lib/presenter/view_context.rb +89 -0
- data/pakyow-presenter/lib/presenter/view_store.rb +12 -12
- metadata +30 -10
- data/pakyow-presenter/lib/presenter/title_helpers.rb +0 -21
@@ -33,11 +33,7 @@ module Pakyow
|
|
33
33
|
return view_path if view_path.is_a?(Page)
|
34
34
|
|
35
35
|
raise ArgumentError, "Cannot build page for nil path" if view_path.nil?
|
36
|
-
return at_path(view_path, :page)
|
37
|
-
end
|
38
|
-
|
39
|
-
def view(view_path)
|
40
|
-
return at_path(view_path, :composer).view.dup
|
36
|
+
return at_path(view_path, :page)
|
41
37
|
end
|
42
38
|
|
43
39
|
def partials(view_path)
|
@@ -49,7 +45,11 @@ module Pakyow
|
|
49
45
|
end
|
50
46
|
|
51
47
|
def composer(view_path)
|
52
|
-
return at_path(view_path, :composer)
|
48
|
+
return at_path(view_path, :composer)
|
49
|
+
end
|
50
|
+
|
51
|
+
def view(view_path)
|
52
|
+
return composer(view_path).view
|
53
53
|
end
|
54
54
|
|
55
55
|
# iterations through known views, yielding each
|
@@ -95,6 +95,7 @@ module Pakyow
|
|
95
95
|
if info.nil?
|
96
96
|
raise MissingView, "No view at path '#{view_path}'"
|
97
97
|
else
|
98
|
+
#TODO need to consider whose responsibility it is to make the dups
|
98
99
|
return (obj ? info[obj.to_sym] : info).dup
|
99
100
|
end
|
100
101
|
end
|
@@ -123,7 +124,7 @@ module Pakyow
|
|
123
124
|
end
|
124
125
|
|
125
126
|
def templates_path
|
126
|
-
return File.join(@store_path, Config
|
127
|
+
return File.join(@store_path, Config.presenter.template_dir(@name))
|
127
128
|
end
|
128
129
|
|
129
130
|
def load_path_info
|
@@ -132,7 +133,7 @@ module Pakyow
|
|
132
133
|
# for keeping up with pages for previous paths
|
133
134
|
pages = {}
|
134
135
|
|
135
|
-
|
136
|
+
Dir.walk(@store_path) do |path|
|
136
137
|
# skip root
|
137
138
|
next if path == @store_path
|
138
139
|
|
@@ -170,7 +171,6 @@ module Pakyow
|
|
170
171
|
|
171
172
|
# compose template/page/partials
|
172
173
|
composer = ViewComposer.from_path(self, normalized_path, template: template, page: page, includes: partials)
|
173
|
-
composer.precompose!
|
174
174
|
|
175
175
|
info = {
|
176
176
|
page: page,
|
@@ -187,7 +187,7 @@ module Pakyow
|
|
187
187
|
relative_path = path.gsub(@store_path, '')
|
188
188
|
relative_path = relative_path.gsub(File.extname(relative_path), '')
|
189
189
|
relative_path = relative_path.gsub('index', '')
|
190
|
-
relative_path =
|
190
|
+
relative_path = String.normalize_path(relative_path)
|
191
191
|
|
192
192
|
return relative_path
|
193
193
|
end
|
@@ -196,7 +196,7 @@ module Pakyow
|
|
196
196
|
view_path = File.dirname(view_path) unless File.directory?(view_path)
|
197
197
|
|
198
198
|
partials = {}
|
199
|
-
|
199
|
+
Dir.walk(@store_path) do |path|
|
200
200
|
# skip non-partials
|
201
201
|
next unless File.basename(path)[0,1] == '_'
|
202
202
|
|
@@ -204,7 +204,7 @@ module Pakyow
|
|
204
204
|
next if File.directory?(path)
|
205
205
|
|
206
206
|
# skip files not within `view_path`
|
207
|
-
next unless
|
207
|
+
next unless Dir.within_dir?(File.dirname(path), view_path)
|
208
208
|
|
209
209
|
name = File.basename(path.split('/')[-1], '.*')[1..-1]
|
210
210
|
partials[name.to_sym] = path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pakyow-presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
@@ -9,22 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pakyow-support
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.0
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: pakyow-core
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
17
31
|
requirements:
|
18
32
|
- - '='
|
19
33
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
34
|
+
version: 0.9.0
|
21
35
|
type: :runtime
|
22
36
|
prerelease: false
|
23
37
|
version_requirements: !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
39
|
- - '='
|
26
40
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
41
|
+
version: 0.9.0
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: nokogiri
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,8 +81,8 @@ dependencies:
|
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
83
|
version: '0.9'
|
70
|
-
description: A library for building
|
71
|
-
|
84
|
+
description: A library for building frontends for Pakyow apps, including templating
|
85
|
+
and data binding.
|
72
86
|
email: bryan@metabahn.com
|
73
87
|
executables: []
|
74
88
|
extensions: []
|
@@ -82,20 +96,25 @@ files:
|
|
82
96
|
- pakyow-presenter/lib/presenter/base.rb
|
83
97
|
- pakyow-presenter/lib/presenter/binder.rb
|
84
98
|
- pakyow-presenter/lib/presenter/binder_set.rb
|
99
|
+
- pakyow-presenter/lib/presenter/binding_eval.rb
|
85
100
|
- pakyow-presenter/lib/presenter/config/presenter.rb
|
86
101
|
- pakyow-presenter/lib/presenter/container.rb
|
87
102
|
- pakyow-presenter/lib/presenter/doc_helpers.rb
|
88
103
|
- pakyow-presenter/lib/presenter/exceptions.rb
|
89
104
|
- pakyow-presenter/lib/presenter/ext/app.rb
|
90
105
|
- pakyow-presenter/lib/presenter/helpers.rb
|
106
|
+
- pakyow-presenter/lib/presenter/nokogiri_doc.rb
|
91
107
|
- pakyow-presenter/lib/presenter/page.rb
|
92
108
|
- pakyow-presenter/lib/presenter/partial.rb
|
93
109
|
- pakyow-presenter/lib/presenter/presenter.rb
|
110
|
+
- pakyow-presenter/lib/presenter/string_doc.rb
|
111
|
+
- pakyow-presenter/lib/presenter/string_doc_parser.rb
|
112
|
+
- pakyow-presenter/lib/presenter/string_doc_renderer.rb
|
94
113
|
- pakyow-presenter/lib/presenter/template.rb
|
95
|
-
- pakyow-presenter/lib/presenter/title_helpers.rb
|
96
114
|
- pakyow-presenter/lib/presenter/view.rb
|
97
115
|
- pakyow-presenter/lib/presenter/view_collection.rb
|
98
116
|
- pakyow-presenter/lib/presenter/view_composer.rb
|
117
|
+
- pakyow-presenter/lib/presenter/view_context.rb
|
99
118
|
- pakyow-presenter/lib/presenter/view_store.rb
|
100
119
|
homepage: http://pakyow.com
|
101
120
|
licenses:
|
@@ -109,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
128
|
requirements:
|
110
129
|
- - ">="
|
111
130
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
131
|
+
version: 2.0.0
|
113
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
133
|
requirements:
|
115
134
|
- - ">="
|
@@ -117,8 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
136
|
version: '0'
|
118
137
|
requirements: []
|
119
138
|
rubyforge_project: pakyow-presenter
|
120
|
-
rubygems_version: 2.2.
|
139
|
+
rubygems_version: 2.2.2
|
121
140
|
signing_key:
|
122
141
|
specification_version: 4
|
123
|
-
summary:
|
142
|
+
summary: Presenter functionality for Pakyow apps.
|
124
143
|
test_files: []
|
144
|
+
has_rdoc:
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Pakyow
|
2
|
-
module Presenter
|
3
|
-
module TitleHelpers
|
4
|
-
def title=(title)
|
5
|
-
return if @doc.nil?
|
6
|
-
|
7
|
-
if o = @doc.css('title').first
|
8
|
-
o.inner_html = Nokogiri::HTML::fragment(title.to_s)
|
9
|
-
elsif o = @doc.css('head').first
|
10
|
-
o.add_child(Nokogiri::HTML::fragment("<title>#{title}</title>"))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def title
|
15
|
-
return unless o = @doc.css('title').first
|
16
|
-
o.inner_text
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|