cells 3.3.5 → 3.3.6
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/Gemfile.lock +51 -23
- data/lib/cells/cell/base.rb +9 -3
- data/lib/cells/cell/caching.rb +1 -1
- data/lib/cells/cell/test_case.rb +1 -0
- data/lib/cells/version.rb +1 -1
- data/rails/init.rb +19 -5
- data/test/cells_test.rb +1 -1
- data/test/dummy/tmp/app/cells/blog/post_cell.rb +7 -0
- data/test/render_test.rb +5 -2
- metadata +76 -39
- data/rails/tasks/log.rake +0 -9
data/Gemfile.lock
CHANGED
@@ -1,33 +1,61 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cells (3.6.2)
|
5
|
+
actionpack (~> 3.0)
|
6
|
+
railties (~> 3.0)
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: http://rubygems.org/
|
3
10
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
activesupport (=
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionpack (3.0.8)
|
13
|
+
activemodel (= 3.0.8)
|
14
|
+
activesupport (= 3.0.8)
|
15
|
+
builder (~> 2.1.2)
|
16
|
+
erubis (~> 2.6.6)
|
17
|
+
i18n (~> 0.5.0)
|
18
|
+
rack (~> 1.2.1)
|
19
|
+
rack-mount (~> 0.6.14)
|
20
|
+
rack-test (~> 0.5.7)
|
21
|
+
tzinfo (~> 0.3.23)
|
22
|
+
activemodel (3.0.8)
|
23
|
+
activesupport (= 3.0.8)
|
24
|
+
builder (~> 2.1.2)
|
25
|
+
i18n (~> 0.5.0)
|
26
|
+
activesupport (3.0.8)
|
27
|
+
builder (2.1.2)
|
28
|
+
erubis (2.6.6)
|
29
|
+
abstract (>= 1.0.0)
|
30
|
+
haml (3.1.2)
|
31
|
+
i18n (0.5.0)
|
32
|
+
rack (1.2.3)
|
33
|
+
rack-mount (0.6.14)
|
34
|
+
rack (>= 1.0.0)
|
35
|
+
rack-test (0.5.7)
|
36
|
+
rack (>= 1.0)
|
37
|
+
railties (3.0.8)
|
38
|
+
actionpack (= 3.0.8)
|
39
|
+
activesupport (= 3.0.8)
|
40
|
+
rake (>= 0.8.7)
|
41
|
+
thor (~> 0.14.4)
|
42
|
+
rake (0.9.2)
|
25
43
|
shoulda (2.11.3)
|
44
|
+
slim (0.9.4)
|
45
|
+
temple (~> 0.3.0)
|
46
|
+
tilt (~> 1.2)
|
47
|
+
temple (0.3.1)
|
48
|
+
thor (0.14.6)
|
49
|
+
tilt (1.3.2)
|
50
|
+
tzinfo (0.3.28)
|
26
51
|
|
27
52
|
PLATFORMS
|
28
53
|
ruby
|
29
54
|
|
30
55
|
DEPENDENCIES
|
31
|
-
|
32
|
-
|
56
|
+
actionpack (~> 3.0)
|
57
|
+
cells!
|
58
|
+
haml
|
59
|
+
railties (~> 3.0)
|
33
60
|
shoulda
|
61
|
+
slim
|
data/lib/cells/cell/base.rb
CHANGED
@@ -230,6 +230,11 @@ module Cells
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
+
class MissingTemplate < ActionView::ActionViewError
|
234
|
+
def initialize(message, possible_paths)
|
235
|
+
super(message + " and possible paths #{possible_paths}")
|
236
|
+
end
|
237
|
+
end
|
233
238
|
|
234
239
|
class_inheritable_accessor :allow_forgery_protection
|
235
240
|
self.allow_forgery_protection = true
|
@@ -395,8 +400,9 @@ module Cells
|
|
395
400
|
### DISCUSS: moved to Cell::View#find_template in rainhead's fork:
|
396
401
|
def find_family_view_for_state(state, action_view)
|
397
402
|
missing_template_exception = nil
|
398
|
-
|
399
|
-
|
403
|
+
possible_paths = possible_paths_for_state(state)
|
404
|
+
|
405
|
+
possible_paths.each do |template_path|
|
400
406
|
# we need to catch MissingTemplate, since we want to try for all possible
|
401
407
|
# family views.
|
402
408
|
begin
|
@@ -407,7 +413,7 @@ module Cells
|
|
407
413
|
end
|
408
414
|
end
|
409
415
|
|
410
|
-
raise missing_template_exception
|
416
|
+
raise MissingTemplate.new(missing_template_exception.message, possible_paths)
|
411
417
|
end
|
412
418
|
|
413
419
|
# In production mode, the view for a state/template_format is cached.
|
data/lib/cells/cell/caching.rb
CHANGED
@@ -121,7 +121,7 @@ module Cells
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def read_fragment(key, cache_options = nil) #:nodoc:
|
124
|
-
|
124
|
+
self.class.cache_store.read(key, cache_options).tap do |content|
|
125
125
|
log "Cell Cache hit: #{key}" unless content.blank?
|
126
126
|
end
|
127
127
|
end
|
data/lib/cells/cell/test_case.rb
CHANGED
data/lib/cells/version.rb
CHANGED
data/rails/init.rb
CHANGED
@@ -5,7 +5,13 @@ require 'cells'
|
|
5
5
|
#
|
6
6
|
# * +app/cells+
|
7
7
|
#
|
8
|
-
ActiveSupport::Dependencies
|
8
|
+
dep = ::ActiveSupport::Dependencies
|
9
|
+
|
10
|
+
if dep.respond_to?(:autoload_paths)
|
11
|
+
dep.autoload_paths << Rails.root.join(*%w[app cells])
|
12
|
+
else
|
13
|
+
dep.load_paths << Rails.root.join(*%w[app cells])
|
14
|
+
end
|
9
15
|
|
10
16
|
# Rails initialization hook.
|
11
17
|
if defined?(Rails)
|
@@ -16,15 +22,23 @@ if defined?(Rails)
|
|
16
22
|
if plugin.engine? && File.exists?(engine_cells_dir)
|
17
23
|
# propagate the view- and code path of this engine-cell:
|
18
24
|
::Cell::Base.view_paths << engine_cells_dir
|
19
|
-
|
20
|
-
|
25
|
+
if dep.respond_to?(:autoload_paths)
|
26
|
+
dep.autoload_paths << engine_cells_dir
|
27
|
+
else
|
28
|
+
dep.load_paths << engine_cells_dir
|
29
|
+
end
|
30
|
+
|
21
31
|
# if a path is in +load_once_path+ it won't be reloaded between requests.
|
22
32
|
unless config.reload_plugins?
|
23
|
-
|
33
|
+
if dep.respond_to?(:autoload_once_paths)
|
34
|
+
dep.autoload_once_paths << engine_cells_dir
|
35
|
+
else
|
36
|
+
dep.load_once_paths << engine_cells_dir
|
37
|
+
end
|
24
38
|
end
|
25
39
|
end
|
26
40
|
end
|
27
41
|
end
|
28
42
|
else
|
29
43
|
puts "[cells:] NOTE: Rails environment not available. Running isolated."
|
30
|
-
end
|
44
|
+
end
|
data/test/cells_test.rb
CHANGED
@@ -174,7 +174,7 @@ class CellsTest < ActionController::TestCase
|
|
174
174
|
cell = MyTestCell.new(@controller)
|
175
175
|
### TODO: production <-> development/test context.
|
176
176
|
|
177
|
-
assert_raises
|
177
|
+
assert_raises Cell::Base::MissingTemplate do
|
178
178
|
c = cell.render_state(:missing_view)
|
179
179
|
end
|
180
180
|
end
|
data/test/render_test.rb
CHANGED
@@ -44,12 +44,15 @@ class RenderTest < ActiveSupport::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_render_with_not_existing_view
|
47
|
-
assert_raises
|
47
|
+
assert_raises Cell::Base::MissingTemplate do
|
48
48
|
render_cell(:a, :not_existing_view)
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
|
+
e = assert_raise Cell::Base::MissingTemplate do
|
51
52
|
render_cell(:b, :not_existing_view)
|
52
53
|
end
|
54
|
+
|
55
|
+
assert_equal "Missing template a/not_existing_view.erb in view path app/cells:app/cells/layouts:/home/nick/projects/cells/test/app/cells:/home/nick/projects/cells/test/app/cells/layouts and possible paths [\"b/not_existing_view\", \"a/not_existing_view\"]", e.message
|
53
56
|
end
|
54
57
|
|
55
58
|
def test_render_without_arguments_with_locally_existing_view
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 1
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 3
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
8
|
+
- 6
|
9
|
+
version: 3.3.6
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Nick Sutterer
|
@@ -15,10 +14,49 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-06-29 00:00:00 +02:00
|
19
18
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 3
|
30
|
+
version: "2.3"
|
31
|
+
type: :runtime
|
32
|
+
prerelease: false
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: shoulda
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: active_helper
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id003
|
22
60
|
description: Cells are lightweight controllers for Rails and can be rendered in controllers and views, providing an elegant and fast way for encapsulation and component-orientation.
|
23
61
|
email: apotonick@gmail.com
|
24
62
|
executables: []
|
@@ -50,7 +88,6 @@ files:
|
|
50
88
|
- lib/cells/rails/action_view.rb
|
51
89
|
- lib/cells/version.rb
|
52
90
|
- rails/init.rb
|
53
|
-
- rails/tasks/log.rake
|
54
91
|
- rails_generators/cell/USAGE
|
55
92
|
- rails_generators/cell/cell_generator.rb
|
56
93
|
- rails_generators/cell/templates/cell.rb
|
@@ -61,35 +98,36 @@ files:
|
|
61
98
|
- rails_generators/cells_install/cells_install_generator.rb
|
62
99
|
- rails_generators/cells_install/templates/initializer.rb
|
63
100
|
- rails_generators/cells_install/templates/tasks.rake
|
64
|
-
- test/rails_test.rb
|
65
101
|
- test/active_helper_test.rb
|
66
|
-
- test/capture_helper_test.rb
|
67
|
-
- test/assertions_helper_test.rb
|
68
|
-
- test/cell_generator_test.rb
|
69
|
-
- test/test_helper.rb
|
70
|
-
- test/support/internal_assertions_helper.rb
|
71
|
-
- test/bugs_test.rb
|
72
|
-
- test/render_test.rb
|
73
|
-
- test/test_case_test.rb
|
74
|
-
- test/cells_test.rb
|
75
|
-
- test/helper_test.rb
|
76
|
-
- test/caching_test.rb
|
77
|
-
- test/app/controllers/cells_test_controller.rb
|
78
102
|
- test/app/cells/bassist_cell.rb
|
79
|
-
- test/app/cells/really_module/nested_cell.rb
|
80
103
|
- test/app/cells/cells_test_one_cell.rb
|
81
104
|
- test/app/cells/cells_test_two_cell.rb
|
105
|
+
- test/app/cells/really_module/nested_cell.rb
|
82
106
|
- test/app/cells/simple_cell.rb
|
83
107
|
- test/app/cells/test_cell.rb
|
108
|
+
- test/app/controllers/cells_test_controller.rb
|
84
109
|
- test/app/helpers/application_helper.rb
|
85
110
|
- test/app/helpers/helper_using_cell_helper.rb
|
111
|
+
- test/assertions_helper_test.rb
|
112
|
+
- test/bugs_test.rb
|
113
|
+
- test/caching_test.rb
|
114
|
+
- test/capture_helper_test.rb
|
115
|
+
- test/cell_generator_test.rb
|
116
|
+
- test/cells_test.rb
|
117
|
+
- test/dummy/tmp/app/cells/blog/post_cell.rb
|
118
|
+
- test/helper_test.rb
|
119
|
+
- test/rails_test.rb
|
120
|
+
- test/render_test.rb
|
121
|
+
- test/support/internal_assertions_helper.rb
|
122
|
+
- test/test_case_test.rb
|
123
|
+
- test/test_helper.rb
|
86
124
|
has_rdoc: true
|
87
125
|
homepage: http://cells.rubyforge.org
|
88
126
|
licenses: []
|
89
127
|
|
90
128
|
post_install_message:
|
91
|
-
rdoc_options:
|
92
|
-
|
129
|
+
rdoc_options: []
|
130
|
+
|
93
131
|
require_paths:
|
94
132
|
- lib
|
95
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -97,7 +135,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
135
|
requirements:
|
98
136
|
- - ">="
|
99
137
|
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
138
|
segments:
|
102
139
|
- 0
|
103
140
|
version: "0"
|
@@ -106,7 +143,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
143
|
requirements:
|
107
144
|
- - ">="
|
108
145
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
146
|
segments:
|
111
147
|
- 0
|
112
148
|
version: "0"
|
@@ -118,25 +154,26 @@ signing_key:
|
|
118
154
|
specification_version: 3
|
119
155
|
summary: Cells are lightweight controllers for Rails and can be rendered in controllers and views, providing an elegant and fast way for encapsulation and component-orientation.
|
120
156
|
test_files:
|
121
|
-
- test/rails_test.rb
|
122
157
|
- test/active_helper_test.rb
|
123
|
-
- test/capture_helper_test.rb
|
124
|
-
- test/assertions_helper_test.rb
|
125
|
-
- test/cell_generator_test.rb
|
126
|
-
- test/test_helper.rb
|
127
|
-
- test/support/internal_assertions_helper.rb
|
128
|
-
- test/bugs_test.rb
|
129
|
-
- test/render_test.rb
|
130
|
-
- test/test_case_test.rb
|
131
|
-
- test/cells_test.rb
|
132
|
-
- test/helper_test.rb
|
133
|
-
- test/caching_test.rb
|
134
|
-
- test/app/controllers/cells_test_controller.rb
|
135
158
|
- test/app/cells/bassist_cell.rb
|
136
|
-
- test/app/cells/really_module/nested_cell.rb
|
137
159
|
- test/app/cells/cells_test_one_cell.rb
|
138
160
|
- test/app/cells/cells_test_two_cell.rb
|
161
|
+
- test/app/cells/really_module/nested_cell.rb
|
139
162
|
- test/app/cells/simple_cell.rb
|
140
163
|
- test/app/cells/test_cell.rb
|
164
|
+
- test/app/controllers/cells_test_controller.rb
|
141
165
|
- test/app/helpers/application_helper.rb
|
142
166
|
- test/app/helpers/helper_using_cell_helper.rb
|
167
|
+
- test/assertions_helper_test.rb
|
168
|
+
- test/bugs_test.rb
|
169
|
+
- test/caching_test.rb
|
170
|
+
- test/capture_helper_test.rb
|
171
|
+
- test/cell_generator_test.rb
|
172
|
+
- test/cells_test.rb
|
173
|
+
- test/dummy/tmp/app/cells/blog/post_cell.rb
|
174
|
+
- test/helper_test.rb
|
175
|
+
- test/rails_test.rb
|
176
|
+
- test/render_test.rb
|
177
|
+
- test/support/internal_assertions_helper.rb
|
178
|
+
- test/test_case_test.rb
|
179
|
+
- test/test_helper.rb
|