capifony 2.8.3 → 2.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,15 @@
1
+ ### 2.8.4 / April 13, 2015
2
+
3
+ * Fixed: update_assets_version by date of last modified file
4
+ * Fixed: replace latest_release with current_path and write tests
5
+
6
+ *Important:* http://williamdurand.fr/2015/04/11/on-capifony-and-its-future/
7
+
1
8
  ### 2.8.3 / December 17, 2014
2
9
 
3
- Fixed: rollback using the sudo context if available.
4
- Fixed: support for hosts other then localhost when using `database:copy:to_local`
5
- Fixed: revert "Recreated composer autoload after `deploy:rollback`
10
+ * Fixed: rollback using the sudo context if available.
11
+ * Fixed: support for hosts other then localhost when using `database:copy:to_local`
12
+ * Fixed: revert "Recreated composer autoload after `deploy:rollback`
6
13
 
7
14
  ### 2.8.2 / October 7, 2014
8
15
 
data/README.md CHANGED
@@ -1,3 +1,15 @@
1
+ #### Hi! This is your captain speaking.
2
+
3
+ #### **Capifony** is based on *Capistrano v2.x* and will stick to this version (i.e. Capifony is feature-frozen, and will only accept bug fixes).
4
+
5
+ #### At the time of writing, [*Capistrano v3*](http://capistranorb.com/) is the current major version, and *Capifony is not compatible* with it.
6
+
7
+ #### Don't worry, there is a plugin for that! Using *Capistrano v3* + [*capistrano/symfony*](https://github.com/capistrano/symfony) (heavily inspired by *Capifony*) may be the way to go for new projects! You can [read more on capifony and its future](http://williamdurand.fr/2015/04/11/on-capifony-and-its-future/).
8
+
9
+ #### Cheers!
10
+
11
+ ---
12
+
1
13
  Capifony
2
14
  ========
3
15
 
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  symfony_version = nil
7
7
  symfony_app_path = 'app'
8
- capifony_version = '2.8.3'
8
+ capifony_version = '2.8.4'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -95,9 +95,12 @@ module Capifony
95
95
  set :assets_relative, false
96
96
  set :assets_install_path, web_path
97
97
 
98
- # Whether to update `assets_version` in `config.yml`
98
+ # Whether to update `assets_version` parameter in `assets_version.yml`
99
99
  set :update_assets_version, false
100
100
 
101
+ # Whether to normalize assets timestamps
102
+ set :normalize_asset_timestamps, false
103
+
101
104
  # Need to clear *_dev controllers
102
105
  set :clear_controllers, true
103
106
 
@@ -282,7 +285,11 @@ module Capifony
282
285
 
283
286
  after "deploy:finalize_update" do
284
287
  if update_assets_version
285
- symfony.assets.update_version # Update `assets_version`
288
+ symfony.assets.update_version
289
+ end
290
+
291
+ if normalize_asset_timestamps
292
+ symfony.assets.normalize_timestamps
286
293
  end
287
294
 
288
295
  if use_composer && !use_composer_tmp
@@ -105,20 +105,6 @@ namespace :deploy do
105
105
  capifony_puts_ok
106
106
 
107
107
  share_childs
108
-
109
- if fetch(:normalize_asset_timestamps, true)
110
- stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
111
- asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
112
-
113
- if asset_paths.chomp.empty?
114
- puts " No asset paths found, skipped".yellow
115
- else
116
- capifony_pretty_print "--> Normalizing asset timestamps"
117
-
118
- run "#{try_sudo} find #{asset_paths} -exec touch -t #{stamp} {} ';' &> /dev/null || true", :env => { "TZ" => "UTC" }
119
- capifony_puts_ok
120
- end
121
- end
122
108
  end
123
109
 
124
110
  desc <<-DESC
@@ -25,12 +25,38 @@ namespace :symfony do
25
25
  end
26
26
 
27
27
  namespace :assets do
28
- desc "Updates assets version (in config.yml)"
28
+ desc "Creates a config file (assets_version.yml) withe latest asset version"
29
29
  task :update_version, :roles => :app, :except => { :no_release => true } do
30
- capifony_pretty_print "--> Updating assets version (in config.yml)"
30
+ capifony_pretty_print "--> Updating `assets_version`"
31
+ asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
31
32
 
32
- run "#{try_sudo} sed -i 's/\\(assets_version:[ ]*\\)\\([a-zA-Z0-9_~]*\\)\\(.*\\)$/\\1#{real_revision.to_s[0,7]}\\3/g' #{latest_release}/#{app_config_path}/config.yml"
33
- capifony_puts_ok
33
+ if asset_paths.chomp.empty?
34
+ puts " No asset paths found, skipped".yellow
35
+ else
36
+ assets_version = capture("find #{asset_paths} -type f -printf '%Ts\\n' | sort -n | tail -1")
37
+ assets_version = assets_version.to_i.to_s(36)
38
+ puts " Latest assets version: (#{assets_version})"
39
+
40
+ file_path = "#{latest_release}/#{app_config_path}/assets_version.yml"
41
+ file_content = "parameters:\\n assets_version: #{assets_version}"
42
+ run "echo '#{file_content}' | #{try_sudo} tee #{file_path}"
43
+ capifony_puts_ok
44
+ end
45
+ end
46
+
47
+ desc "Normalizes assets timestamps"
48
+ task :normalize_timestamps, :roles => :app, :except => { :no_release => true } do
49
+ stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
50
+ asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
51
+
52
+ if asset_paths.chomp.empty?
53
+ puts " No asset paths found, skipped".yellow
54
+ else
55
+ capifony_pretty_print "--> Normalizing asset timestamps"
56
+
57
+ run "#{try_sudo} find #{asset_paths} -exec touch -t #{stamp} {} ';' &> /dev/null || true", :env => { "TZ" => "UTC" }
58
+ capifony_puts_ok
59
+ end
34
60
  end
35
61
 
36
62
  desc "Installs bundle's assets"
@@ -1,5 +1,6 @@
1
1
  namespace :deploy do
2
2
  namespace :web do
3
+
3
4
  desc <<-DESC
4
5
  Present a maintenance page to visitors. Disables your application's web \
5
6
  interface by writing a "#{maintenance_basename}.html" file to each web server. The \
@@ -43,14 +44,18 @@ namespace :deploy do
43
44
  DESC
44
45
  task :disable, :roles => :web, :except => { :no_release => true } do
45
46
  require 'erb'
46
- on_rollback { run "rm #{latest_release}/#{web_path}/#{maintenance_basename}.html" }
47
+ maintenance_file_path = "#{current_path}/#{web_path}/#{maintenance_basename}.html"
48
+ on_rollback { run "rm #{maintenance_file_path}" }
47
49
 
48
50
  reason = ENV['REASON']
49
51
  deadline = ENV['UNTIL']
50
52
  template = File.read(maintenance_template_path)
51
53
  result = ERB.new(template).result(binding)
52
54
 
53
- put result, "#{latest_release}/#{web_path}/#{maintenance_basename}.html", :mode => 0644
55
+ file = File.new(maintenance_file_path, "w")
56
+ file.syswrite(result)
57
+ file.chmod(0644)
58
+ file.close
54
59
  end
55
60
 
56
61
  desc <<-DESC
@@ -60,7 +65,8 @@ namespace :deploy do
60
65
  web-accessible again.
61
66
  DESC
62
67
  task :enable, :roles => :web, :except => { :no_release => true } do
63
- run "#{try_sudo} rm -f #{latest_release}/#{web_path}/#{maintenance_basename}.html"
68
+ maintenance_file_path = "#{current_path}/#{web_path}/#{maintenance_basename}.html"
69
+ run "#{try_sudo} rm -f #{maintenance_file_path}"
64
70
  end
65
71
  end
66
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capifony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.3
4
+ version: 2.8.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-17 00:00:00.000000000 Z
13
+ date: 2015-04-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano