dew 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,3 @@
1
- # Monkey patch clamp to remove duplicate options from help
2
- module Clamp::Option::Declaration
3
- alias_method :non_uniq_documented_options, :documented_options
4
- def documented_options
5
- non_uniq_documented_options.uniq
6
- end
7
- end
8
-
9
-
10
1
  class DewBaseCommand < Clamp::Command
11
2
  def configure
12
3
  $debug = debug?
@@ -21,6 +21,7 @@ class DeployCommand < Clamp::Command
21
21
  option ['--ssl-private-key'], 'FILE', "SSL Private Key file"
22
22
  option ['--[no-]passenger'], :flag, "Use passenger (just server public/* if unset)", :default => true, :attribute_name => :use_passenger
23
23
  option ['--gamej-proxy'], 'GAMEJ_PROXY', "GameJ Reverse Proxy"
24
+ option ['--create-database'], :flag, "Create the database, even if this isn't the initial checkout", :default => false
24
25
 
25
26
  def check_and_remove_rvmrc
26
27
  if ssh.exist? "#{application_name}/.rvmrc"
@@ -42,11 +43,11 @@ class DeployCommand < Clamp::Command
42
43
  raise "--ssl-certificate required if SSL private key supplied" unless ssl_certificate
43
44
  raise "--ssl-certificate file #{ssl_certificate} does not exist" unless File.exist?(ssl_certificate)
44
45
  end
45
-
46
+
46
47
  env = Environment.get(environment_name)
47
-
48
+
48
49
  db_managed = false
49
-
50
+
50
51
  env.servers.each do |server|
51
52
  Inform.info("Working with server %{id} of %{l} servers", :id => server.id, :l => env.servers.length)
52
53
  env.remove_server_from_elb(server) if env.has_elb?
@@ -81,13 +82,13 @@ class DeployCommand < Clamp::Command
81
82
  check_and_remove_rvmrc unless is_redhat
82
83
  ssh.run "cd #{application_name}; git fetch -q"
83
84
  end
84
-
85
+
85
86
  check_and_remove_rvmrc unless is_redhat
86
87
  Inform.debug("Checking out version %{version}", :version => revision)
87
88
  ssh.run "cd #{application_name} && git checkout -q -f #{revision}"
88
89
  check_and_remove_rvmrc unless is_redhat
89
90
  end
90
-
91
+
91
92
  cd_and_rvm = "cd #{application_name} && . /usr/local/rvm/scripts/rvm && rvm use ruby-1.9.2 && RAILS_ENV=#{rails_env} "
92
93
  if is_redhat
93
94
  cd_and_rvm = "cd #{application_name} && RAILS_ENV=#{rails_env} "
@@ -97,10 +98,16 @@ class DeployCommand < Clamp::Command
97
98
  ssh.run cd_and_rvm + "bundle install --without development"
98
99
  end
99
100
 
101
+ if ssh.exist?("#{application_name}/config/database.dew.yml")
102
+ Inform.info("config/database.dew.yml found, linking to database.yml") do
103
+ ssh.run cd_and_rvm + "ln -sf database.dew.yml config/database.yml"
104
+ end
105
+ end
106
+
100
107
  if ssh.exist?("#{application_name}/config/database.yml")
101
108
  if !db_managed
102
109
  Inform.info("config/database.yml exists, creating and/or updating database") do
103
- if initial
110
+ if initial || create_database?
104
111
  Inform.debug("Creating database")
105
112
  ssh.run cd_and_rvm + "bundle exec rake db:create"
106
113
  end
@@ -105,7 +105,7 @@ class Environment
105
105
  end
106
106
 
107
107
  def add_server ami, size, keypair, groups, username
108
- Inform.info "Adding server using AMI %{ami} of size %{size}, keypair %{keypair} and security groups %{groups}",
108
+ Inform.info "Adding server using AMI %{ami} of size %{size}, keypair %{keypair} and security groups %{groups.join(',')}",
109
109
  :ami => ami, :size => size, :keypair => keypair, :groups => groups do
110
110
  server = Server.create!( ami, size, keypair, groups )
111
111
  server.add_tag('Environment', name)
@@ -1,3 +1,3 @@
1
1
  module Dew
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dew
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.7
5
+ version: 0.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - PlayUp Devops
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-18 00:00:00 Z
13
+ date: 2011-07-20 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: inform
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 0.2.0
34
+ version: 0.2.2
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency