diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-08-06 22:40:16 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-08-06 22:40:16 -0300 |
commit | dcc478352219d778b9416f189bcad4a2f7f96cca (patch) | |
tree | fbceabdd913a6aeaccef3a12cb2a81e96fe957a1 /railties | |
parent | 8d897e5d949381b25ed1b2b8a66025c54b40cb7d (diff) | |
parent | c7375fd1625d592b2c342c8bc6092bc49d922f91 (diff) | |
download | rails-dcc478352219d778b9416f189bcad4a2f7f96cca.tar.gz rails-dcc478352219d778b9416f189bcad4a2f7f96cca.tar.bz2 rails-dcc478352219d778b9416f189bcad4a2f7f96cca.zip |
Merge pull request #20972 from vngrs/bin_update
Added bin/update script to update application automatically
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/bin/update | 28 |
2 files changed, 32 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 734fe8bc7a..0f1aab9839 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -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 the top level directory of an engine that has a test app. diff --git a/railties/lib/rails/generators/rails/app/templates/bin/update b/railties/lib/rails/generators/rails/app/templates/bin/update new file mode 100644 index 0000000000..9830e6b29a --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/bin/update @@ -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 |