rocket_cms 0.4.2 → 0.5.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -2
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +7 -55
  5. data/README.md +18 -3
  6. data/app/models/concerns/boolean_field.rb +3 -1
  7. data/app/models/concerns/mappable.rb +10 -8
  8. data/app/models/concerns/seoable.rb +17 -9
  9. data/app/models/concerns/sort_field.rb +7 -2
  10. data/app/models/contact_message.rb +5 -0
  11. data/app/models/menu.rb +5 -0
  12. data/app/models/news.rb +5 -0
  13. data/app/models/page.rb +5 -0
  14. data/app/views/contact_mailer/new_message_email.html.haml +0 -0
  15. data/app/views/contacts/new.html.haml +2 -1
  16. data/config/locales/en.rs.yml +1 -0
  17. data/config/locales/ru.models.yml +3 -1
  18. data/config/locales/ru.rs.yml +1 -0
  19. data/lib/generators/rocket_cms/capify_generator.rb +40 -0
  20. data/lib/generators/rocket_cms/migration_generator.rb +19 -0
  21. data/lib/generators/rocket_cms/templates/Capfile +17 -0
  22. data/lib/generators/rocket_cms/templates/admin.erb +5 -1
  23. data/lib/generators/rocket_cms/templates/deploy.erb +47 -0
  24. data/lib/generators/rocket_cms/templates/dl.erb +30 -0
  25. data/lib/generators/rocket_cms/templates/migration_contact_messages.rb +15 -0
  26. data/lib/generators/rocket_cms/templates/migration_news.rb +21 -0
  27. data/lib/generators/rocket_cms/templates/migration_pages.rb +30 -0
  28. data/lib/generators/rocket_cms/templates/production.erb +8 -0
  29. data/lib/generators/rocket_cms/templates/unicorn.erb +66 -0
  30. data/lib/rocket_cms/configuration.rb +3 -0
  31. data/lib/rocket_cms/engine.rb +5 -11
  32. data/lib/rocket_cms/migration.rb +21 -0
  33. data/lib/rocket_cms/model.rb +10 -4
  34. data/lib/rocket_cms/models/active_record/contact_message.rb +14 -0
  35. data/lib/rocket_cms/models/active_record/menu.rb +16 -0
  36. data/lib/rocket_cms/models/active_record/news.rb +26 -0
  37. data/lib/rocket_cms/models/active_record/page.rb +17 -0
  38. data/lib/rocket_cms/models/contact_message.rb +1 -14
  39. data/lib/rocket_cms/models/menu.rb +2 -4
  40. data/lib/rocket_cms/models/mongoid/contact_message.rb +20 -0
  41. data/lib/rocket_cms/models/mongoid/menu.rb +14 -0
  42. data/lib/rocket_cms/models/mongoid/news.rb +29 -0
  43. data/lib/rocket_cms/models/mongoid/page.rb +19 -0
  44. data/lib/rocket_cms/models/news.rb +9 -27
  45. data/lib/rocket_cms/models/page.rb +3 -14
  46. data/lib/rocket_cms/version.rb +2 -2
  47. data/lib/rocket_cms.rb +38 -19
  48. data/rocket_cms.gemspec +6 -11
  49. data/template.rb +130 -261
  50. metadata +33 -79
  51. data/app/models/ckeditor/asset.rb +0 -5
  52. data/app/models/ckeditor/attachment_file.rb +0 -15
  53. data/app/models/ckeditor/picture.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc958ba10567b7dbd2c47d0ad77d1f87b430f3f6
4
- data.tar.gz: 3dd62cbefa7c6cb9b0ce1fc6187c3f76570bb430
3
+ metadata.gz: 44a0c682369f69ea98f5067be527d09d2a2db3ef
4
+ data.tar.gz: 01576c2b8ce639883bc808321313c0e3920d4e20
5
5
  SHA512:
6
- metadata.gz: ed182f2578e649d18f96cbceffa934d3938dd26afc46b4282f38ded8896703dbfa9d409264ca3eb670459c0ed2d5817362a73fe372eac9ad0a5b501f4147fea3
7
- data.tar.gz: 241c23002b1b73a8b3fd225f9d321909307e1302a1d9275edc4ca86df975defbea665173b1556b6839e0f982da611867cbc83afdf9ee71e015d0a38448d0e313
6
+ metadata.gz: 80ebdbed5f4dfe6b9f507fe355fafca8a232fbbc7982a1e72c1b42bea09a0af7610a8c41f66f6d8aa592fad3f74bf458b3cca116dbde2587530aea744d87038b
7
+ data.tar.gz: 5b42a35814367854428f94bdedf05cf4bd9f624bceca01119ca53bef11914f48086379dd555649c01fa8cd165b96a64097d0f1c90feac7cf5d096b0aa454794e
data/.ruby-version CHANGED
@@ -1,2 +1 @@
1
- 2.1.2
2
-
1
+ 2.1.3
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rocket_cms.gemspec
4
4
  gemspec
5
+
data/Gemfile.lock CHANGED
@@ -1,29 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rocket_cms (0.4.2)
4
+ rocket_cms (0.5.0.rc.4)
5
5
  addressable
6
6
  coffee-rails
7
7
  devise
8
8
  geocoder
9
9
  glebtv-ckeditor
10
- glebtv-mongoid-paperclip
11
- glebtv-mongoid_nested_set
12
10
  glebtv-simple_captcha
13
11
  jquery-rails
14
12
  kaminari
15
- mongoid (~> 4.0.0)
16
- mongoid-audit (~> 1.0.0.alpha.1)
17
- mongoid_slug
18
- rails (>= 4.1.0, < 5.0.0)
13
+ rails (~> 4.1.6)
19
14
  rails_admin
20
15
  rails_admin_nested_set
21
- rails_admin_settings (~> 0.8.0)
16
+ rails_admin_settings (~> 0.9.0.pre.4)
22
17
  rails_admin_toggleable
23
18
  simple-navigation
24
19
  simple_form
25
20
  sitemap_generator
26
21
  smart_excerpt
22
+ stringex
27
23
  thor
28
24
  turbolinks
29
25
  validates_email_format_of
@@ -60,12 +56,7 @@ GEM
60
56
  addressable (2.3.6)
61
57
  arel (5.0.1.20140414130214)
62
58
  bcrypt (3.1.7)
63
- bson (2.3.0)
64
59
  builder (3.2.2)
65
- climate_control (0.0.3)
66
- activesupport (>= 3.0)
67
- cocaine (0.5.4)
68
- climate_control (>= 0.0.3, < 1.0)
69
60
  coffee-rails (4.0.1)
70
61
  coffee-script (>= 2.2.0)
71
62
  railties (>= 4.0.0, < 5.0)
@@ -73,14 +64,12 @@ GEM
73
64
  coffee-script-source
74
65
  execjs
75
66
  coffee-script-source (1.8.0)
76
- connection_pool (2.0.0)
77
67
  devise (3.3.0)
78
68
  bcrypt (~> 3.0)
79
69
  orm_adapter (~> 0.1)
80
70
  railties (>= 3.2.6, < 5)
81
71
  thread_safe (~> 0.1)
82
72
  warden (~> 1.2.3)
83
- easy_diff (0.0.3)
84
73
  erubis (2.7.0)
85
74
  execjs (2.2.1)
86
75
  font-awesome-rails (4.2.0.0)
@@ -90,14 +79,7 @@ GEM
90
79
  mime-types
91
80
  orm_adapter (~> 0.5.0)
92
81
  rails (~> 4.0)
93
- glebtv-mongoid-paperclip (0.2.4)
94
- mongoid (>= 3.0, < 5.0)
95
- paperclip (>= 2.3.6)
96
- glebtv-mongoid_nested_set (0.4.3)
97
- mongoid (>= 3.1.0, < 4.1)
98
82
  glebtv-simple_captcha (0.6.5)
99
- glebtv_mongoid_userstamp (0.4.1)
100
- mongoid (~> 4.0.0.beta1)
101
83
  haml (4.0.5)
102
84
  tilt
103
85
  hike (1.2.3)
@@ -116,41 +98,12 @@ GEM
116
98
  mime-types (>= 1.16, < 3)
117
99
  mime-types (2.3)
118
100
  mini_portile (0.6.0)
