fixi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +57 -5
  3. data/lib/fixi/index.rb +16 -4
  4. data/lib/fixi/version.rb +1 -1
  5. metadata +68 -64
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8330f52e6d7f34454d161504cab06f0402058ba
4
+ data.tar.gz: 36ad54970efa87fbc22e001a387ed5c8d991e012
5
+ SHA512:
6
+ metadata.gz: ae6e6798919ec237d07e8e68402a43735247dcc3dac560f2d33c4da3c02319c6e7759b6852f7828cc2b1005b7fc3f62e47610982b7569c509acf043f337a2c19
7
+ data.tar.gz: 8fb9d5befde5b56c1a03784b51d0997892edd80f7dadb279cad4283b181b3e4fdd5263eaf56adfdbf429262c050113ab34a5670caa56fe13b3908d0efe552e0e
data/README.md CHANGED
@@ -13,30 +13,82 @@ and fixi aims to help with that in as unobtrusive a manner as possible.
13
13
  * Supports regular expression-based includes and excludes
14
14
  * Supports any combination of md5, sha1, sha256, sha384, and sha512
15
15
  * Supports shallow (fast) and deep (checksum-based) fixity checking
16
- * Support export and import of BagIt bags
16
+ * Supports export and import of BagIt bags
17
17
  * Supports fast lookups of files by checksum
18
18
 
19
19
  # Installation
20
20
 
21
+ *NOTE: Fixi has been tested with Ruby 1.9 on recent versions of Mac OS X, Ubuntu,
22
+ and Windows.*
23
+
21
24
  Releases of Fixi are published to rubygems.org, so you can install them the
22
25
  usual way:
23
26
 
24
- [sudo] gem install fixi
27
+ > [sudo] gem install fixi
25
28
 
26
29
  Or you can install from source via:
27
30
 
28
- [sudo] rake install
31
+ > [sudo] rake install
29
32
 
30
- *NOTE: Fixi uses sqlite3, which will need to be built if it's not already on
33
+ *NOTE: Fixi uses sqlite3, which may need to be built if it's not already on
31
34
  your system.*
32
35
 
33
36
  If you are using Ubuntu and you get an error about building sqlite, you may
34
37
  need to install both the ruby1.9.1-dev and the libsqlite3-dev packages:
35
38
 
36
- [sudo] apt-get install ruby1.9.1-dev libsqlite3-dev
39
+ > [sudo] apt-get install ruby1.9.1-dev libsqlite3-dev
37
40
 
38
41
  Similar steps may be necessary for other distros and operating systems.
39
42
 
43
+ # Quick Example
44
+
45
+ Say you have a growing collection of photos you keep organized on your laptop.
46
+ You keep a backup in the cloud, but you also want to start tracking the
47
+ bit-level integrity of the files. You're particularly concerned that files on
48
+ your laptop may become corrupt over time, and if you don't notice soon enough,
49
+ the problem might eventually be propogated to your backup copy!
50
+
51
+ First, create a fixity index. Let's say you decide you want to keep md5 and
52
+ sha1 checksums of each file rather than using the default single hash algorithm,
53
+ sha256.
54
+
55
+ > cd ~/Pictures
56
+ > fixi init -l md5,sha1
57
+
58
+ Now you have an empty index. To populate it for the first time:
59
+
60
+ > fixi add
61
+
62
+ Let's say after a couple weeks, you have more pictures. You've also intentionally
63
+ deleted a few older pictures you don't care about anymore. To get a quick report
64
+ of what has changed, without having to actually compute any checksums (the -s
65
+ option is short for --shallow), you can run:
66
+
67
+ > fixi check -s
68
+
69
+ The check command reports on each file that has been added (A), modified (M),
70
+ or deleted (D). After verifying that the reported adds and deletes are expected,
71
+ you can update the index via:
72
+
73
+ > fixi add
74
+ > fixi rm
75
+
76
+ Now let's say a couple more weeks have passed, and you've intentionally changed
77
+ the EXIF metadata in a bunch of old photos. After doing another shallow check and
78
+ verifying the reported modifications are expected, you can update the index via:
79
+
80
+ > fixi commit
81
+
82
+ Note: Anytime you want to do a full fixity check of all files, or even just a
83
+ single file, you can run:
84
+
85
+ > fixi check [/path/to/indexed/dir-or-file]
86
+
87
+ These are just the basics. For more information about all the commands fixi
88
+ supports, run:
89
+
90
+ > fixi --help
91
+
40
92
  # General Usage
