capun 0.0.24 → 0.0.25
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 +4 -4
- data/lib/capun/setup.rb +15 -13
- data/lib/capun/version.rb +1 -1
- data/lib/generators/capun/stage_generator.rb +2 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb4e11d12db98de66dd3d2c91b08266e60c87dc2
|
4
|
+
data.tar.gz: 6f932877bc38b865bbb187ae62bb6566bc3d66e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb734a2e12ee6163805ec7b6b577b648fb062ba30641f3e31a5eade630cc769019dd6f0b3f4d11d22f761e673de9c406f546d127e235a02d132b990b9b5f7ea1
|
7
|
+
data.tar.gz: e51241ee3450c6ad5ee1991d73da5ab32c4963ee061e0e566e312fad67f01680584be223762cbaa5e17e6f7e97e115551f8f3c8d303cc64990c51a511abc33cc
|
data/lib/capun/setup.rb
CHANGED
@@ -16,24 +16,25 @@ set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets public/system}
|
|
16
16
|
set :unicorn_config_path, -> { "#{shared_path}/config/unicorn.config.rb" }
|
17
17
|
|
18
18
|
set :uploads, []
|
19
|
+
# Lambdas are used for lazy access to variables set later, in stage file
|
19
20
|
set :std_uploads, [
|
20
|
-
#figaro
|
21
|
+
# figaro
|
21
22
|
{what: "config/application.yml", where: '#{shared_path}/config/application.yml', upload: true, overwrite: true},
|
22
|
-
#logstash configs
|
23
|
+
# logstash configs
|
23
24
|
{what: "config/deploy/logstash.config.erb", where: '#{shared_path}/config/logstash.config', upload: -> { !!fetch(:addELK) }, overwrite: true},
|
24
|
-
#logrotate configs
|
25
|
+
# logrotate configs
|
25
26
|
{what: "config/deploy/logrotate.config.erb", where: '#{shared_path}/config/logrotate.config', upload: -> { !!fetch(:addlogrotate) }, overwrite: true},
|
26
|
-
#basic_authenticatable.rb
|
27
|
+
# basic_authenticatable.rb
|
27
28
|
{what: "config/deploy/basic_authenticatable.rb.erb", where: '#{release_path}/app/controllers/concerns/basic_authenticatable.rb', upload: -> { !!fetch(:use_basic_auth) }, overwrite: true},
|
28
|
-
#nginx.conf
|
29
|
+
# nginx.conf
|
29
30
|
{what: "config/deploy/nginx.conf.erb", where: '#{shared_path}/config/nginx.conf', upload: -> { !!fetch(:addNginx) }, overwrite: true},
|
30
|
-
#unicorn.config.rb
|
31
|
+
# unicorn.config.rb
|
31
32
|
{what: "config/deploy/unicorn.config.rb.erb", where: '#{shared_path}/config/unicorn.config.rb', upload: true, overwrite: true},
|
32
|
-
#database.yml
|
33
|
+
# database.yml
|
33
34
|
{what: "config/deploy/database.yml.erb", where: '#{shared_path}/config/database.yml', upload: true, overwrite: true},
|
34
|
-
#jenkins' config.xml
|
35
|
+
# jenkins' config.xml
|
35
36
|
{what: "config/deploy/jenkins.config.xml.erb", where: '#{shared_path}/config/jenkins.config.xml', upload: -> { !!fetch(:addJenkins) }, overwrite: false},
|
36
|
-
#newrelic.yml
|
37
|
+
# newrelic.yml
|
37
38
|
{what: "config/deploy/newrelic.yml.erb", where: '#{shared_path}/config/newrelic.yml', upload: -> { !!fetch(:addNewRelic) }, overwrite: true}
|
38
39
|
]
|
39
40
|
|
@@ -57,24 +58,25 @@ namespace :deploy do
|
|
57
58
|
task :kill_me do
|
58
59
|
on roles(:app) do
|
59
60
|
execute "kill -9 $(ps aux | grep #{fetch(:application)} | grep -v grep | awk '{print $2}') || true"
|
60
|
-
end
|
61
|
+
end
|
61
62
|
end
|
62
63
|
before :deploy, 'deploy:kill_me'
|
63
64
|
|
64
65
|
desc 'Uploads files to app based on stage'
|
65
66
|
task :upload do
|
66
67
|
on roles(:app) do |server|
|
67
|
-
#create /home/[user]/apps/[app]/shared/config directory, if it doesn't exist yet
|
68
|
+
# create /home/[user]/apps/[app]/shared/config directory, if it doesn't exist yet
|
68
69
|
execute :mkdir, "-p", "#{shared_path}/config"
|
69
70
|
execute :sudo, :chown, "-R", "#{fetch(:user)}:#{fetch(:user)}", "#{shared_path}/config/."
|
70
71
|
uploads = fetch(:uploads).concat(fetch(:std_uploads))
|
71
72
|
uploads.each do |file_hash|
|
72
|
-
|
73
|
+
# file_hash[:upload] may be either a boolean or a lambda; in the latter case we use its result
|
73
74
|
next if !file_hash[:upload] || ( file_hash[:upload].is_a?(Proc) && !file_hash[:upload].call )
|
75
|
+
what = file_hash[:what]
|
74
76
|
next unless File.exists?(what)
|
75
77
|
where = eval "\"" + file_hash[:where] + "\""
|
76
78
|
next if !file_hash[:overwrite] && test("[ -f #{where} ]")
|
77
|
-
#compile temlate if it ends with .erb before upload
|
79
|
+
# compile temlate if it ends with .erb before upload
|
78
80
|
upload! (what.end_with?(".erb") ? StringIO.new(ERB.new(File.read(what)).result(binding)) : what), where
|
79
81
|
info "copying: #{what} to: #{where}"
|
80
82
|
end
|
data/lib/capun/version.rb
CHANGED
@@ -15,7 +15,6 @@ module Capun
|
|
15
15
|
@username = ask("Basic authentication username [ex.: mike]:")
|
16
16
|
@password = ask("Basic authentication password [ex.: secret]:")
|
17
17
|
end
|
18
|
-
@addNginx = ask("Would you like to add nginx configuration file? [Y/n]").capitalize == 'Y'
|
19
18
|
@addJenkins = ask("Would you like to add Jenkins configuration file? [Y/n]").capitalize == 'Y'
|
20
19
|
@addNewRelic = ask("Would you like to add New Relic configuration file? [Y/n]").capitalize == 'Y'
|
21
20
|
if @addNewRelic
|
@@ -49,10 +48,8 @@ module Capun
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def add_nginx
|
52
|
-
|
53
|
-
|
54
|
-
append_to_file "config/deploy/#{singular_name}.rb", "\nset :addNginx, true"
|
55
|
-
end
|
51
|
+
copy_file "nginx.conf.erb", "config/deploy/nginx.conf.erb"
|
52
|
+
append_to_file "config/deploy/#{singular_name}.rb", "\nset :addNginx, true"
|
56
53
|
end
|
57
54
|
|
58
55
|
def add_secret
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Zamylin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|