diff options
author | gitlabhq <m@gitlabhq.com> | 2011-10-09 00:36:38 +0300 |
---|---|---|
committer | gitlabhq <m@gitlabhq.com> | 2011-10-09 00:36:38 +0300 |
commit | 9ba1224867665844b117fa037e1465bb706b3685 (patch) | |
tree | 52fbfc1cdb55df21843965479c97be0c91121a9a /install/prepare.rb | |
parent | 93efff945215a4407afcaf0cba15ac601b56df0d (diff) | |
download | gitlab-ce-9ba1224867665844b117fa037e1465bb706b3685.tar.gz |
init commit
Diffstat (limited to 'install/prepare.rb')
-rw-r--r-- | install/prepare.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/install/prepare.rb b/install/prepare.rb new file mode 100644 index 00000000000..f85c01a01ec --- /dev/null +++ b/install/prepare.rb @@ -0,0 +1,51 @@ +module Install + class << self + def prepare(env) + puts green " == Starting for ENV=#{env} ..." + puts "rvm detected" if is_rvm? + + bundler + db(env) + + puts green " == Done! Now you can start server" + end + + def bundler + command 'gem install bundler' + command 'bundle install' + end + + def db(env) + command "bundle exec rake db:setup RAILS_ENV=#{env}" + command "bundle exec rake db:seed_fu RAILS_ENV=#{env}" + end + + def is_rvm? + `type rvm | head -1` =~ /^rvm is/ + end + + 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 +end + |