capistrano-psw 1.0.0.pre6 → 1.0.0.pre7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -0
- data/lib/capistrano/psw/version.rb +1 -1
- data/resources/lib/capistrano/tasks/psw-peppr.cap +74 -0
- data/spec/psw-peppr_spec.rb +34 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be1c9392553922701952bc9e5242cc4c26c96cd
|
4
|
+
data.tar.gz: 35e023a0c02a43bc3ece8da65cea524a79ca86ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89cc5bbba5502cf782e9aee4767df87db6d481a1fb9babd752a069d050f82fd752d52b29f30a963854ec18c46b3a9338efa7eb9db814d5149d3c572606b88323
|
7
|
+
data.tar.gz: da81dcafaec116d10cd2aa9f23e80df62b146b8f3065804cee09ad13bd653ef19815a174828a0003c3b733db31d6d2ca3d6e0c4febd14d748a16ddf1d43c7a60
|
data/README.md
CHANGED
@@ -160,6 +160,32 @@ still points to the last run (otherwise the PID files won't exist)
|
|
160
160
|
### psw_clockwork:restart
|
161
161
|
Executes the following tasks: stop, start
|
162
162
|
|
163
|
+
## Peppr-related Tasks
|
164
|
+
These tasks are used for peppr application deployments.
|
165
|
+
|
166
|
+
### psw_peppr:environment_files
|
167
|
+
Uploads environment files retrieved by peppr to the target machine.
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
namespace :deploy do
|
171
|
+
after :check, 'psw_peppr:environment_files'
|
172
|
+
end
|
173
|
+
```
|
174
|
+
|
175
|
+
### psw_peppr:clear_shared_files
|
176
|
+
(Optional task) Clears the shared folder. This is to ensure that
|
177
|
+
stale environment files are not left on the target machine. This task
|
178
|
+
should be executed before starting so that Capistrano can re-generate
|
179
|
+
necessary shared folder items. Note that running this task will cause
|
180
|
+
deployments to be slower due to the fact that gem bins must be re-installed
|
181
|
+
for every deploy.
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
namespace :deploy do
|
185
|
+
before :starting, 'psw_peppr:clear_shared_files'
|
186
|
+
end
|
187
|
+
```
|
188
|
+
|
163
189
|
## License
|
164
190
|
|
165
191
|
2013 Lexmark International Technology S.A. All rights reserved.
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# == peppr.cap
|
2
|
+
#
|
3
|
+
# Contains the capistrano tasks needed to deploy a peppr application
|
4
|
+
#
|
5
|
+
# == Configuration
|
6
|
+
#
|
7
|
+
# To use the defined tasks, hook into other tasks.
|
8
|
+
#
|
9
|
+
# Examples:
|
10
|
+
#
|
11
|
+
# before :starting, 'psw_peppr:clear_shared_files'
|
12
|
+
# after :check, 'psw_peppr:environment_files'
|
13
|
+
#
|
14
|
+
# == Tasks
|
15
|
+
#
|
16
|
+
# === psw_peppr:environment_files
|
17
|
+
# This task will upload environment files that were downloaded locally
|
18
|
+
# by peppr. Note: This should only be used if peppr is deploying the
|
19
|
+
# application. However, if the environment files do not exist, they
|
20
|
+
# will not be uploaded.
|
21
|
+
#
|
22
|
+
# === psw_peppr:clear_shared_files
|
23
|
+
# This optional task will delete the shared directory. It should be done
|
24
|
+
# before starting. Note that using this task will increase deploy time
|
25
|
+
# as bundle will have to re-install gem bins for each deploy. However,
|
26
|
+
# this task ensures that stale environment files are not left on the
|
27
|
+
# target machine.
|
28
|
+
#
|
29
|
+
# == Contact
|
30
|
+
#
|
31
|
+
# Author:: Lexmark International Technology S.A.
|
32
|
+
# Copyright:: 2013 Lexmark International Technology S.A. All rights reserved.
|
33
|
+
# License:: 3-Clause BSD
|
34
|
+
|
35
|
+
|
36
|
+
namespace :psw_peppr do
|
37
|
+
task :environment_files do
|
38
|
+
on roles(:app) do |host|
|
39
|
+
info "Preparing to upload environment files if applicable..."
|
40
|
+
application_id = ENV['peppr_application_id'].to_i
|
41
|
+
application_deployment = ENV['peppr_application_deployment_id'].to_i
|
42
|
+
if application_id > 0 and application_deployment > 0
|
43
|
+
local_shared_files_path = "/tmp/peppr/applications/#{application_id}/deployments/#{application_deployment}/environments/#{fetch(:stage)}/shared_files"
|
44
|
+
|
45
|
+
func_file_upload = lambda { |file|
|
46
|
+
rel_file = "#{file.gsub("#{local_shared_files_path}", '')}"
|
47
|
+
rel_file = rel_file[1..-1] if rel_file[0] == '/'
|
48
|
+
|
49
|
+
if (fetch(:peppr_debug))
|
50
|
+
debug "Inspecting: #{rel_file}"
|
51
|
+
end
|
52
|
+
if File.directory?(file)
|
53
|
+
execute :mkdir, '-p', "#{shared_path}/#{rel_file}"
|
54
|
+
elsif rel_file.gsub(/\s+/, '') != '' and rel_file != '.' and rel_file != '..'
|
55
|
+
info "Uploading environment file #{rel_file}..."
|
56
|
+
upload! "#{local_shared_files_path}/#{rel_file}", "#{shared_path}/#{rel_file}"
|
57
|
+
end
|
58
|
+
}
|
59
|
+
|
60
|
+
if File.exist?(local_shared_files_path)
|
61
|
+
info "Uploading environment files..."
|
62
|
+
Find.find(local_shared_files_path).each &func_file_upload
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
task :clear_shared_files do
|
69
|
+
on roles(:app) do |host|
|
70
|
+
info "Deleting shared folder ..."
|
71
|
+
execute :rm, '-rf', "#{shared_path}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe 'psw-peppr' do
|
5
|
+
describe 'environment_files' do
|
6
|
+
let(:rake) { Rake::Application.new }
|
7
|
+
subject { rake["psw_peppr:environment_files"] }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Rake.application = rake
|
11
|
+
Rake.application.add_import("./resources/lib/capistrano/tasks/psw-peppr.cap")
|
12
|
+
Rake.application.load_imports()
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have no prerequisites' do
|
16
|
+
subject.prerequisites.should be_empty
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'clear_shared_files' do
|
21
|
+
let(:rake) { Rake::Application.new }
|
22
|
+
subject { rake["psw_peppr:clear_shared_files"] }
|
23
|
+
|
24
|
+
before do
|
25
|
+
Rake.application = rake
|
26
|
+
Rake.application.add_import("./resources/lib/capistrano/tasks/psw-peppr.cap")
|
27
|
+
Rake.application.load_imports()
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have no prerequisites' do
|
31
|
+
subject.prerequisites.should be_empty
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.pre7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lexmark International Technology S.A
|
@@ -86,9 +86,11 @@ files:
|
|
86
86
|
- lib/capistrano/psw/task_loader.rb
|
87
87
|
- lib/capistrano/psw/version.rb
|
88
88
|
- resources/lib/capistrano/tasks/psw-clockwork.cap
|
89
|
+
- resources/lib/capistrano/tasks/psw-peppr.cap
|
89
90
|
- resources/lib/capistrano/tasks/psw-repo.cap
|
90
91
|
- resources/lib/capistrano/tasks/psw-sidekiq.cap
|
91
92
|
- spec/psw-clockwork_spec.rb
|
93
|
+
- spec/psw-peppr_spec.rb
|
92
94
|
- spec/psw-repo_spec.rb
|
93
95
|
- spec/psw-sidekiq_spec.rb
|
94
96
|
- spec/spec_helper.rb
|
@@ -119,6 +121,7 @@ specification_version: 4
|
|
119
121
|
summary: Contains Capistrano v3 Deployment Tasks
|
120
122
|
test_files:
|
121
123
|
- spec/psw-clockwork_spec.rb
|
124
|
+
- spec/psw-peppr_spec.rb
|
122
125
|
- spec/psw-repo_spec.rb
|
123
126
|
- spec/psw-sidekiq_spec.rb
|
124
127
|
- spec/spec_helper.rb
|