capistrano-psw 1.0.0.pre33 → 1.0.0.pre34

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: 9a6bb05a51b8f52e1d0794467c9f899642d06359
4
- data.tar.gz: 3ef12e185ea7a4dca4a15e4a7d472c8e6c37154b
3
+ metadata.gz: c6b61dbaec2f8f0cac76941f3095074c3404a71e
4
+ data.tar.gz: 66e72333aea714660f5981c32d3067fd35d3c8a4
5
5
  SHA512:
6
- metadata.gz: d0deda336d97eb31dc1020954c9b464a5a3d16bc69059a55089c5b419efff15d9fe55f4d894f9ed64404b62c33518b5c326586dbfbd32b190fb261800e6b0b37
7
- data.tar.gz: 79a7d0e87ad864eaf211f70fa10ef6a5fc7682157346efb21d781d11f158b5479c30606f3014c5de52ee6b6bc8cbf0ffc7b2499e9c63f97fa755b99ac7bb2f9e
6
+ metadata.gz: ed260af184c0e90f492174ed77be814987b9e6f3100650bf01c192ee9ec6a7312c32b11cfeb97cc5ffd9266a351eede23ff6428be234a98610ef1533e70cf6e9
7
+ data.tar.gz: b7b6221258d8282f0e9a7187cdabb23f8acd8704098e812dee3557ce8079d38cfea0d3f1029c7eb6a51a138b61976b14f4187bc2b8da781129f632a91094a8df
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Capistrano
12
12
  module Psw
13
- VERSION = "1.0.0.pre33"
13
+ VERSION = "1.0.0.pre34"
14
14
  end
15
15
  end
@@ -76,55 +76,85 @@ namespace :psw_peppr_app_deploy do
76
76
  end
77
77
  end
78
78
 
79
+ desc 'Packer Gems locally so they can be pushed to the remote host'
80
+ task :pack_gems do
81
+ pack_gems = fetch(:psw_peppr_app_deploy_pack_gems)
82
+ puts "pack_gems: #{pack_gems}"
83
+ if !pack_gems.nil? && pack_gems
84
+ on roles(:app) do |host|
85
+ info "Packing local Gems for deploy to host #{host}..."
86
+ end
87
+
88
+ local_shared_files_path = PepprAppDeployFileUtils::Local::get_deployment_shared_files_dir
89
+
90
+ Bundler.with_clean_env do
91
+ run_locally do
92
+ cmd = "bundle install --gemfile Gemfile --path vendor/bundle --without development test --deployment --quiet"
93
+ info "Executing install command: #{cmd}"
94
+ execute(cmd)
95
+ cmd = "bundle package --all"
96
+ info "Executing bundle package command: #{cmd}"
97
+ execute(cmd)
98
+
99
+ cmd = "mv vendor/ #{local_shared_files_path}"
100
+ info "Executing move command: #{cmd}"
101
+ execute(cmd)
102
+
103
+ cmd = "mv Gemfile.lock #{local_shared_files_path}"
104
+ info "Executing move command: #{cmd}"
105
+ execute(cmd)
106
+ end
107
+ end
108
+ else
109
+ on roles(:app) do |host|
110
+ info "Peppr will not send local Gems to remote host #{host}"
111
+ end
112
+ end
113
+ end
114
+
79
115
  desc 'Copy application enviroment files to remote machine'
80
116
  task :upload_environment_files do
81
- on roles(:app) do |host|
117
+ on roles(:app) do |host|
82
118
  info 'Preparing to upload environment files (if applicable)...'
83
119
  local_shared_files_path = PepprAppDeployFileUtils::Local::get_deployment_shared_files_dir
120
+ remote_shared_files_path = PepprAppDeployFileUtils::Remote::get_deployment_shared_files_dir
121
+
122
+ info "Uploading #{local_shared_files_path} (local) to #{remote_shared_files_path} on remote server #{host}..."
123
+ PepprAppDeployFileUtils::upload_compressed_local_dir(local_shared_files_path, remote_shared_files_path)
124
+
125
+ #this will only list the top-level folders and files, nested will show as a result of the link
126
+ if File.directory?(local_shared_files_path)
127
+ Dir.foreach(local_shared_files_path) do |file|
128
+ next if file == '.' || file == '..' || file == '.absolute_paths'
129
+
130
+ if File.directory?(file)
131
+ debug "Creating a symlink for environment folder #{remote_shared_files_path}/#{file}..."
132
+ sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}"
133
+ else
134
+ debug "Creating a symlink for environment file #{remote_shared_files_path}/#{file}..."
135
+ sudo :ln, '-sf', "#{remote_shared_files_path}/#{file}", "#{shared_path}/#{file}"
136
+ end
137
+ end
138
+ end
84
139
 
85
- if File.exist? local_shared_files_path
86
- info "Uploading environment files from #{local_shared_files_path}..."
140
+ #absolute directories and files need to explicitly link files (can't just link to remote file folder)
141
+ if File.directory?("#{local_shared_files_path}/.absolute_paths")
87
142
  files = Find.find(local_shared_files_path)
88
-
89
143
  absolute_path_files, shared_files = files.partition { |f| f.start_with? "#{local_shared_files_path}/.absolute_paths" }
90
144
 
91
- if shared_files.nil?
92
- info "Uploading #{shared_files.size} relative shared directory environment files..."
93
- else
94
- info "There are no relative shared directory environment files to upload."
95
- end
96
- shared_files.each do |file|
97
- relative_path = file.gsub("#{local_shared_files_path}/", '')
98
-
99
- debug "Inspecting: #{relative_path}"
100
-
101
- if File.directory?(file) && relative_path.strip != ''
102
- execute :mkdir, '-p', "#{shared_path}/#{relative_path}"
103
- elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
104
- debug "Uploading environment file #{relative_path}..."
105
- upload! file, "#{shared_path}/#{relative_path}"
106
- end
107
- end
108
-
109
- if absolute_path_files.nil?
110
- info "Uploading #{shared_files.size} absolute path environment files..."
111
- else
112
- info "There are no absolute path environment files to upload."
113
- end
114
145
  absolute_path_files.each do |file|
115
146
  relative_path = file.gsub("#{local_shared_files_path}/.absolute_paths", '')
116
-
117
- debug "Inspecting: #{relative_path}"
147
+ filename = Pathname.new(relative_path).basename
118
148
 
119
149
  if File.directory?(file) && relative_path.strip != ''
120
- execute :mkdir, '-p', relative_path
150
+ #we need to create the directories because symlinks don't created nested folders
151
+ execute :mkdir, '-p', relative_path
121
152
  elsif relative_path.gsub(/\s+/, '') != '' and relative_path != '.' and relative_path != '..'
122
- debug "Uploading environment file #{relative_path}..."
123
- upload! file, relative_path
124
- end
153
+ original_location = File.join(remote_shared_files_path, ".absolute_paths", relative_path)
154
+ debug "Creating a symlink from environment file #{original_location} to #{relative_path}..."
155
+ sudo :ln, '-sf', original_location, relative_path
156
+ end
125
157
  end
126
- else
127
- info "The shared files path, #{local_shared_files_path} does not exist."
128
158
  end
129
159
  end
130
160
  end
@@ -161,7 +191,7 @@ namespace :psw_peppr_app_deploy do
161
191
  end
162
192
 
163
193
  desc "Deploy a Peppr application to the remote server(s)"
164
- task default: [:'set_deploy_revision', :'create_deployment_directories', :'upload_app_source_repo', :'upload_environment_files', :'upload_artifacts', :'remove_existing_source_repo'] do
194
+ task default: [:'set_deploy_revision', :'create_deployment_directories', :'upload_app_source_repo', :'pack_gems', :'upload_environment_files', :'upload_artifacts', :'remove_existing_source_repo'] do
165
195
  end
166
196
 
167
197
  desc 'Task to create a symlink from the artifacts directory to the release directory'
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.pre33
4
+ version: 1.0.0.pre34
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-13 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler