capistrano-upload-config 0.6.0 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45bcc121c9d71f9a727cf88810ca9cf28a3bb0b8
4
- data.tar.gz: 491a885002828e44629bcf24383e5611b68d9489
3
+ metadata.gz: 374f20ce7842bdf074f18ef70955c338da2a8a77
4
+ data.tar.gz: aeddf47b8458c7f70ed29344a54a77d7f755afe3
5
5
  SHA512:
6
- metadata.gz: 857d580344523afd49dec47e7b6ade4b763cd9fc0b3f607e45a9d69325153a6011744ae9d311be2bebc236b253ee7fcd3ebaf318bc88fef628e059e9c4b817e5
7
- data.tar.gz: 9348d06e1175088509ca9eff0c84ab7a92aa86b68328d96b9ec8554179d61a23448a1485fb08a640c63b265964d959de99f1362fa1a9339ace0910b9c6ef128f
6
+ metadata.gz: dc85496ab5ad9f57bd3c6e5c22189e489b15664444b469d7b9d7476231496cc87918dc3e69ea798b3017a6a35e391904cdfc973a60187d349ad5940df388671b
7
+ data.tar.gz: 49294687f402d65e0f3ffbce4d0ff1072b2dbafd82d20b050777b2ca4e531d6970ecd01eff75c0445849fb35963c79753a2a12117687557361483556a23b47ce
data/README.md CHANGED
@@ -92,7 +92,7 @@ before 'deploy:check:linked_files', 'config:push'
92
92
  ```
93
93
 
94
94
 
95
- #### config:push
95
+ #### config:pull
96
96
 
97
97
  This task download the config from the remote server.
98
98
 
@@ -140,6 +140,21 @@ set :config_example_suffix, '.eg'
140
140
 
141
141
  Note, only suffixes (i.e. after the whole filename) are supported.
142
142
 
143
+ #### Use Stage Name Remotely
144
+
145
+ By default, capistrano-upload-config will remove the environment name from the
146
+ file name for the server's version. Occasionally, you'll want the server's file
147
+ name to reflect the local file's name.
148
+
149
+ ```ruby
150
+ # in deploy.rb
151
+
152
+ set :config_use_stage_remotely, true
153
+ set :config_files, [ ".env.php" ]
154
+ ```
155
+
156
+ Running `cap staging config:push` will upload the remote file as
157
+ `.env.staging.php`, rather than `.env.php`.
143
158
 
144
159
  ## Contributing
145
160
 
@@ -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.6.0'
7
+ spec.version = '0.7.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}
@@ -39,11 +39,13 @@ namespace :config do
39
39
  task :push do
40
40
  on release_roles :all do
41
41
  within shared_path do
42
+ use_stage_remotely = fetch(:config_use_stage_remotely)
42
43
  fetch(:config_files).each do |config|
43
44
  local_path = CapistranoUploadConfig::Helpers.get_local_config_name(config, fetch(:stage).to_s)
45
+ server_name = use_stage_remotely ? local_path.split('/').last : config
44
46
  if File.exists?(local_path)
45
- info "Uploading config #{local_path} as #{config}"
46
- upload! StringIO.new(IO.read(local_path)), File.join(shared_path, config)
47
+ info "Uploading config #{local_path} as #{server_name}"
48
+ upload! StringIO.new(IO.read(local_path)), File.join(shared_path, server_name)
47
49
  else
48
50
  fail "#{local_path} doesn't exist"
49
51
  end
@@ -56,10 +58,12 @@ namespace :config do
56
58
  task :pull do
57
59
  on release_roles :all do
58
60
  within shared_path do
61
+ use_stage_remotely = fetch(:config_use_stage_remotely)
59
62
  fetch(:config_files).each do |config|
60
63
  local_path = CapistranoUploadConfig::Helpers.get_local_config_name(config, fetch(:stage).to_s)
61
- info "Downloading config #{config} as #{local_path} "
62
- download! File.join(shared_path, config), local_path
64
+ server_name = use_stage_remotely ? local_path.split('/').last : config
65
+ info "Downloading config #{server_name} as #{local_path} "
66
+ download! File.join(shared_path, server_name), local_path
63
67
  end
64
68
  end
65
69
  end
@@ -74,6 +78,7 @@ namespace :load do
74
78
  set :config_example_suffix, '-example'
75
79
  # https://github.com/rjocoleman/capistrano-upload-config/issues/1
76
80
  set :config_example_prefix, -> { fetch(:config_example_suffix) }
81
+ set :config_use_stage_remotely, false
77
82
 
78
83
  end
79
84
  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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Coleman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -88,8 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.4.5
91
+ rubygems_version: 2.4.5.1
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: