capistrano-simple-permissions 0.1.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 +7 -0
- data/.gitignore +19 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +71 -0
- data/Rakefile +1 -0
- data/capistrano-simple-permisions.gemspec +26 -0
- data/lib/capistrano/simple_permissions.rb +1 -0
- data/lib/capistrano/simple_permissions/version.rb +5 -0
- data/lib/capistrano/tasks/simple_permissions.rake +24 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a2609529d7ff410333fa821951894f3faa8742e3584b520f287b25cd324bd389
|
4
|
+
data.tar.gz: 3fbb64452c686899b882f1d9dc6ece667b006e0c5e4f9bf055ba5a4fbf550e95
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ed3fb416c844f5eeff2367bdcb63987ce2b111e6fe31278b130701e8aa5b38ee9f505fe6b920b5e4e48dccb8ef2bdf79ae131b1d6c976d966547ea2f880b1d8
|
7
|
+
data.tar.gz: 2854e0bd8e11d2bd800b7222e32d2ad579989a6eb2d66e82605fe2b05dfb954ad34b0f85c0d3b29e95cca93cf5c4a24d302b8c1c10adb61be00f597a1747ecdd
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 DaMoo
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Capistrano::SimplePermissions
|
2
|
+
|
3
|
+
Capistrano task for ensuring specific permissions (including owner and group) on files and folders on deploy.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano-simple-permissions'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then add it to your `Capfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'capistrano/simple_permissions'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
$ bundle install
|
23
|
+
```
|
24
|
+
|
25
|
+
## How it works
|
26
|
+
|
27
|
+
This gem hooks into Capistrano's deploy process by executing several `chmod` and `chown` commands after the
|
28
|
+
`deploy:log_revision` portion of Capistrano's [flow](https://capistranorb.com/documentation/getting-started/flow/). See
|
29
|
+
the source for more details.
|
30
|
+
|
31
|
+
## Options
|
32
|
+
|
33
|
+
- ```ruby
|
34
|
+
set :permissions_folders, []
|
35
|
+
```
|
36
|
+
|
37
|
+
- Sets the folders that should be recursively affected by both `chmod` and `chown`. A sensible setting to use would be
|
38
|
+
`set :permissions_folders, [fetch(:deploy_to)]` in your `deploy.rb`
|
39
|
+
|
40
|
+
- ```ruby
|
41
|
+
set :chmod_folder_permissions, "775"
|
42
|
+
```
|
43
|
+
|
44
|
+
- Sets the permissions for folders that `chmod` will affect
|
45
|
+
|
46
|
+
- ```ruby
|
47
|
+
set :chmod_file_permissions, "664"
|
48
|
+
```
|
49
|
+
|
50
|
+
- Sets the permissions for files that `chmod` will affect
|
51
|
+
|
52
|
+
- ```ruby
|
53
|
+
set :chown_owner, ""
|
54
|
+
```
|
55
|
+
|
56
|
+
- Sets the owner of the files for `chown`. Note that the command isn't run as root so changing this to anything other
|
57
|
+
than the default of `""` might cause errors unless your deploy user has the correct permissions.
|
58
|
+
|
59
|
+
- ```ruby
|
60
|
+
set :chown_group, "web"
|
61
|
+
```
|
62
|
+
|
63
|
+
- Sets the group of the files for `chown`.
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
Bug reports and pull requests are welcome!
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "capistrano/simple_permissions/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-simple-permissions"
|
8
|
+
spec.version = Capistrano::SimplePermissions::VERSION
|
9
|
+
spec.authors = ["DaMoo"]
|
10
|
+
spec.email = ["git@damoo.zone"]
|
11
|
+
|
12
|
+
spec.summary = %q{Capistrano task for ensuring specific permissions on files and folders on deploy.}
|
13
|
+
spec.homepage = "https://github.com/da-moo/capistrano-simple-permissions"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "capistrano", "~> 3.11"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/simple_permissions.rake', __FILE__)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :load do
|
2
|
+
task :defaults do
|
3
|
+
set :permissions_folders, []
|
4
|
+
set :chmod_folder_permissions, "775"
|
5
|
+
set :chmod_file_permissions, "664"
|
6
|
+
set :chown_owner, ""
|
7
|
+
set :chown_group, "web"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :deploy do
|
12
|
+
namespace :simple_permissions do
|
13
|
+
|
14
|
+
task :set_permissions do
|
15
|
+
on roles(:web) do
|
16
|
+
execute :find, *fetch(:permissions_folders), '-type', :d, '-exec', :chmod, fetch(:chmod_folder_permissions), '{}', '\\;'
|
17
|
+
execute :find, *fetch(:permissions_folders), '-type', :f, '-exec', :chmod, fetch(:chmod_file_permissions), '{}', '\\;'
|
18
|
+
execute :chown, '-R', "#{fetch(:chown_owner)}:#{fetch(:chown_group)}", *fetch(:permissions_folders)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
after "deploy:log_revision", "deploy:simple_permissions:set_permissions"
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-simple-permissions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- DaMoo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-06 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.11'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.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: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- git@damoo.zone
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- capistrano-simple-permisions.gemspec
|
69
|
+
- lib/capistrano/simple_permissions.rb
|
70
|
+
- lib/capistrano/simple_permissions/version.rb
|
71
|
+
- lib/capistrano/tasks/simple_permissions.rake
|
72
|
+
homepage: https://github.com/da-moo/capistrano-simple-permissions
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubygems_version: 3.0.3
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Capistrano task for ensuring specific permissions on files and folders on
|
95
|
+
deploy.
|
96
|
+
test_files: []
|