capobvious 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,11 +19,13 @@ Capistrano::Configuration.instance.load do
19
19
 
20
20
  set :unicorn_init, "unicorn_#{application}"
21
21
 
22
- run_local_psql = if `uname -a`.include?("Darwin")
23
- "psql -h localhost -U postgres"
24
- else
25
- "#{sudo} -u postgres psql"
26
- end
22
+ psql = "psql -h localhost"
23
+ psql_postgres = "#{psql} -U postgres"
24
+
25
+ # psql_postgre = if `uname -a`.include?("Darwin")
26
+ # else
27
+ # "#{sudo} -u postgres psql"
28
+ # end
27
29
 
28
30
  database_yml_path = "config/database.yml"
29
31
 
@@ -44,7 +46,7 @@ Capistrano::Configuration.instance.load do
44
46
  local_rails_env = 'development'
45
47
  local_adapter = config[local_rails_env]["adapter"]
46
48
  local_database = config[local_rails_env]["database"]
47
- local_db_username = config[local_rails_env]["username"]
49
+ local_db_username = config[local_rails_env]["username"]||`whoami`.chop
48
50
  local_db_password = config[local_rails_env]["password"]
49
51
 
50
52
 
@@ -97,6 +99,18 @@ Capistrano::Configuration.instance.load do
97
99
  end
98
100
  end
99
101
 
102
+ namespace :delayed_job do
103
+ desc 'Start the delayed_job process'
104
+ task :start, :roles => :app do
105
+ run "cd #{current_path} && RAILS_ENV=#{rails_env} script/delayed_job start"
106
+ end
107
+ desc "Restart the delayed_job process"
108
+ task :restart, :roles => :app do
109
+ logger.important 'Restarting delayed_job process'
110
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job restart"
111
+ end
112
+ end
113
+
100
114
  after "deploy:update_code", "create:dbconf"
101
115
  namespace :create do
102
116
  task :files do
@@ -135,6 +149,9 @@ Capistrano::Configuration.instance.load do
135
149
  if exists?(:auto_migrate) && fetch(:auto_migrate) == true
136
150
  db.migrate
137
151
  end
152
+ if exists?(:delayed_job) && fetch(:delayed_job) == true
153
+ delayed_job.restart
154
+ end
138
155
  end
139
156
  task :prepare do
140
157
  db.create
@@ -170,11 +187,11 @@ Capistrano::Configuration.instance.load do
170
187
  file_name = "#{db_file_name}.#{db_archive_ext}"
171
188
  file_path = "#{local_folder_path}/#{file_name}"
172
189
  system "cd #{local_folder_path} && #{arch_extract} #{file_name}"
173
- system "echo \"drop database #{local_database}\" | #{run_local_psql}"
174
- system "echo \"create database #{local_database} owner #{local_db_username};\" | #{run_local_psql}"
175
- # system "#{run_local_psql} #{local_database} < #{local_folder_path}/#{db_file_name}"
190
+ system "echo \"drop database IF EXISTS #{local_database}\" | #{psql_postgres}"
191
+ system "echo \"create database #{local_database} owner #{local_db_username};\" | #{psql_postgres}"
192
+ # system "#{psql_postgre} #{local_database} < #{local_folder_path}/#{db_file_name}"
176
193
  puts "ENTER your development password: #{local_db_password}"
177
- system "#{run_local_psql} -U#{local_db_username} #{local_database} < #{local_folder_path}/#{db_file_name}"
194
+ system "#{psql} -U#{local_db_username} #{local_database} < #{local_folder_path}/#{db_file_name}"
178
195
  system "rm #{local_folder_path}/#{db_file_name}"
179
196
  end
180
197
  task :pg_import do
@@ -1,3 +1,3 @@
1
1
  module Capobvious
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capobvious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project: capobvious
82
- rubygems_version: 1.8.24
82
+ rubygems_version: 1.8.23
83
83
  signing_key:
84
84
  specification_version: 3
85
85
  summary: Cap recipes