comfortable_mexican_sofa 1.0.41 → 1.0.42
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/VERSION +1 -1
- data/comfortable_mexican_sofa.gemspec +3 -2
- data/config/initializers/comfortable_mexican_sofa.rb +5 -0
- data/lib/comfortable_mexican_sofa/cms_tag.rb +6 -1
- data/lib/comfortable_mexican_sofa/configuration.rb +5 -1
- data/test/functional/cms_content_controller_test.rb +40 -0
- data/test/test_helper.rb +2 -1
- data/test/unit/cms_configuration_test.rb +2 -1
- metadata +5 -4
data/.gemtest
ADDED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.42
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.42"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-03}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
+
".gemtest",
|
20
21
|
"Gemfile",
|
21
22
|
"Gemfile.lock",
|
22
23
|
"LICENSE",
|
@@ -20,6 +20,11 @@ ComfortableMexicanSofa.configure do |config|
|
|
20
20
|
|
21
21
|
# Let CMS handle site creation and management. Enabled by default.
|
22
22
|
# config.auto_manage_sites = true
|
23
|
+
|
24
|
+
# By default you cannot have irb code inside your layouts/pages/snippets.
|
25
|
+
# Generally this is to prevent putting something like this:
|
26
|
+
# <% User.delete_all %> but if you really want to allow it...
|
27
|
+
# config.disable_irb = true
|
23
28
|
end
|
24
29
|
|
25
30
|
# Default credentials for ComfortableMexicanSofa::HttpAuth
|
@@ -67,7 +67,12 @@ module CmsTag
|
|
67
67
|
# Content that is used during page rendering. Outputting existing content
|
68
68
|
# as a default.
|
69
69
|
def render
|
70
|
-
content.
|
70
|
+
# cleaning content from possible irb stuff. Partial and Helper tags are OK.
|
71
|
+
if ComfortableMexicanSofa.config.disable_irb && ![CmsTag::Partial, CmsTag::Helper].member?(self.class)
|
72
|
+
content.to_s.gsub('<%', '<%').gsub('%>', '%>')
|
73
|
+
else
|
74
|
+
content.to_s
|
75
|
+
end
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
@@ -21,14 +21,18 @@ class ComfortableMexicanSofa::Configuration
|
|
21
21
|
# Let CMS handle site creation and management. Enabled by default.
|
22
22
|
attr_accessor :auto_manage_sites
|
23
23
|
|
24
|
+
# Not allowing irb code to be run inside page content. True by default.
|
25
|
+
attr_accessor :disable_irb
|
26
|
+
|
24
27
|
# Configuration defaults
|
25
28
|
def initialize
|
26
|
-
@cms_title = 'ComfortableMexicanSofa'
|
29
|
+
@cms_title = 'ComfortableMexicanSofa MicroCMS'
|
27
30
|
@authentication = 'ComfortableMexicanSofa::HttpAuth'
|
28
31
|
@seed_data_path = nil
|
29
32
|
@admin_route_prefix = 'cms-admin'
|
30
33
|
@admin_route_redirect = "/#{@admin_route_prefix}/pages"
|
31
34
|
@auto_manage_sites = true
|
35
|
+
@disable_irb = true
|
32
36
|
end
|
33
37
|
|
34
38
|
end
|
@@ -67,6 +67,46 @@ class CmsContentControllerTest < ActionController::TestCase
|
|
67
67
|
assert_response 404
|
68
68
|
end
|
69
69
|
|
70
|
+
def test_render_page_with_irb_disabled
|
71
|
+
assert ComfortableMexicanSofa.config.disable_irb
|
72
|
+
|
73
|
+
irb_page = cms_sites(:default).cms_pages.create!(
|
74
|
+
:label => 'irb',
|
75
|
+
:slug => 'irb',
|
76
|
+
:parent_id => cms_pages(:default).id,
|
77
|
+
:cms_layout_id => cms_layouts(:default).id,
|
78
|
+
:is_published => '1',
|
79
|
+
:cms_blocks_attributes => [
|
80
|
+
{ :label => 'default_page_text',
|
81
|
+
:type => 'CmsTag::PageText',
|
82
|
+
:content => 'text <%= 2 + 2 %> text' }
|
83
|
+
]
|
84
|
+
)
|
85
|
+
get :render_html, :cms_path => 'irb'
|
86
|
+
assert_response :success
|
87
|
+
assert_match "text <%= 2 + 2 %> text", response.body
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_render_page_with_irb_enabled
|
91
|
+
ComfortableMexicanSofa.config.disable_irb = false
|
92
|
+
|
93
|
+
irb_page = cms_sites(:default).cms_pages.create!(
|
94
|
+
:label => 'irb',
|
95
|
+
:slug => 'irb',
|
96
|
+
:parent_id => cms_pages(:default).id,
|
97
|
+
:cms_layout_id => cms_layouts(:default).id,
|
98
|
+
:is_published => '1',
|
99
|
+
:cms_blocks_attributes => [
|
100
|
+
{ :label => 'default_page_text',
|
101
|
+
:type => 'CmsTag::PageText',
|
102
|
+
:content => 'text <%= 2 + 2 %> text' }
|
103
|
+
]
|
104
|
+
)
|
105
|
+
get :render_html, :cms_path => 'irb'
|
106
|
+
assert_response :success
|
107
|
+
assert_match "text 4 text", response.body
|
108
|
+
end
|
109
|
+
|
70
110
|
def test_render_css
|
71
111
|
get :render_css, :id => cms_layouts(:default).slug
|
72
112
|
assert_response :success
|
data/test/test_helper.rb
CHANGED
@@ -14,12 +14,13 @@ class ActiveSupport::TestCase
|
|
14
14
|
# resetting default configuration
|
15
15
|
def reset_config
|
16
16
|
ComfortableMexicanSofa.configure do |config|
|
17
|
-
config.cms_title = 'ComfortableMexicanSofa'
|
17
|
+
config.cms_title = 'ComfortableMexicanSofa MicroCMS'
|
18
18
|
config.authentication = 'ComfortableMexicanSofa::HttpAuth'
|
19
19
|
config.seed_data_path = nil
|
20
20
|
config.admin_route_prefix = 'cms-admin'
|
21
21
|
config.admin_route_redirect = "/cms-admin/pages"
|
22
22
|
config.auto_manage_sites = true
|
23
|
+
config.disable_irb = true
|
23
24
|
end
|
24
25
|
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
25
26
|
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
@@ -4,11 +4,12 @@ class CmsConfigurationTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def test_configuration_presense
|
6
6
|
assert config = ComfortableMexicanSofa.configuration
|
7
|
-
assert_equal 'ComfortableMexicanSofa', config.cms_title
|
7
|
+
assert_equal 'ComfortableMexicanSofa MicroCMS', config.cms_title
|
8
8
|
assert_equal 'ComfortableMexicanSofa::HttpAuth', config.authentication
|
9
9
|
assert_equal nil, config.seed_data_path
|
10
10
|
assert_equal 'cms-admin', config.admin_route_prefix
|
11
11
|
assert_equal '/cms-admin/pages', config.admin_route_redirect
|
12
|
+
assert_equal true, config.disable_irb
|
12
13
|
end
|
13
14
|
|
14
15
|
def test_initialization_overrides
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 42
|
9
|
+
version: 1.0.42
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Oleg Khabarov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-03 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -144,6 +144,7 @@ extra_rdoc_files:
|
|
144
144
|
- LICENSE
|
145
145
|
- README.md
|
146
146
|
files:
|
147
|
+
- .gemtest
|
147
148
|
- Gemfile
|
148
149
|
- Gemfile.lock
|
149
150
|
- LICENSE
|
@@ -376,7 +377,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
376
377
|
requirements:
|
377
378
|
- - ">="
|
378
379
|
- !ruby/object:Gem::Version
|
379
|
-
hash:
|
380
|
+
hash: -1540326834008141182
|
380
381
|
segments:
|
381
382
|
- 0
|
382
383
|
version: "0"
|