comfortable_mexican_sofa 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/comfortable_mexican_sofa.gemspec +2 -42
- data/lib/comfortable_mexican_sofa/view_methods.rb +3 -3
- data/lib/generators/cms_generator.rb +10 -6
- data/test/unit/fixtures_test.rb +1 -1
- data/test/unit/view_methods_test.rb +22 -16
- metadata +5 -42
- data/Gemfile.lock +0 -85
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
@@ -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.2.
|
8
|
+
s.version = "1.2.1"
|
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-05-
|
12
|
+
s.date = %q{2011-05-11}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".gemtest",
|
21
21
|
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
22
|
"LICENSE",
|
24
23
|
"README.md",
|
25
24
|
"Rakefile",
|
@@ -264,45 +263,6 @@ Gem::Specification.new do |s|
|
|
264
263
|
s.require_paths = ["lib"]
|
265
264
|
s.rubygems_version = %q{1.7.2}
|
266
265
|
s.summary = %q{ComfortableMexicanSofa is a powerful micro CMS for Ruby on Rails 3 applications}
|
267
|
-
s.test_files = [
|
268
|
-
"test/functional/cms_admin/layouts_controller_test.rb",
|
269
|
-
"test/functional/cms_admin/pages_controller_test.rb",
|
270
|
-
"test/functional/cms_admin/revisions_controller_test.rb",
|
271
|
-
"test/functional/cms_admin/sites_controller_test.rb",
|
272
|
-
"test/functional/cms_admin/snippets_controller_test.rb",
|
273
|
-
"test/functional/cms_admin/uploads_controller_test.rb",
|
274
|
-
"test/functional/cms_content_controller_test.rb",
|
275
|
-
"test/integration/authentication_test.rb",
|
276
|
-
"test/integration/fixtures_test.rb",
|
277
|
-
"test/integration/render_cms_test.rb",
|
278
|
-
"test/integration/routing_extensions_test.rb",
|
279
|
-
"test/integration/sites_test.rb",
|
280
|
-
"test/integration/view_hooks_test.rb",
|
281
|
-
"test/test_helper.rb",
|
282
|
-
"test/unit/configuration_test.rb",
|
283
|
-
"test/unit/fixtures_test.rb",
|
284
|
-
"test/unit/models/block_test.rb",
|
285
|
-
"test/unit/models/layout_test.rb",
|
286
|
-
"test/unit/models/page_test.rb",
|
287
|
-
"test/unit/models/site_test.rb",
|
288
|
-
"test/unit/models/snippet_test.rb",
|
289
|
-
"test/unit/models/upload_test.rb",
|
290
|
-
"test/unit/revisions_test.rb",
|
291
|
-
"test/unit/tag_test.rb",
|
292
|
-
"test/unit/tags/field_datetime_test.rb",
|
293
|
-
"test/unit/tags/field_integer_test.rb",
|
294
|
-
"test/unit/tags/field_string_test.rb",
|
295
|
-
"test/unit/tags/field_text_test.rb",
|
296
|
-
"test/unit/tags/helper_test.rb",
|
297
|
-
"test/unit/tags/page_datetime_test.rb",
|
298
|
-
"test/unit/tags/page_integer_test.rb",
|
299
|
-
"test/unit/tags/page_rich_text.rb",
|
300
|
-
"test/unit/tags/page_string_test.rb",
|
301
|
-
"test/unit/tags/page_text_test.rb",
|
302
|
-
"test/unit/tags/partial_test.rb",
|
303
|
-
"test/unit/tags/snippet_test.rb",
|
304
|
-
"test/unit/view_methods_test.rb"
|
305
|
-
]
|
306
266
|
|
307
267
|
if s.respond_to? :specification_version then
|
308
268
|
s.specification_version = 3
|
@@ -23,9 +23,9 @@ module ComfortableMexicanSofa::ViewMethods
|
|
23
23
|
# Content of a snippet. Example:
|
24
24
|
# cms_snippet_content(:my_snippet)
|
25
25
|
def cms_snippet_content(snippet_slug, cms_site = nil)
|
26
|
-
return '' unless cms_site ||= (@cms_site || Cms::Site.find_by_hostname
|
26
|
+
return '' unless cms_site ||= (@cms_site || Cms::Site.find_by_hostname(request.host.downcase))
|
27
27
|
return '' unless snippet = cms_site.snippets.find_by_slug(snippet_slug)
|
28
|
-
ComfortableMexicanSofa::Tag.process_content(Cms::Page.new, snippet.content)
|
28
|
+
render :inline => ComfortableMexicanSofa::Tag.process_content(Cms::Page.new, snippet.content)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Content of a page block. This is how you get content from page:field
|
@@ -35,7 +35,7 @@ module ComfortableMexicanSofa::ViewMethods
|
|
35
35
|
def cms_page_content(block_label, page = nil)
|
36
36
|
return '' unless page ||= @cms_page
|
37
37
|
return '' unless block = page.blocks.find_by_label(block_label)
|
38
|
-
ComfortableMexicanSofa::Tag.process_content(page, block.content)
|
38
|
+
render :inline => ComfortableMexicanSofa::Tag.process_content(page, block.content)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class CmsGenerator < Rails::Generators::Base
|
2
2
|
|
3
|
+
require 'rails/generators/active_record'
|
3
4
|
include Rails::Generators::Migration
|
4
5
|
include Thor::Actions
|
5
6
|
|
@@ -22,9 +23,14 @@ class CmsGenerator < Rails::Generators::Base
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def generate_public_assets
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
assets_dir = if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1 && Rails.configuration.assets.enabled
|
27
|
+
'app/assets'
|
28
|
+
else
|
29
|
+
'public'
|
30
|
+
end
|
31
|
+
directory 'public/stylesheets/comfortable_mexican_sofa', "#{assets_dir}/stylesheets/comfortable_mexican_sofa"
|
32
|
+
directory 'public/javascripts/comfortable_mexican_sofa', "#{assets_dir}/javascripts/comfortable_mexican_sofa"
|
33
|
+
directory 'public/images/comfortable_mexican_sofa', "#{assets_dir}/images/comfortable_mexican_sofa"
|
28
34
|
end
|
29
35
|
|
30
36
|
def generate_cms_seeds
|
@@ -36,9 +42,7 @@ class CmsGenerator < Rails::Generators::Base
|
|
36
42
|
end
|
37
43
|
|
38
44
|
def self.next_migration_number(dirname)
|
39
|
-
|
40
|
-
require "rails/generators/#{orm}"
|
41
|
-
"#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
|
45
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
42
46
|
end
|
43
47
|
|
44
48
|
end
|
data/test/unit/fixtures_test.rb
CHANGED
@@ -2,32 +2,38 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
class ViewMethodsTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
|
5
|
+
class HelpersTestController < ActionController::Base
|
6
|
+
helper { def hello; 'hello' end }
|
7
|
+
def test_cms_snippet_content
|
8
|
+
render :inline => '<%= cms_snippet_content(:default) %>'
|
9
|
+
end
|
10
|
+
def test_cms_page_content
|
11
|
+
@cms_page = Cms::Page.root
|
12
|
+
render :inline => '<%= cms_page_content(:default_field_text) %>'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Simulating a call and getting resulting output
|
17
|
+
def action_result(action)
|
18
|
+
HelpersTestController.action(action).call(ActionController::TestRequest.new.env).last.body
|
19
|
+
end
|
6
20
|
|
7
21
|
def test_cms_snippet_content
|
8
|
-
assert_equal 'default_snippet_content',
|
9
|
-
assert_equal '', cms_snippet_content('not_found', cms_sites(:default))
|
22
|
+
assert_equal 'default_snippet_content', action_result('test_cms_snippet_content')
|
10
23
|
end
|
11
24
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
assert_equal 'content <%= test() %>', cms_snippet_content(:default, cms_sites(:default))
|
25
|
+
def test_cms_snippet_content_with_tags
|
26
|
+
cms_snippets(:default).update_attribute(:content, '{{cms:helper:hello}}')
|
27
|
+
assert_equal 'hello', action_result('test_cms_snippet_content')
|
16
28
|
end
|
17
29
|
|
18
30
|
def test_cms_page_content
|
19
|
-
assert_equal 'default_field_text_content',
|
20
|
-
assert_equal '', cms_page_content('default_field_text')
|
21
|
-
@cms_page = cms_pages(:default)
|
22
|
-
assert_equal 'default_field_text_content', cms_page_content('default_field_text')
|
23
|
-
assert_equal '', cms_page_content('not_found')
|
24
|
-
@cms_page = nil
|
31
|
+
assert_equal 'default_field_text_content', action_result('test_cms_page_content')
|
25
32
|
end
|
26
33
|
|
27
34
|
def test_cms_page_content_with_tags
|
28
|
-
|
29
|
-
|
30
|
-
assert_equal 'content <%= test() %>', cms_page_content(:default_field_text, cms_pages(:default))
|
35
|
+
cms_blocks(:default_field_text).update_attribute(:content, '{{cms:helper:hello}}')
|
36
|
+
assert_equal 'hello', action_result('test_cms_page_content')
|
31
37
|
end
|
32
38
|
|
33
39
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Oleg Khabarov
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-05-
|
14
|
+
date: 2011-05-11 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -69,7 +69,6 @@ extra_rdoc_files:
|
|
69
69
|
files:
|
70
70
|
- .gemtest
|
71
71
|
- Gemfile
|
72
|
-
- Gemfile.lock
|
73
72
|
- LICENSE
|
74
73
|
- README.md
|
75
74
|
- Rakefile
|
@@ -322,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
322
321
|
requirements:
|
323
322
|
- - ">="
|
324
323
|
- !ruby/object:Gem::Version
|
325
|
-
hash:
|
324
|
+
hash: -2061797632960950114
|
326
325
|
segments:
|
327
326
|
- 0
|
328
327
|
version: "0"
|
@@ -339,41 +338,5 @@ rubygems_version: 1.7.2
|
|
339
338
|
signing_key:
|
340
339
|
specification_version: 3
|
341
340
|
summary: ComfortableMexicanSofa is a powerful micro CMS for Ruby on Rails 3 applications
|
342
|
-
test_files:
|
343
|
-
|
344
|
-
- test/functional/cms_admin/pages_controller_test.rb
|
345
|
-
- test/functional/cms_admin/revisions_controller_test.rb
|
346
|
-
- test/functional/cms_admin/sites_controller_test.rb
|
347
|
-
- test/functional/cms_admin/snippets_controller_test.rb
|
348
|
-
- test/functional/cms_admin/uploads_controller_test.rb
|
349
|
-
- test/functional/cms_content_controller_test.rb
|
350
|
-
- test/integration/authentication_test.rb
|
351
|
-
- test/integration/fixtures_test.rb
|
352
|
-
- test/integration/render_cms_test.rb
|
353
|
-
- test/integration/routing_extensions_test.rb
|
354
|
-
- test/integration/sites_test.rb
|
355
|
-
- test/integration/view_hooks_test.rb
|
356
|
-
- test/test_helper.rb
|
357
|
-
- test/unit/configuration_test.rb
|
358
|
-
- test/unit/fixtures_test.rb
|
359
|
-
- test/unit/models/block_test.rb
|
360
|
-
- test/unit/models/layout_test.rb
|
361
|
-
- test/unit/models/page_test.rb
|
362
|
-
- test/unit/models/site_test.rb
|
363
|
-
- test/unit/models/snippet_test.rb
|
364
|
-
- test/unit/models/upload_test.rb
|
365
|
-
- test/unit/revisions_test.rb
|
366
|
-
- test/unit/tag_test.rb
|
367
|
-
- test/unit/tags/field_datetime_test.rb
|
368
|
-
- test/unit/tags/field_integer_test.rb
|
369
|
-
- test/unit/tags/field_string_test.rb
|
370
|
-
- test/unit/tags/field_text_test.rb
|
371
|
-
- test/unit/tags/helper_test.rb
|
372
|
-
- test/unit/tags/page_datetime_test.rb
|
373
|
-
- test/unit/tags/page_integer_test.rb
|
374
|
-
- test/unit/tags/page_rich_text.rb
|
375
|
-
- test/unit/tags/page_string_test.rb
|
376
|
-
- test/unit/tags/page_text_test.rb
|
377
|
-
- test/unit/tags/partial_test.rb
|
378
|
-
- test/unit/tags/snippet_test.rb
|
379
|
-
- test/unit/view_methods_test.rb
|
341
|
+
test_files: []
|
342
|
+
|
data/Gemfile.lock
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.3)
|
6
|
-
actionpack (= 3.0.3)
|
7
|
-
mail (~> 2.2.9)
|
8
|
-
actionpack (3.0.3)
|
9
|
-
activemodel (= 3.0.3)
|
10
|
-
activesupport (= 3.0.3)
|
11
|
-
builder (~> 2.1.2)
|
12
|
-
erubis (~> 2.6.6)
|
13
|
-
i18n (~> 0.4)
|
14
|
-
rack (~> 1.2.1)
|
15
|
-
rack-mount (~> 0.6.13)
|
16
|
-
rack-test (~> 0.5.6)
|
17
|
-
tzinfo (~> 0.3.23)
|
18
|
-
active_link_to (0.0.7)
|
19
|
-
activemodel (3.0.3)
|
20
|
-
activesupport (= 3.0.3)
|
21
|
-
builder (~> 2.1.2)
|
22
|
-
i18n (~> 0.4)
|
23
|
-
activerecord (3.0.3)
|
24
|
-
activemodel (= 3.0.3)
|
25
|
-
activesupport (= 3.0.3)
|
26
|
-
arel (~> 2.0.2)
|
27
|
-
tzinfo (~> 0.3.23)
|
28
|
-
activeresource (3.0.3)
|
29
|
-
activemodel (= 3.0.3)
|
30
|
-
activesupport (= 3.0.3)
|
31
|
-
activesupport (3.0.3)
|
32
|
-
arel (2.0.6)
|
33
|
-
builder (2.1.2)
|
34
|
-
erubis (2.6.6)
|
35
|
-
abstract (>= 1.0.0)
|
36
|
-
git (1.2.5)
|
37
|
-
i18n (0.5.0)
|
38
|
-
jeweler (1.5.1)
|
39
|
-
bundler (~> 1.0.0)
|
40
|
-
git (>= 1.2.5)
|
41
|
-
rake
|
42
|
-
mail (2.2.12)
|
43
|
-
activesupport (>= 2.3.6)
|
44
|
-
i18n (>= 0.4.0)
|
45
|
-
mime-types (~> 1.16)
|
46
|
-
treetop (~> 1.4.8)
|
47
|
-
mime-types (1.16)
|
48
|
-
paperclip (2.3.8)
|
49
|
-
activerecord
|
50
|
-
activesupport
|
51
|
-
polyglot (0.3.1)
|
52
|
-
rack (1.2.1)
|
53
|
-
rack-mount (0.6.13)
|
54
|
-
rack (>= 1.0.0)
|
55
|
-
rack-test (0.5.6)
|
56
|
-
rack (>= 1.0)
|
57
|
-
rails (3.0.3)
|
58
|
-
actionmailer (= 3.0.3)
|
59
|
-
actionpack (= 3.0.3)
|
60
|
-
activerecord (= 3.0.3)
|
61
|
-
activeresource (= 3.0.3)
|
62
|
-
activesupport (= 3.0.3)
|
63
|
-
bundler (~> 1.0)
|
64
|
-
railties (= 3.0.3)
|
65
|
-
railties (3.0.3)
|
66
|
-
actionpack (= 3.0.3)
|
67
|
-
activesupport (= 3.0.3)
|
68
|
-
rake (>= 0.8.7)
|
69
|
-
thor (~> 0.14.4)
|
70
|
-
rake (0.8.7)
|
71
|
-
sqlite3 (1.3.3)
|
72
|
-
thor (0.14.6)
|
73
|
-
treetop (1.4.9)
|
74
|
-
polyglot (>= 0.3.1)
|
75
|
-
tzinfo (0.3.23)
|
76
|
-
|
77
|
-
PLATFORMS
|
78
|
-
ruby
|
79
|
-
|
80
|
-
DEPENDENCIES
|
81
|
-
active_link_to (>= 0.0.7)
|
82
|
-
jeweler (>= 1.4.0)
|
83
|
-
paperclip (>= 2.3.8)
|
84
|
-
rails (>= 3.0.0)
|
85
|
-
sqlite3
|