diskman 1.0.1 → 1.0.5

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: 5f495782abb13ab1f2378141a37adccc8795754376bceb7b431424f72773bf0b
4
- data.tar.gz: a858344c43c168dc352e3ee6e68b9009ba607e89a8ca20f3cc92ba6085ad964a
3
+ metadata.gz: fc55f72e8adacb9143ad05cf5edc11c2db9d8be185569bb9263735efcbe54700
4
+ data.tar.gz: 28a1cfa67910767440b3f6293192ddd05be1194e3b9a7246ed304b3bdb33df3c
5
5
  SHA512:
6
- metadata.gz: adee8c52252440fd704dac86884cae71c63b4fd476f316ecd70029e324b9fe5b75679f80f996edd8b6675abd2dee6044c03b3ba99b8aba477630ea76dadcfea3
7
- data.tar.gz: '09ed132b747d2b505e822f96c399df95302c5ac152260489d64fb496cc64e68e11211b33e2f69859e6f89dca959a88d4c511af85fbb38b0907d1841859fcecb9'
6
+ metadata.gz: b07d213e836deffc0998b14e57e68a4b41f509cf3ba7e7d60d488c6ee8a9f376c7032c90e34a1fb603bee553aaa81902145dfe2a83ca79d1bd976627e269c18d
7
+ data.tar.gz: 0f68a40ed3db1504f00b05765a646fd57e1e8686fb37e6d1b6e6a7af93303bbd2b4018dffafa9b9ab27a434be3a30b8d4ef5b96cee8f988a768fbddbd51f2729
@@ -36,7 +36,7 @@ module Diskman
36
36
  puts
37
37
 
38
38
  if @items.length == 1
39
- puts 'Press any key to select it.'
39
+ puts 'Press enter to select it.'
40
40
  $stdin.gets
41
41
  return @items.first
42
42
  end
@@ -1,8 +1,8 @@
1
1
  module Command
2
2
  class Mkfs
3
3
  def get_list
4
- Dir['/usr/bin/mkfs.*'].map do |path|
5
- path.gsub(%r[^/usr/bin/mkfs.], '')
4
+ Dir['/sbin/mkfs.*'].map do |path|
5
+ path.gsub(%r[^/sbin/mkfs.], '')
6
6
  end.sort
7
7
  end
8
8
 
@@ -13,8 +13,6 @@ module Command
13
13
  end
14
14
 
15
15
  device = RootDevice.choose
16
- device.ensure_not_mounted!
17
-
18
16
  device = device.choose_with_partitions
19
17
 
20
18
  fs = Chooser.new(get_list, item: 'filesystem').select
@@ -24,7 +22,7 @@ module Command
24
22
  puts "Device: #{device.to_s.yellow}"
25
23
  puts "Command: #{cmd.yellow}"
26
24
 
27
- System.exec!(cmd)
25
+ System.exec! cmd
28
26
  end
29
27
  end
30
28
  end
@@ -7,7 +7,7 @@ module Command
7
7
  end
8
8
 
9
9
  device = RootDevice.choose
10
- device.ensure_not_mounted!
10
+ device = device.choose_with_partitions
11
11
 
12
12
  size = File.size(file)
13
13
  cmd = device.get_write_command(file, size)
@@ -16,7 +16,7 @@ module Command
16
16
  puts "Device: #{device.to_s.yellow}"
17
17
  puts "Command: #{cmd.yellow}"
18
18
 
19
- System.exec!(cmd)
19
+ System.exec! cmd
20
20
  end
21
21
  end
22
22
  end
@@ -1,5 +1,6 @@
1
1
  module Diskman
2
2
  class Device
3
+ attr_reader :name
3
4
  attr_reader :path
4
5
 
5
6
  def initialize(name)
@@ -16,13 +17,7 @@ module Diskman
16
17
  end
17
18
 
18
19
  def get_write_command(path, bytes)
19
- if `which 2>/dev/null pv`.length > 0
20
- pv = 'pv --size %d' % bytes
21
- dd = 'dd if="%s" | ' + pv + ' | sudo dd of="%s" bs=%d'
22
- else
23
- dd = 'sudo dd if="%s" of="%s" bs=%d'
24
- end
25
-
20
+ dd = 'sudo dd if="%s" of="%s" bs=%dK status=progress'
26
21
  dd % [path, @path, 4096]
27
22
  end
28
23
 
@@ -5,11 +5,15 @@ module Diskman
5
5
  File.read(file).strip == '1'
6
6
  end.map do |path|
7
7
  path =~ %r[^/sys/block/(.*)/removable$]x && RootDevice.new($1)
8
+ end.reject do |device|
9
+ device.name =~ /sr\d+/
8
10
  end.sort
9
11
  end
10
12
 
11
13
  def self.choose
12
- Chooser.new(RootDevice.get_removable, item: 'removable device').select
14
+ selection = Chooser.new(RootDevice.get_removable, item: 'removable device').select
15
+ selection.ensure_not_mounted!
16
+ selection
13
17
  end
14
18
 
15
19
  def choose_with_partitions
@@ -1,3 +1,3 @@
1
1
  module Diskman
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diskman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - crdx
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-09 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: require_all
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
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: '2.0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colorize
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.17.0
61
+ version: 0.21.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: 0.17.0
68
+ version: 0.21.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,16 +86,16 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '12.3'
89
+ version: '13.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: '12.3'
97
- description:
98
- email:
96
+ version: '13.0'
97
+ description:
98
+ email:
99
99
  executables:
100
100
  - diskman
101
101
  extensions: []
@@ -117,7 +117,7 @@ homepage: https://github.com/crdx/diskman
117
117
  licenses:
118
118
  - MIT
119
119
  metadata: {}
120
- post_install_message:
120
+ post_install_message:
121
121
  rdoc_options: []
122
122
  require_paths:
123
123
  - lib
@@ -132,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.0.6
136
- signing_key:
135
+ rubygems_version: 3.2.21
136
+ signing_key:
137
137
  specification_version: 4
138
138
  summary: Interactive command line interface for safely managing disks
139
139
  test_files: []