41
93
  fixi [--version] [--help] <command> [<options>] [<args>]
42
94
 
@@ -82,9 +82,9 @@ class Fixi::Index
82
82
  if path && File.expand_path(path) != @rootpath
83
83
  relpath = relpath(File.expand_path(path))
84
84
  if File.directory?(path)
85
- conditions << " relpath like '#{relpath}/%'"
85
+ conditions << " relpath like ?"
86
86
  else
87
- conditions << " relpath = '#{relpath}'"
87
+ conditions << " relpath = ?"
88
88
  end
89
89
  end
90
90
  attribs.each do |name,value|
@@ -103,8 +103,20 @@ class Fixi::Index
103
103
  sql += " #{c}"
104
104
  end
105
105
  end
106
- @db.execute(sql) do |hash|
107
- yield hash
106
+ if (!relpath.nil?)
107
+ if File.directory?(path)
108
+ @db.execute(sql, relpath+"/%") do |hash|
109
+ yield hash
110
+ end
111
+ else
112
+ @db.execute(sql, relpath) do |hash|
113
+ yield hash
114
+ end
115
+ end
116
+ else
117
+ @db.execute(sql) do |hash|
118
+ yield hash
119
+ end
108
120
  end
109
121
  end
110
122
 
@@ -1,3 +1,3 @@
1
1
  module Fixi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,72 +1,80 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fixi
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Chris Wilper
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-12-16 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
16
14
  name: rspec
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
21
17
  - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
24
20
  type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: simplecov
28
21
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
32
31
  - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
35
34
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: trollop
39
35
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: trollop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
43
45
  - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
46
48
  type: :runtime
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: sqlite3
50
49
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
54
59
  - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
57
62
  type: :runtime
58
- version_requirements: *id004
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
59
69
  description: Keeps an index of checksums and lets you update and verify them
60
- email:
70
+ email:
61
71
  - cwilper@gmail.com
62
- executables:
72
+ executables:
63
73
  - fixi
64
74
  extensions: []
65
-
66
75
  extra_rdoc_files: []
67
-
68
- files:
69
- - .gitignore
76
+ files:
77
+ - ".gitignore"
70
78
  - Gemfile
71
79
  - LICENSE
72
80
  - README.md
@@ -92,34 +100,30 @@ files:
92
100
  - spec/lib/fixi/patch/string_pack_spec.rb
93
101
  - spec/lib/fixi_spec.rb
94
102
  - spec/spec_helper.rb
95
- homepage: ""
103
+ homepage: ''
96
104
  licenses: []
97
-
105
+ metadata: {}
98
106
  post_install_message:
99
107
  rdoc_options: []
100
-
101
- require_paths:
108
+ require_paths:
102
109
  - lib
103
- required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
- requirements:
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
106
112
  - - ">="
107
- - !ruby/object:Gem::Version
108
- version: "0"
109
- required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
- requirements:
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
112
117
  - - ">="
113
- - !ruby/object:Gem::Version
114
- version: "0"
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
115
120
  requirements: []
116
-
117
121
  rubyforge_project: fixi
118
- rubygems_version: 1.8.11
122
+ rubygems_version: 2.6.7
119
123
  signing_key:
120
- specification_version: 3
124
+ specification_version: 4
121
125
  summary: A fixity tracker utility
122
- test_files:
126
+ test_files:
123
127
  - spec/lib/fixi/command/init_spec.rb
124
128
  - spec/lib/fixi/patch/string_pack_spec.rb
125
129
  - spec/lib/fixi_spec.rb