install & update
This commit is contained in:
commit
2cd52b492a
7 changed files with 100 additions and 56 deletions
|
@ -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"
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
root_path = File.expand_path(File.dirname(__FILE__))
|
||||
require File.join(root_path, "install", "prepare")
|
||||
env = ARGV[0] || "development"
|
||||
|
||||
Install.prepare(env)
|
32
install.rb
Normal file
32
install.rb
Normal file
|
@ -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"
|
|
@ -1,51 +0,0 @@
|
|||
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
|
||||
|
25
lib/color.rb
Normal file
25
lib/color.rb
Normal file
|
@ -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
|
||||
|
31
update.rb
Normal file
31
update.rb
Normal file
|
@ -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"
|
Loading…
Reference in a new issue