bup 0.1.0 → 0.2.0

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: 66fb72e2d0fbc1251274b4b505e62f695cf975aba7daa6fb6896fe7c72f2f969
4
- data.tar.gz: 38be925b9fb61f41475b495145b572e6244ce8a692b40e8af311816315cca517
3
+ metadata.gz: 02ca6df7a29ad6290ab682bd214dc097c70e6a7a464bbbea22b1b4d100465ec7
4
+ data.tar.gz: 7bf6a98055fed3353f131e56033c876860ec6f4e22b995c4f002ffedd5e8462b
5
5
  SHA512:
6
- metadata.gz: 0c9621fb9d2087df3767a57ce5e71f540e8316d1dc0be9a1a8eb47c3da81f9230f234de7832f2b507754764759305a3edb21131da182caeb1a40bb6e752e3615
7
- data.tar.gz: d762849552b7c575d7a366eaeea96900a1fd822ef07f4e7cf736afb737368c004e2aab9a8a34563971f9124cc348fd5bca0aa6686327ef34edc73a2b37fdffe0
6
+ metadata.gz: f96824b5eaa8fa4089497aa3eff4daf4abf5f041931fac622ac0163aed57d79036cced77b50a771fb5c675b6abaa1473e1018b9312c8e8d5935d12fc6255c601
7
+ data.tar.gz: 31aaf6faab04f3e7806bc60b082aac8bd0177aa4ade5fb40e02189289e75fef8d401aaedfce4f4abd4454aeb6679c881af0391dc732169d6eb362a820c970c9a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2021-11-10
3
+ - List profiles.
4
+ - Bug fixes against empty backup directories.
5
+ - Bug fix to print buffers using read_nonblock from popen3 streams.
4
6
 
5
- - Initial release
7
+ ## [0.1.0] - 2021-11-11
8
+
9
+ - Backup profiles.
10
+ - Backup history limits.
11
+ - Tar command specification.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bup (0.1.0)
4
+ bup (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/buprc CHANGED
@@ -1,14 +1,15 @@
1
1
  ---
2
2
  profiles:
3
3
  default:
4
+ description: "Simple backup of critical files."
4
5
  include:
5
6
  - "$HOME"
6
7
  exclude:
7
8
  - "$HOME"
8
9
  - "$HOME/backups"
9
- lastrun: '2021-11-11T14:18:27 +0000'
10
+ lastrun: '2021-11-11T18:45:33 +0000'
10
11
  destination: "$HOME/backups"
11
- history: 10
12
+ history: 2
12
13
  tarcmd:
13
14
  - sudo
14
15
  - tar
data/exe/bup CHANGED
@@ -21,12 +21,21 @@ OptParse.new do |opt|
21
21
  opt.on("-t", "--type=type", String, "Type of backup.") do |t|
22
22
  config.runtime["type"] = t == "incremental" ? t : "full"
23
23
  end
24
+
25
+ opt.on("-l", "--list", "List profiles and exit.") do
26
+ config.runtime['action'] = 'list'
27
+ end
24
28
  end.parse!
25
29
 
26
30
  config.load(configfile) if File.exist?(configfile)
27
31
 
28
- tar = Bup::Tar.new(config)
29
-
30
- tar.call
31
-
32
- config.save(configfile)
32
+ case config.runtime["action"]
33
+ when "list"
34
+ config.config["profiles"].each do |key, profile|
35
+ puts "#{key} - #{profile["description"] || ""}"
36
+ end
37
+ else
38
+ tar = Bup::Tar.new(config)
39
+ tar.call
40
+ config.save(configfile)
41
+ end
data/lib/bup/tar.rb CHANGED
@@ -62,9 +62,11 @@ module Bup
62
62
  end
63
63
 
64
64
  # Remove all incremental files that are older than the oldest kept full backup.
65
- remove_before = File.stat(oldest_kept_file).ctime
66
- Dir["#{destination}/#{profile_name}*"].each do |backupfile|
67
- File.delete(backupfile) if File.stat(backupfile).ctime < remove_before
65
+ if oldest_kept_file
66
+ remove_before = File.stat(oldest_kept_file).ctime
67
+ Dir["#{destination}/#{profile_name}*"].each do |backupfile|
68
+ File.delete(backupfile) if File.stat(backupfile).ctime < remove_before
69
+ end
68
70
  end
69
71
  end
70
72
 
@@ -101,17 +103,28 @@ module Bup
101
103
  begin
102
104
  Open3.popen3(*args) do |stdin, stdout, stderr, wait_thr|
103
105
  stdin.close
104
-
105
106
  while wait_thr.status
106
107
  r, w, e = IO.select([stdout, stderr])
107
108
  r.each do |stream|
108
- print stream.read
109
+ begin
110
+ print stream.read_nonblock(1024)
111
+ rescue EOFError
112
+ end
109
113
  end
110
114
  end
111
115
 
112
116
  wait_thr.join
113
- print stdout.read
114
- print stderr.read
117
+ begin
118
+ print stdout.read_nonblock(1024)
119
+ rescue EOFError
120
+ end
121
+
122
+ begin
123
+ print stderr.read_nonblock(1024)
124
+ rescue EOFError
125
+ end
126
+
127
+ STDOUT.flush
115
128
  end
116
129
  ensure
117
130
  tf.unlink
data/lib/bup/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bup
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Baskinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-11-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Backup tool driver that connects tar, gnupg, and other tools to accomplish
14
14
  backups.