ack_rocket_cms 0.7.2.1
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 +7 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +244 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/head.load.js +707 -0
- data/app/assets/javascripts/jquery.placeholder.js +157 -0
- data/app/assets/javascripts/rocket_cms.js.coffee +10 -0
- data/app/assets/javascripts/rocket_cms/flash.js.coffee +3 -0
- data/app/assets/javascripts/rocket_cms/map.js.coffee +22 -0
- data/app/assets/stylesheets/rocket_cms.css.sass +6 -0
- data/app/assets/stylesheets/rocket_cms/flash.css.sass +66 -0
- data/app/assets/stylesheets/rocket_cms/normalize.css.scss +406 -0
- data/app/controllers/concerns/no_cache.rb +12 -0
- data/app/controllers/concerns/rs_errors.rb +63 -0
- data/app/controllers/concerns/rs_menu.rb +45 -0
- data/app/controllers/concerns/rs_pages.rb +41 -0
- data/app/controllers/contacts_controller.rb +3 -0
- data/app/controllers/home_controller.rb +5 -0
- data/app/controllers/news_controller.rb +3 -0
- data/app/controllers/pages_controller.rb +4 -0
- data/app/controllers/search_controller.rb +4 -0
- data/app/mailers/contact_mailer.rb +15 -0
- data/app/models/concerns/boolean_field.rb +17 -0
- data/app/models/concerns/enableable.rb +8 -0
- data/app/models/concerns/geocodeable.rb +4 -0
- data/app/models/concerns/mappable.rb +95 -0
- data/app/models/concerns/seoable.rb +42 -0
- data/app/models/concerns/sitemap_data.rb +20 -0
- data/app/models/concerns/sort_field.rb +17 -0
- data/app/models/concerns/sortable.rb +8 -0
- data/app/models/contact_message.rb +11 -0
- data/app/models/menu.rb +11 -0
- data/app/models/news.rb +10 -0
- data/app/models/page.rb +11 -0
- data/app/views/blocks/_footer.html.haml +1 -0
- data/app/views/contact_mailer/new_message_email.html.haml +16 -0
- data/app/views/contacts/index.html.haml +10 -0
- data/app/views/contacts/new.html.haml +10 -0
- data/app/views/contacts/sent.html.haml +4 -0
- data/app/views/errors/_base.html.haml +3 -0
- data/app/views/errors/error_403.html.haml +1 -0
- data/app/views/errors/error_404.html.haml +1 -0
- data/app/views/errors/error_500.html.haml +1 -0
- data/app/views/home/index.html.haml +1 -0
- data/app/views/layouts/application.html.haml +23 -0
- data/app/views/layouts/application.html.slim +24 -0
- data/app/views/news/index.html.haml +9 -0
- data/app/views/news/show.html.haml +8 -0
- data/app/views/pages/show.html.haml +1 -0
- data/app/views/rails_admin/main/_check_boxes.html.haml +27 -0
- data/app/views/rails_admin/main/_enum_check_boxes.html.haml +5 -0
- data/app/views/rails_admin/main/_enum_radio_buttons.html.haml +5 -0
- data/app/views/rails_admin/main/_form_raw.html.haml +1 -0
- data/app/views/search/index.html.haml +19 -0
- data/app/views/shared/_admin_link.html.haml +3 -0
- data/app/views/shared/_messages.html.haml +7 -0
- data/app/views/shared/_meta.html.haml +6 -0
- data/app/views/shared/_obj.html.haml +20 -0
- data/app/views/shared/_og.html.haml +4 -0
- data/config/locales/en.rocket_admin.yml +6 -0
- data/config/locales/en.rs.yml +20 -0
- data/config/locales/ru.cancan.yml +4 -0
- data/config/locales/ru.devise.yml +65 -0
- data/config/locales/ru.kaminari.yml +17 -0
- data/config/locales/ru.models.yml +92 -0
- data/config/locales/ru.mongoid.yml +450 -0
- data/config/locales/ru.rails_admin.yml +148 -0
- data/config/locales/ru.rocket_admin.yml +6 -0
- data/config/locales/ru.rs.yml +20 -0
- data/config/locales/ru.simple_captcha.yml +3 -0
- data/config/locales/ru.simple_form.yml +9 -0
- data/lib/filename_to_slug.rb +34 -0
- data/lib/generators/rocket_cms/ability_generator.rb +15 -0
- data/lib/generators/rocket_cms/admin_generator.rb +21 -0
- data/lib/generators/rocket_cms/capify_generator.rb +40 -0
- data/lib/generators/rocket_cms/layout_generator.rb +15 -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/ability.erb +28 -0
- data/lib/generators/rocket_cms/templates/admin.erb +81 -0
- 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 +36 -0
- data/lib/generators/rocket_cms/templates/production.erb +8 -0
- data/lib/generators/rocket_cms/templates/unicorn.erb +66 -0
- data/lib/generators/rocket_cms/utils.rb +22 -0
- data/lib/manual_slug.rb +11 -0
- data/lib/manual_slug/active_record.rb +32 -0
- data/lib/manual_slug/mongoid.rb +36 -0
- data/lib/rails_admin/custom_show_in_app.rb +39 -0
- data/lib/rocket_cms.rb +88 -0
- data/lib/rocket_cms/admin.rb +152 -0
- data/lib/rocket_cms/configuration.rb +67 -0
- data/lib/rocket_cms/controller.rb +24 -0
- data/lib/rocket_cms/controllers/contacts.rb +70 -0
- data/lib/rocket_cms/controllers/news.rb +31 -0
- data/lib/rocket_cms/controllers/pages.rb +19 -0
- data/lib/rocket_cms/controllers/search.rb +45 -0
- data/lib/rocket_cms/elastic_search.rb +31 -0
- data/lib/rocket_cms/engine.rb +39 -0
- data/lib/rocket_cms/migration.rb +31 -0
- data/lib/rocket_cms/model.rb +25 -0
- data/lib/rocket_cms/models/active_record/contact_message.rb +14 -0
- data/lib/rocket_cms/models/active_record/menu.rb +14 -0
- data/lib/rocket_cms/models/active_record/news.rb +23 -0
- data/lib/rocket_cms/models/active_record/page.rb +17 -0
- data/lib/rocket_cms/models/contact_message.rb +27 -0
- data/lib/rocket_cms/models/menu.rb +29 -0
- data/lib/rocket_cms/models/mongoid/contact_message.rb +20 -0
- data/lib/rocket_cms/models/mongoid/menu.rb +12 -0
- data/lib/rocket_cms/models/mongoid/news.rb +27 -0
- data/lib/rocket_cms/models/mongoid/page.rb +26 -0
- data/lib/rocket_cms/models/news.rb +50 -0
- data/lib/rocket_cms/models/page.rb +76 -0
- data/lib/rocket_cms/patch.rb +58 -0
- data/lib/rocket_cms/rails_admin_menu.rb +145 -0
- data/lib/rocket_cms/simple_form_patch.rb +12 -0
- data/lib/rocket_cms/tasks.rb +13 -0
- data/lib/rocket_cms/version.rb +3 -0
- data/release.sh +13 -0
- data/rocket_cms.gemspec +54 -0
- data/template.rb +557 -0
- metadata +533 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
ru:
|
|
2
|
+
rs:
|
|
3
|
+
cms: "CMS"
|
|
4
|
+
menu: "Меню"
|
|
5
|
+
settings: 'Настройки'
|
|
6
|
+
news: 'Новости'
|
|
7
|
+
with_final_slash: "c начальным слешем"
|
|
8
|
+
page_url_regex: "Регулярное выражение, по которому определяется является ли этот пункт активным"
|
|
9
|
+
final_in_menu: "В меню сразу отдается конечная ссылка"
|
|
10
|
+
no_contact_info: "^Пожалуйста введите ваш е-мейл или телефон чтобы мы могли связаться с вами."
|
|
11
|
+
map: 'Карта'
|
|
12
|
+
sitemap: 'Карта сайта'
|
|
13
|
+
sitemap_data: 'Данные для карты сайта'
|
|
14
|
+
edit: Редактировать
|
|
15
|
+
send: Отправить
|
|
16
|
+
m:
|
|
17
|
+
enabled: 'добавлено в меню "%{menu}"'
|
|
18
|
+
disabled: 'удалено из меню "%{menu}"'
|
|
19
|
+
error: "Ошибка: %{err}"
|
|
20
|
+
no_id: "Не указан ID"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'stringex'
|
|
2
|
+
require 'digest/md5'
|
|
3
|
+
|
|
4
|
+
class String
|
|
5
|
+
def filename_to_slug
|
|
6
|
+
s = self.to_url
|
|
7
|
+
if s.blank?
|
|
8
|
+
return Digest::MD5.hexdigest(self)
|
|
9
|
+
end
|
|
10
|
+
s
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
module FilenameToSlug
|
|
15
|
+
extend ActiveSupport::Concern
|
|
16
|
+
included do
|
|
17
|
+
before_post_process :filename_to_slug
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def filename_to_slug
|
|
21
|
+
if self.class.attachment_definitions
|
|
22
|
+
self.class.attachment_definitions.each do |k,v|
|
|
23
|
+
if self.send(k).file?
|
|
24
|
+
full_file_name = self.send("#{k}_file_name")
|
|
25
|
+
extension = File.extname(full_file_name)[1..-1]
|
|
26
|
+
file_name = full_file_name[0..full_file_name.size-extension.size-1]
|
|
27
|
+
self.send("#{k}").instance_write(:file_name, "#{file_name.filename_to_slug}.#{extension.filename_to_slug}")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require File.expand_path('../utils', __FILE__)
|
|
3
|
+
|
|
4
|
+
module RocketCms
|
|
5
|
+
class AbilityGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
7
|
+
include Generators::Utils::InstanceMethods
|
|
8
|
+
|
|
9
|
+
desc 'RocketCMS CanCan Ability config generator'
|
|
10
|
+
def ability
|
|
11
|
+
template 'ability.erb', 'app/models/ability.rb'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# shamelessly stolen from https://github.com/sferik/rails_admin/blob/master/lib/generators/rails_admin/utils.rb
|
|
2
|
+
|
|
3
|
+
require 'rails/generators'
|
|
4
|
+
require File.expand_path('../utils', __FILE__)
|
|
5
|
+
|
|
6
|
+
module RocketCms
|
|
7
|
+
class AdminGenerator < Rails::Generators::Base
|
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
9
|
+
include Generators::Utils::InstanceMethods
|
|
10
|
+
|
|
11
|
+
#argument :_namespace, type: :string, required: false, desc: 'RailsAdmin url namespace'
|
|
12
|
+
desc 'RocketCMS RailsAdmin config generator'
|
|
13
|
+
|
|
14
|
+
def install
|
|
15
|
+
#namespace = ask_for('Where do you want to mount rails_admin?', 'admin', _namespace)
|
|
16
|
+
namespace = 'admin'
|
|
17
|
+
route("mount RailsAdmin::Engine => '/#{namespace}', as: 'rails_admin'")
|
|
18
|
+
template 'admin.erb', 'config/initializers/rails_admin.rb'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module RocketCms
|
|
4
|
+
class CapifyGenerator < Rails::Generators::Base
|
|
5
|
+
argument :kind, type: :string
|
|
6
|
+
argument :port, type: :string
|
|
7
|
+
argument :domain, type: :string
|
|
8
|
+
|
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
10
|
+
|
|
11
|
+
def app_name
|
|
12
|
+
Rails.application.class.name.split("::")[0]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def deploy_to
|
|
16
|
+
if kind == 'data'
|
|
17
|
+
"/data/#{app_name.downcase}/app"
|
|
18
|
+
else
|
|
19
|
+
"/home/#{app_name.downcase}/#{app_name.downcase}"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
def tmp_path
|
|
23
|
+
if kind == 'data'
|
|
24
|
+
"/data/#{app_name.downcase}/tmp_dump"
|
|
25
|
+
else
|
|
26
|
+
"/home/#{app_name.downcase}/tmp_dump"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
desc 'RocketCMS capistrano setup generator'
|
|
31
|
+
def install
|
|
32
|
+
copy_file "Capfile", "Capfile"
|
|
33
|
+
template "unicorn.erb", "config/unicorn/production.rb"
|
|
34
|
+
template "deploy.erb", "config/deploy.rb"
|
|
35
|
+
template "production.erb", "config/deploy/production.rb"
|
|
36
|
+
template "dl.erb", "lib/tasks/dl.thor"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require File.expand_path('../utils', __FILE__)
|
|
3
|
+
|
|
4
|
+
module RocketCms
|
|
5
|
+
class LayoutGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path("../../../..", __FILE__)
|
|
7
|
+
include Generators::Utils::InstanceMethods
|
|
8
|
+
|
|
9
|
+
desc 'RocketCMS Layout generator'
|
|
10
|
+
def layout
|
|
11
|
+
template('app/views/layouts/application.html.slim', 'app/views/layouts/application.html.slim')
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/active_record'
|
|
3
|
+
|
|
4
|
+
module RocketCms
|
|
5
|
+
class MigrationGenerator < Rails::Generators::Base
|
|
6
|
+
include ActiveRecord::Generators::Migration
|
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
8
|
+
|
|
9
|
+
desc 'RocketCMS migration generator'
|
|
10
|
+
def install
|
|
11
|
+
if RocketCMS.active_record?
|
|
12
|
+
%w(contact_messages news pages).each do |table_name|
|
|
13
|
+
migration_template "migration_#{table_name}.rb", "db/migrate/rocket_cms_create_#{table_name}.rb"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Load DSL and Setup Up Stages
|
|
2
|
+
require 'capistrano/setup'
|
|
3
|
+
|
|
4
|
+
# Includes default deployment tasks
|
|
5
|
+
require 'capistrano/deploy'
|
|
6
|
+
|
|
7
|
+
require 'rvm1/capistrano3'
|
|
8
|
+
require 'capistrano/bundler'
|
|
9
|
+
require 'capistrano/rails/assets'
|
|
10
|
+
#require "whenever/capistrano"
|
|
11
|
+
|
|
12
|
+
require 'capistrano/unicorn'
|
|
13
|
+
|
|
14
|
+
# require 'capistrano/rails/console'
|
|
15
|
+
|
|
16
|
+
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
|
|
17
|
+
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class Ability
|
|
2
|
+
include CanCan::Ability
|
|
3
|
+
|
|
4
|
+
def initialize(user)
|
|
5
|
+
if !user.nil? and (user.admin? or user.manager?)
|
|
6
|
+
can :read, :all
|
|
7
|
+
can :manage, :all
|
|
8
|
+
if user.admin?
|
|
9
|
+
admin_ui(user)
|
|
10
|
+
elsif user.manager?
|
|
11
|
+
manager_ui(user)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def admin_ui(user)
|
|
17
|
+
can :access, :rails_admin # grant access to rails_admin
|
|
18
|
+
can :dashboard # grant access to the dashboard
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def manager_ui(user)
|
|
22
|
+
can :access, :rails_admin # grant access to rails_admin
|
|
23
|
+
can :dashboard # grant access to the dashboard
|
|
24
|
+
cannot :manage, Menu
|
|
25
|
+
cannot [:edit, :destroy, :new, :create], User
|
|
26
|
+
can :edit, user
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require 'rails_admin/custom_show_in_app'
|
|
2
|
+
|
|
3
|
+
<% if RocketCMS.mongoid? %>
|
|
4
|
+
RailsAdminSettings.track_history!
|
|
5
|
+
<% end %>
|
|
6
|
+
|
|
7
|
+
RailsAdmin.config do |config|
|
|
8
|
+
## == Devise ==
|
|
9
|
+
# this is required if not using cancan
|
|
10
|
+
#config.authenticate_with do
|
|
11
|
+
#warden.authenticate! scope: :user
|
|
12
|
+
#end
|
|
13
|
+
|
|
14
|
+
config.current_user_method(&:current_user)
|
|
15
|
+
|
|
16
|
+
## == Cancan ==
|
|
17
|
+
config.authorize_with :cancan
|
|
18
|
+
<% if RocketCMS.mongoid? %>
|
|
19
|
+
## == MongoidAudit
|
|
20
|
+
#config.audit_with :mongoid_audit, 'HistoryTracker'
|
|
21
|
+
<% elsif RocketCMS.active_record? %>
|
|
22
|
+
config.audit_with :paper_trail, 'User', 'PaperTrail::Version'
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
config.actions do
|
|
27
|
+
dashboard # mandatory
|
|
28
|
+
|
|
29
|
+
# collection actions
|
|
30
|
+
index
|
|
31
|
+
new
|
|
32
|
+
export
|
|
33
|
+
bulk_delete
|
|
34
|
+
|
|
35
|
+
# member actions
|
|
36
|
+
show
|
|
37
|
+
edit
|
|
38
|
+
delete
|
|
39
|
+
|
|
40
|
+
history_index
|
|
41
|
+
history_show
|
|
42
|
+
|
|
43
|
+
nested_set do
|
|
44
|
+
visible do
|
|
45
|
+
['Page'].include? bindings[:abstract_model].model_name
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
custom_show_in_app do
|
|
50
|
+
visible do
|
|
51
|
+
['Page', 'News'].include? bindings[:abstract_model].model_name
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
toggle
|
|
56
|
+
toggle_menu
|
|
57
|
+
sitemap
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
config.main_app_name = ['<%= Rails.application.class.name.split('::')[0] %>', 'Админка']
|
|
61
|
+
|
|
62
|
+
config.excluded_models = [
|
|
63
|
+
'RailsAdmin::CustomShowInApp', 'HistoryTracker',
|
|
64
|
+
'Ckeditor::Asset', 'Ckeditor::AttachmentFile', 'Ckeditor::Picture',
|
|
65
|
+
]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# [required] fix for timezones to be displayed in local time instead of UTC
|
|
69
|
+
module RailsAdmin
|
|
70
|
+
module Config
|
|
71
|
+
module Fields
|
|
72
|
+
module Types
|
|
73
|
+
class Datetime
|
|
74
|
+
def value
|
|
75
|
+
bindings[:object].send(name)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
set :user, "<%= app_name.downcase %>"
|
|
2
|
+
set :application, '<%= app_name.downcase %>'
|
|
3
|
+
set :scm, :git
|
|
4
|
+
set :repo_url, 'git@rscz.ru:rocket-science/<%= app_name.downcase %>.git'
|
|
5
|
+
|
|
6
|
+
set :branch, ENV["REVISION"] || "master"
|
|
7
|
+
|
|
8
|
+
set :deploy_to, "<%= deploy_to %>"
|
|
9
|
+
|
|
10
|
+
# require 'hipchat/capistrano'
|
|
11
|
+
# set :hipchat_token, ""
|
|
12
|
+
# set :hipchat_room_name, "<%= app_name %>"
|
|
13
|
+
# set :hipchat_announce, false
|
|
14
|
+
|
|
15
|
+
set :rvm_type, :user
|
|
16
|
+
set :rvm_ruby_version, "2.2.0@#{fetch :application}"
|
|
17
|
+
set :use_sudo, false
|
|
18
|
+
|
|
19
|
+
set :keep_releases, 20
|
|
20
|
+
|
|
21
|
+
set :linked_files, %w{config/mongoid.yml config/secrets.yml}
|
|
22
|
+
set :linked_dirs, %w{log tmp vendor/bundle public/assets public/system public/uploads public/ckeditor_assets public/sitemap}
|
|
23
|
+
|
|
24
|
+
namespace :db do
|
|
25
|
+
desc "Create the indexes defined on your mongoid models"
|
|
26
|
+
task :create_mongoid_indexes do
|
|
27
|
+
on roles(:app) do
|
|
28
|
+
execute :rake, "db:mongoid:create_indexes"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
namespace :deploy do
|
|
34
|
+
task :restart do
|
|
35
|
+
end
|
|
36
|
+
desc "Update the crontab"
|
|
37
|
+
task :update_crontab do
|
|
38
|
+
on roles(:app) do
|
|
39
|
+
execute "cd #{release_path}; #{fetch(:tmp_dir)}/#{fetch :application}/rvm-auto.sh . bundle exec whenever --update-crontab #{fetch :user} --set \'environment=#{fetch :stage}¤t_path=#{release_path}\'; true"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
after 'deploy:publishing', 'deploy:restart'
|
|
45
|
+
after 'deploy:restart', 'unicorn:duplicate'
|
|
46
|
+
#before "deploy:update_crontab", 'rvm1:hook'
|
|
47
|
+
#after "deploy:restart", "deploy:update_crontab"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'cloner'
|
|
2
|
+
|
|
3
|
+
class Dl < Cloner::Base
|
|
4
|
+
no_commands do
|
|
5
|
+
def rails_path
|
|
6
|
+
File.expand_path("../../../config/environment", __FILE__)
|
|
7
|
+
end
|
|
8
|
+
def ssh_host
|
|
9
|
+
'<%= domain %>.ru'
|
|
10
|
+
end
|
|
11
|
+
def ssh_user
|
|
12
|
+
'<%= app_name.downcase %>'
|
|
13
|
+
end
|
|
14
|
+
def remote_dump_path
|
|
15
|
+
'<%= tmp_path %>'
|
|
16
|
+
end
|
|
17
|
+
def remote_app_path
|
|
18
|
+
'<%= deploy_to %>'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "download", "clone files and DB from production"
|
|
23
|
+
def download
|
|
24
|
+
load_env
|
|
25
|
+
clone_db
|
|
26
|
+
rsync_public("ckeditor_assets")
|
|
27
|
+
rsync_public("system")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class RocketCmsCreateContactMessages < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :contact_messages do |t|
|
|
4
|
+
t.string :name
|
|
5
|
+
t.string :email
|
|
6
|
+
t.string :phone
|
|
7
|
+
t.text :content
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
add_index :contact_messages, :created_at
|
|
12
|
+
add_index :contact_messages, :updated_at
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class RocketCmsCreateNews < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :news do |t|
|
|
4
|
+
t.boolean :enabled, default: true, null: false
|
|
5
|
+
t.timestamp :time, null: false
|
|
6
|
+
t.string :name, null: false
|
|
7
|
+
t.text :excerpt
|
|
8
|
+
t.text :content
|
|
9
|
+
|
|
10
|
+
t.string :slug, null: false
|
|
11
|
+
t.attachment :image
|
|
12
|
+
RocketCMS::Migration.seo_fields(t)
|
|
13
|
+
|
|
14
|
+
t.timestamps
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
add_index :news, :slug, unique: true
|
|
18
|
+
add_index :news, [:enabled, :time]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|