bitferry 0.0.5 → 0.0.6
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 +4 -4
- data/CHANGES.md +4 -0
- data/bin/bitferryfx +3 -0
- data/lib/bitferry/fx.rb +63 -0
- data/lib/bitferry.rb +16 -4
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef499867b4d23f30f8edeb19f087d80d5c6e10f22a0b969b296c953e5d3b2e6
|
4
|
+
data.tar.gz: 9a4945bbcd8c6ea7c0994f291c8f278cd08cc4aae2fab432811059a169c805b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2737d6337aa29f0046eaa9d9088dd14ac83fc3934c234bd9d659c788aca15fb03c618aa5698327a99985b5049f68f52e320d649e867bac1b18aaff0a876f2d5f
|
7
|
+
data.tar.gz: 362ba450ce7b4322f19d153b1958d6bb615e1ffd379c9b90a3bd191c1f39f706f30e495b5836ce2ab575b96b7f22510dd59de1386bb98461919f46e22d30ff79
|
data/CHANGES.md
CHANGED
data/bin/bitferryfx
ADDED
data/lib/bitferry/fx.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'fox16'
|
2
|
+
require 'bitferry'
|
3
|
+
|
4
|
+
include Fox
|
5
|
+
|
6
|
+
class UI < FXMainWindow
|
7
|
+
|
8
|
+
def initialize(app)
|
9
|
+
super(@app = app, 'BitferryFX', width: 400, padding: 4)
|
10
|
+
FXToolTip.new(app)
|
11
|
+
@progress = FXProgressBar.new(self, padding: 4, height: 16, opts: LAYOUT_FILL_X | JUSTIFY_BOTTOM | LAYOUT_FIX_HEIGHT)
|
12
|
+
@simulate = FXCheckButton.new(self, "&Simulation mode (dry run)\tPrevent operations from making any on-disk changes")
|
13
|
+
@simulate.checkState = Bitferry.simulate?
|
14
|
+
buttons = FXPacker.new(self, opts: LAYOUT_FILL_X | LAYOUT_SIDE_BOTTOM | PACK_UNIFORM_WIDTH | FRAME_SUNKEN)
|
15
|
+
@process = FXButton.new(buttons, "&Process\tProcess all intact tasks", opts: BUTTON_NORMAL | BUTTON_INITIAL | BUTTON_DEFAULT | LAYOUT_SIDE_LEFT)
|
16
|
+
@process.connect(SEL_COMMAND) { process }
|
17
|
+
@process.setFocus
|
18
|
+
@quit = FXButton.new(buttons, "&Quit\tStop any pending operations and exit", opts: BUTTON_NORMAL | LAYOUT_SIDE_RIGHT)
|
19
|
+
@quit.connect(SEL_COMMAND) { exit }
|
20
|
+
@reload = FXButton.new(buttons, "&Reload\tReread volumes and tasks to capture volume changes", opts: BUTTON_NORMAL | LAYOUT_SIDE_RIGHT)
|
21
|
+
@reload.connect(SEL_COMMAND) { reset }
|
22
|
+
@sensible = [@process, @reload] # Controls which must be disabled during processing
|
23
|
+
reset
|
24
|
+
end
|
25
|
+
|
26
|
+
def process
|
27
|
+
Bitferry.simulate = @simulate.checked?
|
28
|
+
@progress.setBarColor(:blue)
|
29
|
+
@progress.progress = 0
|
30
|
+
Thread.new {
|
31
|
+
@app.runOnUiThread { @sensible.each(&:disable) }
|
32
|
+
begin
|
33
|
+
Bitferry.process { |total, processed, failed |
|
34
|
+
@app.runOnUiThread {
|
35
|
+
@progress.setBarColor(:red) if failed > 0
|
36
|
+
@progress.progress = processed
|
37
|
+
@progress.total = total
|
38
|
+
}
|
39
|
+
}
|
40
|
+
ensure
|
41
|
+
@app.runOnUiThread { @sensible.each(&:enable) }
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def reset
|
47
|
+
@progress.progress = 0
|
48
|
+
Bitferry.restore
|
49
|
+
end
|
50
|
+
|
51
|
+
def create
|
52
|
+
super
|
53
|
+
show(PLACEMENT_SCREEN)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
FXApp.new do |app|
|
59
|
+
Bitferry.verbosity = :verbose
|
60
|
+
UI.new(app)
|
61
|
+
app.create
|
62
|
+
app.run
|
63
|
+
end
|
data/lib/bitferry.rb
CHANGED
@@ -12,7 +12,7 @@ require 'shellwords'
|
|
12
12
|
module Bitferry
|
13
13
|
|
14
14
|
|
15
|
-
VERSION = '0.0.
|
15
|
+
VERSION = '0.0.6'
|
16
16
|
|
17
17
|
|
18
18
|
module Logging
|
@@ -85,9 +85,11 @@ module Bitferry
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
def self.
|
88
|
+
def self.intact_tasks = Volume.intact.collect { |volume| volume.intact_tasks }.flatten.uniq
|
89
|
+
|
90
|
+
def self.process(*tags, &block)
|
89
91
|
log.info('processing tasks')
|
90
|
-
tasks =
|
92
|
+
tasks = intact_tasks
|
91
93
|
if tags.empty?
|
92
94
|
process = tasks
|
93
95
|
else
|
@@ -102,7 +104,17 @@ module Bitferry
|
|
102
104
|
end
|
103
105
|
end
|
104
106
|
end
|
105
|
-
|
107
|
+
tasks = process.uniq
|
108
|
+
total = tasks.size
|
109
|
+
processed = 0
|
110
|
+
failed = 0
|
111
|
+
result = tasks.all? do |task|
|
112
|
+
r = task.process
|
113
|
+
processed += 1
|
114
|
+
failed += 1 unless r
|
115
|
+
yield(total, processed, failed) if block_given?
|
116
|
+
r
|
117
|
+
end
|
106
118
|
result ? log.info('tasks processed') : log.warn('task process failure(s) reported')
|
107
119
|
result
|
108
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitferry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg A. Khlybov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03
|
11
|
+
date: 2024-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fxruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: neatjson
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,14 +98,17 @@ description:
|
|
84
98
|
email: fougas@mail.ru
|
85
99
|
executables:
|
86
100
|
- bitferry
|
101
|
+
- bitferryfx
|
87
102
|
extensions: []
|
88
103
|
extra_rdoc_files: []
|
89
104
|
files:
|
90
105
|
- CHANGES.md
|
91
106
|
- README.md
|
92
107
|
- bin/bitferry
|
108
|
+
- bin/bitferryfx
|
93
109
|
- lib/bitferry.rb
|
94
110
|
- lib/bitferry/cli.rb
|
111
|
+
- lib/bitferry/fx.rb
|
95
112
|
homepage: https://github.com/okhlybov/bitferry
|
96
113
|
licenses:
|
97
114
|
- BSD-3-Clause
|