capifony 2.1.11 → 2.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ == 2.1.12 / August 6, 2012
2
+
3
+ * Enable options for assets:install
4
+ * Looked for sf1 settings DB file instead of sf2 one
5
+ * Add ability to tail `dev|prod.log`
6
+ * Put remote tmp directory in a variable so that it can be overriden
7
+
1
8
  == 2.1.11 / July 20, 2012
2
9
 
3
10
  * Fix hard-coded "app" references
data/lib/capifony.rb CHANGED
@@ -7,6 +7,8 @@ set :symfony_env_prod, "prod"
7
7
  # PHP binary to execute
8
8
  set :php_bin, "php"
9
9
 
10
+ set :remote_tmp_dir, "/tmp"
11
+
10
12
  def prompt_with_default(var, default, &block)
11
13
  set(var) do
12
14
  Capistrano::CLI.ui.ask("#{var} [#{default}] : ", &block)
@@ -3,7 +3,7 @@ namespace :database do
3
3
  desc "Dump remote database"
4
4
  task :remote, :roles => :db, :only => { :primary => true } do
5
5
  filename = "#{application}.remote_dump.#{Time.now.strftime("%Y-%m-%d_%H-%M-%S")}.sql.gz"
6
- file = "/tmp/#{filename}"
6
+ file = "#{remote_tmp_dir}/#{filename}"
7
7
  sqlfile = "#{application}_dump.sql"
8
8
  config = ""
9
9
 
@@ -95,8 +95,8 @@ namespace :database do
95
95
 
96
96
  database.dump.local
97
97
 
98
- upload(file, "/tmp/#{filename}", :via => :scp)
99
- run "gunzip -c /tmp/#{filename} > /tmp/#{sqlfile}"
98
+ upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
99
+ run "gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
100
100
 
101
101
  run "cat #{shared_path}/config/databases.yml" do |ch, st, data|
102
102
  config = load_database_config data, symfony_env_prod
@@ -107,12 +107,12 @@ namespace :database do
107
107
 
108
108
  sql_import_cmd = generate_sql_command('import', config)
109
109
 
110
- run "#{sql_import_cmd} < /tmp/#{sqlfile}" do |ch, stream, data|
110
+ run "#{sql_import_cmd} < #{remote_tmp_dir}/#{sqlfile}" do |ch, stream, data|
111
111
  puts data
112
112
  end
113
113
 
114
- run "rm /tmp/#{filename}"
115
- run "rm /tmp/#{sqlfile}"
114
+ run "rm #{remote_tmp_dir}/#{filename}"
115
+ run "rm #{remote_tmp_dir}/#{sqlfile}"
116
116
  end
117
117
  end
118
118
  end
data/lib/symfony2.rb CHANGED
@@ -50,6 +50,8 @@ set :dump_assetic_assets, false
50
50
 
51
51
  # Assets install
52
52
  set :assets_install, true
53
+ set :assets_symlinks, false
54
+ set :assets_relative, false
53
55
 
54
56
  # Whether to update `assets_version` in `config.yml`
55
57
  set :update_assets_version, false
@@ -6,7 +6,7 @@ namespace :database do
6
6
  desc "Dumps remote database"
7
7
  task :remote, :roles => :db, :only => { :primary => true } do
8
8
  filename = "#{application}.remote_dump.#{Time.now.to_i}.sql.gz"
9
- file = "/tmp/#{filename}"
9
+ file = "#{remote_tmp_dir}/#{filename}"
10
10
  sqlfile = "#{application}_dump.sql"
11
11
  config = ""
12
12
 
@@ -101,26 +101,26 @@ namespace :database do
101
101
 
102
102
  database.dump.local
103
103
 
104
- upload(file, "/tmp/#{filename}", :via => :scp)
105
- run "gunzip -c /tmp/#{filename} > /tmp/#{sqlfile}"
104
+ upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
105
+ run "gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
106
106
 
107
- run "cat #{shared_path}/config/databases.yml" do |ch, st, data|
107
+ run "cat #{current_path}/#{app_path}/config/parameters.yml" do |ch, st, data|
108
108
  config = load_database_config data, symfony_env_prod
109
109
  end
110
110
 
111
111
  case config['database_driver']
112
112
  when "pdo_mysql", "mysql"
113
- run "mysql -u#{config['database_user']} --password='#{config['database_password']}' #{config['database_name']} < /tmp/#{sqlfile}" do |ch, stream, data|
113
+ run "mysql -u#{config['database_user']} --password='#{config['database_password']}' #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}" do |ch, stream, data|
114
114
  puts data
115
115
  end
116
116
  when "pdo_pgsql", "pgsql"
117
- run "psql -U #{config['database_user']} #{config['database_name']} < /tmp/#{sqlfile}" do |ch, stream, data|
117
+ run "psql -U #{config['database_user']} #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}" do |ch, stream, data|
118
118
  puts data
119
119
  end
120
120
  end
121
121
 
122
- run "rm /tmp/#{filename}"
123
- run "rm /tmp/#{sqlfile}"
122
+ run "rm #{remote_tmp_dir}/#{filename}"
123
+ run "rm #{remote_tmp_dir}/#{sqlfile}"
124
124
  end
125
125
  end
126
126
  end
@@ -6,6 +6,22 @@ namespace :symfony do
6
6
  stream "cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
7
7
  end
8
8
 
9
+ namespace :logs do
10
+ [:tail, :tail_dev].each do |action|
11
+ lines = ENV['lines'].nil? ? '50' : ENV['lines']
12
+ log = action.to_s == 'tail' ? 'prod.log' : 'dev.log'
13
+ desc "Tail #{log}"
14
+ task action, :roles => :app, :except => { :no_release => true } do
15
+ run "tail -n #{lines} -f #{shared_path}/#{log_path}/#{log}" do |channel, stream, data|
16
+ trap("INT") { puts 'Interupted'; exit 0; }
17
+ puts
18
+ puts "#{channel[:host]}: #{data}"
19
+ break if stream == :err
20
+ end
21
+ end
22
+ end
23
+ end
24
+
9
25
  namespace :assets do
10
26
  desc "Updates assets version (in config.yml)"
11
27
  task :update_version, :roles => :app, :except => { :no_release => true } do
@@ -16,7 +32,17 @@ namespace :symfony do
16
32
  task :install, :roles => :app, :except => { :no_release => true } do
17
33
  pretty_print "--> Installing bundle's assets"
18
34
 
19
- run "cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}"
35
+ install_options = ''
36
+
37
+ if true == assets_symlinks then
38
+ install_options += " --symlink"
39
+ end
40
+
41
+ if true == assets_relative then
42
+ install_options += " --relative"
43
+ end
44
+
45
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} #{install_options} --env=#{symfony_env_prod}"
20
46
  puts_ok
21
47
  end
22
48
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capifony
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 11
10
- version: 2.1.11
9
+ - 12
10
+ version: 2.1.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantin Kudryashov
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-07-20 00:00:00 Z
19
+ date: 2012-08-06 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: capistrano