Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-17 19:45:31 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-17 19:45:31 +0400
commitadd45eb8fb49c8f6d1bd111d499c9e31fb4cd796 (patch)
tree9015239d2b0768468a415810efcfa2849066e3bd
parenta953e45936c25c44c74ce78a84907c2dfe07c243 (diff)
update.rb
-rw-r--r--lib/color.rb4
-rw-r--r--update.rb28
2 files changed, 27 insertions, 5 deletions
diff --git a/lib/color.rb b/lib/color.rb
index d5500aca8e2..23feecf4071 100644
--- a/lib/color.rb
+++ b/lib/color.rb
@@ -11,6 +11,10 @@ module Color
colorize(text, "32m")
end
+ def yellow(text)
+ colorize(text, "93m")
+ end
+
def command(string)
`#{string}`
if $?.to_i > 0
diff --git a/update.rb b/update.rb
index d7eec2898b2..dccb7df3699 100644
--- a/update.rb
+++ b/update.rb
@@ -2,6 +2,10 @@ root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "lib", "color")
include Color
+def version
+ File.read("VERSION")
+end
+
#
# ruby ./update.rb development # or test or production (default)
#
@@ -12,15 +16,29 @@ env = if envs.include?(ARGV[0])
"production"
end
-puts green " == Update for ENV=#{env}"
+puts yellow "== RAILS ENV | #{env}"
+current_version = version
+puts yellow "Your version is #{current_version}"
+puts yellow "Check for new version: $ git pull origin"
+`git pull origin` # pull from origin
-# pull from github
-`git pull`
+# latest version
+if version == current_version
+ puts yellow "You have a latest version"
+else
+ puts green "Update to #{version}"
`bundle install`
-# migrate db
+ # migrate db
+if env == "development"
+`bundle exec rake db:migrate RAILS_ENV=development`
+`bundle exec rake db:migrate RAILS_ENV=test`
+else
`bundle exec rake db:migrate RAILS_ENV=#{env}`
+end
+
+ puts green "== Done! Now you can start/restart server"
+end
-puts green " == Done! Now you can start/restart server"