Commit 2cd52b492a65b60723473748912110b24f05b29c

Authored by gitlabhq
2 parents a18924e9 0f6ebcb6

install & update

Gemfile.lock
... ... @@ -22,11 +22,20 @@ GIT
22 22  
23 23 GIT
24 24 remote: git://github.com/mbleigh/seed-fu.git
  25 +<<<<<<< HEAD
25 26 revision: 77be06852b18fb01e272ab763ddb292da575586c
26 27 specs:
27 28 seed-fu (2.1.0)
28 29 activerecord (~> 3.1.0)
29 30 activesupport (~> 3.1.0)
  31 +=======
  32 + revision: 29fe8c61ca6cc4408115ea7475fe2647081bd348
  33 + branch: rails-3-1
  34 + specs:
  35 + seed-fu (2.0.1.rails31)
  36 + activerecord (~> 3.1.0.rc4)
  37 + activesupport (~> 3.1.0.rc4)
  38 +>>>>>>> d3784687943e0bd699d73d82a6bc6cac39689473
30 39  
31 40 GEM
32 41 remote: http://rubygems.org/
... ...
app/views/commits/index.html.haml
... ... @@ -9,7 +9,10 @@
9 9 = select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
10 10 = text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url", "one_click_select"]
11 11 .clear
  12 +<<<<<<< HEAD
12 13 - if params[:path]
13 14 %h3{:style => "color:#555"} /#{params[:path]}
  15 +=======
  16 +>>>>>>> d3784687943e0bd699d73d82a6bc6cac39689473
14 17 %div{:id => dom_id(@project)}
15 18 = render "commits"
... ...
configure.rb
... ... @@ -1,5 +0,0 @@
1   -root_path = File.expand_path(File.dirname(__FILE__))
2   -require File.join(root_path, "install", "prepare")
3   -env = ARGV[0] || "development"
4   -
5   -Install.prepare(env)
install.rb 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +root_path = File.expand_path(File.dirname(__FILE__))
  2 +require File.join(root_path, "lib", "color")
  3 +include Color
  4 +
  5 +#
  6 +# ruby ./update.rb development # or test or production (default)
  7 +#
  8 +envs = ["production", "test", "development"]
  9 +env = if envs.include?(ARGV[0])
  10 + ARGV[0]
  11 + else
  12 + "production"
  13 + end
  14 +
  15 +puts green " == Install for ENV=#{env} ..."
  16 +
  17 +# pull from github
  18 +`git pull origin 1x`
  19 +
  20 +# bundle install
  21 +if env == "production"
  22 +`bundle install --without development test`
  23 +else
  24 +`bundle install`
  25 +end
  26 +
  27 +# migrate db
  28 +`bundle exec rake db:setup RAILS_ENV=#{env}`
  29 +`bundle exec rake db:seed_fu RAILS_ENV=#{env}`
  30 +
  31 +
  32 +puts green " == Done! Now you can start server"
... ...
install/prepare.rb
... ... @@ -1,51 +0,0 @@
1   -module Install
2   - class << self
3   - def prepare(env)
4   - puts green " == Starting for ENV=#{env} ..."
5   - puts "rvm detected" if is_rvm?
6   -
7   - bundler
8   - db(env)
9   -
10   - puts green " == Done! Now you can start server"
11   - end
12   -
13   - def bundler
14   - command 'gem install bundler'
15   - command 'bundle install'
16   - end
17   -
18   - def db(env)
19   - command "bundle exec rake db:setup RAILS_ENV=#{env}"
20   - command "bundle exec rake db:seed_fu RAILS_ENV=#{env}"
21   - end
22   -
23   - def is_rvm?
24   - `type rvm | head -1` =~ /^rvm is/
25   - end
26   -
27   - def colorize(text, color_code)
28   - "\033[#{color_code}#{text}\033[0m"
29   - end
30   -
31   - def red(text)
32   - colorize(text, "31m")
33   - end
34   -
35   - def green(text)
36   - colorize(text, "32m")
37   - end
38   -
39   - def command(string)
40   - `#{string}`
41   - if $?.to_i > 0
42   - puts red " == #{string} - FAIL"
43   - puts red " == Error during configure"
44   - exit
45   - else
46   - puts green " == #{string} - OK"
47   - end
48   - end
49   - end
50   -end
51   -
lib/color.rb 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +module Color
  2 + def colorize(text, color_code)
  3 + "\033[#{color_code}#{text}\033[0m"
  4 + end
  5 +
  6 + def red(text)
  7 + colorize(text, "31m")
  8 + end
  9 +
  10 + def green(text)
  11 + colorize(text, "32m")
  12 + end
  13 +
  14 + def command(string)
  15 + `#{string}`
  16 + if $?.to_i > 0
  17 + puts red " == #{string} - FAIL"
  18 + puts red " == Error during configure"
  19 + exit
  20 + else
  21 + puts green " == #{string} - OK"
  22 + end
  23 + end
  24 +end
  25 +
... ...
update.rb 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +root_path = File.expand_path(File.dirname(__FILE__))
  2 +require File.join(root_path, "lib", "color")
  3 +include Color
  4 +
  5 +#
  6 +# ruby ./update.rb development # or test or production (default)
  7 +#
  8 +envs = ["production", "test", "development"]
  9 +env = if envs.include?(ARGV[0])
  10 + ARGV[0]
  11 + else
  12 + "production"
  13 + end
  14 +
  15 +puts green " == Update for ENV=#{env} from 1x"
  16 +
  17 +# pull from github
  18 +`git pull origin 1x`
  19 +
  20 +# bundle install
  21 +if env == "production"
  22 +`bundle install --without development test`
  23 +else
  24 +`bundle install`
  25 +end
  26 +
  27 +# migrate db
  28 +`bundle exec rake db:migrate RAILS_ENV=#{env}`
  29 +
  30 +
  31 +puts green " == Done! Now you can start/restart server"
... ...