capistrano-upload-config 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +15 -4
- data/capistrano-upload-config.gemspec +1 -1
- data/lib/capistrano/tasks/upload-config.rake +9 -10
- data/lib/capistrano/upload-config.rb +3 -3
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d6e2a3a1e6d8b8229e6944f0bec54afa510947e0f348618d312fe41438a0131
|
4
|
+
data.tar.gz: 925c4b266e62f95f969334d7850661f1701c1fc8d0a2266407ffbb5b7214197a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '089395f9bfeb4102f6a908e101a287a1fb3f32b465bb6ba225824ee214776bef4922f4967fbb21f91f0e842d88016dbfb3adfb02132141de449e6042413d10f9'
|
7
|
+
data.tar.gz: 07250d4c75acf42cf27e6cefc297813e76a430a163f3f40b02146d4a2c702ced4f67a4745f4a4641192e85a960ca007dfd4b30406da38b359f4f13117a6cd776
|
data/README.md
CHANGED
@@ -76,10 +76,8 @@ This task creates the config on the remote server.
|
|
76
76
|
|
77
77
|
|
78
78
|
```shell
|
79
|
-
$ cap staging config:
|
80
|
-
|
81
|
-
INFO Copied: config/example.yml-example to config/example.staging.yml
|
82
|
-
Created: config/foobar.staging.yml as empty file
|
79
|
+
$ cap staging config:push
|
80
|
+
INFO Uploading config config/database.staging.yml as config/database.yml
|
83
81
|
```
|
84
82
|
|
85
83
|
Can be used during a deploy, If your `:config_files` and `:linked_files` are going to be the same I suggest hooking in before
|
@@ -113,6 +111,7 @@ Configurable options, shown here with defaults:
|
|
113
111
|
```ruby
|
114
112
|
set :config_files, fetch(:linked_files)
|
115
113
|
set :config_example_suffix, '-example'
|
114
|
+
set :local_base_dir, ''
|
116
115
|
```
|
117
116
|
|
118
117
|
By default your `:linked_files` are assumed to be config files, this might be totally wrong for your environment, never fear just:
|
@@ -156,6 +155,18 @@ set :config_files, [ ".env.php" ]
|
|
156
155
|
Running `cap staging config:push` will upload the remote file as
|
157
156
|
`.env.staging.php`, rather than `.env.php`.
|
158
157
|
|
158
|
+
#### Local Base Dir
|
159
|
+
|
160
|
+
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.
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
# in deploy.rb
|
164
|
+
|
165
|
+
set :local_base_dir, '..'
|
166
|
+
```
|
167
|
+
|
168
|
+
For example Capistrano is outside of the application root and your config lives relative to the directory above.
|
169
|
+
|
159
170
|
## Contributing
|
160
171
|
|
161
172
|
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.9.0'
|
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,12 +4,12 @@ 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.
|
8
|
-
if File.
|
7
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
8
|
+
if File.exist?(local_path)
|
9
9
|
warn "Already Exists: #{local_path}"
|
10
10
|
else
|
11
11
|
example_suffix = fetch(:config_example_suffix, '')
|
12
|
-
if File.
|
12
|
+
if File.exist?("#{config}#{example_suffix}")
|
13
13
|
FileUtils.cp "#{config}#{example_suffix}", local_path
|
14
14
|
info "Copied: #{config}#{example_suffix} to #{local_path}"
|
15
15
|
else
|
@@ -25,8 +25,8 @@ 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.
|
29
|
-
if File.
|
28
|
+
local_path = CapistranoUploadConfig::Helpers.get_config_name(config, fetch(:stage).to_s, fetch(:local_base_dir).to_s)
|
29
|
+
if File.exist?(local_path)
|
30
30
|
info "Found: #{local_path}"
|
31
31
|
else
|
32
32
|
warn "Not found: #{local_path}"
|
@@ -41,9 +41,9 @@ 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
|
-
if File.
|
46
|
+
if File.exist?(local_path)
|
47
47
|
info "Uploading config #{local_path} as #{server_name}"
|
48
48
|
upload! StringIO.new(IO.read(local_path)), File.join(shared_path, server_name)
|
49
49
|
else
|
@@ -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.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Coleman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -72,7 +72,7 @@ homepage: https://github.com/rjocoleman/capistrano-upload-config
|
|
72
72
|
licenses:
|
73
73
|
- MIT
|
74
74
|
metadata: {}
|
75
|
-
post_install_message:
|
75
|
+
post_install_message:
|
76
76
|
rdoc_options: []
|
77
77
|
require_paths:
|
78
78
|
- lib
|
@@ -87,10 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
|
91
|
-
|
92
|
-
signing_key:
|
90
|
+
rubygems_version: 3.3.7
|
91
|
+
signing_key:
|
93
92
|
specification_version: 4
|
94
93
|
summary: Capistrano 3.x tasks to upload shared config that is stored outside of SCM
|
95
94
|
test_files: []
|
96
|
-
has_rdoc:
|