capistrano-linked-files 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +61 -0
- data/Rakefile +1 -0
- data/capistrano-linked-files.gemspec +22 -0
- data/lib/capistrano-linked-files.rb +0 -0
- data/lib/capistrano/linked_files.rb +1 -0
- data/lib/capistrano/tasks/linked_files.rake +58 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 869df53defa75a669478fd9d3f52cfd7454190d1
|
4
|
+
data.tar.gz: 8fb45854a55ca7f9038a1d93d146d3be72b54d81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d40ae7b29972288aa25617964938d338495f99befebf9e7bb99c7083757f48696cf5d7c4248a148b0742d73575e99ee4fb3500b5a5f0b368649bf49a0a7bea2c
|
7
|
+
data.tar.gz: 994cbd4afefaef1032ff9b8d1d6cc30f612c008a43eeed3159f45215bc29d013a1c974a473ee647f2e01b715bc3ec90d1ac877373d98da5bbe25c9ce3a18de0b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Runar Skaare Tveiten
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# capistrano-linked-files
|
2
|
+
|
3
|
+
This gem provides Capistrano reciepes to upload your linked files and directories. It's quite useful for files such as `config/database.yml` and `config/secrets.yml`, which are usually ignored (at least they should be) from version control systems.
|
4
|
+
|
5
|
+
Linked files and directories are placed in the `shared` directory on your remote servers and kept between deployments. After a new deployment, a symlink is created from the `shared` directory to the `current` directory.
|
6
|
+
|
7
|
+
Inspiration was found in damselem's [capistrano-shared-files](https://github.com/damselem/capistrano-shared-file), but capistrano-linked-files uses the "built in" Capistrano configuration variables `linked_files` and `linked_dirs` instead of custom ones. This way it's not necessary to specify your linked files twice.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add the gem to your `Gemfile`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'capistrano-linked-files'
|
15
|
+
```
|
16
|
+
|
17
|
+
Or install it to your system:
|
18
|
+
|
19
|
+
```
|
20
|
+
$ gem install capistrano-linked-files
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Add the gem to your `Capfile`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'capistrano/linked_files'
|
29
|
+
```
|
30
|
+
|
31
|
+
In `deploy.rb`, list the files and directories you'd like to keep between deployments:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
set :linked_files, %w(config/database.yml config/secrets.yml)
|
35
|
+
set :linked_dirs, %w(bin log tmp)
|
36
|
+
```
|
37
|
+
|
38
|
+
Then run the task:
|
39
|
+
|
40
|
+
```
|
41
|
+
$ bundle exec cap <STAGE> linked_files:upload
|
42
|
+
```
|
43
|
+
|
44
|
+
To automatically upload linked files and directories after a new deployment, add the following to your `deploy.rb`:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
before :finishing, 'linked_files:upload'
|
48
|
+
```
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create a new Pull Request
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The capistrano-linked-files plugin is free software released under the MIT License.
|
61
|
+
See [LICENSE](https://github.com/runar/capistrano-linked-files/blob/master/LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'capistrano-linked-files'
|
6
|
+
s.version = '0.1.0'
|
7
|
+
s.summary = 'Upload linked files and directories.'
|
8
|
+
s.description = 'Adds tasks to upload your linked files and directories. '
|
9
|
+
|
10
|
+
s.authors = ['Runar Skaare Tveiten']
|
11
|
+
s.email = ['runar@tveiten.io']
|
12
|
+
s.homepage = 'https://github.com/runar/capistrano-linked-files'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
|
18
|
+
s.add_dependency 'capistrano', '~> 3.1'
|
19
|
+
|
20
|
+
s.add_development_dependency 'bundler'
|
21
|
+
s.add_development_dependency 'rake'
|
22
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/linked_files.rake', __FILE__)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
def backup_path_for(file)
|
2
|
+
File.join(File.dirname(file), "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{File.basename(file)}")
|
3
|
+
end
|
4
|
+
|
5
|
+
namespace :linked_files do
|
6
|
+
|
7
|
+
desc 'Upload linked files and directories'
|
8
|
+
task :upload do
|
9
|
+
invoke 'linked_files:upload:files'
|
10
|
+
invoke 'linked_files:upload:dirs'
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :upload do
|
14
|
+
|
15
|
+
task :files do
|
16
|
+
on roles :web do
|
17
|
+
fetch(:linked_files).each do |file|
|
18
|
+
upload! file, "#{shared_path}/#{file}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task :dirs do
|
24
|
+
on roles :web do
|
25
|
+
fetch(:linked_dirs).each do |dir|
|
26
|
+
upload! dir, "#{shared_path}/", recursive: true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :backup do
|
34
|
+
|
35
|
+
desc 'Download a backup of remote linked files'
|
36
|
+
task :files do
|
37
|
+
on roles :web do
|
38
|
+
fetch(:linked_files).each do |file|
|
39
|
+
download! "#{shared_path}/#{file}", backup_path_for(file)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc 'Download a backup of remote linked directories'
|
45
|
+
task :dirs do
|
46
|
+
on roles :web do
|
47
|
+
fetch(:linked_dirs).each do |dir|
|
48
|
+
download! "#{shared_path}/#{dir}", "backups_#{dir}", recursive: true
|
49
|
+
# info "#{shared_path}/#{dir} #{backup_path_for(dir)}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
before 'linked_files:upload', 'deploy:check:make_linked_dirs'
|
57
|
+
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-linked-files
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Runar Skaare Tveiten
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: 'Adds tasks to upload your linked files and directories. '
|
56
|
+
email:
|
57
|
+
- runar@tveiten.io
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- capistrano-linked-files.gemspec
|
68
|
+
- lib/capistrano-linked-files.rb
|
69
|
+
- lib/capistrano/linked_files.rb
|
70
|
+
- lib/capistrano/tasks/linked_files.rake
|
71
|
+
homepage: https://github.com/runar/capistrano-linked-files
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.0
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Upload linked files and directories.
|
95
|
+
test_files: []
|