summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2021-12-16 18:44:23 +0100
committerHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2022-09-15 09:51:34 +0200
commit8b7cb6b761741a201044be076bd75eb0e28566b9 (patch)
tree50fa91b4f89cc36a24702dd5e2e69d473454b242 /bin
parent9e9bc737baab9a78f5bfa7be152ca4726508708b (diff)
downloadecs-8b7cb6b761741a201044be076bd75eb0e28566b9.tar.gz
ecs-8b7cb6b761741a201044be076bd75eb0e28566b9.zip
WIP: Rails 5
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rails2
-rwxr-xr-xbin/setup34
-rwxr-xr-xbin/update29
3 files changed, 64 insertions, 1 deletions
diff --git a/bin/rails b/bin/rails
index 5191e69..0739660 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..e620b4d
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+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 starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/update b/bin/update
new file mode 100755
index 0000000..a8e4462
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+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') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end