checksum-tools 1.2.0.beta2 → 1.2.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +5 -11
- data/lib/checksum-tools.rb +14 -14
- data/lib/checksum-tools/remote.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff2633feaa353c335048a693b831f4205f819103
|
4
|
+
data.tar.gz: 1ee1945f4c93efd206534acd1fe1dd4e23311e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7349365c1d455fe14ddbc6639b4bdfecec3a14129c4108afb3d71c84f34dc46de62daa6a0c01146c086669dee506b8adbd5aec541f8e0ba93e71ebcf17f7ddf7
|
7
|
+
data.tar.gz: 6d0595b9893a1edf8d205ecc746ab485eb00edae1de58240073cf719f662db965d81d2c8384a16227971ba4d7345e6a6a827f5a2f6efd5ea9083f7e7f97505a1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,7 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/cbeer/gssapi.git
|
3
|
-
revision: 59bbd6dd916cf2b96cf6b1984f5db8e7891c8bcd
|
4
|
-
specs:
|
5
|
-
gssapi (1.1.2)
|
6
|
-
ffi (>= 1.0.1)
|
7
|
-
|
8
1
|
PATH
|
9
2
|
remote: .
|
10
3
|
specs:
|
11
|
-
checksum-tools (1.2.0.
|
4
|
+
checksum-tools (1.2.0.beta3)
|
12
5
|
highline
|
13
6
|
net-sftp
|
14
7
|
net-ssh
|
@@ -20,13 +13,15 @@ GEM
|
|
20
13
|
specs:
|
21
14
|
diff-lcs (1.2.5)
|
22
15
|
ffi (1.9.10)
|
16
|
+
gssapi (1.2.0)
|
17
|
+
ffi (>= 1.0.1)
|
23
18
|
highline (1.7.8)
|
24
19
|
json (1.8.3)
|
25
20
|
net-sftp (2.1.2)
|
26
21
|
net-ssh (>= 2.6.5)
|
27
22
|
net-ssh (3.1.1)
|
28
|
-
net-ssh-krb (0.
|
29
|
-
gssapi (~> 1.
|
23
|
+
net-ssh-krb (0.4.0)
|
24
|
+
gssapi (~> 1.2.0)
|
30
25
|
net-ssh (>= 2.0)
|
31
26
|
progressbar (0.21.0)
|
32
27
|
rake (11.1.2)
|
@@ -47,7 +42,6 @@ PLATFORMS
|
|
47
42
|
|
48
43
|
DEPENDENCIES
|
49
44
|
checksum-tools!
|
50
|
-
gssapi!
|
51
45
|
rake (>= 0.8.7)
|
52
46
|
rdoc
|
53
47
|
rspec (~> 2.14.0)
|
data/lib/checksum-tools.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Checksum
|
2
2
|
module Tools
|
3
|
-
VERSION = "1.2.0.
|
3
|
+
VERSION = "1.2.0.beta3"
|
4
4
|
|
5
5
|
CHUNK_SIZE = 1048576 # 1M blocks
|
6
6
|
DEFAULT_OPTS = { :overwrite => false, :recursive => false, :exclude => [], :extension => '.digest' }
|
7
7
|
|
8
8
|
autoload :Local, File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), 'local')
|
9
9
|
autoload :Remote, File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), 'remote')
|
10
|
-
|
10
|
+
|
11
11
|
class Exception < ::Exception; end
|
12
12
|
class ConfigurationError < Exception; end
|
13
|
-
|
13
|
+
|
14
14
|
class << self
|
15
15
|
def new(path_info, *args)
|
16
16
|
remote = path_info[:remote]
|
@@ -20,7 +20,7 @@ module Checksum
|
|
20
20
|
Remote.new(remote[:host],remote[:user],*args)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def parse_path(path)
|
25
25
|
user,host,dir = path.to_s.scan(/^(?:(.+)@)?(?:(.+):)?(?:(.+))?$/).flatten
|
26
26
|
dir ||= '.'
|
@@ -28,10 +28,10 @@ module Checksum
|
|
28
28
|
return result
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
class Base
|
33
33
|
attr_reader :host
|
34
|
-
|
34
|
+
|
35
35
|
def initialize(*args)
|
36
36
|
@opts = DEFAULT_OPTS
|
37
37
|
if args.last.is_a?(Hash)
|
@@ -41,7 +41,7 @@ module Checksum
|
|
41
41
|
@opts[:exclude].uniq!
|
42
42
|
@digest_types = args
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def digest_filename(filename)
|
46
46
|
"#{filename}.#{opts[:extension].sub(/^\.+/,'')}"
|
47
47
|
end
|
@@ -52,7 +52,7 @@ module Checksum
|
|
52
52
|
create_digest_file(filename, &block)
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def create_digest_file(filename, &block)
|
57
57
|
digest_file = digest_filename(filename)
|
58
58
|
if File.expand_path(filename) == File.expand_path(digest_file)
|
@@ -61,7 +61,7 @@ module Checksum
|
|
61
61
|
if opts[:overwrite] or not file_exists?(digest_file)
|
62
62
|
result = digest_file(filename, &block)
|
63
63
|
file_open(digest_file,'w') do |cksum|
|
64
|
-
result.each_pair do |type,hexdigest|
|
64
|
+
result.each_pair do |type,hexdigest|
|
65
65
|
cksum.puts("#{type.to_s.upcase}(#{File.basename(filename)})= #{hexdigest}")
|
66
66
|
end
|
67
67
|
end
|
@@ -137,7 +137,7 @@ module Checksum
|
|
137
137
|
replacements.each { |args| result.gsub!(*args) }
|
138
138
|
Regexp.new(result)
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
def file_read(filename)
|
142
142
|
if file_exists?(filename)
|
143
143
|
result = ''
|
@@ -152,19 +152,19 @@ module Checksum
|
|
152
152
|
unless block_given?
|
153
153
|
raise ArgumentError, "no block given"
|
154
154
|
end
|
155
|
-
|
155
|
+
|
156
156
|
excludes = Array(opts[:exclude]).collect { |ex| glob_to_re(ex) }
|
157
157
|
targets = file_list(base_dir, *include_masks).reject { |f| excludes.any? { |re| f.match(re) } }
|
158
158
|
targets.sort!
|
159
159
|
targets.uniq!
|
160
|
-
|
160
|
+
|
161
161
|
result = {}
|
162
162
|
targets.each do |filename|
|
163
163
|
result[filename] = yield(filename)
|
164
164
|
end
|
165
165
|
return result
|
166
166
|
end
|
167
|
-
|
167
|
+
|
168
168
|
def with_types(new_types)
|
169
169
|
old_types = @digest_types
|
170
170
|
@digest_types = new_types
|
@@ -175,6 +175,6 @@ module Checksum
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
end
|
180
180
|
end
|
@@ -35,7 +35,7 @@ module Checksum::Tools
|
|
35
35
|
|
36
36
|
def sftp
|
37
37
|
@sftp ||= begin
|
38
|
-
auth_methods = %w(
|
38
|
+
auth_methods = %w(publickey hostbased keyboard-interactive) if defined? Net::SSH::Kerberos
|
39
39
|
auth_methods ||= %w(publickey hostbased keyboard-interactive)
|
40
40
|
Net::SFTP.start(@host, @user, :auth_methods => auth_methods)
|
41
41
|
end
|