Last active
March 9, 2018 00:25
-
-
Save sveinn/70c9ac9920b74f12991a0d9b244d78a6 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
merge_type = ARGV[0] | |
REGULAR_MERGE = '0' | |
SQUASH_MERGE = '1' | |
PROPERTY_DIR = File.expand_path('../../apps/property') | |
def bundle_install_if_needed | |
no_action_required = system 'echo $PWD ; bundle check', chdir: PROPERTY_DIR | |
unless no_action_required | |
say 'bundle installing..' | |
# bundle_cmd = 'bundle install > /dev/null 2>&1' | |
bundle_cmd = 'bundle install' | |
system bundle_cmd, chdir: PROPERTY_DIR | |
end | |
end | |
def migrate_if_needed | |
no_action_required = system 'rake db:abort_if_pending_migrations', chdir: PROPERTY_DIR | |
if no_action_required | |
say 'migrate not necessary' | |
else | |
say 'migrating..' | |
#rake_cmd = 'rake db:migrate ; RAILS_ENV=test rake db:migrate > /dev/null 2>&1' | |
rake_cmd = 'rake db:migrate ; RAILS_ENV=test rake db:migrate' | |
system rake_cmd, chdir: PROPERTY_DIR | |
end | |
end | |
def say(msg) | |
puts "#{__FILE__}: " + msg | |
end | |
if (REGULAR_MERGE) # GIT PULL | |
bundle_install_if_needed | |
migrate_if_needed | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment