diskman 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/diskman +4 -4
- data/lib/diskman/chooser.rb +1 -1
- data/lib/diskman/commands/fdisk.rb +1 -1
- data/lib/diskman/commands/mkfs.rb +1 -1
- data/lib/diskman/commands/write.rb +3 -3
- data/lib/diskman/device.rb +3 -3
- data/lib/diskman/root_device.rb +2 -2
- data/lib/diskman/system.rb +2 -2
- data/lib/diskman/version.rb +1 -1
- data/lib/diskman.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b601bff2adbe81099f2b8c279a9757a99d0afc8b62fbec38a8cff8140fb7b1f
|
4
|
+
data.tar.gz: 12579cdae49bf6a812e0a415ab7bc273f0106dee52880e2a2850c4f1ea9ad680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99c8eeb4df39180d09418c9b8707df8bb1413aaa4c6ec55a2f058a66ce017e1a2a51b12254a7461dbfc2215aa0138995fdcd7b179f7987116eed8826bd938ab5
|
7
|
+
data.tar.gz: 05051535ce5c6007a5e6372e7c779b73b48e6ea920a16e7876533063b0d9ed754a21f2a1e1f5ace6b015eb01654230f78ec18e8e2684c4d13237f3790aa7947b
|
data/bin/diskman
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require_relative '../lib/diskman'
|
3
|
-
include Diskman
|
4
|
-
|
5
3
|
require 'docopt'
|
6
4
|
|
5
|
+
include Diskman # rubocop:disable Style/MixinUsage
|
6
|
+
|
7
7
|
class Main
|
8
8
|
def initialize(opts)
|
9
9
|
@opts = opts
|
@@ -37,7 +37,7 @@ class Main
|
|
37
37
|
elsif params.fdisk
|
38
38
|
Command::Fdisk.new.run
|
39
39
|
end
|
40
|
-
rescue Interrupt
|
40
|
+
rescue Interrupt # rubocop:disable Lint/SuppressedException
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -55,7 +55,7 @@ EOF
|
|
55
55
|
|
56
56
|
begin
|
57
57
|
Main.run(Docopt.docopt(usage))
|
58
|
-
rescue Docopt::Exit
|
58
|
+
rescue Docopt::Exit
|
59
59
|
puts usage
|
60
60
|
exit 2
|
61
61
|
end
|
data/lib/diskman/chooser.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Command
|
2
2
|
class Write
|
3
3
|
def run(file:)
|
4
|
-
if !File.
|
4
|
+
if !File.exist?(file)
|
5
5
|
puts ('Unable to read ' + file).red
|
6
6
|
raise Interrupt
|
7
7
|
end
|
@@ -10,13 +10,13 @@ module Command
|
|
10
10
|
device = device.choose_with_partitions
|
11
11
|
|
12
12
|
size = File.size(file)
|
13
|
-
cmd = device.get_write_command(file
|
13
|
+
cmd = device.get_write_command(file)
|
14
14
|
|
15
15
|
puts "File: #{file.yellow} (#{System.bytes2human(size)})"
|
16
16
|
puts "Device: #{device.to_s.yellow}"
|
17
17
|
puts "Command: #{cmd.yellow}"
|
18
18
|
|
19
|
-
System.exec!
|
19
|
+
System.exec!(cmd)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/diskman/device.rb
CHANGED
@@ -16,7 +16,7 @@ module Diskman
|
|
16
16
|
'sudo mkfs.%s %s' % [fs, @path]
|
17
17
|
end
|
18
18
|
|
19
|
-
def get_write_command(path
|
19
|
+
def get_write_command(path)
|
20
20
|
dd = 'sudo dd if="%s" of="%s" bs=%dK status=progress'
|
21
21
|
dd % [path, @path, 4096]
|
22
22
|
end
|
@@ -27,8 +27,8 @@ module Diskman
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def <=>(
|
31
|
-
@path <=>
|
30
|
+
def <=>(other)
|
31
|
+
@path <=> other.path
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/diskman/root_device.rb
CHANGED
@@ -35,7 +35,7 @@ module Diskman
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def get_with_partitions
|
38
|
-
Dir[@path + '*'].
|
38
|
+
Dir[@path + '*'].map do |file|
|
39
39
|
file =~ %r[/dev/(.*)] && Device.new($1)
|
40
40
|
end.sort
|
41
41
|
end
|
@@ -45,7 +45,7 @@ module Diskman
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def get_prop(name)
|
48
|
-
file =
|
48
|
+
file = '/sys/class/block/%s/%s' % [@name, name]
|
49
49
|
File.read(file).strip.gsub(/\s+/, ' ')
|
50
50
|
end
|
51
51
|
|
data/lib/diskman/system.rb
CHANGED
@@ -15,7 +15,7 @@ module Diskman
|
|
15
15
|
Confirmer.check! if safe
|
16
16
|
prepare_sudo_session! if sudo
|
17
17
|
puts
|
18
|
-
exec
|
18
|
+
exec(cmd)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Convert bytes into a human-friendly representation.
|
@@ -26,7 +26,7 @@ module Diskman
|
|
26
26
|
# advertised.
|
27
27
|
k = 1000
|
28
28
|
|
29
|
-
suffixes = [
|
29
|
+
suffixes = %w[T G M K B]
|
30
30
|
|
31
31
|
suffixes.each_with_index do |suffix, i|
|
32
32
|
threshold = k ** (suffixes.length - i - 1)
|
data/lib/diskman/version.rb
CHANGED
data/lib/diskman.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diskman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crdx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: colorize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.1
|
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:
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: docopt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: require_all
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
47
|
+
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,19 +81,19 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.21.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.21.0
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
executables:
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '0'
|
128
|
+
version: '3.0'
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - ">="
|