-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
100 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
root_path = File.expand_path(File.dirname(__FILE__)) | ||
require File.join(root_path, "lib", "color") | ||
include Color | ||
|
||
# | ||
# ruby ./update.rb development # or test or production (default) | ||
# | ||
envs = ["production", "test", "development"] | ||
env = if envs.include?(ARGV[0]) | ||
ARGV[0] | ||
else | ||
"production" | ||
end | ||
|
||
puts green " == Install for ENV=#{env} ..." | ||
|
||
# pull from github | ||
`git pull origin 1x` | ||
|
||
# bundle install | ||
if env == "production" | ||
`bundle install --without development test` | ||
else | ||
`bundle install` | ||
end | ||
|
||
# migrate db | ||
`bundle exec rake db:setup RAILS_ENV=#{env}` | ||
`bundle exec rake db:seed_fu RAILS_ENV=#{env}` | ||
|
||
|
||
puts green " == Done! Now you can start server" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Color | ||
def colorize(text, color_code) | ||
"\033[#{color_code}#{text}\033[0m" | ||
end | ||
|
||
def red(text) | ||
colorize(text, "31m") | ||
end | ||
|
||
def green(text) | ||
colorize(text, "32m") | ||
end | ||
|
||
def command(string) | ||
`#{string}` | ||
if $?.to_i > 0 | ||
puts red " == #{string} - FAIL" | ||
puts red " == Error during configure" | ||
exit | ||
else | ||
puts green " == #{string} - OK" | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
root_path = File.expand_path(File.dirname(__FILE__)) | ||
require File.join(root_path, "lib", "color") | ||
include Color | ||
|
||
# | ||
# ruby ./update.rb development # or test or production (default) | ||
# | ||
envs = ["production", "test", "development"] | ||
env = if envs.include?(ARGV[0]) | ||
ARGV[0] | ||
else | ||
"production" | ||
end | ||
|
||
puts green " == Update for ENV=#{env} from 1x" | ||
|
||
# pull from github | ||
`git pull origin 1x` | ||
|
||
# bundle install | ||
if env == "production" | ||
`bundle install --without development test` | ||
else | ||
`bundle install` | ||
end | ||
|
||
# migrate db | ||
`bundle exec rake db:migrate RAILS_ENV=#{env}` | ||
|
||
|
||
puts green " == Done! Now you can start/restart server" |