kstrano 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/kumafy +20 -25
  2. data/lib/kstrano_symfony2.rb +25 -2
  3. metadata +4 -3
data/bin/kumafy CHANGED
@@ -142,40 +142,35 @@ def update_deploy_config(ui, base, context, force)
142
142
  end
143
143
 
144
144
  def update_symfony2(ui, base, context, force)
145
- build_dir = File.join(base, "build")
146
- web_dir = File.join(base, "web")
145
+ file = File.join(base, "build.xml")
146
+ write = true
147
147
 
148
- Dir.mkdir(build_dir) unless File.directory?(build_dir)
149
- Dir.mkdir(web_dir) unless File.directory?(web_dir)
150
-
151
- {
152
- File.join(base, "build.xml") => "#{context['recipe']}/build.xml",
153
- File.join(build_dir, "phpdox.xml") => "#{context['recipe']}/build.xml"
154
- }.each do |target_file, source_file|
155
- write = true
156
-
157
- if File.exists?(target_file)
158
- overwrite = ui.ask("The file #{target_file} already exists, do you want to override it? ") { |q| q.default = 'n' }
159
- if !overwrite.match(/^y/)
160
- write = false
161
- end
148
+ if File.exists?(file)
149
+ overwrite = ui.ask("The file #{file} already exists, do you want to override it? ") { |q| q.default = 'n' }
150
+ if !overwrite.match(/^y/)
151
+ write = false
162
152
  end
153
+ end
163
154
 
164
- if write
165
- build_file = read_resource_file("#{context['recipe']}/build.xml")
155
+ if write
156
+ build_file = read_resource_file("#{context['recipe']}/build.xml")
166
157
 
167
- context["app_name"] ||= ui.ask("What's the name of the application?")
168
- app_name = context["app_name"]
169
- build_file.gsub!(/(\<project\sname=)(\"\")/, '\1' + "\"#{app_name}\"")
158
+ context["app_name"] ||= ui.ask("What's the name of the application?")
159
+ app_name = context["app_name"]
160
+ build_file.gsub!(/(\<project\sname=)(\"\")/, '\1' + "\"#{app_name}\"")
170
161
 
171
- File.open(file, "w") do |f|
172
- build_file.each_line do |line|
173
- f.print line
174
- end
162
+ File.open(file, "w") do |f|
163
+ build_file.each_line do |line|
164
+ f.print line
175
165
  end
176
166
  end
177
167
  end
178
168
 
169
+ build_dir = File.join(base, "build")
170
+ web_dir = File.join(base, "web")
171
+ Dir.mkdir(build_dir) unless File.directory?(build_dir)
172
+ Dir.mkdir(web_dir) unless File.directory?(web_dir)
173
+
179
174
  copy_resources({
180
175
  File.join(build_dir, "phpcs.xml") => "#{context['recipe']}/phpcs.xml",
181
176
  File.join(build_dir, "phpmd.xml") => "#{context['recipe']}/phpmd.xml",
@@ -56,6 +56,28 @@ module KStrano
56
56
  sudo "pkill -QUIT -f \"^php-fpm: pool #{application} \" "
57
57
  end
58
58
  end
59
+
60
+ namespace :apc do
61
+ desc "Prepare for APC cache clear"
62
+ task :prepare_clear do
63
+ server_project_name = "#{server_name}"
64
+ if server_project_name.nil? || server_project_name.empty?
65
+ server_project_name = domain.split('.')[0]
66
+ end
67
+ sudo "sh -c 'if [ ! -f /home/projects/#{server_project_name}/site/apcclear.php ]; then curl https://raw.github.com/Kunstmaan/kStrano/master/resources/symfony2/apcclear.php > /home/projects/#{server_project_name}/site/apcclear.php; fi'"
68
+ sudo "chmod 777 /home/projects/#{server_project_name}/site/apcclear.php"
69
+ end
70
+
71
+ desc "Clear the APC cache"
72
+ task :clear do
73
+ hostname = "#{domain}"
74
+ server_project_name = "#{server_name}"
75
+ if !server_project_name.nil? && !server_project_name.empty?
76
+ hostname = "#{server_project_name}.#{hostname}"
77
+ end
78
+ sudo "curl http://#{hostname}/apcclear.php"
79
+ end
80
+ end
59
81
  end
60
82
 
61
83
  namespace :deploy do
@@ -130,8 +152,9 @@ module KStrano
130
152
  end
131
153
  end
132
154
 
133
- after "deploy:finalize_update", "kuma:fpm:graceful_restart"
134
- after "deploy:create_symlink", "kuma:fpm:graceful_restart"
155
+ before "deploy:finalize_update", "kuma:apc:prepare_clear"
156
+ after "deploy:finalize_update", "kuma:apc:clear", "kuma:fpm:graceful_restart"
157
+ after "deploy:create_symlink", "kuma:apc:clear", "kuma:fpm:graceful_restart"
135
158
 
136
159
  end
137
160
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kstrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
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: 2013-07-23 00:00:00.000000000 Z
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capifony
@@ -141,7 +141,8 @@ files:
141
141
  - resources/symfony2/phpunit.xml.dist
142
142
  - bin/kumafy
143
143
  homepage: https://github.com/Kunstmaan/kStrano
144
- licenses: []
144
+ licenses:
145
+ - MIT
145
146
  post_install_message:
146
147
  rdoc_options: []
147
148
  require_paths: