capistrano-upload-config 0.7.0 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/capistrano-upload-config.gemspec +1 -1
- data/lib/capistrano/tasks/upload-config.rake +5 -6
- data/lib/capistrano/upload-config.rb +3 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 358c1cccd790b716915fa7f506cd42460620b91b
|
4
|
+
data.tar.gz: 9db4df937dd439546bcb70bc426cd345a6e833ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b05de93c46b982ef597d735d651f30792ee08be7a81fdf2ed526eef58f9d5b760b7b77e99ee78828c972a6b91d697f0d336a11bd63e041bbc6749e3786dca62
|
7
|
+
data.tar.gz: 538de4da01294100d615b13448f0d8deeff29b4dc042ea16f9c33d28def5310b11f202664e568c781fe6f8a442c583d3354d025821f6a65cfa94b950ab534c49
|
data/README.md
CHANGED
@@ -76,7 +76,7 @@ This task creates the config on the remote server.
|
|
76
76
|
|
77
77
|
|
78
78
|
```shell
|
79
|
-
$ cap staging config:
|
79
|
+
$ cap staging config:push
|
80
80
|
WARN Already Exists: config/database.staging.yml
|
81
81
|
INFO Copied: config/example.yml-example to config/example.staging.yml
|
82
82
|
Created: config/foobar.staging.yml as empty file
|
@@ -113,6 +113,7 @@ Configurable options, shown here with defaults:
|
|
113
113
|
```ruby
|
114
114
|
set :config_files, fetch(:linked_files)
|
115
115
|
set :config_example_suffix, '-example'
|
116
|
+
set :local_base_dir, ''
|
116
117
|
```
|
117
118
|
|
118
119
|
By default your `:linked_files` are assumed to be config files, this might be totally wrong for your environment, never fear just:
|
@@ -156,6 +157,18 @@ set :config_files, [ ".env.php" ]
|
|
156
157
|
Running `cap staging config:push` will upload the remote file as
|
157
158
|
`.env.staging.php`, rather than `.env.php`.
|
158
159
|
|
160
|
+
#### Local Base Dir
|
161
|
+
|
162
|
+
Using this option you can base your local config file/s in any directory, if unset they're assumed to be in the current directory tree.
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
# in deploy.rb
|
166
|
+
|
167
|
+
set :local_base_dir, '..'
|
168
|
+
```
|
169
|
+
|
170
|
+
For example Capistrano is outside of the application root and your config lives relative to the directory above.
|
171
|
+
|
159
172
|
## Contributing
|
160
173
|
|
161
174
|
1. Fork it
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'capistrano-upload-config'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.8.2'
|
8
8
|
spec.authors = 'Robert Coleman'
|
9
9
|
spec.email = 'github@robert.net.nz'
|
10
10
|
spec.description = %q{Capistrano 3.x tasks to upload shared config that is stored outside of SCM}
|
@@ -4,7 +4,7 @@ namespace :config do
|
|
4
4
|
task :init do
|
5
5
|
run_locally do
|
6
6
|
fetch(:config_files).each do |config|
|
7
|
-
local_path = CapistranoUploadConfig::Helpers.
|
7
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
8
8
|
if File.exists?(local_path)
|
9
9
|
warn "Already Exists: #{local_path}"
|
10
10
|
else
|
@@ -25,7 +25,7 @@ namespace :config do
|
|
25
25
|
task :check do
|
26
26
|
run_locally do
|
27
27
|
fetch(:config_files).each do |config|
|
28
|
-
local_path = CapistranoUploadConfig::Helpers.
|
28
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
29
29
|
if File.exists?(local_path)
|
30
30
|
info "Found: #{local_path}"
|
31
31
|
else
|
@@ -41,7 +41,7 @@ namespace :config do
|
|
41
41
|
within shared_path do
|
42
42
|
use_stage_remotely = fetch(:config_use_stage_remotely)
|
43
43
|
fetch(:config_files).each do |config|
|
44
|
-
local_path = CapistranoUploadConfig::Helpers.
|
44
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
45
45
|
server_name = use_stage_remotely ? local_path.split('/').last : config
|
46
46
|
if File.exists?(local_path)
|
47
47
|
info "Uploading config #{local_path} as #{server_name}"
|
@@ -60,7 +60,7 @@ namespace :config do
|
|
60
60
|
within shared_path do
|
61
61
|
use_stage_remotely = fetch(:config_use_stage_remotely)
|
62
62
|
fetch(:config_files).each do |config|
|
63
|
-
local_path = CapistranoUploadConfig::Helpers.
|
63
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
64
64
|
server_name = use_stage_remotely ? local_path.split('/').last : config
|
65
65
|
info "Downloading config #{server_name} as #{local_path} "
|
66
66
|
download! File.join(shared_path, server_name), local_path
|
@@ -73,12 +73,11 @@ end
|
|
73
73
|
|
74
74
|
namespace :load do
|
75
75
|
task :defaults do
|
76
|
-
|
76
|
+
set :local_base_dir, '.'
|
77
77
|
set :config_files, -> { fetch(:linked_files) }
|
78
78
|
set :config_example_suffix, '-example'
|
79
79
|
# https://github.com/rjocoleman/capistrano-upload-config/issues/1
|
80
80
|
set :config_example_prefix, -> { fetch(:config_example_suffix) }
|
81
81
|
set :config_use_stage_remotely, false
|
82
|
-
|
83
82
|
end
|
84
83
|
end
|
@@ -4,14 +4,14 @@ module CapistranoUploadConfig
|
|
4
4
|
class Helpers
|
5
5
|
class << self
|
6
6
|
|
7
|
-
def
|
8
|
-
path = File.dirname(config)
|
7
|
+
def get_config_name(config, stage, local_base_dir)
|
8
|
+
path = File.dirname(File.join(local_base_dir, config))
|
9
9
|
extension = File.extname(config)
|
10
10
|
filename = File.basename(config, extension)
|
11
11
|
extension.sub!(/^\./, '')
|
12
12
|
local_file = [filename, stage].join('.')
|
13
13
|
local_file = [local_file, extension].join('.') unless extension.empty?
|
14
|
-
|
14
|
+
File.join(path, local_file)
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-upload-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Coleman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -88,9 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.5.2
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Capistrano 3.x tasks to upload shared config that is stored outside of SCM
|
95
95
|
test_files: []
|
96
|
-
has_rdoc:
|