diff --git a/Gemfile.lock b/Gemfile.lock index c02ad3cd..88d2a84f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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/ diff --git a/app/views/commits/index.html.haml b/app/views/commits/index.html.haml index 0e231e4e..ea08be4b 100644 --- a/app/views/commits/index.html.haml +++ b/app/views/commits/index.html.haml @@ -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" diff --git a/configure.rb b/configure.rb deleted file mode 100644 index 27bad806..00000000 --- a/configure.rb +++ /dev/null @@ -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) diff --git a/install.rb b/install.rb new file mode 100644 index 00000000..5c7dfddb --- /dev/null +++ b/install.rb @@ -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" diff --git a/install/prepare.rb b/install/prepare.rb deleted file mode 100644 index f85c01a0..00000000 --- a/install/prepare.rb +++ /dev/null @@ -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 - diff --git a/lib/color.rb b/lib/color.rb new file mode 100644 index 00000000..d5500aca --- /dev/null +++ b/lib/color.rb @@ -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 + diff --git a/update.rb b/update.rb new file mode 100644 index 00000000..f41c3617 --- /dev/null +++ b/update.rb @@ -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"