rocket_cms 0.4.2 → 0.5.0.rc.4
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/.ruby-version +1 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -55
- data/README.md +18 -3
- data/app/models/concerns/boolean_field.rb +3 -1
- data/app/models/concerns/mappable.rb +10 -8
- data/app/models/concerns/seoable.rb +17 -9
- data/app/models/concerns/sort_field.rb +7 -2
- data/app/models/contact_message.rb +5 -0
- data/app/models/menu.rb +5 -0
- data/app/models/news.rb +5 -0
- data/app/models/page.rb +5 -0
- data/app/views/contact_mailer/new_message_email.html.haml +0 -0
- data/app/views/contacts/new.html.haml +2 -1
- data/config/locales/en.rs.yml +1 -0
- data/config/locales/ru.models.yml +3 -1
- data/config/locales/ru.rs.yml +1 -0
- data/lib/generators/rocket_cms/capify_generator.rb +40 -0
- data/lib/generators/rocket_cms/migration_generator.rb +19 -0
- data/lib/generators/rocket_cms/templates/Capfile +17 -0
- data/lib/generators/rocket_cms/templates/admin.erb +5 -1
- data/lib/generators/rocket_cms/templates/deploy.erb +47 -0
- data/lib/generators/rocket_cms/templates/dl.erb +30 -0
- data/lib/generators/rocket_cms/templates/migration_contact_messages.rb +15 -0
- data/lib/generators/rocket_cms/templates/migration_news.rb +21 -0
- data/lib/generators/rocket_cms/templates/migration_pages.rb +30 -0
- data/lib/generators/rocket_cms/templates/production.erb +8 -0
- data/lib/generators/rocket_cms/templates/unicorn.erb +66 -0
- data/lib/rocket_cms/configuration.rb +3 -0
- data/lib/rocket_cms/engine.rb +5 -11
- data/lib/rocket_cms/migration.rb +21 -0
- data/lib/rocket_cms/model.rb +10 -4
- data/lib/rocket_cms/models/active_record/contact_message.rb +14 -0
- data/lib/rocket_cms/models/active_record/menu.rb +16 -0
- data/lib/rocket_cms/models/active_record/news.rb +26 -0
- data/lib/rocket_cms/models/active_record/page.rb +17 -0
- data/lib/rocket_cms/models/contact_message.rb +1 -14
- data/lib/rocket_cms/models/menu.rb +2 -4
- data/lib/rocket_cms/models/mongoid/contact_message.rb +20 -0
- data/lib/rocket_cms/models/mongoid/menu.rb +14 -0
- data/lib/rocket_cms/models/mongoid/news.rb +29 -0
- data/lib/rocket_cms/models/mongoid/page.rb +19 -0
- data/lib/rocket_cms/models/news.rb +9 -27
- data/lib/rocket_cms/models/page.rb +3 -14
- data/lib/rocket_cms/version.rb +2 -2
- data/lib/rocket_cms.rb +38 -19
- data/rocket_cms.gemspec +6 -11
- data/template.rb +130 -261
- metadata +33 -79
- data/app/models/ckeditor/asset.rb +0 -5
- data/app/models/ckeditor/attachment_file.rb +0 -15
- data/app/models/ckeditor/picture.rb +0 -16
@@ -0,0 +1,66 @@
|
|
1
|
+
rails_env = ENV['RAILS_ENV'] || 'production'
|
2
|
+
|
3
|
+
deploy_to = '<%= deploy_to %>'
|
4
|
+
|
5
|
+
rails_root = "#{deploy_to}/current"
|
6
|
+
|
7
|
+
tmp_dir = "#{deploy_to}/shared/tmp"
|
8
|
+
pid_dir = "#{tmp_dir}/pids"
|
9
|
+
if File.directory?(tmp_dir) && !File.directory?(pid_dir)
|
10
|
+
puts "creating pid dir #{pid_dir}"
|
11
|
+
Dir.mkdir(pid_dir)
|
12
|
+
end
|
13
|
+
pid_file = "#{pid_dir}/unicorn.pid"
|
14
|
+
|
15
|
+
log_file = "#{deploy_to}/shared/log/unicorn.log"
|
16
|
+
err_log_file = "#{deploy_to}/shared/log/unicorn.error.log"
|
17
|
+
|
18
|
+
old_pid_file = pid_file + '.oldbin'
|
19
|
+
|
20
|
+
worker_processes 1
|
21
|
+
working_directory rails_root
|
22
|
+
|
23
|
+
timeout 120
|
24
|
+
|
25
|
+
# Specify path to socket unicorn listens to,
|
26
|
+
# we will use this in our nginx.conf later
|
27
|
+
|
28
|
+
listen "127.0.0.1:<%= port %>"
|
29
|
+
|
30
|
+
pid pid_file
|
31
|
+
|
32
|
+
# Set log file paths
|
33
|
+
stderr_path err_log_file
|
34
|
+
stdout_path log_file
|
35
|
+
|
36
|
+
# http://tech.tulentsev.com/2012/03/deploying-with-sinatra-capistrano-unicorn/
|
37
|
+
# NOTE: http://unicorn.bogomips.org/SIGNALS.html
|
38
|
+
preload_app true
|
39
|
+
|
40
|
+
# make sure that Bundler finds the Gemfile
|
41
|
+
before_exec do |server|
|
42
|
+
ENV['BUNDLE_GEMFILE'] = File.join( rails_root, 'Gemfile' )
|
43
|
+
end
|
44
|
+
|
45
|
+
before_fork do |server, worker|
|
46
|
+
# при использовании preload_app = true здесь должно быть закрытие всех открытых сокетов
|
47
|
+
|
48
|
+
# Mongoid сам заботится о переконнекте
|
49
|
+
# http://two.mongoid.org/docs/upgrading.html
|
50
|
+
|
51
|
+
# http://stackoverflow.com/a/9498372/2041969
|
52
|
+
# убиваем параллельный старый-процесс просле старта нового
|
53
|
+
if File.exists?( old_pid_file )
|
54
|
+
begin
|
55
|
+
Process.kill( "QUIT", File.read( old_pid_file ).to_i )
|
56
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
57
|
+
puts "Old master alerady dead"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
after_fork do |server, worker|
|
63
|
+
# pid-ы дочерних процессов
|
64
|
+
child_pid_file = server.config[:pid].sub(".pid", ".#{worker.nr}.pid"
|
65
|
+
system("echo #{Process.pid} > #{child_pid_file}")
|
66
|
+
end
|
data/lib/rocket_cms/engine.rb
CHANGED
@@ -4,19 +4,13 @@ module RocketCMS
|
|
4
4
|
require File.expand_path('../tasks', __FILE__)
|
5
5
|
end
|
6
6
|
|
7
|
-
initializer "rocket_cms.ckeditor" do
|
8
|
-
if Object.const_defined?("Ckeditor")
|
9
|
-
Ckeditor.setup do |config|
|
10
|
-
require "ckeditor/orm/mongoid"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
7
|
initializer "rocket_cms.email_defaults" do
|
16
8
|
# Write default email settings to DB so they can be changed.
|
17
|
-
Settings.
|
18
|
-
|
19
|
-
|
9
|
+
if Settings.table_exists?
|
10
|
+
Settings.default_email_from(default: 'noreply@rscx.ru')
|
11
|
+
Settings.form_email(default: 'glebtv@ya.ru')
|
12
|
+
Settings.email_topic(default: 'с сайта')
|
13
|
+
end
|
20
14
|
end
|
21
15
|
|
22
16
|
initializer 'rocket_cms.paperclip' do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Migration
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def seo_fields(t)
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :h1
|
8
|
+
t.string :title
|
9
|
+
t.string :keywords
|
10
|
+
t.text :description
|
11
|
+
t.string :robots
|
12
|
+
t.string :og_title
|
13
|
+
t.attachment :og_image
|
14
|
+
|
15
|
+
#if RocketCMS.localize
|
16
|
+
#t.column :name_translations, 'hstore'
|
17
|
+
#t.column :name_translations, 'hstore'
|
18
|
+
#end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/rocket_cms/model.rb
CHANGED
@@ -2,16 +2,22 @@ module RocketCMS
|
|
2
2
|
module Model
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
included do
|
5
|
-
|
6
|
-
|
5
|
+
if RocketCMS.mongoid?
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps::Short
|
8
|
+
end
|
7
9
|
include ActiveModel::ForbiddenAttributesProtection
|
8
10
|
include BooleanField
|
9
11
|
include SortField
|
10
|
-
|
12
|
+
|
13
|
+
if RocketCMS.mongoid?
|
14
|
+
include Mongoid::Paperclip
|
15
|
+
end
|
16
|
+
|
11
17
|
include SmartExcerpt
|
12
18
|
include SimpleCaptcha::ModelHelpers
|
13
19
|
|
14
|
-
if defined?(Trackable)
|
20
|
+
if RocketCMS.mongoid? && defined?(Trackable)
|
15
21
|
include Trackable
|
16
22
|
end
|
17
23
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module ActiveRecord
|
4
|
+
module Menu
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
extend FriendlyId
|
8
|
+
friendly_id :report_slug, use: [:slugged, :finders]
|
9
|
+
has_paper_trail
|
10
|
+
validates_lengths_from_database
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module ActiveRecord
|
4
|
+
module News
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
extend FriendlyId
|
8
|
+
|
9
|
+
unless RocketCMS.configuration.news_image_styles.nil?
|
10
|
+
has_attached_file :image, styles: RocketCMS.configuration.news_image_styles
|
11
|
+
validates_attachment_content_type :image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :image?
|
12
|
+
end
|
13
|
+
friendly_id :report_slug, use: [:slugged, :finders]
|
14
|
+
|
15
|
+
has_paper_trail
|
16
|
+
|
17
|
+
validates_lengths_from_database only: [:name, :title, :content, :excerpt, :h1, :keywords, :robots, :og_title]
|
18
|
+
|
19
|
+
scope :after_now, -> { where("time < ?", Time.now) }
|
20
|
+
scope :by_date, -> { order(time: :desc) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module ActiveRecord
|
4
|
+
module Page
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
extend FriendlyId
|
9
|
+
friendly_id :name, use: [:slugged, :finders]
|
10
|
+
has_paper_trail
|
11
|
+
validates_lengths_from_database only: [:name, :title, :content, :excerpt, :h1, :keywords, :robots, :og_title, :regexp, :redirect, :fullpath]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -3,32 +3,19 @@ module RocketCMS
|
|
3
3
|
module ContactMessage
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
include RocketCMS::Model
|
6
|
+
include RocketCMS.orm_specific('ContactMessage')
|
6
7
|
|
7
8
|
included do
|
8
9
|
apply_simple_captcha
|
9
|
-
|
10
|
-
field :name, type: String
|
11
|
-
field :email, type: String
|
12
|
-
field :phone, type: String
|
13
|
-
field :content, type: String
|
14
|
-
|
15
10
|
validates_email_format_of :email, unless: 'email.blank?'
|
16
|
-
|
17
11
|
if RocketCMS.configuration.contacts_message_required
|
18
12
|
validates_presence_of :content
|
19
13
|
end
|
20
|
-
|
21
14
|
validate do
|
22
15
|
if email.blank? && phone.blank?
|
23
16
|
errors.add(:email, I18n.t('rs.no_contact_info'))
|
24
17
|
end
|
25
18
|
end
|
26
|
-
|
27
|
-
RocketCMS.configuration.contacts_fields.each_pair do |fn, ft|
|
28
|
-
next if ft.nil?
|
29
|
-
field fn, type: ft
|
30
|
-
end
|
31
|
-
|
32
19
|
after_create do
|
33
20
|
ContactMailer.new_message_email(self).deliver
|
34
21
|
end
|
@@ -4,8 +4,7 @@ module RocketCMS
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
include RocketCMS::Model
|
6
6
|
include Enableable
|
7
|
-
include
|
8
|
-
|
7
|
+
include RocketCMS.orm_specific('Menu')
|
9
8
|
included do
|
10
9
|
after_save do
|
11
10
|
Rails.cache.delete 'menus'
|
@@ -13,10 +12,9 @@ module RocketCMS
|
|
13
12
|
after_destroy do
|
14
13
|
Rails.cache.delete 'menus'
|
15
14
|
end
|
16
|
-
field :name, type: String
|
17
|
-
manual_slug :name
|
18
15
|
has_and_belongs_to_many :pages, inverse_of: :menus
|
19
16
|
end
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
20
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module Mongoid
|
4
|
+
module ContactMessage
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
field :name, type: String
|
8
|
+
field :email, type: String
|
9
|
+
field :phone, type: String
|
10
|
+
field :content, type: String
|
11
|
+
RocketCMS.configuration.contacts_fields.each_pair do |fn, ft|
|
12
|
+
next if ft.nil?
|
13
|
+
field fn, type: ft
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module Mongoid
|
4
|
+
module News
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
unless RocketCMS.configuration.news_image_styles.nil?
|
7
|
+
include ::Mongoid::Paperclip
|
8
|
+
end
|
9
|
+
include ManualSlug
|
10
|
+
included do
|
11
|
+
field :time, type: Time
|
12
|
+
index({enabled: 1, time: 1})
|
13
|
+
unless RocketCMS.configuration.news_image_styles.nil?
|
14
|
+
has_mongoid_attached_file :image, styles: RocketCMS.configuration.news_image_styles
|
15
|
+
validates_attachment_content_type :image, :content_type => ['image/gif', 'image/jpeg', 'image/jpg', 'image/png'], if: :image?
|
16
|
+
end
|
17
|
+
|
18
|
+
field :excerpt, type: String, localize: RocketCMS.configuration.localize
|
19
|
+
field :content, type: String, localize: RocketCMS.configuration.localize
|
20
|
+
manual_slug :report_slug
|
21
|
+
|
22
|
+
scope :after_now, -> { where(:time.lt => Time.now) }
|
23
|
+
scope :by_date, -> { desc(:time) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
module Models
|
3
|
+
module Mongoid
|
4
|
+
module Page
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
include ManualSlug
|
7
|
+
included do
|
8
|
+
field :regexp, type: String
|
9
|
+
field :redirect, type: String
|
10
|
+
field :content, type: String, localize: RocketCMS.configuration.localize
|
11
|
+
field :fullpath, type: String
|
12
|
+
has_and_belongs_to_many :menus, inverse_of: :pages
|
13
|
+
|
14
|
+
manual_slug :name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,58 +4,40 @@ module RocketCMS
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
include RocketCMS::Model
|
6
6
|
include Seoable
|
7
|
-
include Enableable
|
7
|
+
include Enableable
|
8
|
+
include RocketCMS.orm_specific('News')
|
9
|
+
|
8
10
|
if RocketCMS.configuration.search_enabled
|
9
11
|
include RocketCMS::ElasticSearch
|
10
12
|
end
|
11
|
-
unless RocketCMS.configuration.news_image_styles.nil?
|
12
|
-
include Mongoid::Paperclip
|
13
|
-
end
|
14
|
-
include ManualSlug
|
15
13
|
|
16
14
|
included do
|
17
|
-
field :time, type: Time
|
18
|
-
index({enabled: 1, time: 1})
|
19
|
-
scope :after_now, -> { where(:time.lt => Time.now) }
|
20
|
-
|
21
|
-
field :excerpt, type: String, localize: RocketCMS.configuration.localize
|
22
|
-
field :content, type: String, localize: RocketCMS.configuration.localize
|
23
|
-
|
24
|
-
unless RocketCMS.configuration.news_image_styles.nil?
|
25
|
-
has_mongoid_attached_file :image, styles: RocketCMS.configuration.news_image_styles
|
26
|
-
validates_attachment_content_type :image, :content_type => ['image/gif', 'image/jpeg', 'image/jpg', 'image/png'], if: :image?
|
27
|
-
end
|
28
|
-
|
29
15
|
validates_presence_of :name, :content
|
30
|
-
|
31
16
|
before_validation do
|
32
17
|
self.time = Time.now if self.time.blank?
|
33
18
|
end
|
34
|
-
|
35
|
-
manual_slug :report_slug
|
36
|
-
|
37
|
-
scope :by_date, -> { desc(:time) }
|
38
19
|
scope :recent, ->(count = 5) { enabled.after_now.by_date.limit(count) }
|
39
20
|
unless RocketCMS.configuration.news_per_page.nil?
|
40
21
|
paginates_per RocketCMS.configuration.news_per_page
|
41
22
|
end
|
42
|
-
|
43
23
|
smart_excerpt :excerpt, :content, RocketCMS.configuration.news_excerpt
|
44
|
-
|
45
24
|
RocketCMS.apply_patches self
|
46
25
|
end
|
47
26
|
|
48
27
|
def report_slug
|
49
|
-
|
28
|
+
if name.blank?
|
29
|
+
time.strftime('%Y-%m-%d')
|
30
|
+
else
|
31
|
+
time.strftime('%Y-%m-%d') + '-' + name[0..20]
|
32
|
+
end
|
50
33
|
end
|
51
|
-
|
52
34
|
def html5_date
|
53
35
|
time.strftime('%Y-%m-%d')
|
54
36
|
end
|
55
|
-
|
56
37
|
def format_date
|
57
38
|
time.strftime('%d.%m.%Y')
|
58
39
|
end
|
59
40
|
end
|
60
41
|
end
|
61
42
|
end
|
43
|
+
|
@@ -2,35 +2,24 @@ module RocketCMS
|
|
2
2
|
module Models
|
3
3
|
module Page
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
|
6
5
|
include RocketCMS::Model
|
7
6
|
include Enableable
|
8
7
|
include Seoable
|
9
|
-
|
8
|
+
|
9
|
+
include RocketCMS.orm_specific('Page')
|
10
|
+
|
10
11
|
if RocketCMS.configuration.search_enabled
|
11
12
|
include RocketCMS::ElasticSearch
|
12
13
|
end
|
13
14
|
|
14
15
|
included do
|
15
|
-
field :regexp, type: String
|
16
|
-
field :redirect, type: String
|
17
|
-
field :content, type: String, localize: RocketCMS.configuration.localize
|
18
|
-
field :fullpath, type: String
|
19
|
-
|
20
16
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
21
17
|
scope :menu, ->(menu_id) { enabled.sorted.where(menu_ids: menu_id) }
|
22
|
-
|
23
18
|
has_and_belongs_to_many :menus, inverse_of: :pages
|
24
|
-
|
25
|
-
acts_as_nested_set
|
26
|
-
|
27
|
-
manual_slug :name
|
28
|
-
|
29
19
|
before_validation do
|
30
20
|
self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
|
31
21
|
end
|
32
22
|
validates_uniqueness_of :fullpath
|
33
|
-
|
34
23
|
validates_presence_of :name
|
35
24
|
end
|
36
25
|
|
data/lib/rocket_cms/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.4
|
1
|
+
module RocketCMS
|
2
|
+
VERSION = "0.5.0.rc.4"
|
3
3
|
end
|
data/lib/rocket_cms.rb
CHANGED
@@ -1,32 +1,20 @@
|
|
1
|
-
|
1
|
+
unless defined?(RocketCMS) && [:active_record, :mongoid].include?(RocketCMS.orm)
|
2
|
+
puts "please use rocket_cms_mongoid or rocket_cms_activerecord and not rocket_cms directly"
|
3
|
+
exit 1
|
4
|
+
end
|
2
5
|
|
3
|
-
require '
|
4
|
-
# require 'yajl/json_gem'
|
6
|
+
require 'rocket_cms/version'
|
5
7
|
require 'devise'
|
6
|
-
|
7
8
|
require 'simple_form'
|
8
9
|
require 'glebtv-simple_captcha'
|
9
|
-
|
10
10
|
require 'validates_email_format_of'
|
11
|
-
|
12
11
|
require 'smart_excerpt'
|
13
|
-
|
14
|
-
# uploads
|
15
|
-
require 'glebtv-mongoid-paperclip'
|
16
12
|
require 'filename_to_slug'
|
17
|
-
|
18
13
|
require 'rails_admin'
|
19
|
-
# require 'rs_russian'
|
20
|
-
|
21
|
-
require 'glebtv-mongoid_nested_set'
|
22
14
|
require 'rails_admin_nested_set'
|
23
15
|
require 'rails_admin_toggleable'
|
24
|
-
require 'glebtv-ckeditor'
|
25
16
|
require 'rails_admin_settings'
|
26
|
-
require '
|
27
|
-
|
28
|
-
require 'mongoid_slug'
|
29
|
-
|
17
|
+
require 'glebtv-ckeditor'
|
30
18
|
require 'sitemap_generator'
|
31
19
|
require 'kaminari'
|
32
20
|
require 'addressable/uri'
|
@@ -36,18 +24,49 @@ require 'simple-navigation'
|
|
36
24
|
require 'rocket_cms/configuration'
|
37
25
|
require 'rocket_cms/patch'
|
38
26
|
require 'rocket_cms/admin'
|
39
|
-
require 'rocket_cms/elastic_search'
|
27
|
+
require 'rocket_cms/elastic_search'
|
40
28
|
require 'rocket_cms/model'
|
41
29
|
require 'rocket_cms/rails_admin_menu'
|
42
30
|
require 'rocket_cms/engine'
|
43
31
|
require 'rocket_cms/controller'
|
44
32
|
|
45
33
|
module RocketCMS
|
34
|
+
class << self
|
35
|
+
def mongoid?
|
36
|
+
RocketCMS.orm == :mongoid
|
37
|
+
end
|
38
|
+
def active_record?
|
39
|
+
RocketCMS.orm == :active_record
|
40
|
+
end
|
41
|
+
def model_namespace
|
42
|
+
"RocketCMS::Models::#{RocketCMS.orm.to_s.camelize}"
|
43
|
+
end
|
44
|
+
def orm_specific(name)
|
45
|
+
"#{model_namespace}::#{name}".constantize
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
autoload :Migration, 'rocket_cms/migration'
|
50
|
+
|
46
51
|
module Models
|
47
52
|
autoload :Menu, 'rocket_cms/models/menu'
|
48
53
|
autoload :Page, 'rocket_cms/models/page'
|
49
54
|
autoload :News, 'rocket_cms/models/news'
|
50
55
|
autoload :ContactMessage, 'rocket_cms/models/contact_message'
|
56
|
+
|
57
|
+
module Mongoid
|
58
|
+
autoload :Menu, 'rocket_cms/models/mongoid/menu'
|
59
|
+
autoload :Page, 'rocket_cms/models/mongoid/page'
|
60
|
+
autoload :News, 'rocket_cms/models/mongoid/news'
|
61
|
+
autoload :ContactMessage, 'rocket_cms/models/mongoid/contact_message'
|
62
|
+
end
|
63
|
+
|
64
|
+
module ActiveRecord
|
65
|
+
autoload :Menu, 'rocket_cms/models/active_record/menu'
|
66
|
+
autoload :Page, 'rocket_cms/models/active_record/page'
|
67
|
+
autoload :News, 'rocket_cms/models/active_record/news'
|
68
|
+
autoload :ContactMessage, 'rocket_cms/models/active_record/contact_message'
|
69
|
+
end
|
51
70
|
end
|
52
71
|
|
53
72
|
module Controllers
|
data/rocket_cms.gemspec
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'rocket_cms/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'rocket_cms'
|
8
|
-
spec.version =
|
7
|
+
spec.version = RocketCMS::VERSION
|
9
8
|
spec.authors = ['glebtv']
|
10
9
|
spec.email = ['glebtv@gmail.com']
|
11
10
|
spec.description = %q{RocketCMS}
|
12
|
-
spec.summary = %q{
|
11
|
+
spec.summary = %q{}
|
13
12
|
spec.homepage = 'https://github.com/rs-pro/rocket_cms'
|
14
13
|
spec.license = 'MIT'
|
15
14
|
|
16
|
-
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.files = `git ls-files`.split($/).reject {|f| f.start_with?('mongoid') || f.start_with?('activerecord') }
|
17
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ['lib']
|
@@ -21,30 +20,26 @@ Gem::Specification.new do |spec|
|
|
21
20
|
spec.add_development_dependency 'bundler'
|
22
21
|
spec.add_development_dependency 'rake'
|
23
22
|
|
24
|
-
spec.add_dependency 'rails',
|
25
|
-
spec.add_dependency 'mongoid', '~> 4.0.0'
|
23
|
+
spec.add_dependency 'rails', "~> 4.1.6"
|
26
24
|
|
27
25
|
spec.add_dependency 'jquery-rails'
|
28
|
-
spec.add_dependency 'glebtv-mongoid_nested_set'
|
29
26
|
spec.add_dependency 'simple_form'
|
30
27
|
spec.add_dependency 'glebtv-simple_captcha'
|
31
28
|
spec.add_dependency 'coffee-rails'
|
32
29
|
spec.add_dependency 'devise'
|
33
30
|
spec.add_dependency 'turbolinks'
|
34
31
|
spec.add_dependency 'validates_email_format_of'
|
35
|
-
spec.add_dependency 'glebtv-mongoid-paperclip'
|
36
32
|
spec.add_dependency 'rails_admin'
|
37
33
|
spec.add_dependency 'rails_admin_nested_set'
|
38
34
|
spec.add_dependency 'rails_admin_toggleable'
|
39
35
|
spec.add_dependency 'glebtv-ckeditor'
|
40
|
-
spec.add_dependency 'rails_admin_settings', '~> 0.
|
36
|
+
spec.add_dependency 'rails_admin_settings', '~> 0.9.0.pre.4'
|
41
37
|
spec.add_dependency 'geocoder'
|
42
|
-
spec.add_dependency 'mongoid-audit', '~> 1.0.0.alpha.1'
|
43
|
-
spec.add_dependency 'mongoid_slug'
|
44
38
|
spec.add_dependency 'simple-navigation'
|
45
39
|
spec.add_dependency 'sitemap_generator'
|
46
40
|
spec.add_dependency 'kaminari'
|
47
41
|
spec.add_dependency 'addressable'
|
42
|
+
spec.add_dependency 'stringex'
|
48
43
|
spec.add_dependency 'thor'
|
49
44
|
|
50
45
|
spec.add_dependency 'smart_excerpt'
|