capistrano-psw 1.0.0.pre37 → 1.0.0.pre38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: faeed6aa6953cfd8e283a5c2a446b5329f992274
4
- data.tar.gz: 1e302fd93ba0a9a7596d33f9f3677c57bf68a16f
3
+ metadata.gz: 97ed93489efaaaa150e01f7f4cf0e6640fe98c48
4
+ data.tar.gz: bb22c0367f1ed2b9c654f6decfca88d6f66f5044
5
5
  SHA512:
6
- metadata.gz: 894eb4b01112fbaaef6c185801f8ce684306af7e58b51e82db54146b6ab27d41b54392db16c44162c48fe3c91baffc2d27fb14dc8b19a73b950466dc4e7129d3
7
- data.tar.gz: 386448357886b992ad160169bb46cd4947107aab7b1e52f735f99bb961d53f0227c67caf530d83f9961e2efc9677ed8edce3214ccad05601da349dd436ffb561
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
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Capistrano
12
12
  module Psw
13
- VERSION = "1.0.0.pre37"
13
+ VERSION = "1.0.0.pre38"
14
14
  end
15
15
  end
@@ -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
- #this will only list the top-level folders and files, nested will show as a result of the link
186
- if File.directory?(local_shared_files_path)
187
- Dir.foreach(local_shared_files_path) do |file|
188
- next if file == '.' || file == '..' || file == '.absolute_paths'
189
-
190
- if File.directory?(file)
191
- new_file_path = File.join(shared_path, file)
192
- debug "Deleting existing environment file: #{new_file_path}"
193
- sudo :rm, '-rf', new_file_path
194
-
195
- debug "Creating a symlink for environment folder #{remote_shared_files_path}/#{file}..."
196
- sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}"
197
- else
198
- new_file_path = File.join(shared_path, file)
199
- debug "Deleting existing environment file: #{new_file_path}"
200
- sudo :rm, '-rf', new_file_path
201
-
202
- debug "Creating a symlink for environment file #{remote_shared_files_path}/#{file}..."
203
- sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}/#{file}"
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
- #absolute directories and files need to explicitly link files (can't just link to remote file folder)
209
- if File.directory?("#{local_shared_files_path}/.absolute_paths")
210
- files = Find.find(local_shared_files_path)
211
- absolute_path_files, shared_files = files.partition { |f| f.start_with? "#{local_shared_files_path}/.absolute_paths" }
212
-
213
- absolute_path_files.each do |file|
214
- relative_path = file.gsub("#{local_shared_files_path}/.absolute_paths", '')
215
- filename = Pathname.new(relative_path).basename
216
-
217
- if File.directory?(file) && relative_path.strip != ''
218
- #we need to create the directories because symlinks don't created nested folders
219
- execute :mkdir, '-p', relative_path
220
- elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
221
- original_location = File.join(remote_shared_files_path, ".absolute_paths", relative_path)
222
- debug "Creating a symlink from environment file #{original_location} to #{relative_path}..."
223
- sudo :ln, '-sf', original_location, relative_path
224
- end
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.pre37
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-28 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler