Commit f913b566 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

install & update

parents 9a198054 d3784687
......@@ -22,11 +22,20 @@ GIT
GIT
remote: git://github.com/mbleigh/seed-fu.git
<<<<<<< HEAD
revision: 77be06852b18fb01e272ab763ddb292da575586c
specs:
seed-fu (2.1.0)
activerecord (~> 3.1.0)
activesupport (~> 3.1.0)
=======
revision: 29fe8c61ca6cc4408115ea7475fe2647081bd348
branch: rails-3-1
specs:
seed-fu (2.0.1.rails31)
activerecord (~> 3.1.0.rc4)
activesupport (~> 3.1.0.rc4)
>>>>>>> d3784687943e0bd699d73d82a6bc6cac39689473
GEM
remote: http://rubygems.org/
......
......@@ -9,7 +9,10 @@
= select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url", "one_click_select"]
.clear
<<<<<<< HEAD
- if params[:path]
%h3{:style => "color:#555"} /#{params[:path]}
=======
>>>>>>> d3784687943e0bd699d73d82a6bc6cac39689473
%div{:id => dom_id(@project)}
= render "commits"
root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "install", "prepare")
env = ARGV[0] || "development"
Install.prepare(env)
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"
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
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
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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment