kanrisuru 0.8.5 → 0.8.9

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
  SHA256:
3
- metadata.gz: e165b21ec0ad68281ccbb6dd27277d5fe77833d9c27382f8c5233dc93c128ba8
4
- data.tar.gz: 2ab686965334402864a17586c1e45724d3163a4ed84833f4b904dc0834e1bb68
3
+ metadata.gz: e1dfc7b4ed56b9054d2a9cffd137f21b47a992e76f89bc279911c619c9349b15
4
+ data.tar.gz: ed85d4d847c5cdffc544dc93faf32552e6216e96da0ee9a4effa03f4f1cac08a
5
5
  SHA512:
6
- metadata.gz: 88820369f4d9f10dbe9d4200cecc4804aff4ddb29322cd4c7dd399c1739b2f2736ac6e2346666717e5949a3bbac0cbcf12a2e681706f591c93d9da4144b4c035
7
- data.tar.gz: 6f1eadc3de432097d35dbf5f42b3fc3a9d9b6eabf3cc697551ea71f9b6547875f36407d821e61ec9bfc257d76f96f4e7dcd2d0ae2c65baab03b32f34f2618411
6
+ metadata.gz: 1bfe2ce44a7a045ce622e3ca724fc9455e0efee19fd20235dda6befddeacd1c916604a41d053323879befe0762d37d9c41a87bd6221a564178973e9222cde6da
7
+ data.tar.gz: 7130b94ddf938c126f3d4ef8f76f28298ff7f8abe169dbb9b4dd8ae384d334f6ccf17019e1aafb1c07ac2fcd0a0b5558aae36dd07f8f0523fc9721e7b5ed2e6b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Kanrisuru 0.8.9 (August 24, 2021)
2
+ * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
3
+
4
+ ## Kanrisuru 0.8.8 (August 21, 2021) ##
5
+ * Add shorthand notation for tar command actions, such as `x` for `extract`, `t` for `list`, and `c` for `create`.
6
+
7
+ ## Kanrisuru 0.8.7 (August 21, 2021) ##
8
+ * Fix `FileInfo` field for ls command. Was set to `memory_blocks`, but was incorrect, corrected this to `hard_links`.
9
+
10
+ ## Kanrisuru 0.8.6 (August 21, 2021) ##
11
+ * Add `minimum_io_size`, `physical_sector_size`, and `logical_sector_size` to the blkid low level disk probe for devices.
12
+
1
13
  ## Kanrisuru 0.8.5 (August 20, 2021) ##
2
14
  * Add `summarize` option to `du` command. This will only output a total disk usage size for the entire directory versus disk usage for each file individually.
3
15
 
@@ -24,7 +24,7 @@ module Kanrisuru
24
24
  set_compression(command, compress) if compress
25
25
 
26
26
  case action
27
- when 'list'
27
+ when 'list', 't'
28
28
  command.append_flag('-t')
29
29
  command.append_arg('--occurrence', opts[:occurrence])
30
30
  command.append_flag('--label', opts[:label])
@@ -38,9 +38,10 @@ module Kanrisuru
38
38
  FilePath.new(item)
39
39
  end
40
40
  end
41
- when 'extract', 'get'
41
+ when 'extract', 'get', 'x'
42
42
  command.append_flag('-x')
43
43
  command.append_arg('--occurrence', opts[:occurrence])
44
+
44
45
  command.append_flag('--no-same-owner', opts[:no_same_owner])
45
46
  command.append_flag('--no-same-permissions', opts[:no_same_permissions])
46
47
  command.append_flag('--no-selinux', opts[:no_selinux])
@@ -64,7 +65,7 @@ module Kanrisuru
64
65
 
65
66
  execute_shell(command)
66
67
  Kanrisuru::Result.new(command)
67
- when 'create'
68
+ when 'create', 'c'
68
69
  command.append_flag('-c')
69
70
  command.append_flag('--multi-volume', opts[:multi_volume])
70
71
 
@@ -81,7 +82,7 @@ module Kanrisuru
81
82
  execute_shell(command)
82
83
 
83
84
  Kanrisuru::Result.new(command)
84
- when 'append'
85
+ when 'append', 'r'
85
86
  command.append_flag('-r')
86
87
 
87
88
  if Kanrisuru::Util.present?(paths)
@@ -91,7 +92,7 @@ module Kanrisuru
91
92
 
92
93
  execute_shell(command)
93
94
  Kanrisuru::Result.new(command)
94
- when 'catenate', 'concat'
95
+ when 'catenate', 'concat', 'A'
95
96
  command.append_flag('-A')
96
97
 
97
98
  if Kanrisuru::Util.present?(paths)
@@ -101,7 +102,7 @@ module Kanrisuru
101
102
 
102
103
  execute_shell(command)
103
104
  Kanrisuru::Result.new(command)
104
- when 'update'
105
+ when 'update', 'u'
105
106
  command.append_flag('-u')
106
107
 
107
108
  if Kanrisuru::Util.present?(paths)
@@ -111,7 +112,7 @@ module Kanrisuru
111
112
 
112
113
  execute_shell(command)
113
114
  Kanrisuru::Result.new(command)
114
- when 'diff', 'compare'
115
+ when 'diff', 'compare', 'd'
115
116
  command.append_flag('-d')
116
117
  command.append_arg('--occurrence', opts[:occurrence])
117
118
 
@@ -22,7 +22,8 @@ module Kanrisuru
22
22
  BlkidDevice = Struct.new(
23
23
  :name, :label, :uuid, :type, :uuid_sub, :label_fatboot, :version, :usage,
24
24
  :part_uuid, :part_entry_scheme, :part_entry_uuid, :part_entry_type,
25
- :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk
25
+ :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk,
26
+ :minimum_io_size, :physical_sector_size, :logical_sector_size,
26
27
  )
27
28
 
28
29
  def du(opts = {})
@@ -32,9 +33,7 @@ module Kanrisuru
32
33
 
33
34
  command = Kanrisuru::Command.new('du')
34
35
  command.append_flag('-s', summarize)
35
-
36
36
  command << path if Kanrisuru::Util.present?(path)
37
-
38
37
  command | "awk '{print \\$1, \\$2}'"
39
38
 
40
39
  execute_shell(command)
@@ -101,7 +100,7 @@ module Kanrisuru
101
100
  command.append_arg('-U', opts[:uuid])
102
101
  elsif Kanrisuru::Util.present?(device)
103
102
  mode = 'device'
104
- command.append_arg('-po', 'export')
103
+ command.append_arg('-pio', 'export')
105
104
  command << device
106
105
  else
107
106
  mode = 'list'
@@ -116,10 +115,7 @@ module Kanrisuru
116
115
  cmd.to_s
117
116
  when 'device'
118
117
  lines = cmd.to_a
119
-
120
- ## Only gets 1 device
121
- devices = blkid_devices(lines)
122
- devices[0]
118
+ blkid_devices(lines)
123
119
  else
124
120
  lines = cmd.to_a
125
121
  blkid_devices(lines)
@@ -191,6 +187,12 @@ module Kanrisuru
191
187
  current_device.usage = value
192
188
  elsif line =~ /^VERSION=/
193
189
  current_device.version = value.to_f
190
+ elsif line =~ /^MINIMUM_IO_SIZE=/
191
+ current_device.minimum_io_size = value.to_i
192
+ elsif line =~ /^PHYSICAL_SECTOR_SIZE=/
193
+ current_device.physical_sector_size = value.to_i
194
+ elsif line =~ /^LOGICAL_SECTOR_SIZE=/
195
+ current_device.logical_sector_size = value.to_i
194
196
  elsif line =~ /^PART_ENTRY_SCHEME=/
195
197
  current_device.part_entry_scheme = value
196
198
  elsif line =~ /^PART_ENTRY_UUID=/
@@ -15,8 +15,8 @@ module Kanrisuru
15
15
  os_define :linux, :which
16
16
 
17
17
  FilePath = Struct.new(:path)
18
- FileInfoId = Struct.new(:inode, :mode, :memory_blocks, :uid, :gid, :fsize, :date, :path, :type)
19
- FileInfo = Struct.new(:inode, :mode, :memory_blocks, :owner, :group, :fsize, :date, :path, :type)
18
+ FileInfoId = Struct.new(:inode, :mode, :hard_links, :uid, :gid, :fsize, :date, :path, :type)
19
+ FileInfo = Struct.new(:inode, :mode, :hard_links, :owner, :group, :fsize, :date, :path, :type)
20
20
  UserName = Struct.new(:user)
21
21
 
22
22
  def ls(opts = {})
@@ -235,7 +235,7 @@ module Kanrisuru
235
235
  @group = Kanrisuru::Mode::Permission.new(symbolic_to_numeric(modes[3..5]), modes[3..5])
236
236
  @other = Kanrisuru::Mode::Permission.new(symbolic_to_numeric(modes[6..8]), modes[6..8])
237
237
  else
238
- raise ArgumentErorr, "Invalid format for mode #{string}"
238
+ raise ArgumentError, "Invalid format for mode #{string}"
239
239
  end
240
240
  end
241
241
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.9'
5
5
  end
@@ -37,10 +37,11 @@ RSpec.describe Kanrisuru::Core::Disk do
37
37
  # puts device.name
38
38
  # puts result.inspect
39
39
  expect(result.success?).to eq(true)
40
- expect(result.data).to respond_to(
40
+ expect(result.data[0]).to respond_to(
41
41
  :name, :label, :uuid, :type, :uuid_sub, :label_fatboot, :version, :usage,
42
42
  :part_uuid, :part_entry_scheme, :part_entry_uuid, :part_entry_type,
43
- :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk
43
+ :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk,
44
+ :minimum_io_size, :physical_sector_size, :logical_sector_size,
44
45
  )
45
46
  end
46
47
 
@@ -67,6 +67,10 @@ RSpec.describe Kanrisuru::Core::File do
67
67
  mode = host.chmod(path, mode).mode
68
68
  expect(mode.symbolic).to eq('-rwxr--r--')
69
69
  expect(mode.to_i).to eq(0o744)
70
+
71
+ expect {
72
+ host.chmod(path, 600))
73
+ }.to raise_error(ArgumentError)
70
74
  end
71
75
 
72
76
  it 'changes file owner and group' do
@@ -29,13 +29,13 @@ RSpec.describe Kanrisuru::Core::Path do
29
29
  expect(result.data).to be_instance_of(Array)
30
30
 
31
31
  file = result.find { |f| f.path == '.bashrc' }
32
- expect(file.uid).to eq(1000)
32
+ expect(file.owner).to eq(1000)
33
33
 
34
34
  case os_name
35
35
  when 'opensuse', 'sles'
36
- expect(file.gid).to eq(100)
36
+ expect(file.group).to eq(100)
37
37
  else
38
- expect(file.gid).to eq(1000)
38
+ expect(file.group).to eq(1000)
39
39
  end
40
40
  end
41
41
 
@@ -15,7 +15,8 @@ RSpec.describe Kanrisuru::Core::Disk do
15
15
  expect(Kanrisuru::Core::Disk::BlkidDevice.new).to respond_to(
16
16
  :name, :label, :uuid, :type, :uuid_sub, :label_fatboot, :version, :usage,
17
17
  :part_uuid, :part_entry_scheme, :part_entry_uuid, :part_entry_type,
18
- :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk
18
+ :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk,
19
+ :minimum_io_size, :physical_sector_size, :logical_sector_size
19
20
  )
20
21
  end
21
22
  end
@@ -6,10 +6,10 @@ RSpec.describe Kanrisuru::Core::Path do
6
6
  it 'responds to path fields' do
7
7
  expect(Kanrisuru::Core::Path::FilePath.new).to respond_to(:path)
8
8
  expect(Kanrisuru::Core::Path::FileInfoId.new).to respond_to(
9
- :inode, :mode, :memory_blocks, :uid, :gid, :fsize, :date, :path, :type
9
+ :inode, :mode, :hard_links, :uid, :gid, :fsize, :date, :path, :type
10
10
  )
11
11
  expect(Kanrisuru::Core::Path::FileInfo.new).to respond_to(
12
- :inode, :mode, :memory_blocks, :owner, :group, :fsize, :date, :path, :type
12
+ :inode, :mode, :hard_links, :owner, :group, :fsize, :date, :path, :type
13
13
  )
14
14
  expect(Kanrisuru::Core::Path::UserName.new).to respond_to(:user)
15
15
  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.8.5
4
+ version: 0.8.9
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-08-20 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec