factorylabs-fdlcap 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
+ .idea/
1
2
  pkg/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.20
1
+ 0.3.21
data/fdlcap.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fdlcap}
8
- s.version = "0.3.20"
8
+ s.version = "0.3.21"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Factory Design Labs"]
12
- s.date = %q{2009-09-16}
12
+ s.date = %q{2009-09-24}
13
13
  s.default_executable = %q{fdlcap}
14
14
  s.email = %q{interactive@factorylabs.com}
15
15
  s.executables = ["fdlcap"]
@@ -131,17 +131,41 @@ Capistrano::Configuration.instance(:must_exist).load do
131
131
  database = db_info["database"]
132
132
  tables = ENV['TABLES'] ? ENV['TABLES'].split(',').join(' ') : ''
133
133
  dump_file = "/tmp/#{database}.sql"
134
-
134
+
135
+ db_dump_found = false
136
+ run "if [ -f #{dump_file}.gz ]; then echo exists; else echo not_found; fi" do |channel, stream, data|
137
+ puts "Result: #{channel[:server]} -> #{dump_file}.gz ( #{data} )"
138
+ db_dump_found = data.strip == 'exists' ? true : false
139
+ break if stream == :err
140
+ end
141
+
135
142
  db_host = db_info["host"]
136
143
  host = ""
137
144
  host_arg = " -h #{db_host}" if db_host
138
- run "mysqldump -e -q --single-transaction \
145
+ db_dump_cmd = "mysqldump -e -q --single-transaction \
139
146
  -u #{db_info["username"]} --password=#{db_info["password"]} \
140
147
  #{host_arg} #{db_info["database"]} #{tables} | gzip > #{dump_file}.gz"
141
148
 
149
+ if db_dump_found
150
+ run "ls -l #{dump_file}.gz"
151
+ puts %{
152
+ ! INFO !: The remote database dump '#{dump_file}.gz' already exists
153
+
154
+ If you would like to use the existing database dump type "USE EXISTING":
155
+ }
156
+
157
+ if ($stdin.gets.strip != "USE EXISTING")
158
+ puts "Ignoring existing file and regenerating #{dump_file}.gz"
159
+ run db_dump_cmd
160
+ else
161
+ puts "You confirmed that you want to use the existing file [#{dump_file}.gz], here we go"
162
+ end
163
+ else
164
+ run db_dump_cmd
165
+ end
142
166
 
143
167
  get "#{dump_file}.gz", "#{dump_file}.gz"
144
- run "rm #{dump_file}.gz"
168
+ run "rm #{dump_file}.gz" unless ENV['LEAVE_ON_SERVER']
145
169
 
146
170
  target_env = ENV['LOCAL_ENV'] || "development"
147
171
  target_db_info = all_db_info[target_env]
@@ -1,17 +1,23 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
- define_recipe :delayed_job do
2
+ define_recipe :delayed_job do |*args|
3
+
4
+ options = args.empty? ? {} : args.first
5
+ prefix = options[:prefix] || 'dj'
6
+ set :dj_monit_prefix, prefix unless exists?(:dj_monit_prefix)
7
+
3
8
  namespace :delayed_job do
9
+
4
10
  desc "Start delayed_job"
5
11
  task :start, :only => {:delayed_job => true} do
6
- sudo "/usr/bin/monit start all -g dj_#{application}"
12
+ sudo "/usr/bin/monit start all -g #{dj_monit_prefix}_#{application}"
7
13
  end
8
14
  desc "Stop delayed_job"
9
15
  task :stop, :only => {:delayed_job => true} do
10
- sudo "/usr/bin/monit stop all -g dj_#{application}"
16
+ sudo "/usr/bin/monit stop all -g #{dj_monit_prefix}_#{application}"
11
17
  end
12
18
  desc "Restart delayed_job"
13
19
  task :restart, :only => {:delayed_job => true} do
14
- sudo "/usr/bin/monit restart all -g dj_#{application}"
20
+ sudo "/usr/bin/monit restart all -g #{dj_monit_prefix}_#{application}"
15
21
  end
16
22
  end
17
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factorylabs-fdlcap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Factory Design Labs
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-16 00:00:00 -07:00
12
+ date: 2009-09-24 00:00:00 -07:00
13
13
  default_executable: fdlcap
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency