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.
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
data/template.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  rails_spec = (Gem.loaded_specs["railties"] || Gem.loaded_specs["rails"])
2
2
  version = rails_spec.version.to_s
3
3
 
4
+ mongoid = options[:skip_active_record]
5
+
4
6
  if Gem::Version.new(version) < Gem::Version.new('4.1.0')
5
7
  puts "You are using an old version of Rails (#{version})"
6
8
  puts "Please update"
@@ -12,13 +14,12 @@ remove_file 'Gemfile'
12
14
  create_file 'Gemfile' do <<-TEXT
13
15
  source 'https://rubygems.org'
14
16
 
15
- gem 'spring', group: 'development'
16
17
  gem 'rails', '4.1.6'
18
+ #{if mongoid then "gem 'mongoid', '~> 4.0.0'" else "gem 'pg'" end}
17
19
 
18
- gem 'mongoid', '~> 4.0.0'
19
20
  gem 'sass', '~> 3.4.4'
20
21
 
21
- gem 'rocket_cms'
22
+ #{if mongoid then "gem 'rocket_cms_mongoid'" else "gem 'rocket_cms_activerecord'" end}, '~> 0.5.0.pre.1'
22
23
 
23
24
  gem 'sass-rails', github: 'rails/sass-rails', ref: '3a9e47db7d769221157c82229fc1bade55b580f0'
24
25
  gem 'compass-rails', '~> 2.0.0'
@@ -28,6 +29,7 @@ gem 'slim-rails'
28
29
  gem 'rs_russian'
29
30
  gem 'cancancan'
30
31
 
32
+ gem 'cloner'
31
33
  gem 'unicorn'
32
34
  gem 'x-real-ip'
33
35
 
@@ -37,6 +39,7 @@ group :development do
37
39
  gem 'better_errors'
38
40
  gem 'binding_of_caller'
39
41
  gem 'pry-rails'
42
+ gem 'spring'
40
43
 
41
44
  gem 'capistrano', '~> 3.2.0', require: false
42
45
  gem 'rvm1-capistrano3', require: false
@@ -53,7 +56,7 @@ group :test do
53
56
  gem 'rspec-rails'
54
57
  gem 'database_cleaner'
55
58
  gem 'email_spec'
56
- gem 'glebtv-mongoid-rspec'
59
+ #{if mongoid then "gem 'glebtv-mongoid-rspec'" else "" end}
57
60
  gem 'ffaker'
58
61
  gem 'factory_girl_rails'
59
62
  end
@@ -75,15 +78,14 @@ create_file '.gitignore' do <<-TEXT
75
78
  /public/system
76
79
  /public/ckeditor_assets
77
80
  /public/assets
78
- /config/mongoid.yml
81
+ #{if mongoid then '/config/mongoid.yml' else '/config/database.yml' end}
79
82
  /config/sectets.yml
80
83
  TEXT
81
84
  end
82
85
 
83
- create_file 'extra/.gitkeep' do <<-TEXT
84
- TEXT
85
- end
86
+ create_file 'extra/.gitkeep', ''
86
87
 
88
+ if mongoid
87
89
  remove_file 'config/initializers/cookies_serializer.rb'
88
90
  create_file 'config/initializers/cookies_serializer.rb' do <<-TEXT
89
91
  # Be sure to restart your server when you modify this file.
@@ -93,8 +95,7 @@ create_file 'config/initializers/cookies_serializer.rb' do <<-TEXT
93
95
  Rails.application.config.action_dispatch.cookies_serializer = :marshal
94
96
  TEXT
95
97
  end
96
-
97
-
98
+ end
98
99
 
99
100
  remove_file 'app/controllers/application_controller.rb'
100
101
  create_file 'app/controllers/application_controller.rb' do <<-TEXT
@@ -110,14 +111,14 @@ create_file 'config/navigation.rb' do <<-TEXT
110
111
  TEXT
111
112
  end
112
113
 
113
- create_file 'README.md', "## Project generated by RocketCMS\n\n"
114
+ create_file 'README.md', "## #{app_name}\nProject generated by RocketCMS\nORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}\n\n"
114
115
 
115
- create_file '.ruby-version', "2.1.2\n"
116
+ create_file '.ruby-version', "2.1.3\n"
116
117
  create_file '.ruby-gemset', "#{app_name}\n"
117
118
 
118
119
  run 'bundle install --without production'
119
- # generate "mongoid:config"
120
120
 
