capistrano-file-permissions 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d698954d7a5af6f58ee7c098138dedd27d18d25
4
- data.tar.gz: ee1681fcf5686a2a32410807fceb52fe146c2531
3
+ metadata.gz: 9cf981064d58b4b616f0e598c07d5d5b0e7d40ab
4
+ data.tar.gz: 61c5e45cc5d036fa25cb3422ea27264273d83ec2
5
5
  SHA512:
6
- metadata.gz: 90917d4212cb56cc5769476b2403b1e8497024e3360ae4c4a6e90330e15793545b8eaae12a85de3bd5079237e193863e0460c9831265d8ed9ae38de356fd4bd8
7
- data.tar.gz: 3ce31494cd81f4cfc9dfc71e0d6828fd20b7405e437d31e1e2f9a54bf821936de82e8b8acc61a498c4bfee577244c03ec59d8bd09c01cee9821c6628c2be1a85
6
+ metadata.gz: 568e3dc8a08f143c5a38318c431d95396d2d41dc69841efcf8a623fb05eb8496988fa9b9a3f16569e30c2ec7ab7061eb11bf353b33b4efa6c84630aea1a7c198
7
+ data.tar.gz: dcd7f79e8bf3d17d01c9facc86be1bdaf900e4486dd6c3d5812444e7be0d90e51ddbd525d9f02e60ecd2bdc3788f3cd0bea4264e786e46eb9a5c27c3f21f4927
data/README.md CHANGED
@@ -47,13 +47,14 @@ Assume `app/logs` is a shared directory, and `app/cache` is part of the normal
47
47
  release, this gem would execute the following:
48
48
 
49
49
  ```
50
- [..] setfacl -m u:www-data:rwx,u:<deploy-user>:rwx <path-to-app>/shared/app/logs <path-to-app>/<release>/app/cache
50
+ [..] setfacl -Rn -m u:www-data:rwX -m u:<deploy-user>:rwX <path-to-app>/shared/app/logs <path-to-app>/<release>/app/cache
51
51
  ```
52
52
 
53
53
  ### Other tasks
54
54
  * deploy:set_permissions:chmod
55
55
  * deploy:set_permissions:chgrp
56
-
56
+ * deploy:set_permissions:chown
57
+ *
57
58
  ### Configuration
58
59
 
59
60
  The gem makes the following configuration variables available (shown with defaults)
@@ -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-file-permissions'
7
- spec.version = '0.1.1'
7
+ spec.version = '1.0.0'
8
8
  spec.authors = ['Peter Mitchell']
9
9
  spec.email = ['peterjmit@gmail.com']
10
10
  spec.description = %q{File permissions management for Capistrano 3.x}
@@ -15,6 +15,5 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files`.split($/)
16
16
  spec.require_paths = ['lib']
17
17
 
18
- spec.add_dependency 'capistrano', '~> 3.1'
19
-
18
+ spec.add_dependency 'capistrano', '~> 3.0'
20
19
  end
@@ -10,7 +10,7 @@ def absolute_writable_paths
10
10
  end
11
11
  end
12
12
 
13
- def acl_entries(items, type = 'u', permissions = 'rwx')
13
+ def acl_entries(items, type = 'u', permissions = 'rwX')
14
14
  items.map { |item| "#{type}:#{item}:#{permissions}" }
15
15
  end
16
16
 
@@ -40,10 +40,10 @@ namespace :deploy do
40
40
  entries.push(*acl_entries(fetch(:file_permissions_groups), 'g'))
41
41
  end
42
42
 
43
- entries = entries.join(',')
43
+ entries = entries.map { |e| "-m #{e}" }.join(' ')
44
44
 
45
- execute :setfacl, "-Rm", entries, *paths
46
- execute :setfacl, "-Rdm", entries, *paths
45
+ execute :setfacl, "-Rn", entries, *paths
46
+ execute :setfacl, "-dRn", entries, *paths.map
47
47
  end
48
48
  end
49
49
 
@@ -55,6 +55,22 @@ namespace :deploy do
55
55
  end
56
56
  end
57
57
 
58
+ desc "Recursively change user ownership for configured paths, and make them user writable"
59
+ task :chown => [:check] do
60
+ next unless any? :file_permissions_paths
61
+ next unless any? :file_permissions_users
62
+
63
+ users = fetch(:file_permissions_users)
64
+ if users.length > 1
65
+ warn "More than one user configured, using the first user only"
66
+ end
67
+
68
+ on roles fetch(:file_permissions_roles) do |host|
69
+ paths = absolute_writable_paths
70
+ execute :sudo, :chown, "-R", users.first, *paths
71
+ end
72
+ end
73
+
58
74
  desc "Recursively change group ownership for configured paths, and make them group writable"
59
75
  task :chgrp => [:check] do
60
76
  next unless any? :file_permissions_paths
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-file-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '3.0'
27
27
  description: File permissions management for Capistrano 3.x
28
28
  email:
29
29
  - peterjmit@gmail.com
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.2.2
63
+ rubygems_version: 2.4.5.1
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: File permissions management for Capistrano 3.x