capistrano-psw 1.0.0.pre12 → 1.0.0.pre13

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: 363463b138f875fc7626754ac596d5e6cf39e4fe
4
- data.tar.gz: 22fd679acbe117aac653c9ff405933bd231a8d6c
3
+ metadata.gz: 8f79ecd1499787fbc4d7676ef0b357bdfce0176a
4
+ data.tar.gz: c0abaf08ade68e50f8645e128bf406bf907eb714
5
5
  SHA512:
6
- metadata.gz: ce0046d799c1fe3ddd41b9ce85e9627a27592638e148fd002d9388eaa84311ab7bdcc4ff3da919970a85d1f50fcf1324b415ec4452da330326524f15de8ad892
7
- data.tar.gz: 02d308c7504564172526fb78fdfc1529f1994c8c10822af280ac74066827722d27f1e32952c7e9b253e34d571683fd4aec3211e7f63f5218f56293f6895d6d05
6
+ metadata.gz: 8ec32198aafcfda7a9fb8498055874c3248131c3a5707599fe2f65b095443443c346c13ad3ee4522c4c3fcbb6272ff112ff2ae6de54830ec6667a3ab1f62d0cf
7
+ data.tar.gz: 7ea38d71efefa1ccb50f4d7d51ff4f86e11b9e0edfc9bd32e5f6e5c6df1531dadcd89742b121f9fe9650d5aa377547d6147e616e1c52d0ddbc56f9e05fc75ab1
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Capistrano
12
12
  module Psw
13
- VERSION = "1.0.0.pre12"
13
+ VERSION = "1.0.0.pre13"
14
14
  end
15
15
  end
@@ -34,39 +34,59 @@
34
34
 
35
35
 
36
36
  namespace :psw_peppr do
37
+ desc 'Copy application enviroment files to remote machine'
37
38
  task :environment_files do
38
39
  on roles(:app) do |host|
39
40
  application_id = ENV['peppr_application_id'].to_i
40
41
  application_deployment = ENV['peppr_application_deployment_id'].to_i
41
- info "Got peppr application id #{application_id}" unless application_id == 0
42
- info "Got peppr application deployment id #{application_deployment}" unless application_deployment == 0
42
+ info "peppr_application_id: #{application_id}"
43
+ info "peppr_application_deployment: #{application_deployment}"
43
44
  if application_id > 0 and application_deployment > 0
44
- info "Preparing to upload environment files if applicable..."
45
+ info 'Preparing to upload environment files if applicable...'
46
+
45
47
  local_shared_files_path = "/tmp/peppr_deployments/applications/#{application_id}/deployments/#{application_deployment}/environments/#{fetch(:stage)}/shared_files"
46
48
 
47
- func_file_upload = lambda { |file|
48
- rel_file = "#{file.gsub("#{local_shared_files_path}", '')}"
49
- rel_file = rel_file[1..-1] if rel_file[0] == '/'
49
+ if File.exist? local_shared_files_path
50
+ info "Uploading environment files..."
51
+ files = Find.find(local_shared_files_path)
50
52
 
51
- if (fetch(:peppr_debug))
52
- debug "Inspecting: #{rel_file}"
53
- end
54
- if File.directory?(file)
55
- execute :mkdir, '-p', "#{shared_path}/#{rel_file}"
56
- elsif rel_file.gsub(/\s+/, '') != '' and rel_file != '.' and rel_file != '..'
57
- info "Uploading environment file #{rel_file}..."
58
- upload! "#{local_shared_files_path}/#{rel_file}", "#{shared_path}/#{rel_file}"
53
+ absolute_path_files, shared_files = files.partition { |f| f.start_with? "#{local_shared_files_path}/.absolute_paths" }
54
+
55
+ info 'uploading shared files'
56
+ shared_files.each do |file|
57
+ relative_path = file.gsub("#{local_shared_files_path}/", '')
58
+
59
+ debug "Inspecting: #{relative_path}" if fetch(:peppr_debug)
60
+
61
+ if File.directory?(file) && relative_path.strip != ''
62
+ execute :mkdir, '-p', "#{shared_path}/#{relative_path}"
63
+ elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
64
+ info "Uploading environment file #{relative_path}..."
65
+ upload! file, "#{shared_path}/#{relative_path}"
66
+ end
59
67
  end
60
- }
61
68
 
62
- if File.exist?(local_shared_files_path)
63
- info "Uploading environment files..."
64
- Find.find(local_shared_files_path).each &func_file_upload
69
+ info 'uploading absolute path files'
70
+ absolute_path_files.each do |file|
71
+ relative_path = file.gsub("#{local_shared_files_path}/.absolute_paths", '')
72
+
73
+ debug "Inspecting: #{relative_path}" if fetch(:peppr_debug)
74
+
75
+ if File.directory?(file) && relative_path.strip != ''
76
+ execute :mkdir, '-p', relative_path
77
+ elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
78
+ info "Uploading environment file #{relative_path}..."
79
+ upload! file, relative_path
80
+ end
81
+ end
82
+ else
83
+ info "The shared files path, #{local_shared_files_path} does not exist."
65
84
  end
66
85
  end
67
86
  end
68
87
  end
69
88
 
89
+ desc 'Delete shared files from remote machine'
70
90
  task :clear_shared_files do
71
91
  on roles(:app) do |host|
72
92
  info "Deleting shared folder ..."
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.pre12
4
+ version: 1.0.0.pre13
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-02-19 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler