rubysl-digest 1.2.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -8
- data/lib/digest/md5.rb +6 -3
- data/lib/digest/sha1.rb +6 -3
- data/lib/rubysl/digest/digest.rb +26 -0
- data/lib/rubysl/digest/version.rb +1 -1
- data/rubysl-digest.gemspec +1 -2
- data/spec/md5/file_spec.rb +1 -1
- data/spec/sha1/file_spec.rb +1 -1
- data/spec/sha256/file_spec.rb +1 -1
- data/spec/sha384/file_spec.rb +1 -1
- data/spec/sha512/file_spec.rb +1 -1
- metadata +22 -42
- data/lib/md5.rb +0 -6
- data/lib/sha1.rb +0 -6
- data/spec/shared/fixtures/common.rb +0 -167
- data/spec/shared/read.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 894b9040ca02d32c9978b21b2de48b17aea7d073
|
4
|
+
data.tar.gz: 1219883b474b25c9372a362aa7df7e2d7dedd71b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3137785b143caf64fa3c962d0edc75f7822cb21337853afc5f1656a4da5de7b582db4469f4d187ce8acb0adb6e69dae2dbe76d3f6b7dffece5ad243c722358b0
|
7
|
+
data.tar.gz: 201df694e7967084875fdc5a0b04b44c6e8ade274594cb79acb9637f9039e9be0998564694ecedb95a5b476b786e5269f905c6a54d9b819a719b19dba4101873
|
data/.travis.yml
CHANGED
data/lib/digest/md5.rb
CHANGED
@@ -7,10 +7,13 @@ require 'digest/md5/md5'
|
|
7
7
|
|
8
8
|
class MD5 < Digest::MD5
|
9
9
|
class << self
|
10
|
+
alias orig_new new
|
10
11
|
def new(str = nil)
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
if str
|
13
|
+
orig_new.update(str)
|
14
|
+
else
|
15
|
+
orig_new
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
19
|
def md5(*args)
|
data/lib/digest/sha1.rb
CHANGED
@@ -7,10 +7,13 @@ require 'digest/sha1/sha1'
|
|
7
7
|
|
8
8
|
class SHA1 < Digest::SHA1
|
9
9
|
class << self
|
10
|
+
alias orig_new new
|
10
11
|
def new(str = nil)
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
if str
|
13
|
+
orig_new.update(str)
|
14
|
+
else
|
15
|
+
orig_new
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
19
|
def sha1(*args)
|
data/lib/rubysl/digest/digest.rb
CHANGED
@@ -28,6 +28,13 @@ module Digest
|
|
28
28
|
def self.file(name)
|
29
29
|
new.file(name)
|
30
30
|
end
|
31
|
+
|
32
|
+
# Returns the base64 encoded hash value of a given _string_. The
|
33
|
+
# return value is properly padded with '=' and contains no line
|
34
|
+
# feeds.
|
35
|
+
def self.base64digest(str, *args)
|
36
|
+
[digest(str, *args)].pack('m0')
|
37
|
+
end
|
31
38
|
end
|
32
39
|
|
33
40
|
module Instance
|
@@ -42,6 +49,25 @@ module Digest
|
|
42
49
|
}
|
43
50
|
self
|
44
51
|
end
|
52
|
+
|
53
|
+
# If none is given, returns the resulting hash value of the digest
|
54
|
+
# in a base64 encoded form, keeping the digest's state.
|
55
|
+
#
|
56
|
+
# If a +string+ is given, returns the hash value for the given
|
57
|
+
# +string+ in a base64 encoded form, resetting the digest to the
|
58
|
+
# initial state before and after the process.
|
59
|
+
#
|
60
|
+
# In either case, the return value is properly padded with '=' and
|
61
|
+
# contains no line feeds.
|
62
|
+
def base64digest(str = nil)
|
63
|
+
[str ? digest(str) : digest].pack('m0')
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns the resulting hash value and resets the digest to the
|
67
|
+
# initial state.
|
68
|
+
def base64digest!
|
69
|
+
[digest!].pack('m0')
|
70
|
+
end
|
45
71
|
end
|
46
72
|
end
|
47
73
|
|
data/rubysl-digest.gemspec
CHANGED
@@ -22,10 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = "~>
|
25
|
+
spec.required_ruby_version = "~> 2.0"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.3"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency "mspec", "~> 1.5"
|
30
|
-
spec.add_development_dependency "rubysl-prettyprint", "~> 1.0"
|
31
30
|
end
|
data/spec/md5/file_spec.rb
CHANGED
data/spec/sha1/file_spec.rb
CHANGED
data/spec/sha256/file_spec.rb
CHANGED
data/spec/sha384/file_spec.rb
CHANGED
data/spec/sha512/file_spec.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-digest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
version_requirements: !ruby/object:Gem::Requirement
|
15
|
-
requirements:
|
16
|
-
- - "~>"
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: '1.3'
|
19
14
|
name: bundler
|
20
|
-
prerelease: false
|
21
15
|
requirement: !ruby/object:Gem::Requirement
|
22
16
|
requirements:
|
23
|
-
- -
|
17
|
+
- - ~>
|
24
18
|
- !ruby/object:Gem::Version
|
25
19
|
version: '1.3'
|
26
20
|
type: :development
|
27
|
-
|
21
|
+
prerelease: false
|
28
22
|
version_requirements: !ruby/object:Gem::Requirement
|
29
23
|
requirements:
|
30
|
-
- -
|
24
|
+
- - ~>
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
33
28
|
name: rake
|
34
|
-
prerelease: false
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- -
|
31
|
+
- - ~>
|
38
32
|
- !ruby/object:Gem::Version
|
39
33
|
version: '10.0'
|
40
34
|
type: :development
|
41
|
-
|
35
|
+
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- -
|
38
|
+
- - ~>
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
47
42
|
name: mspec
|
48
|
-
prerelease: false
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '1.5'
|
54
48
|
type: :development
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '1.0'
|
61
|
-
name: rubysl-prettyprint
|
62
49
|
prerelease: false
|
63
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
51
|
requirements:
|
65
|
-
- -
|
52
|
+
- - ~>
|
66
53
|
- !ruby/object:Gem::Version
|
67
|
-
version: '1.
|
68
|
-
type: :development
|
54
|
+
version: '1.5'
|
69
55
|
description: Ruby standard library digest.
|
70
56
|
email:
|
71
57
|
- brixen@gmail.com
|
@@ -79,8 +65,8 @@ extensions:
|
|
79
65
|
- ext/rubysl/digest/sha2/extconf.rb
|
80
66
|
extra_rdoc_files: []
|
81
67
|
files:
|
82
|
-
-
|
83
|
-
-
|
68
|
+
- .gitignore
|
69
|
+
- .travis.yml
|
84
70
|
- Gemfile
|
85
71
|
- LICENSE
|
86
72
|
- README.md
|
@@ -128,11 +114,9 @@ files:
|
|
128
114
|
- lib/digest/rmd160.rb
|
129
115
|
- lib/digest/sha1.rb
|
130
116
|
- lib/digest/sha2.rb
|
131
|
-
- lib/md5.rb
|
132
117
|
- lib/rubysl/digest.rb
|
133
118
|
- lib/rubysl/digest/digest.rb
|
134
119
|
- lib/rubysl/digest/version.rb
|
135
|
-
- lib/sha1.rb
|
136
120
|
- rubysl-digest.gemspec
|
137
121
|
- spec/hexencode_spec.rb
|
138
122
|
- spec/md5/append_spec.rb
|
@@ -211,8 +195,6 @@ files:
|
|
211
195
|
- spec/sha512/size_spec.rb
|
212
196
|
- spec/sha512/to_s_spec.rb
|
213
197
|
- spec/sha512/update_spec.rb
|
214
|
-
- spec/shared/fixtures/common.rb
|
215
|
-
- spec/shared/read.rb
|
216
198
|
homepage: https://github.com/rubysl/rubysl-digest
|
217
199
|
licenses:
|
218
200
|
- BSD
|
@@ -223,17 +205,17 @@ require_paths:
|
|
223
205
|
- lib
|
224
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
225
207
|
requirements:
|
226
|
-
- -
|
208
|
+
- - ~>
|
227
209
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
210
|
+
version: '2.0'
|
229
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
212
|
requirements:
|
231
|
-
- -
|
213
|
+
- - '>='
|
232
214
|
- !ruby/object:Gem::Version
|
233
215
|
version: '0'
|
234
216
|
requirements: []
|
235
217
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.0.7
|
237
219
|
signing_key:
|
238
220
|
specification_version: 4
|
239
221
|
summary: Ruby standard library digest.
|
@@ -315,5 +297,3 @@ test_files:
|
|
315
297
|
- spec/sha512/size_spec.rb
|
316
298
|
- spec/sha512/to_s_spec.rb
|
317
299
|
- spec/sha512/update_spec.rb
|
318
|
-
- spec/shared/fixtures/common.rb
|
319
|
-
- spec/shared/read.rb
|
data/lib/md5.rb
DELETED
data/lib/sha1.rb
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
module DirSpecs
|
2
|
-
def self.mock_dir(dirs = ['dir_specs_mock'])
|
3
|
-
@mock_dir ||= tmp("")
|
4
|
-
File.join @mock_dir, dirs
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.nonexistent
|
8
|
-
name = File.join mock_dir, "nonexistent00"
|
9
|
-
name = name.next while File.exist? name
|
10
|
-
File.join mock_dir, name
|
11
|
-
end
|
12
|
-
|
13
|
-
# TODO: make these relative to the mock_dir
|
14
|
-
def self.clear_dirs
|
15
|
-
begin
|
16
|
-
kcode, $KCODE = $KCODE, 'u'
|
17
|
-
[ 'nonexisting',
|
18
|
-
'default_perms',
|
19
|
-
'reduced',
|
20
|
-
'always_returns_0',
|
21
|
-
'???',
|
22
|
-
[0xe9].pack('U')
|
23
|
-
].each do |dir|
|
24
|
-
begin
|
25
|
-
Dir.rmdir dir
|
26
|
-
rescue
|
27
|
-
end
|
28
|
-
end
|
29
|
-
ensure
|
30
|
-
$KCODE = kcode
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# The names of the fixture directories and files used by
|
35
|
-
# various Dir specs.
|
36
|
-
def self.mock_dir_files
|
37
|
-
unless @mock_dir_files
|
38
|
-
@mock_dir_files = %w[
|
39
|
-
.dotfile
|
40
|
-
.dotsubdir/.dotfile
|
41
|
-
.dotsubdir/nondotfile
|
42
|
-
|
43
|
-
deeply/.dotfile
|
44
|
-
deeply/nested/.dotfile.ext
|
45
|
-
deeply/nested/directory/structure/.ext
|
46
|
-
deeply/nested/directory/structure/bar
|
47
|
-
deeply/nested/directory/structure/baz
|
48
|
-
deeply/nested/directory/structure/file_one
|
49
|
-
deeply/nested/directory/structure/file_one.ext
|
50
|
-
deeply/nested/directory/structure/foo
|
51
|
-
deeply/nondotfile
|
52
|
-
|
53
|
-
file_one.ext
|
54
|
-
file_two.ext
|
55
|
-
|
56
|
-
dir_filename_ordering
|
57
|
-
dir/filename_ordering
|
58
|
-
|
59
|
-
nondotfile
|
60
|
-
|
61
|
-
subdir_one/.dotfile
|
62
|
-
subdir_one/nondotfile
|
63
|
-
subdir_two/nondotfile
|
64
|
-
subdir_two/nondotfile.ext
|
65
|
-
|
66
|
-
brace/a
|
67
|
-
brace/a.js
|
68
|
-
brace/a.erb
|
69
|
-
brace/a.js.rjs
|
70
|
-
brace/a.html.erb
|
71
|
-
|
72
|
-
special/+
|
73
|
-
|
74
|
-
special/^
|
75
|
-
special/$
|
76
|
-
|
77
|
-
special/(
|
78
|
-
special/)
|
79
|
-
special/[
|
80
|
-
special/]
|
81
|
-
special/{
|
82
|
-
special/}
|
83
|
-
|
84
|
-
special/test{1}/file[1]
|
85
|
-
]
|
86
|
-
|
87
|
-
platform_is_not :windows do
|
88
|
-
@mock_dir_files += %w[
|
89
|
-
special/*
|
90
|
-
special/?
|
91
|
-
|
92
|
-
special/|
|
93
|
-
]
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
@mock_dir_files
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.create_mock_dirs
|
101
|
-
umask = File.umask 0
|
102
|
-
mock_dir_files.each do |name|
|
103
|
-
file = File.join mock_dir, name
|
104
|
-
mkdir_p File.dirname(file)
|
105
|
-
touch file
|
106
|
-
end
|
107
|
-
File.umask umask
|
108
|
-
end
|
109
|
-
|
110
|
-
def self.delete_mock_dirs
|
111
|
-
rm_r mock_dir
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.mock_rmdir(*dirs)
|
115
|
-
mock_dir ['rmdir_dirs'].concat(dirs)
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.rmdir_dirs(create = true)
|
119
|
-
dirs = %w[
|
120
|
-
empty
|
121
|
-
nonempty
|
122
|
-
nonempty/child
|
123
|
-
noperm
|
124
|
-
noperm/child
|
125
|
-
]
|
126
|
-
|
127
|
-
base_dir = mock_dir ['rmdir_dirs']
|
128
|
-
|
129
|
-
dirs.reverse_each do |d|
|
130
|
-
dir = File.join base_dir, d
|
131
|
-
if File.exists? dir
|
132
|
-
File.chmod 0777, dir
|
133
|
-
rm_r dir
|
134
|
-
end
|
135
|
-
end
|
136
|
-
rm_r base_dir
|
137
|
-
|
138
|
-
if create
|
139
|
-
dirs.each do |d|
|
140
|
-
dir = File.join base_dir, d
|
141
|
-
unless File.exists? dir
|
142
|
-
mkdir_p dir
|
143
|
-
File.chmod 0777, dir
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def self.expected_paths
|
150
|
-
%w[
|
151
|
-
.
|
152
|
-
..
|
153
|
-
.dotfile
|
154
|
-
.dotsubdir
|
155
|
-
brace
|
156
|
-
deeply
|
157
|
-
dir
|
158
|
-
dir_filename_ordering
|
159
|
-
file_one.ext
|
160
|
-
file_two.ext
|
161
|
-
nondotfile
|
162
|
-
special
|
163
|
-
subdir_one
|
164
|
-
subdir_two
|
165
|
-
]
|
166
|
-
end
|
167
|
-
end
|
data/spec/shared/read.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path('../fixtures/common', __FILE__)
|
2
|
-
|
3
|
-
describe :file_read_directory, :shared => true do
|
4
|
-
platform_is :darwin, :linux do
|
5
|
-
it "raises an Errno::EISDIR when passed a path that is a directory" do
|
6
|
-
lambda { @object.send(@method, ".") }.should raise_error(Errno::EISDIR)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
platform_is :bsd do
|
11
|
-
it "does not raises any exception when passed a path that is a directory" do
|
12
|
-
lambda { @object.send(@method, ".") }.should_not raise_error
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
platform_is :windows do
|
17
|
-
it "raises an Errno::EACCES when passed a path that is a directory" do
|
18
|
-
lambda { @object.send(@method, ".") }.should raise_error(Errno::EACCES)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|