bitferry 0.0.4 → 0.0.6

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: 17d40f40cac1390daae5cb6500acddf6f47bc83cc99b089530b7babf76adfb67
4
- data.tar.gz: 4a5652c86fc09e7b6a23fe1bf53b8ffd891ca544782fe73df9eeb4472cdd4495
3
+ metadata.gz: 4ef499867b4d23f30f8edeb19f087d80d5c6e10f22a0b969b296c953e5d3b2e6
4
+ data.tar.gz: 9a4945bbcd8c6ea7c0994f291c8f278cd08cc4aae2fab432811059a169c805b3
5
5
  SHA512:
6
- metadata.gz: 95f3e41305bd871b1ca3ce8b8d5172c54006e8b3ca4125ac60dd36a1d4f9b816853f2f30454c7269ef084c596c520c491c0f9202169ef9e2cf34f82a06f3d33f
7
- data.tar.gz: 0cc18872c913a6583d72d487191c26bac65f35f09fa051005b6fdc39293eb8d428a151e9643486bd9bb241dbd2cf705081345638c274ce49a2f13ebddd26daed
6
+ metadata.gz: 2737d6337aa29f0046eaa9d9088dd14ac83fc3934c234bd9d659c788aca15fb03c618aa5698327a99985b5049f68f52e320d649e867bac1b18aaff0a876f2d5f
7
+ data.tar.gz: 362ba450ce7b4322f19d153b1958d6bb615e1ffd379c9b90a3bd191c1f39f706f30e495b5836ce2ab575b96b7f22510dd59de1386bb98461919f46e22d30ff79
data/CHANGES.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.0.6
2
+
3
+ - Rudimentary GUI employing FXRuby
4
+
5
+ ## 0.0.5
6
+
7
+ - Disable cache usage in Restic check profiles
8
+ - Show stale tasks in verbose mode only
9
+ - Pick the innermost Bitferry volume in case of volumes nesting
10
+ - Fix an options profile application bug
11
+
1
12
  ## 0.0.4
2
13
 
3
14
  - Include/exclude path filters
data/README.md CHANGED
@@ -211,7 +211,7 @@ Parameters:
211
211
  Options:
212
212
  -e Encrypt files in destination using default profile (alias for -E default)
213
213
  -d Decrypt source files using default profile (alias for -D default)
214
- -x Use extended encryption profile options (applies to -e, -d)
214
+ -u Use extended encryption profile options (applies to -e, -d)
215
215
  --process, -X OPTIONS Extra task processing profile/options
216
216
  --encrypt, -E OPTIONS Encrypt files in destination using specified profile/options
217
217
  --decrypt, -D OPTIONS Decrypt source files using specified profile/options
data/bin/bitferryfx ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bitferry/fx'
3
+ #
data/lib/bitferry/cli.rb CHANGED
@@ -158,7 +158,7 @@ Clamp do
158
158
  puts " #{task.tag} #{task.show_status}"
159
159
  end
160
160
  end
161
- unless (xs = Bitferry::Task.stale).empty?
161
+ if !(xs = Bitferry::Task.stale).empty? && Bitferry.verbosity == :verbose
162
162
  puts
163
163
  puts '# Stale tasks'
164
164
  puts
@@ -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.4'
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.process(*tags)
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 = Volume.intact.collect { |volume| volume.intact_tasks }.flatten.uniq
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
- result = process.uniq.all? { |task| task.process }
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
@@ -341,12 +353,10 @@ module Bitferry
341
353
 
342
354
  def self.endpoint(root)
343
355
  path = Pathname.new(root).realdirpath
344
- # FIXME select innermost or outermost volume in case of nested volumes?
345
- intact.sort { |v1, v2| v2.root.size <=> v1.root.size }.each do |volume|
356
+ intact.sort { |v1, v2| v2.root.to_s.size <=> v1.root.to_s.size }.each do |volume|
346
357
  begin
347
- # FIXME chop trailing slashes
348
- stem = path.relative_path_from(volume.root)
349
- case stem.to_s
358
+ stem = path.relative_path_from(volume.root).to_s #.chomp('/')
359
+ case stem
350
360
  when '.' then return volume.endpoint
351
361
  when /^[^\.].*/ then return volume.endpoint(stem)
352
362
  end
@@ -477,7 +487,7 @@ module Bitferry
477
487
  when Array then option # Array is passed verbatim
478
488
  when '-' then nil # Disable adding any options with -
479
489
  when /^-/ then option.split(',') # Split comma-separated string into array --foo,bar --> [--foo, bar]
480
- else route.fetch(option) # Obtain array from the database
490
+ else route.fetch(option.nil? ? nil : option.to_sym) # Obtain options from the profile database
481
491
  end
482
492
  end
483
493
 
@@ -860,7 +870,7 @@ module Bitferry
860
870
 
861
871
  def include_filters = include.collect { |x| ['--filter', "+ #{x}"]}.flatten
862
872
 
863
-
873
+
864
874
  def exclude_filters = ([Volume::STORAGE, Volume::STORAGE_] + exclude).collect { |x| ['--filter', "- #{x}"]}.flatten
865
875
 
866
876
 
@@ -1044,7 +1054,7 @@ module Bitferry
1044
1054
 
1045
1055
  def include_filters = include.collect { |x| ['--include', x]}.flatten
1046
1056
 
1047
-
1057
+
1048
1058
  def common_options
1049
1059
  [
1050
1060
  case Bitferry.verbosity
@@ -1118,8 +1128,8 @@ module Bitferry
1118
1128
 
1119
1129
 
1120
1130
  CHECK = {
1121
- default: [],
1122
- full: ['--read-data']
1131
+ default: ['--no-cache'],
1132
+ full: ['--no-cache', '--read-data']
1123
1133
  }
1124
1134
  CHECK[nil] = nil # Skip integrity checking by default
1125
1135
 
@@ -1138,8 +1148,8 @@ module Bitferry
1138
1148
 
1139
1149
 
1140
1150
  def exclude_filters = ([Volume::STORAGE, Volume::STORAGE_] + exclude).collect { |x| ['--exclude', x]}.flatten
1141
-
1142
-
1151
+
1152
+
1143
1153
  def show_status = "#{show_operation} #{directory.show_status} #{show_direction} #{repository.show_status} #{show_filters}"
1144
1154
 
1145
1155
 
@@ -1238,8 +1248,8 @@ module Bitferry
1238
1248
 
1239
1249
 
1240
1250
  def exclude_filters = exclude.collect { |x| ['--exclude', x]}.flatten
1241
-
1242
-
1251
+
1252
+
1243
1253
  def show_status = "#{show_operation} #{repository.show_status} #{show_direction} #{directory.show_status} #{show_filters}"
1244
1254
 
1245
1255
 
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
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-20 00:00:00.000000000 Z
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