kanrisuru 0.16.2 → 0.16.3

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
  SHA256:
3
- metadata.gz: a6038052274021235b996bc9f7ade893cd10d6881c86e563f2b2d382abb16d60
4
- data.tar.gz: cdec7058f5ed36cb0e1132be77c01085eed95267249f36458c6a591e02f27fbc
3
+ metadata.gz: af1a581f630e30f0d4e45864f8adba335b5a4c39ba77ca81c3de97e62d1b63bc
4
+ data.tar.gz: b34344cd94480bac72c5c78db9fe2b331884366a68c30d81b001c4f6d2d648c8
5
5
  SHA512:
6
- metadata.gz: a3ef7552d342a0b2fd0cf85fd1bbc03752d24803052feb9639c59d0244f3340edc85f038b2d3d296e0a2d85d468d45bcdde61b79cfd8d9ca8027cc217bf2f615
7
- data.tar.gz: a6a4f401e579ff750ca46b5580b259eeb8e25998c76e98612a5123daf4ecef4fbe22fb5bf3f6a19337190afae86a0c87d5319757205e99dfcc8faa2a5de11376
6
+ metadata.gz: 437e92131a90f509f116067b7f0f5fb311c7ddc835d554732479d3895d1ce23b63fec937df6dc6d2ecb048deaaff1411c0c9956019c4d2f26b10e0cfeb781d86
7
+ data.tar.gz: 100a3f6f404a6665cf56ab0b6159724f775f8e25c76ab103ba491764916a067d4ce55a4043db671f58251dfed7ba25d09fa5c6b63efee7ae5d9a8facfc612248
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## Kanrisuru 0.16.3 (December 25, 2021) ##
2
+ * Refactor `Kanrisuru::Mode::Permission` class into separate file.
3
+
1
4
  ## Kanrisuru 0.16.2 (December 19, 2021) ##
2
5
  * Organize functional ip specs
3
6
  * Log in realtime, debug output the stdout from the remote server, as opposed to waiting until after the command is done.
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kanrisuru
4
+ class Mode
5
+ class Permission
6
+ attr_reader :symbolic
7
+
8
+ def initialize(numeric, symbolic)
9
+ @numeric = numeric
10
+ @symbolic = symbolic
11
+
12
+ update_symbolic_rwx
13
+ end
14
+
15
+ def to_i
16
+ numeric.to_i
17
+ end
18
+
19
+ def to_s
20
+ symbolic
21
+ end
22
+
23
+ def numeric
24
+ @numeric.to_s
25
+ end
26
+
27
+ def all?
28
+ read? && write? && execute?
29
+ end
30
+
31
+ def symbolic=(symbolic)
32
+ @symbolic = symbolic
33
+
34
+ update_symbolic_rwx
35
+ update_numeric
36
+ end
37
+
38
+ def numeric=(numeric)
39
+ @numeric = numeric
40
+
41
+ update_numeric_rwx
42
+ update_symbolic
43
+ end
44
+
45
+ def read=(boolean)
46
+ @readable = boolean
47
+
48
+ update_numeric
49
+ update_symbolic
50
+ end
51
+
52
+ def write=(boolean)
53
+ @writeable = boolean
54
+
55
+ update_numeric
56
+ update_symbolic
57
+ end
58
+
59
+ def execute=(boolean)
60
+ @executable = boolean
61
+
62
+ update_numeric
63
+ update_symbolic
64
+ end
65
+
66
+ def read?
67
+ @readable
68
+ end
69
+
70
+ def write?
71
+ @writeable
72
+ end
73
+
74
+ def execute?
75
+ @executable
76
+ end
77
+
78
+ private
79
+
80
+ def update_symbolic_rwx
81
+ @readable = @symbolic.include?('r')
82
+ @writeable = @symbolic.include?('w')
83
+ @executable = @symbolic.include?('x')
84
+ end
85
+
86
+ def update_numeric_rwx
87
+ mode = @numeric.to_i(8)
88
+
89
+ @readable = ((mode >> 2) & 0b001) == 1
90
+ @writeable = ((mode >> 1) & 0b001) == 1
91
+ @executable = ((mode >> 0) & 0b001) == 1
92
+ end
93
+
94
+ def update_numeric
95
+ @numeric = (((read? ? 1 : 0) << 2) + ((write? ? 1 : 0) << 1) + (execute? ? 1 : 0)).to_s
96
+ end
97
+
98
+ def update_symbolic
99
+ @symbolic = "#{read? ? 'r' : '-'}#{write? ? 'w' : '-'}#{execute? ? 'x' : '-'}"
100
+ end
101
+ end
102
+ end
103
+ end
@@ -1,105 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'mode/permission'
4
+
3
5
  module Kanrisuru
4
6
  class Mode
5
- class Permission
6
- attr_reader :symbolic
7
-
8
- def initialize(numeric, symbolic)
9
- @numeric = numeric
10
- @symbolic = symbolic
11
-
12
- update_symbolic_rwx
13
- end
14
-
15
- def to_i
16
- numeric.to_i
17
- end
18
-
19
- def to_s
20
- symbolic
21
- end
22
-
23
- def numeric
24
- @numeric.to_s
25
- end
26
-
27
- def all?
28
- read? && write? && execute?
29
- end
30
-
31
- def symbolic=(symbolic)
32
- @symbolic = symbolic
33
-
34
- update_symbolic_rwx
35
- update_numeric
36
- end
37
-
38
- def numeric=(numeric)
39
- @numeric = numeric
40
-
41
- update_numeric_rwx
42
- update_symbolic
43
- end
44
-
45
- def read=(boolean)
46
- @readable = boolean
47
-
48
- update_numeric
49
- update_symbolic
50
- end
51
-
52
- def write=(boolean)
53
- @writeable = boolean
54
-
55
- update_numeric
56
- update_symbolic
57
- end
58
-
59
- def execute=(boolean)
60
- @executable = boolean
61
-
62
- update_numeric
63
- update_symbolic
64
- end
65
-
66
- def read?
67
- @readable
68
- end
69
-
70
- def write?
71
- @writeable
72
- end
73
-
74
- def execute?
75
- @executable
76
- end
77
-
78
- private
79
-
80
- def update_symbolic_rwx
81
- @readable = @symbolic.include?('r')
82
- @writeable = @symbolic.include?('w')
83
- @executable = @symbolic.include?('x')
84
- end
85
-
86
- def update_numeric_rwx
87
- mode = @numeric.to_i(8)
88
-
89
- @readable = ((mode >> 2) & 0b001) == 1
90
- @writeable = ((mode >> 1) & 0b001) == 1
91
- @executable = ((mode >> 0) & 0b001) == 1
92
- end
93
-
94
- def update_numeric
95
- @numeric = (((read? ? 1 : 0) << 2) + ((write? ? 1 : 0) << 1) + (execute? ? 1 : 0)).to_s
96
- end
97
-
98
- def update_symbolic
99
- @symbolic = "#{read? ? 'r' : '-'}#{write? ? 'w' : '-'}#{execute? ? 'x' : '-'}"
100
- end
101
- end
102
-
103
7
  attr_reader :owner, :group, :other
104
8
 
105
9
  def initialize(mode)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.16.2'
4
+ VERSION = '0.16.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-19 00:00:00.000000000 Z
11
+ date: 2021-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel_tests
@@ -417,6 +417,7 @@ files:
417
417
  - lib/kanrisuru/core/zypper/types.rb
418
418
  - lib/kanrisuru/logger.rb
419
419
  - lib/kanrisuru/mode.rb
420
+ - lib/kanrisuru/mode/permission.rb
420
421
  - lib/kanrisuru/os_package.rb
421
422
  - lib/kanrisuru/os_package/collection.rb
422
423
  - lib/kanrisuru/os_package/define.rb