121
+ if mongoid
121
122
  create_file 'config/mongoid.yml' do <<-TEXT
122
123
  development:
123
124
  sessions:
@@ -133,20 +134,59 @@ test:
133
134
  - localhost:27017
134
135
  TEXT
135
136
  end
137
+ else
138
+ remove_file 'config/database.yml'
139
+ create_file 'config/database.yml' do <<-TEXT
140
+ development:
141
+ adapter: postgresql
142
+ encoding: unicode
143
+ database: #{app_name.downcase}_development
144
+ pool: 5
145
+ username: #{app_name.downcase}
146
+ password: #{app_name.downcase}
147
+ template: template0
148
+ TEXT
149
+ end
150
+ 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
151
+ ask("Press <enter> when done.", true)
152
+ end
153
+
154
+ unless mongoid
155
+ generate 'simple_captcha'
156
+ end
136
157
 
137
158
  generate "devise:install"
138
159
  generate "devise", "User"
160
+ remove_file "config/locales/devise.en.yml"
161
+ remove_file "config/locales/en.yml"
162
+
139
163
  gsub_file 'app/models/user.rb', '# :confirmable, :lockable, :timeoutable and :omniauthable', '# :confirmable, :registerable, :timeoutable and :omniauthable'
140
164
  gsub_file 'app/models/user.rb', ':registerable,', ' :lockable,'
165
+ if mongoid
141
166
  gsub_file 'app/models/user.rb', '# field :failed_attempts', 'field :failed_attempts'
142
167
  gsub_file 'app/models/user.rb', '# field :unlock_token', 'field :unlock_token'
143
168
  gsub_file 'app/models/user.rb', '# field :locked_at', 'field :locked_at'
169
+ end
170
+
171
+ if mongoid
172
+ generate "ckeditor:install", "--orm=mongoid", "--backend=paperclip"
173
+ else
174
+ generate "ckeditor:install", "--orm-active_record", "--backend=paperclip"
175
+ end
176
+
177
+ unless mongoid
178
+ generate "rocket_cms:migration"
179
+ generate "rails_admin_settings:migration"
180
+ end
144
181
 
145
- route "mount Ckeditor::Engine => '/ckeditor'"
146
182
  generate "rocket_cms:admin"
147
183
  generate "rocket_cms:ability"
148
184
  generate "rocket_cms:layout"
149
185
 
186
+ unless mongoid
187
+ rake "db:migrate"
188
+ end
189
+
150
190
  generate "rspec:install"
151
191
 
152
192
  remove_file 'config/routes.rb'
@@ -172,34 +212,80 @@ end
172
212
  TEXT
173
213
  end
174
214
 
215
+ create_file 'config/locales/ru.yml' do <<-TEXT
216
+ ru:
217
+ attributes:
218
+ is_default: По умолчанию
219
+ mongoid:
220
+ models:
221
+ item: Товар
222
+ attributes:
223
+ item:
224
+ price: Цена
225
+ TEXT
226
+ end
227
+
175
228
  remove_file 'db/seeds.rb'
176
- admin_pw = (0...8).map { (65 + rand(26)).chr }.join
229
+
230
+ require 'securerandom'
231
+ admin_pw = SecureRandom.urlsafe_base64(6)
177
232
  create_file 'db/seeds.rb' do <<-TEXT
178
233
  admin_pw = "#{admin_pw}"
179
234
  User.destroy_all
180
- User.create!(email: 'admin@#{app_name.downcase}.ru', password: admin_pw, password_confirmation: admin_pw)
235
+ User.create!(email: 'admin@#{app_name.dasherize.downcase}.ru', password: admin_pw, password_confirmation: admin_pw)
236
+ TEXT
237
+ end
238
+
239
+ create_file 'config/initializers/rack.rb' do <<-TEXT
240
+ if Rails.env.development?
241
+ module Rack
242
+ class CommonLogger
243
+ alias_method :log_without_assets, :log
244
+ #{'ASSETS_PREFIX = "/#{Rails.application.config.assets.prefix[/\A\/?(.*?)\/?\z/, 1]}/"'}
245
+ def log(env, status, header, began_at)
246
+ unless env['REQUEST_PATH'].start_with?(ASSETS_PREFIX) || env['REQUEST_PATH'].start_with?('/uploads') || env['REQUEST_PATH'].start_with?('/system')
247
+ log_without_assets(env, status, header, began_at)
248
+ end
249
+ end
250
+ end
251
+ end
252
+ end
181
253
  TEXT
182
254
  end
183
255
 
184
- remove_file 'Capfile'
185
- create_file 'Capfile' do <<-TEXT
186
- # Load DSL and Setup Up Stages
187
- require 'capistrano/setup'
256
+ create_file 'app/assets/stylesheets/rails_admin/custom/theming.css.sass' do <<-TEXT
257
+ body.rails_admin .form-horizontal textarea
258
+ width: 563px
259
+ height: 120px
260
+
261
+ .page-header
262
+ display: none !important
263
+
264
+ body > .container-fluid > .row-fluid > .span3
265
+ max-width: 140px
188
266
 
189
- # Includes default deployment tasks
190
- require 'capistrano/deploy'
267
+ @media screen and (min-width: 910px)
268
+ body > .container-fluid > .row-fluid > .span9
269
+ width: 81.5%
191
270
 
192
- require 'rvm1/capistrano3'
193
- require 'capistrano/bundler'
194
- require 'capistrano/rails/assets'
195
- #require "whenever/capistrano"
271
+ @media screen and (min-width: 1005px)
272
+ body > .container-fluid > .row-fluid > .span9
273
+ width: 83%
196
274
 
197
- require 'capistrano/unicorn'
275
+ @media screen and (min-width: 1150px)
276
+ body > .container-fluid > .row-fluid > .span9
277
+ width: 85%
198
278
 
199
- require 'capistrano/rails/console'
279
+ body.rails_admin .form-horizontal
280
+ .string_type input, .integer_type input, .text_type textarea
281
+ width: 60%
200
282
 
201
- # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
202
- Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
283
+ body.rails_admin .modal
284
+ margin-left: -495px !important
285
+ width: 990px !important
286
+
287
+ input[type=checkbox]
288
+ width: 30px !important
203
289
  TEXT
204
290
  end
205
291
 
@@ -219,236 +305,7 @@ timeout 120
219
305
  TEXT
220
306
  end
221
307
 
222
- create_file 'config/unicorn.rb' do <<-TEXT
223
- rails_env = ENV['RAILS_ENV'] || 'production'
224
-
225
- deploy_to = "/data/#{app_name.downcase}/app"
226
- #{'rails_root = "#{deploy_to}/current"'}
227
-
228
- #{'tmp_dir = "#{deploy_to}/shared/tmp"
229
- pid_dir = "#{tmp_dir}/pids"
230
- if File.directory?(tmp_dir) && !File.directory?(pid_dir)
231
- puts "creating pid dir #{pid_dir}"
232
- Dir.mkdir(pid_dir)
233
- end
234
- pid_file = "#{pid_dir}/unicorn.pid"'}
235
-
236
- #{'log_file = "#{deploy_to}/shared/log/unicorn.log"'}
237
- #{'err_log_file = "#{deploy_to}/shared/log/unicorn.error.log"'}
238
-
239
- old_pid_file = pid_file + '.oldbin'
240
-
241
- worker_processes 1
242
- working_directory rails_root
243
-
244
- timeout 120
245
-
246
- # Specify path to socket unicorn listens to,
247
- # we will use this in our nginx.conf later
248
-
249
- listen "127.0.0.1:#{port}"
250
308
 
251
- pid pid_file
252
-
253
- # Set log file paths
254
- stderr_path err_log_file
255
- stdout_path log_file
256
-
257
- # http://tech.tulentsev.com/2012/03/deploying-with-sinatra-capistrano-unicorn/
258
- # NOTE: http://unicorn.bogomips.org/SIGNALS.html
259
- preload_app true
260
-
261
- # make sure that Bundler finds the Gemfile
262
- before_exec do |server|
263
- ENV['BUNDLE_GEMFILE'] = File.join( rails_root, 'Gemfile' )
264
- end
265
-
266
- before_fork do |server, worker|
267
- # при использовании preload_app = true здесь должно быть закрытие всех открытых сокетов
268
-
269
- # Mongoid сам заботится о переконнекте
270
- # http://two.mongoid.org/docs/upgrading.html
271
-
272
- # http://stackoverflow.com/a/9498372/2041969
273
- # убиваем параллельный старый-процесс просле старта нового
274
- if File.exists?( old_pid_file )
275
- begin
276
- Process.kill( "QUIT", File.read( old_pid_file ).to_i )
277
- rescue Errno::ENOENT, Errno::ESRCH
278
- puts "Old master alerady dead"
279
- end
280
- end
281
- end
282
-
283
- after_fork do |server, worker|
284
- # pid-ы дочерних процессов
285
- #{'child_pid_file = server.config[:pid].sub(".pid", ".#{worker.nr}.pid")'}
286
- #{'system( "echo #{Process.pid} > #{child_pid_file}" )'}
287
- end
288
- TEXT
289
- end
290
-
291
- create_file 'config/deploy.rb' do <<-TEXT
292
- set :user, "#{app_name.downcase}"
293
- set :application, '#{app_name.downcase}'
294
- set :scm, :git
295
- set :repo_url, 'git@github.com:rs-pro/#{app_name.downcase}.git'
296
-
297
- # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
298
- set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"
299
-
300
- #{'set :deploy_to, "/data/#{fetch :application}/app"'}
301
-
302
- # require 'hipchat/capistrano'
303
- # set :hipchat_token, ""
304
- # set :hipchat_room_name, "#{app_name}"
305
- # set :hipchat_announce, false
306
-
307
- set :rvm_type, :user
308
- #{'set :rvm_ruby_version, "2.1.2@#{fetch :application}"'}
309
- set :use_sudo, false
310
-
311
- set :keep_releases, 20
312
-
313
- set :linked_files, %w{config/mongoid.yml config/secrets.yml}
314
- set :linked_dirs, %w{log tmp vendor/bundle public/assets public/system public/uploads public/ckeditor_assets public/sitemap}
315
-
316
- namespace :db do
317
- desc "Create the indexes defined on your mongoid models"
318
- task :create_mongoid_indexes do
319
- on roles(:app) do
320
- execute :rake, "db:mongoid:create_indexes"
321
- end
322
- end
323
- end
324
-
325
- namespace :deploy do
326
- task :restart do
327
- end
328
- #after :finishing, 'deploy:cleanup'
329
- desc "Update the crontab"
330
- task :update_crontab do
331
- on roles(:app) do
332
- #{'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"'}
333
- end
334
- end
335
- end
336
-
337
- after 'deploy:publishing', 'deploy:restart'
338
- after 'deploy:restart', 'unicorn:duplicate'
339
- # before "deploy:update_crontab", 'rvm1:hook'
340
- # after "deploy:restart", "deploy:update_crontab"
341
- TEXT
342
- end
343
-
344
- create_file 'config/deploy/production.rb' do <<-TEXT
345
- set :stage, :production
346
-
347
- server 'rscz.ru', user: '#{app_name.downcase}', roles: %w{web app db}
348
-
349
- set :rails_env, 'production'
350
- set :unicorn_env, 'production'
351
- set :unicorn_rack_env, 'production'
352
- TEXT
353
- end
354
-
355
- create_file 'lib/tasks/dl.thor' do <<-TEXT
356
- class Dl < Thor
357
- package_name "dl"
358
- include Thor::Actions
359
-
360
- no_commands do
361
- def load_env
362
- return if defined?(Rails)
363
- require File.expand_path("../../../config/environment", __FILE__)
364
- end
365
-
366
- def env_from
367
- 'production'
368
- end
369
- def ssh_host
370
- '#{app_name.downcase}.ru'
371
- end
372
- def ssh_user
373
- '#{app_name.downcase}'
374
- end
375
- def ssh_opts
376
- {}
377
- end
378
-
379
- def remote_dump_path
380
- '/data/#{app_name.downcase}/tmp_dump'
381
- end
382
- def remote_app_path
383
- "/data/#{app_name.downcase}/app/current"
384
- end
385
-
386
- def local_auth(conf)
387
- if conf['password'].nil?
388
- ""
389
- else
390
- #{'"-u #{conf["username"]} -p #{conf["password"]}]"'}
391
- end
392
- end
393
- end
394
-
395
- desc "download", "clone files and DB from production"
396
- def download
397
- load_env
398
- require 'net/ssh'
399
-
400
- puts "backup remote DB via ssh"
401
- r_conf = nil
402
- Net::SSH.start(ssh_host, ssh_user, ssh_opts) do |ssh|
403
- r_conf = YAML.load(ssh.exec!("cat #{'#{remote_app_path}'}/config/mongoid.yml"))[env_from]['sessions']['default']
404
- puts ssh.exec!("rm -R #{'#{remote_dump_path}'}")
405
- puts ssh.exec!("mkdir -p #{'#{remote_dump_path}'}")
406
- dump = "mongodump -u #{'#{r_conf[\'username\']} -p #{r_conf[\'password\']} -d #{r_conf[\'database\']} --authenticationDatabase #{r_conf[\'database\']} -o #{remote_dump_path}"'}
407
- puts dump
408
- puts ssh.exec!(dump)
409
- end
410
- conf = YAML.load_file(Rails.root.join('config', 'mongoid.yml'))[Rails.env]['sessions']['default']
411
- db_to = conf['database']
412
- db_path = Rails.root.join("tmp", "dmp", "dump", db_to).to_s
413
- #{'`mkdir -p #{db_path}`'}
414
- #{'rsync = "rsync -e ssh --progress -lzuogthvr #{ssh_user}@#{ssh_host}:#{remote_dump_path}/#{r_conf[\'database\']}/ #{db_path}/"'}
415
- puts rsync
416
- pipe = IO.popen(rsync)
417
- while (line = pipe.gets)
418
- print line
419
- end
420
-
421
- puts "restoring DB"
422
- if Rails.env.staging?
423
- #{'restore = "mongorestore --drop -d #{db_to} -u #{remote_db_user} -p #{remote_db_pass} --authenticationDatabase admin #{db_path}"'}
424
- else
425
- #{'restore = "mongorestore --drop -d #{db_to} #{local_auth(conf)} #{db_path}"'}
426
- end
427
- puts restore
428
- pipe = IO.popen(restore)
429
- while (line = pipe.gets)
430
- print line
431
- end
432
-
433
- #{'rsync = "rsync -e ssh --progress -lzuogthvr #{ssh_user}@#{ssh_host}:#{remote_app_path}/public/system/ #{Rails.root.join(\'public/system\')}/"'}
434
- puts rsync
435
- pipe = IO.popen(rsync)
436
- while (line = pipe.gets)
437
- print line
438
- end
439
-
440
- #{'rsync = "rsync -e ssh --progress -lzuogthvr #{ssh_user}@#{ssh_host}:#{remote_app_path}/public/ckeditor_assets/ #{Rails.root.join(\'public/ckeditor_assets\')}/"'}
441
- puts rsync
442
- pipe = IO.popen(rsync)
443
- while (line = pipe.gets)
444
- print line
445
- end
446
- puts "cloned files"
447
- puts "done"
448
- end
449
- end
450
- TEXT
451
- end
452
309
  remove_file 'app/views/layouts/application.html.erb'
453
310
 
454
311
 
@@ -458,7 +315,7 @@ require File.expand_path('../boot', __FILE__)
458
315
 
459
316
  # Pick the frameworks you want:
460
317
  require "active_model/railtie"
461
- # require "active_record/railtie"
318
+ #{'#' if mongoid}require "active_record/railtie"
462
319
  require "action_controller/railtie"
463
320
  require "action_mailer/railtie"
464
321
  require "action_view/railtie"
@@ -487,6 +344,7 @@ module #{app_name.camelize}
487
344
  config.i18n.default_locale = :ru
488
345
  config.i18n.available_locales = [:ru, :en]
489
346
  config.i18n.enforce_available_locales = true
347
+ #{'config.active_record.schema_format = :sql' unless mongoid}
490
348
 
491
349
  #{'config.autoload_paths += %W(#{config.root}/extra)'}
492
350
  #{'config.eager_load_paths += %W(#{config.root}/extra)'}
@@ -525,9 +383,20 @@ create_file 'app/assets/javascripts/application.js.coffee' do <<-TEXT
525
383
  TEXT
526
384
  end
527
385
 
528
- FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
386
+ if mongoid
387
+ FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
388
+ else
389
+ FileUtils.cp(Pathname.new(destination_root).join('config', 'database.yml').to_s, Pathname.new(destination_root).join('config', 'database.yml.example').to_s)
390
+ end
391
+
529
392
  FileUtils.cp(Pathname.new(destination_root).join('config', 'secrets.yml').to_s, Pathname.new(destination_root).join('config', 'secrets.yml.example').to_s)
530
393
 
394
+ unless mongoid
395
+ generate "paper_trail:install"
396
+ generate "friendly_id"
397
+ rake "db:migrate"
398
+ end
399
+
531
400
  git :init
532
401
  git add: "."
533
402
  git commit: %Q{ -m 'Initial commit' }