119
- minitest (5.4.1)
120
- mongoid (4.0.0)
121
- activemodel (~> 4.0)
122
- moped (~> 2.0.0)
123
- origin (~> 2.1)
124
- tzinfo (>= 0.3.37)
125
- mongoid-audit (1.0.0)
126
- activesupport
127
- glebtv_mongoid_userstamp
128
- kaminari
129
- mongoid (~> 4.0.0)
130
- mongoid-history (~> 0.4.4)
131
- mongoid-history (0.4.4)
132
- activesupport
133
- easy_diff
134
- mongoid (>= 3.0)
135
- mongoid_slug (3.2.1)
136
- mongoid (> 3.0)
137
- stringex (~> 2.0)
138
- moped (2.0.0)
139
- bson (~> 2.2)
140
- connection_pool (~> 2.0)
141
- optionable (~> 0.2.0)
101
+ minitest (5.4.2)
142
102
  multi_json (1.10.1)
143
103
  nested_form (0.3.2)
144
104
  nokogiri (1.6.3.1)
145
105
  mini_portile (= 0.6.0)
146
- optionable (0.2.0)
147
- origin (2.1.1)
148
106
  orm_adapter (0.5.0)
149
- paperclip (4.2.0)
150
- activemodel (>= 3.0.0)
151
- activesupport (>= 3.0.0)
152
- cocaine (~> 0.5.3)
153
- mime-types
154
107
  rack (1.5.2)
155
108
  rack-pjax (0.8.0)
156
109
  nokogiri (~> 1.5)
@@ -182,8 +135,7 @@ GEM
182
135
  safe_yaml (~> 1.0)
183
136
  sass-rails (~> 4.0)
184
137
  rails_admin_nested_set (0.3.6)
185
- rails_admin_settings (0.8.0)
186
- mongoid (>= 3.0, < 4.1)
138
+ rails_admin_settings (0.9.0.pre.6)
187
139
  rails_admin_toggleable (0.4.1)
188
140
  railties (4.1.6)
189
141
  actionpack (= 4.1.6)
@@ -205,7 +157,7 @@ GEM
205
157
  activemodel (~> 4.0)
206
158
  sitemap_generator (5.0.5)
207
159
  builder
208
- smart_excerpt (0.1.2)
160
+ smart_excerpt (0.1.4)
209
161
  activesupport
210
162
  htmlentities
211
163
  sprockets (2.12.2)
data/README.md CHANGED
@@ -13,7 +13,11 @@ any time!**
13
13
 
14
14
  Add this line to your application's Gemfile:
15
15
 
16
- gem 'rocket_cms'
16
+ gem 'rocket_cms_mongoid'
17
+
18
+ or:
19
+
20
+ gem 'rocket_cms_activerecord'
17
21
 
18
22
  And then execute:
19
23
 
@@ -23,6 +27,12 @@ Or install it yourself as:
23
27
 
24
28
  $ gem install rocket_cms
25
29
 
30
+ For activerecord, generate migrations and run them
31
+
32
+ rails g rails_admin_settings:migration
33
+ rails g rocket_cms:migration
34
+ rake db:migrate
35
+
26
36
  ## Usage
27
37
 
28
38
  ### Using app generator
@@ -36,10 +46,14 @@ If not, uninstall rails and install again
36
46
  gem uninstall rails
37
47
  gem install rocket_cms
38
48
 
39
- Then run:
40
-
49
+ Then, for mongoid:
50
+
41
51
  rails new my_app -T -O -m https://raw.github.com/rs-pro/rocket_cms/master/template.rb
42
52
 
53
+ for ActiveRecord:
54
+
55
+ rails new my_app -T --database=postgresql -m https://raw.github.com/rs-pro/rocket_cms/master/template.rb
56
+
43
57
  generator creates a new RVM gemset, so after cd'ing to app dir, you should run `bundle install` again if you use rvm.
44
58
 
45
59
  ### Documentation
@@ -55,3 +69,4 @@ See their documentation for more info
55
69
  3. Commit your changes (`git commit -am 'Add some feature'`)
56
70
  4. Push to the branch (`git push origin my-new-feature`)
57
71
  5. Create new Pull Request
72
+
@@ -2,7 +2,9 @@ module BooleanField
2
2
  extend ActiveSupport::Concern
3
3
  module ClassMethods
4
4
  def boolean_field(name, default = true)
5
- field name, type: Mongoid::Boolean, default: default
5
+ if RocketCMS.mongoid?
6
+ field name, type: Mongoid::Boolean, default: default
7
+ end
6
8
  scope name, -> { where(name => true) }
7
9
  end
8
10
  end
@@ -4,14 +4,16 @@ module Mappable
4
4
  included do
5
5
  include Geocoder::Model::Mongoid
6
6
 
7
- field :coordinates, type: Array
8
- field :address, type: String
9
-
10
- field :map_address, type: String
11
- field :map_hint, type: String
12
-
13
- field :lat, type: Float
14
- field :lon, type: Float
7
+ if RocketCMS.mongoid?
8
+ field :coordinates, type: Array
9
+ field :address, type: String
10
+
11
+ field :map_address, type: String
12
+ field :map_hint, type: String
13
+
14
+ field :lat, type: Float
15
+ field :lon, type: Float
16
+ end
15
17
 
16
18
  geocoded_by :geo_address
17
19
 
@@ -1,18 +1,26 @@
1
1
  module Seoable
2
2
  extend ActiveSupport::Concern
3
- include Mongoid::Paperclip
3
+ if RocketCMS.mongoid?
4
+ include ::Mongoid::Paperclip
5
+ end
4
6
 
5
7
  included do
6
- field :name, type: String, localize: RocketCMS.configuration.localize
7
- field :h1, type: String, localize: RocketCMS.configuration.localize
8
+ if RocketCMS.mongoid?
9
+ field :name, type: String, localize: RocketCMS.configuration.localize
10
+ field :h1, type: String, localize: RocketCMS.configuration.localize
11
+
12
+ field :title, type: String, localize: RocketCMS.configuration.localize
13
+ field :keywords, type: String, localize: RocketCMS.configuration.localize
14
+ field :description, type: String, localize: RocketCMS.configuration.localize
15
+ field :robots, type: String, localize: RocketCMS.configuration.localize
8
16
 
9
- field :title, type: String, localize: RocketCMS.configuration.localize
10
- field :keywords, type: String, localize: RocketCMS.configuration.localize
11
- field :description, type: String, localize: RocketCMS.configuration.localize
12
- field :robots, type: String, localize: RocketCMS.configuration.localize
17
+ field :og_title, type: String, localize: RocketCMS.configuration.localize
18
+ has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
19
+ end
13
20
 
14
- field :og_title, type: String, localize: RocketCMS.configuration.localize
15
- has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
21
+ if RocketCMS.active_record?
22
+ has_attached_file :og_image, styles: {thumb: "800x600>"}
23
+ end
16
24
  end
17
25
 
18
26
  def page_title
@@ -5,8 +5,13 @@ module SortField
5
5
  def sort_field(prefix = '')
6
6
  prefix = "#{prefix}_" unless prefix == ''
7
7
 
8
- field "#{prefix}sort".to_sym, type: Integer
9
- scope "#{prefix}sorted".to_sym, -> { asc("#{prefix}sort".to_sym) }
8
+ if RocketCMS.mongoid?
9
+ field "#{prefix}sort".to_sym, type: Integer
10
+ scope "#{prefix}sorted".to_sym, -> { asc("#{prefix}sort".to_sym) }
11
+ end
12
+ if RocketCMS.active_record?
13
+ scope "#{prefix}sorted".to_sym, -> { order("#{prefix}sort".to_sym => :asc) }
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -1,3 +1,8 @@
1
+ if RocketCMS.active_record?
2
+ class ContactMessage < ActiveRecord::Base
3
+ end
4
+ end
5
+
1
6
  class ContactMessage
2
7
  include RocketCMS::Models::ContactMessage
3
8
  RocketCMS.apply_patches self
data/app/models/menu.rb CHANGED
@@ -1,3 +1,8 @@
1
+ if RocketCMS.active_record?
2
+ class Menu < ActiveRecord::Base
3
+ end
4
+ end
5
+
1
6
  class Menu
2
7
  include RocketCMS::Models::Menu
3
8
  RocketCMS.apply_patches self
data/app/models/news.rb CHANGED
@@ -1,3 +1,8 @@
1
+ if RocketCMS.active_record?
2
+ class News < ActiveRecord::Base
3
+ end
4
+ end
5
+
1
6
  class News
2
7
  include RocketCMS::Models::News
3
8
  RocketCMS.apply_patches self
data/app/models/page.rb CHANGED
@@ -1,3 +1,8 @@
1
+ if RocketCMS.active_record?
2
+ class Page < ActiveRecord::Base
3
+ end
4
+ end
5
+
1
6
  class Page
2
7
  include RocketCMS::Models::Page
