capistrano-psw 1.0.0.pre37 → 1.0.0.pre38
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97ed93489efaaaa150e01f7f4cf0e6640fe98c48
|
4
|
+
data.tar.gz: bb22c0367f1ed2b9c654f6decfca88d6f66f5044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d74fff8e564f71a1ecfaa1b7eedbb3c8d77bc92af5e1cc4e67caf6b1d6bb23d7983e804b634d4aff79c0d2f86ec8280d507818b0ebd254a5e71c2ada60c42523
|
7
|
+
data.tar.gz: e6ce5d9bda42f8857bca156d494352d3aae80398180c882db7c6c71b1156333987197b8255a2b2e8688aef1f40478313122c2371cf48be5fab6357b177aa6015
|
@@ -17,6 +17,14 @@ module PepprAppDeployFileUtils
|
|
17
17
|
PEPPR_RELATIVE_ENVIRONMENTS_DIR = "/environments"
|
18
18
|
PEPPR_RELATIVE_SHARED_FILE_DIR = "/shared_files"
|
19
19
|
PEPPR_RELATIVE_ARTIFACTS_DIR = "/artifacts"
|
20
|
+
|
21
|
+
def self.peppr_deployment?
|
22
|
+
application_id = ENV['peppr_application_id'].to_i
|
23
|
+
application_deployment = ENV['peppr_application_deployment_id'].to_i
|
24
|
+
return true if application_id > 0 && application_deployment > 0
|
25
|
+
|
26
|
+
false
|
27
|
+
end
|
20
28
|
|
21
29
|
module Local
|
22
30
|
# Method for verifying that Peppr's application deployment file structure exists on the
|
@@ -177,51 +177,55 @@ namespace :psw_peppr_app_deploy do
|
|
177
177
|
|
178
178
|
desc "Create symlinks for the current deployment environment files"
|
179
179
|
task :symlink_env_files do
|
180
|
-
on roles(:app) do |host|
|
181
|
-
info "Creating symlinks for environment files..."
|
182
|
-
local_shared_files_path = PepprAppDeployFileUtils::Local::get_deployment_shared_files_dir
|
183
|
-
remote_shared_files_path = PepprAppDeployFileUtils::Remote::get_deployment_shared_files_dir
|
184
180
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
181
|
+
#only try to symlink files if we are executing Capistrano from a peppr deployment
|
182
|
+
if PepprAppDeployFileUtils::peppr_deployment?
|
183
|
+
on roles(:app) do |host|
|
184
|
+
info "Creating symlinks for environment files..."
|
185
|
+
local_shared_files_path = PepprAppDeployFileUtils::Local::get_deployment_shared_files_dir
|
186
|
+
remote_shared_files_path = PepprAppDeployFileUtils::Remote::get_deployment_shared_files_dir
|
187
|
+
|
188
|
+
#this will only list the top-level folders and files, nested will show as a result of the link
|
189
|
+
if File.directory?(local_shared_files_path)
|
190
|
+
Dir.foreach(local_shared_files_path) do |file|
|
191
|
+
next if file == '.' || file == '..' || file == '.absolute_paths'
|
192
|
+
|
193
|
+
if File.directory?(file)
|
194
|
+
new_file_path = File.join(shared_path, file)
|
195
|
+
debug "Deleting existing environment file: #{new_file_path}"
|
196
|
+
sudo :rm, '-rf', new_file_path
|
197
|
+
|
198
|
+
debug "Creating a symlink for environment folder #{remote_shared_files_path}/#{file}..."
|
199
|
+
sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}"
|
200
|
+
else
|
201
|
+
new_file_path = File.join(shared_path, file)
|
202
|
+
debug "Deleting existing environment file: #{new_file_path}"
|
203
|
+
sudo :rm, '-rf', new_file_path
|
204
|
+
|
205
|
+
debug "Creating a symlink for environment file #{remote_shared_files_path}/#{file}..."
|
206
|
+
sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}/#{file}"
|
207
|
+
end
|
204
208
|
end
|
205
209
|
end
|
206
|
-
end
|
207
210
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
211
|
+
#absolute directories and files need to explicitly link files (can't just link to remote file folder)
|
212
|
+
if File.directory?("#{local_shared_files_path}/.absolute_paths")
|
213
|
+
files = Find.find(local_shared_files_path)
|
214
|
+
absolute_path_files, shared_files = files.partition { |f| f.start_with? "#{local_shared_files_path}/.absolute_paths" }
|
215
|
+
|
216
|
+
absolute_path_files.each do |file|
|
217
|
+
relative_path = file.gsub("#{local_shared_files_path}/.absolute_paths", '')
|
218
|
+
filename = Pathname.new(relative_path).basename
|
219
|
+
|
220
|
+
if File.directory?(file) && relative_path.strip != ''
|
221
|
+
#we need to create the directories because symlinks don't created nested folders
|
222
|
+
execute :mkdir, '-p', relative_path
|
223
|
+
elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
|
224
|
+
original_location = File.join(remote_shared_files_path, ".absolute_paths", relative_path)
|
225
|
+
debug "Creating a symlink from environment file #{original_location} to #{relative_path}..."
|
226
|
+
sudo :ln, '-sf', original_location, relative_path
|
227
|
+
end
|
228
|
+
end
|
225
229
|
end
|
226
230
|
end
|
227
231
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-psw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lexmark International Technology S.A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|