mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added bin/update script to update application automatically
use system! fix changelog use bundle check first and use rake use system instead system! for bundle check
This commit is contained in:
parent
6caeec53d5
commit
c7375fd162
3 changed files with 33 additions and 1 deletions
|
@ -166,7 +166,7 @@ of the files and folders that Rails created by default:
|
||||||
| File/Folder | Purpose |
|
| File/Folder | Purpose |
|
||||||
| ----------- | ------- |
|
| ----------- | ------- |
|
||||||
|app/|Contains the controllers, models, views, helpers, mailers and assets for your application. You'll focus on this folder for the remainder of this guide.|
|
|app/|Contains the controllers, models, views, helpers, mailers and assets for your application. You'll focus on this folder for the remainder of this guide.|
|
||||||
|bin/|Contains the rails script that starts your app and can contain other scripts you use to setup, deploy or run your application.|
|
|bin/|Contains the rails script that starts your app and can contain other scripts you use to setup, update, deploy or run your application.|
|
||||||
|config/|Configure your application's routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html).|
|
|config/|Configure your application's routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html).|
|
||||||
|config.ru|Rack configuration for Rack based servers used to start the application.|
|
|config.ru|Rack configuration for Rack based servers used to start the application.|
|
||||||
|db/|Contains your current database schema, as well as the database migrations.|
|
|db/|Contains your current database schema, as well as the database migrations.|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
* Add `bin/update` script to update development environment automatically.
|
||||||
|
|
||||||
|
*Mehmet Emin İNAÇ*
|
||||||
|
|
||||||
* Fix STATS_DIRECTORIES already defined warning when running rake from within
|
* Fix STATS_DIRECTORIES already defined warning when running rake from within
|
||||||
the top level directory of an engine that has a test app.
|
the top level directory of an engine that has a test app.
|
||||||
|
|
||||||
|
|
28
railties/lib/rails/generators/rails/app/templates/bin/update
Normal file
28
railties/lib/rails/generators/rails/app/templates/bin/update
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
require 'pathname'
|
||||||
|
require 'fileutils'
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
def system!(*args)
|
||||||
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
end
|
||||||
|
|
||||||
|
chdir APP_ROOT do
|
||||||
|
# This script is a way to update your development environment automatically.
|
||||||
|
# Add necessary update steps to this file.
|
||||||
|
|
||||||
|
puts '== Installing dependencies =='
|
||||||
|
system! 'gem install bundler --conservative'
|
||||||
|
system 'bundle check' or system! 'bundle install'
|
||||||
|
|
||||||
|
puts "\n== Updating database =="
|
||||||
|
system! 'bin/rake db:migrate'
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system! 'bin/rake log:clear tmp:clear'
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system! 'bin/rake restart'
|
||||||
|
end
|
Loading…
Reference in a new issue