digestif 1.0.2 → 1.0.3

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.
data/History.txt CHANGED
@@ -0,0 +1,10 @@
1
+ === Version 1.0.3
2
+
3
+ * Improved the usability of digestif as a library
4
+ * Access to default options
5
+
6
+ === Version 1.0.0
7
+
8
+ First release
9
+
10
+ * Basic functionality of sparse hashing is functional
data/lib/digestif/cli.rb CHANGED
@@ -9,6 +9,14 @@ module Digestif
9
9
  new(args).run
10
10
  end
11
11
 
12
+ def self.default_options
13
+ options = OpenStruct.new
14
+ options.digest = :sha1
15
+ options.seek_size = 1024
16
+ options.read_size = 512
17
+ options
18
+ end
19
+
12
20
  attr_accessor :args, :options
13
21
 
14
22
  def initialize(args)
@@ -31,11 +39,7 @@ module Digestif
31
39
  end
32
40
 
33
41
  def parse_options
34
- # defaults
35
- options = OpenStruct.new
36
- options.digest = :sha1
37
- options.seek_size = 1024
38
- options.read_size = 512
42
+ options = CLI.default_options
39
43
 
40
44
  parser = OptionParser.new do |p|
41
45
  p.banner = "Usage: digestif [options] filename"
@@ -46,7 +50,8 @@ module Digestif
46
50
 
47
51
  p.on("-d", "--digest DIGEST", [:md5, :sha1],
48
52
  "Digest algorithm to use. Currently supported:",
49
- " md5", " sha1", ' ') do |digest|
53
+ " md5", " sha1",
54
+ "(default #{options.digest.to_s})", ' ') do |digest|
50
55
  options.digest = digest
51
56
  end
52
57
 
@@ -6,7 +6,7 @@ module Digestif
6
6
 
7
7
  attr_accessor :options, :filename
8
8
 
9
- def initialize(filename, options)
9
+ def initialize(filename, options = CLI.default_options)
10
10
  self.filename = filename
11
11
  self.options = options
12
12
  end
@@ -1,6 +1,6 @@
1
1
  module Digestif
2
2
  def self.version
3
- "1.0.2"
3
+ "1.0.3"
4
4
  end
5
5
 
6
6
  def self.version_string
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digestif
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Roberts
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-12 00:00:00 -05:00
18
+ date: 2011-01-20 00:00:00 -05:00
19
19
  default_executable: digestif
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency