ack_rocket_cms 0.7.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,12 @@
|
|
1
|
+
# https://github.com/rs-pro/russian/blob/master/lib/russian/active_model_ext/custom_error_message.rb
|
2
|
+
require 'simple_form/components/errors'
|
3
|
+
module SimpleForm
|
4
|
+
module Components
|
5
|
+
module Errors
|
6
|
+
protected
|
7
|
+
def errors_on_attribute
|
8
|
+
object.errors[attribute_name].map {|m| m.sub(/^\^/, '')}
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# require this file to load the tasks
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
# Require generator at runtime. If we don't do this the ActionView helpers are included
|
5
|
+
# before the Rails environment can be loaded by other Rake tasks, which causes problems
|
6
|
+
# for those tasks when rendering using ActionView.
|
7
|
+
namespace :rs do
|
8
|
+
# Require generator only. When installed as a plugin the require will fail, so in
|
9
|
+
# that case, load the environment first.
|
10
|
+
task :require do
|
11
|
+
Rake::Task['environment'].invoke
|
12
|
+
end
|
13
|
+
end
|
data/release.sh
ADDED
data/rocket_cms.gemspec
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rocket_cms/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'ack_rocket_cms'
|
7
|
+
spec.version = RocketCMS::VERSION
|
8
|
+
spec.authors = ['glebtv', 'Alexander Kiseliev']
|
9
|
+
spec.email = ['glebtv@gmail.com', "i43ack@gmail.com"]
|
10
|
+
spec.description = %q{RocketCMS fork}
|
11
|
+
spec.summary = %q{Please DO NOT use this gem directly, use ack_rocket_cms_mongoid or ack_rocket_cms_activerecord instead!}
|
12
|
+
spec.homepage = 'https://github.com/ack43/rocket_cms'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/).reject {|f| f.start_with?('mongoid') || f.start_with?('activerecord') }
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
|
23
|
+
spec.add_dependency 'rails', '>= 4.1.0', '< 5.0'
|
24
|
+
|
25
|
+
spec.add_dependency 'jquery-rails'
|
26
|
+
spec.add_dependency 'simple_form'
|
27
|
+
spec.add_dependency 'glebtv-simple_captcha'
|
28
|
+
spec.add_dependency 'coffee-rails'
|
29
|
+
spec.add_dependency 'devise'
|
30
|
+
spec.add_dependency 'turbolinks'
|
31
|
+
spec.add_dependency 'validates_email_format_of'
|
32
|
+
spec.add_dependency 'rails_admin'
|
33
|
+
spec.add_dependency 'rails_admin_nested_set'
|
34
|
+
spec.add_dependency 'rails_admin_toggleable'
|
35
|
+
spec.add_dependency 'glebtv-ckeditor'
|
36
|
+
spec.add_dependency 'rails_admin_settings', '~> 0.9.0'
|
37
|
+
spec.add_dependency 'geocoder'
|
38
|
+
spec.add_dependency 'simple-navigation'
|
39
|
+
spec.add_dependency 'sitemap_generator'
|
40
|
+
spec.add_dependency 'kaminari'
|
41
|
+
spec.add_dependency 'addressable'
|
42
|
+
|
43
|
+
# spec.add_dependency ''
|
44
|
+
spec.add_dependency 'x-real-ip'
|
45
|
+
|
46
|
+
|
47
|
+
spec.add_dependency "rails_admin_mongoid_localize_field", "~> 0.1.2"
|
48
|
+
|
49
|
+
spec.add_dependency 'stringex'
|
50
|
+
spec.add_dependency 'thor'
|
51
|
+
|
52
|
+
spec.add_dependency 'smart_excerpt'
|
53
|
+
end
|
54
|
+
|
data/template.rb
ADDED
@@ -0,0 +1,557 @@
|
|
1
|
+
rails_spec = (Gem.loaded_specs["railties"] || Gem.loaded_specs["rails"])
|
2
|
+
version = rails_spec.version.to_s
|
3
|
+
|
4
|
+
mongoid = options[:skip_active_record]
|
5
|
+
|
6
|
+
if Gem::Version.new(version) < Gem::Version.new('4.1.0')
|
7
|
+
puts "You are using an old version of Rails (#{version})"
|
8
|
+
puts "Please update"
|
9
|
+
puts "Stopping"
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
remove_file 'Gemfile'
|
14
|
+
create_file 'Gemfile' do <<-TEXT
|
15
|
+
source 'https://rubygems.org'
|
16
|
+
|
17
|
+
gem 'rails', '4.2.0'
|
18
|
+
#{if mongoid then "gem 'mongoid', '~> 4.0.0'" else "gem 'pg'" end}
|
19
|
+
|
20
|
+
# gem 'sass'
|
21
|
+
|
22
|
+
#{if mongoid then "gem 'ack_rocket_cms_mongoid'" else "gem 'ack_rocket_cms_activerecord'" end}
|
23
|
+
|
24
|
+
gem 'devise'
|
25
|
+
|
26
|
+
gem 'sass-rails'
|
27
|
+
gem 'compass-rails'
|
28
|
+
gem 'compass'
|
29
|
+
|
30
|
+
gem 'slim-rails'
|
31
|
+
gem 'rs_russian'
|
32
|
+
gem 'cancancan'
|
33
|
+
|
34
|
+
gem 'cloner'
|
35
|
+
gem 'unicorn'
|
36
|
+
gem 'x-real-ip'
|
37
|
+
|
38
|
+
gem 'sentry-raven'
|
39
|
+
|
40
|
+
group :development do
|
41
|
+
gem 'better_errors'
|
42
|
+
gem 'binding_of_caller'
|
43
|
+
gem 'pry-rails'
|
44
|
+
gem 'spring'
|
45
|
+
|
46
|
+
gem 'capistrano', require: false
|
47
|
+
gem 'rvm1-capistrano3', require: false
|
48
|
+
gem 'glebtv-capistrano-unicorn', require: false
|
49
|
+
gem 'capistrano-bundler', require: false
|
50
|
+
gem 'capistrano-rails', require: false
|
51
|
+
|
52
|
+
gem 'hipchat'
|
53
|
+
# gem 'coffee-rails-source-maps'
|
54
|
+
# gem 'compass-rails-source-maps'
|
55
|
+
end
|
56
|
+
|
57
|
+
group :test do
|
58
|
+
gem 'rspec-rails'
|
59
|
+
gem 'database_cleaner'
|
60
|
+
gem 'email_spec'
|
61
|
+
#{if mongoid then "gem 'glebtv-mongoid-rspec'" else "" end}
|
62
|
+
gem 'ffaker'
|
63
|
+
gem 'factory_girl_rails'
|
64
|
+
end
|
65
|
+
|
66
|
+
#{if mongoid then "gem 'mongo_session_store-rails4'" else "" end}
|
67
|
+
|
68
|
+
gem 'slim'
|
69
|
+
gem 'sprockets'
|
70
|
+
|
71
|
+
|
72
|
+
gem 'sitemap_generator'
|
73
|
+
gem 'rails_admin_sitemap'
|
74
|
+
|
75
|
+
gem 'uglifier'
|
76
|
+
|
77
|
+
group :production do
|
78
|
+
gem "god"
|
79
|
+
end
|
80
|
+
|
81
|
+
gem "rails_admin_sort_embedded"
|
82
|
+
|
83
|
+
TEXT
|
84
|
+
end
|
85
|
+
|
86
|
+
remove_file '.gitignore'
|
87
|
+
create_file '.gitignore' do <<-TEXT
|
88
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
89
|
+
#
|
90
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
91
|
+
# or operating system, you probably want to add a global ignore instead:
|
92
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
93
|
+
.idea
|
94
|
+
.idea/*
|
95
|
+
|
96
|
+
/.bundle
|
97
|
+
/log/*.log
|
98
|
+
/tmp/*
|
99
|
+
TEXT
|
100
|
+
end
|
101
|
+
|
102
|
+
create_file 'extra/.gitkeep', ''
|
103
|
+
|
104
|
+
if mongoid
|
105
|
+
remove_file 'config/initializers/cookies_serializer.rb'
|
106
|
+
create_file 'config/initializers/cookies_serializer.rb' do <<-TEXT
|
107
|
+
# Be sure to restart your server when you modify this file.
|
108
|
+
# json serializer breaks Devise + Mongoid. DO NOT ENABLE
|
109
|
+
# See https://github.com/plataformatec/devise/pull/2882
|
110
|
+
# Rails.application.config.action_dispatch.cookies_serializer = :json
|
111
|
+
Rails.application.config.action_dispatch.cookies_serializer = :marshal
|
112
|
+
TEXT
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
if mongoid
|
117
|
+
remove_file 'config/initializers/session_store.rb'
|
118
|
+
create_file 'config/initializers/session_store.rb' do <<-TEXT
|
119
|
+
# Be sure to restart your server when you modify this file.
|
120
|
+
|
121
|
+
#Rails.application.config.session_store :cookie_store, key: '_#{app_name.tableize.singularize}_session'
|
122
|
+
Rails.application.config.session_store :mongoid_store
|
123
|
+
|
124
|
+
TEXT
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
remove_file 'app/controllers/application_controller.rb'
|
129
|
+
create_file 'app/controllers/application_controller.rb' do <<-TEXT
|
130
|
+
class ApplicationController < ActionController::Base
|
131
|
+
include RocketCMS::Controller
|
132
|
+
end
|
133
|
+
TEXT
|
134
|
+
end
|
135
|
+
|
136
|
+
create_file 'config/navigation.rb' do <<-TEXT
|
137
|
+
# empty file to please simple_navigation, we are not using it
|
138
|
+
# See https://github.com/ack43/rocket_cms/blob/master/app/controllers/concerns/rs_menu.rb
|
139
|
+
TEXT
|
140
|
+
end
|
141
|
+
|
142
|
+
create_file 'README.md', "## #{app_name}\nProject generated by RocketCMS\nORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}\n\n"
|
143
|
+
|
144
|
+
create_file '.ruby-version', "2.2.0\n"
|
145
|
+
create_file '.ruby-gemset', "#{app_name}\n"
|
146
|
+
|
147
|
+
run 'bundle install --without production'
|
148
|
+
|
149
|
+
|
150
|
+
if mongoid
|
151
|
+
create_file 'config/mongoid.yml' do <<-TEXT
|
152
|
+
development:
|
153
|
+
sessions:
|
154
|
+
default:
|
155
|
+
database: #{app_name.downcase}
|
156
|
+
hosts:
|
157
|
+
- localhost:27017
|
158
|
+
production:
|
159
|
+
sessions:
|
160
|
+
default:
|
161
|
+
database: #{app_name.downcase}
|
162
|
+
hosts:
|
163
|
+
- localhost:27017
|
164
|
+
test:
|
165
|
+
sessions:
|
166
|
+
default:
|
167
|
+
database: #{app_name.downcase}_test
|
168
|
+
hosts:
|
169
|
+
- localhost:27017
|
170
|
+
TEXT
|
171
|
+
end
|
172
|
+
else
|
173
|
+
remove_file 'config/database.yml'
|
174
|
+
create_file 'config/database.yml' do <<-TEXT
|
175
|
+
development:
|
176
|
+
adapter: postgresql
|
177
|
+
encoding: unicode
|
178
|
+
database: #{app_name.downcase}_development
|
179
|
+
pool: 5
|
180
|
+
username: #{app_name.downcase}
|
181
|
+
password: #{app_name.downcase}
|
182
|
+
template: template0
|
183
|
+
TEXT
|
184
|
+
end
|
185
|
+
say "Please create a PostgreSQL user #{app_name.downcase} with password #{app_name.downcase} and a database #{app_name.downcase}_development owned by him for development NOW.", :red
|
186
|
+
ask("Press <enter> when done.", true)
|
187
|
+
end
|
188
|
+
|
189
|
+
unless mongoid
|
190
|
+
generate 'simple_captcha'
|
191
|
+
end
|
192
|
+
|
193
|
+
generate "devise:install"
|
194
|
+
generate "devise", "User"
|
195
|
+
remove_file "config/locales/devise.en.yml"
|
196
|
+
remove_file "config/locales/en.yml"
|
197
|
+
|
198
|
+
gsub_file 'app/models/user.rb', '# :confirmable, :lockable, :timeoutable and :omniauthable', '# :confirmable, :registerable, :timeoutable and :omniauthable'
|
199
|
+
gsub_file 'app/models/user.rb', ':registerable,', ' :lockable,'
|
200
|
+
if mongoid
|
201
|
+
gsub_file 'app/models/user.rb', '# field :failed_attempts', 'field :failed_attempts'
|
202
|
+
gsub_file 'app/models/user.rb', '# field :unlock_token', 'field :unlock_token'
|
203
|
+
gsub_file 'app/models/user.rb', '# field :locked_at', 'field :locked_at'
|
204
|
+
|
205
|
+
inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
206
|
+
|
207
|
+
field :name, type: String
|
208
|
+
field :login, type: String
|
209
|
+
field :roles, type: Array
|
210
|
+
|
211
|
+
before_save do
|
212
|
+
self.roles.reject! { |r| r.blank? }
|
213
|
+
end
|
214
|
+
|
215
|
+
AVAILABLE_ROLES = ["admin", "manager", "client"]
|
216
|
+
|
217
|
+
AVAILABLE_ROLES.each do |r|
|
218
|
+
class_eval <<-EVAL
|
219
|
+
def \#{r}?
|
220
|
+
self.roles.include?("\#{r}")
|
221
|
+
end
|
222
|
+
EVAL
|
223
|
+
end
|
224
|
+
|
225
|
+
rails_admin do
|
226
|
+
list do
|
227
|
+
field :email
|
228
|
+
field :name
|
229
|
+
field :login
|
230
|
+
field :roles do
|
231
|
+
pretty_value do
|
232
|
+
bindings[:view].content_tag(:p, bindings[:object].roles.join(", "))
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
edit do
|
238
|
+
field :email, :string do
|
239
|
+
visible do
|
240
|
+
bindings[:view].current_user.admin?
|
241
|
+
end
|
242
|
+
end
|
243
|
+
field :name, :string
|
244
|
+
field :login, :string do
|
245
|
+
visible do
|
246
|
+
bindings[:view].current_user.admin?
|
247
|
+
end
|
248
|
+
end
|
249
|
+
field :roles, :enum do
|
250
|
+
enum do
|
251
|
+
AVAILABLE_ROLES
|
252
|
+
end
|
253
|
+
|
254
|
+
multiple do
|
255
|
+
true
|
256
|
+
end
|
257
|
+
|
258
|
+
visible do
|
259
|
+
bindings[:view].current_user.admin?
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
field :password do
|
264
|
+
visible do
|
265
|
+
bindings[:view].current_user.admin? or bindings[:view].current_user == bindings[:object]
|
266
|
+
end
|
267
|
+
end
|
268
|
+
field :password_confirmation do
|
269
|
+
visible do
|
270
|
+
bindings[:view].current_user.admin? or bindings[:view].current_user == bindings[:object]
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
TEXT
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
if mongoid
|
280
|
+
generate "ckeditor:install", "--orm=mongoid", "--backend=paperclip"
|
281
|
+
else
|
282
|
+
generate "ckeditor:install", "--orm=active_record", "--backend=paperclip"
|
283
|
+
end
|
284
|
+
|
285
|
+
unless mongoid
|
286
|
+
generate "rocket_cms:migration"
|
287
|
+
generate "rails_admin_settings:migration"
|
288
|
+
end
|
289
|
+
|
290
|
+
generate "rocket_cms:admin"
|
291
|
+
generate "rocket_cms:ability"
|
292
|
+
generate "rocket_cms:layout"
|
293
|
+
|
294
|
+
unless mongoid
|
295
|
+
rake "db:migrate"
|
296
|
+
end
|
297
|
+
|
298
|
+
generate "simple_form:install"
|
299
|
+
|
300
|
+
generate "rspec:install"
|
301
|
+
|
302
|
+
remove_file 'config/routes.rb'
|
303
|
+
create_file 'config/routes.rb' do <<-TEXT
|
304
|
+
Rails.application.routes.draw do
|
305
|
+
devise_for :users
|
306
|
+
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
|
307
|
+
mount Ckeditor::Engine => '/ckeditor'
|
308
|
+
|
309
|
+
get 'contacts' => 'contacts#new', as: :contacts
|
310
|
+
post 'contacts' => 'contacts#create', as: :create_contacts
|
311
|
+
get 'contacts/sent' => 'contacts#sent', as: :contacts_sent
|
312
|
+
|
313
|
+
get 'search' => 'search#index', as: :search
|
314
|
+
|
315
|
+
resources :news, only: [:index, :show]
|
316
|
+
|
317
|
+
root to: 'home#index'
|
318
|
+
|
319
|
+
get '*slug' => 'pages#show'
|
320
|
+
resources :pages, only: [:show]
|
321
|
+
end
|
322
|
+
TEXT
|
323
|
+
end
|
324
|
+
|
325
|
+
create_file 'config/locales/ru.yml' do <<-TEXT
|
326
|
+
ru:
|
327
|
+
attributes:
|
328
|
+
is_default: По умолчанию
|
329
|
+
mongoid:
|
330
|
+
models:
|
331
|
+
item: Товар
|
332
|
+
attributes:
|
333
|
+
item:
|
334
|
+
price: Цена
|
335
|
+
TEXT
|
336
|
+
end
|
337
|
+
|
338
|
+
remove_file 'db/seeds.rb'
|
339
|
+
|
340
|
+
require 'securerandom'
|
341
|
+
admin_pw = SecureRandom.urlsafe_base64(6)
|
342
|
+
create_file 'db/seeds.rb' do <<-TEXT
|
343
|
+
admin_pw = "#{admin_pw}"
|
344
|
+
User.destroy_all
|
345
|
+
User.create!(email: 'admin@#{app_name.dasherize.downcase}.ru', password: admin_pw, password_confirmation: admin_pw)
|
346
|
+
TEXT
|
347
|
+
end
|
348
|
+
|
349
|
+
create_file 'config/initializers/rack.rb' do <<-TEXT
|
350
|
+
if Rails.env.development?
|
351
|
+
module Rack
|
352
|
+
class CommonLogger
|
353
|
+
alias_method :log_without_assets, :log
|
354
|
+
#{'ASSETS_PREFIX = "/#{Rails.application.config.assets.prefix[/\A\/?(.*?)\/?\z/, 1]}/"'}
|
355
|
+
def log(env, status, header, began_at)
|
356
|
+
unless env['REQUEST_PATH'].start_with?(ASSETS_PREFIX) || env['REQUEST_PATH'].start_with?('/uploads') || env['REQUEST_PATH'].start_with?('/system')
|
357
|
+
log_without_assets(env, status, header, began_at)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
TEXT
|
364
|
+
end
|
365
|
+
|
366
|
+
create_file 'app/assets/stylesheets/rails_admin/custom/theming.css.sass' do <<-TEXT
|
367
|
+
.navbar-brand
|
368
|
+
margin-left: 0 !important
|
369
|
+
|
370
|
+
.input-small
|
371
|
+
width: 150px
|
372
|
+
|
373
|
+
input[type=text]
|
374
|
+
width: 380px !important
|
375
|
+
input.ra-filtering-select-input[type=text]
|
376
|
+
width: 180px !important
|
377
|
+
input.hasDatepicker
|
378
|
+
width: 180px !important
|
379
|
+
|
380
|
+
.sidebar-nav
|
381
|
+
a
|
382
|
+
padding: 6px 10px !important
|
383
|
+
.dropdown-header
|
384
|
+
padding: 10px 0px 3px 9px
|
385
|
+
|
386
|
+
.label-important
|
387
|
+
background-color: #d9534f
|
388
|
+
.alert-notice
|
389
|
+
color: #5bc0de
|
390
|
+
|
391
|
+
.page-header
|
392
|
+
display: none
|
393
|
+
.breadcrumb
|
394
|
+
margin-top: 20px
|
395
|
+
|
396
|
+
.control-group
|
397
|
+
clear: both
|
398
|
+
|
399
|
+
.container-fluid
|
400
|
+
padding-left: 0
|
401
|
+
> .row
|
402
|
+
margin: 0
|
403
|
+
|
404
|
+
.last.links
|
405
|
+
a
|
406
|
+
display: inline-block
|
407
|
+
padding: 3px
|
408
|
+
font-size: 20px
|
409
|
+
|
410
|
+
.remove_nested_fields
|
411
|
+
display: block !important
|
412
|
+
z-index: 5
|
413
|
+
right: 0
|
414
|
+
left: auto
|
415
|
+
|
416
|
+
.modal
|
417
|
+
width: 800px !important
|
418
|
+
|
419
|
+
|
420
|
+
body.rails_admin .modal
|
421
|
+
margin: 0 auto !important
|
422
|
+
.modal-dialog
|
423
|
+
width: 990px !important
|
424
|
+
|
425
|
+
input[type=checkbox]
|
426
|
+
width: 30px !important
|
427
|
+
|
428
|
+
body.rails_admin
|
429
|
+
|
430
|
+
.root_links
|
431
|
+
|
432
|
+
> li
|
433
|
+
display: inline-block
|
434
|
+
|
435
|
+
.dropdown-header
|
436
|
+
border-top: 2px solid #777777
|
437
|
+
text-align: right
|
438
|
+
|
439
|
+
&:first-child
|
440
|
+
border-top: none
|
441
|
+
|
442
|
+
.bank_row .logo_field, #edit_bank img
|
443
|
+
background: #ccc !important
|
444
|
+
|
445
|
+
.ui-menu-item
|
446
|
+
border: 1px solid transparent
|
447
|
+
|
448
|
+
.content > .alert
|
449
|
+
margin-top: 20px
|
450
|
+
|
451
|
+
TEXT
|
452
|
+
end
|
453
|
+
|
454
|
+
remove_file 'public/robots.txt'
|
455
|
+
create_file 'public/robots.txt' do <<-TEXT
|
456
|
+
User-Agent: *
|
457
|
+
Disallow: /admin
|
458
|
+
Sitemap: /sitemap.xml.gz
|
459
|
+
TEXT
|
460
|
+
end
|
461
|
+
|
462
|
+
|
463
|
+
remove_file 'app/views/layouts/application.html.erb'
|
464
|
+
|
465
|
+
|
466
|
+
remove_file 'config/application.rb'
|
467
|
+
create_file 'config/application.rb' do <<-TEXT
|
468
|
+
require File.expand_path('../boot', __FILE__)
|
469
|
+
|
470
|
+
# Pick the frameworks you want:
|
471
|
+
require "active_model/railtie"
|
472
|
+
#{'#' if mongoid}require "active_record/railtie"
|
473
|
+
require "action_controller/railtie"
|
474
|
+
require "action_mailer/railtie"
|
475
|
+
require "action_view/railtie"
|
476
|
+
require "sprockets/railtie"
|
477
|
+
# require "rails/test_unit/railtie"
|
478
|
+
|
479
|
+
# Require the gems listed in Gemfile, including any gems
|
480
|
+
# you've limited to :test, :development, or :production.
|
481
|
+
Bundler.require(*Rails.groups)
|
482
|
+
|
483
|
+
module #{app_name.camelize}
|
484
|
+
class Application < Rails::Application
|
485
|
+
config.generators do |g|
|
486
|
+
g.test_framework :rspec
|
487
|
+
g.view_specs false
|
488
|
+
g.helper_specs false
|
489
|
+
g.feature_specs false
|
490
|
+
g.template_engine :slim
|
491
|
+
g.stylesheets false
|
492
|
+
g.javascripts false
|
493
|
+
g.helper false
|
494
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
495
|
+
end
|
496
|
+
|
497
|
+
config.i18n.locale = :ru
|
498
|
+
config.i18n.default_locale = :ru
|
499
|
+
config.i18n.available_locales = [:ru, :en]
|
500
|
+
config.i18n.enforce_available_locales = true
|
501
|
+
#{'config.active_record.schema_format = :sql' unless mongoid}
|
502
|
+
|
503
|
+
#{'config.autoload_paths += %W(#{config.root}/extra)'}
|
504
|
+
#{'config.eager_load_paths += %W(#{config.root}/extra)'}
|
505
|
+
|
506
|
+
config.time_zone = 'Europe/Moscow'
|
507
|
+
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
TEXT
|
512
|
+
end
|
513
|
+
|
514
|
+
remove_file 'app/assets/stylesheets/application.css'
|
515
|
+
create_file 'app/assets/stylesheets/application.css.sass' do <<-TEXT
|
516
|
+
@import 'compass'
|
517
|
+
@import 'rocket_cms'
|
518
|
+
|
519
|
+
#wrapper
|
520
|
+
width: 960px
|
521
|
+
margin: 0 auto
|
522
|
+
#sidebar
|
523
|
+
float: left
|
524
|
+
width: 200px
|
525
|
+
#content
|
526
|
+
float: right
|
527
|
+
width: 750px
|
528
|
+
|
529
|
+
@import "compass/layout/sticky-footer"
|
530
|
+
+sticky-footer(50px)
|
531
|
+
TEXT
|
532
|
+
end
|
533
|
+
|
534
|
+
remove_file 'app/assets/javascripts/application.js'
|
535
|
+
create_file 'app/assets/javascripts/application.js.coffee' do <<-TEXT
|
536
|
+
#= require rocket_cms
|
537
|
+
TEXT
|
538
|
+
end
|
539
|
+
|
540
|
+
if mongoid
|
541
|
+
FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
|
542
|
+
else
|
543
|
+
FileUtils.cp(Pathname.new(destination_root).join('config', 'database.yml').to_s, Pathname.new(destination_root).join('config', 'database.yml.example').to_s)
|
544
|
+
end
|
545
|
+
|
546
|
+
FileUtils.cp(Pathname.new(destination_root).join('config', 'secrets.yml').to_s, Pathname.new(destination_root).join('config', 'secrets.yml.example').to_s)
|
547
|
+
|
548
|
+
unless mongoid
|
549
|
+
generate "paper_trail:install"
|
550
|
+
generate "friendly_id"
|
551
|
+
rake "db:migrate"
|
552
|
+
end
|
553
|
+
|
554
|
+
git :init
|
555
|
+
git add: "."
|
556
|
+
git commit: %Q{ -m 'Initial commit' }
|
557
|
+
|