3
8
  RocketCMS.apply_patches self
File without changes
@@ -1,10 +1,11 @@
1
1
  = render 'shared/obj', obj: @seo_page
2
2
 
3
3
  #rocket_cms_contact_form
4
- = simple_form_for @contact_message do |f|
4
+ = simple_form_for @contact_message, url: contacts_path do |f|
5
5
  = f.input :name
6
6
  = f.input :email
7
7
  = f.input :phone
8
8
  = f.input :content
9
9
  = f.input :captcha
10
10
  = f.submit t('rs.send')
11
+
@@ -10,6 +10,7 @@ en:
10
10
  no_contact_info: "Please enter your phone or email so we could contact you."
11
11
  map: 'Map'
12
12
  edit: Edit
13
+ send: Send
13
14
  m:
14
15
  enabled: 'added to menu "%{menu}"'
15
16
  disabled: 'deleted from menu "%{menu}"'
@@ -36,7 +36,7 @@ ru:
36
36
  title: Title
37
37
  version: Version
38
38
 
39
- mongoid:
39
+ mongoid: &mongoid
40
40
  models:
41
41
  user: Пользователь
42
42
  menu: Меню
@@ -70,6 +70,8 @@ ru:
70
70
  email: Ваш е-мейл
71
71
  phone: Ваш телефон
72
72
  content: Ваше сообщение
73
+ activerecord:
74
+ <<: *mongoid
73
75
 
74
76
  activemodel:
75
77
  errors:
@@ -10,6 +10,7 @@ ru:
10
10
  no_contact_info: "Пожалуйста введите ваш е-мейл или телефон чтобы мы могли связаться с вами."
11
11
  map: 'Карта'
12
12
  edit: Редактировать
13
+ send: Отправить
13
14
  m:
14
15
  enabled: 'добавлено в меню "%{menu}"'
15
16
  disabled: 'удалено из меню "%{menu}"'
@@ -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/#{fetch :application}/app'
18
+ else
19
+ '/home/#{fetch :user}/#{fetch :application}'
20
+ end
21
+ end
22
+ def tmp_path
23
+ if kind == 'data'
24
+ '/data/#{fetch :application}/tmp_dump'
25
+ else
26
+ '/home/#{fetch :user}/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,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 }
@@ -13,9 +13,13 @@ RailsAdmin.config do |config|
13
13
 
14
14
  ## == Cancan ==
15
15
  config.authorize_with :cancan
16
-
16
+ <% if RocketCMS.mongoid? %>
17
17
  ## == MongoidAudit
18
18
  config.audit_with :mongoid_audit, 'HistoryTracker'
19
+ <% elsif RocketCMS.active_record? %>
20
+ config.audit_with :paper_trail, 'User', 'PaperTrail::Version'
21
+ <% end %>
22
+
19
23
 
20
24
  config.actions do
21
25
  dashboard # mandatory
@@ -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@github.com:rs-pro/<%= 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.1.2@#{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}&current_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
+
@@ -0,0 +1,30 @@
1
+ class RocketCmsCreatePages < ActiveRecord::Migration
2
+ def change
3
+ create_table :menus do |t|
4
+ t.string :name, null: false
5
+ t.string :slug, null: false
6
+ t.timestamps
7
+ end
8
+ add_index :menus, :slug, unique: true
9
+
10
+ create_table :pages do |t|
11
+ t.boolean :enabled, default: false
12
+ t.string :slug, null: false
13
+ t.attachment :image
14
+
15
+ t.string :regexp
16
+ t.string :redirect
17
+ t.string :content
18
+ t.string :fullpath, null: false
19
+ RocketCMS::Migration.seo_fields(t)
20
+ t.timestamps
21
+ end
22
+ add_index :pages, :slug, unique: true
23
+
24
+ create_join_table :menus, :pages
25
+
26
+ add_foreign_key(:menus_pages, :menus, dependent: :delete)
27
+ add_foreign_key(:menus_pages, :pages, dependent: :delete)
28
+ end
29
+ end
30
+
@@ -0,0 +1,8 @@
1
+ set :stage, :production
2
+
3
+ server '<%= domain %>', user: '<%= app_name.downcase %>', roles: %w{web app db}
4
+
5
+ set :rails_env, 'production'
6
+ set :unicorn_env, 'production'
7
+ set :unicorn_rack_env, 'production'
8
+