tsalzer-richfile 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +4 -0
- metadata +12 -47
- data/MIT-LICENSE +0 -20
- data/Rakefile +0 -17
- data/init.rb +0 -3
- data/install.rb +0 -1
- data/richfile.gemspec +0 -37
- data/specs/SimpleDigestTest.txt +0 -4
- data/specs/richfile_spec.rb +0 -142
- data/tasks/richfile_tasks.rake +0 -34
- data/uninstall.rb +0 -1
data/VERSION.yml
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tsalzer-richfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Till Salzer
|
@@ -9,65 +9,30 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
type: :development
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rcov
|
27
|
-
type: :development
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: "0"
|
34
|
-
version:
|
35
|
-
description: Extends File objects with some rich instance attributes.
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Extends Ruby File objects with some rich instance attributes.
|
36
17
|
email: till.salzer@googlemail.com
|
37
18
|
executables: []
|
38
19
|
|
39
20
|
extensions: []
|
40
21
|
|
41
22
|
extra_rdoc_files:
|
42
|
-
- lib/richfile/base.rb
|
43
|
-
- lib/richfile.rb
|
44
|
-
- MIT-LICENSE
|
45
23
|
- README.rdoc
|
46
|
-
- tasks/richfile_tasks.rake
|
47
24
|
files:
|
48
|
-
-
|
49
|
-
-
|
25
|
+
- README.rdoc
|
26
|
+
- VERSION.yml
|
27
|
+
- lib/richfile
|
50
28
|
- lib/richfile/base.rb
|
51
29
|
- lib/richfile.rb
|
52
|
-
- MIT-LICENSE
|
53
|
-
- Rakefile
|
54
|
-
- README.rdoc
|
55
|
-
- specs/richfile_spec.rb
|
56
|
-
- specs/SimpleDigestTest.txt
|
57
|
-
- tasks/richfile_tasks.rake
|
58
|
-
- uninstall.rb
|
59
|
-
- Manifest
|
60
|
-
- richfile.gemspec
|
61
30
|
has_rdoc: true
|
62
31
|
homepage: http://github.com/tsalzer/richfile
|
63
32
|
post_install_message:
|
64
33
|
rdoc_options:
|
65
|
-
- --line-numbers
|
66
34
|
- --inline-source
|
67
|
-
- --
|
68
|
-
- Richfile
|
69
|
-
- --main
|
70
|
-
- README.rdoc
|
35
|
+
- --charset=UTF-8
|
71
36
|
require_paths:
|
72
37
|
- lib
|
73
38
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -80,14 +45,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
45
|
requirements:
|
81
46
|
- - ">="
|
82
47
|
- !ruby/object:Gem::Version
|
83
|
-
version: "
|
48
|
+
version: "0"
|
84
49
|
version:
|
85
50
|
requirements: []
|
86
51
|
|
87
|
-
rubyforge_project:
|
52
|
+
rubyforge_project:
|
88
53
|
rubygems_version: 1.2.0
|
89
54
|
signing_key:
|
90
55
|
specification_version: 2
|
91
|
-
summary:
|
56
|
+
summary: More attributes for Ruby File
|
92
57
|
test_files: []
|
93
58
|
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Till Salzer
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Rakefile for img_gravatar
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rake'
|
4
|
-
task :default => [:specs]
|
5
|
-
require 'echoe'
|
6
|
-
|
7
|
-
Echoe.new('richfile', '0.0.2') do |p|
|
8
|
-
p.description = "Extends File objects with some rich instance attributes."
|
9
|
-
p.url = "http://github.com/tsalzer/richfile"
|
10
|
-
p.author = "Till Salzer"
|
11
|
-
p.email = "till.salzer@googlemail.com"
|
12
|
-
p.ignore_pattern = ["tmp/*", "script/*", "rdoc/*", "pkg/*", "coverage/*", "*.tmproj"]
|
13
|
-
p.development_dependencies = ['rspec','rcov']
|
14
|
-
p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README.rdoc|^CHANGELOG|^TODO|^MIT-LICENSE|^COPYING$/
|
15
|
-
end
|
16
|
-
|
17
|
-
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/init.rb
DELETED
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/richfile.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{richfile}
|
5
|
-
s.version = "0.0.2"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Till Salzer"]
|
9
|
-
s.date = %q{2009-03-25}
|
10
|
-
s.description = %q{Extends File objects with some rich instance attributes.}
|
11
|
-
s.email = %q{till.salzer@googlemail.com}
|
12
|
-
s.extra_rdoc_files = ["lib/richfile/base.rb", "lib/richfile.rb", "MIT-LICENSE", "README.rdoc", "tasks/richfile_tasks.rake"]
|
13
|
-
s.files = ["init.rb", "install.rb", "lib/richfile/base.rb", "lib/richfile.rb", "MIT-LICENSE", "Rakefile", "README.rdoc", "specs/richfile_spec.rb", "specs/SimpleDigestTest.txt", "tasks/richfile_tasks.rake", "uninstall.rb", "Manifest", "richfile.gemspec"]
|
14
|
-
s.has_rdoc = true
|
15
|
-
s.homepage = %q{http://github.com/tsalzer/richfile}
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Richfile", "--main", "README.rdoc"]
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = %q{richfile}
|
19
|
-
s.rubygems_version = %q{1.3.1}
|
20
|
-
s.summary = %q{Extends File objects with some rich instance attributes.}
|
21
|
-
|
22
|
-
if s.respond_to? :specification_version then
|
23
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version = 2
|
25
|
-
|
26
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
28
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
29
|
-
else
|
30
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
31
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
32
|
-
end
|
33
|
-
else
|
34
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
35
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
36
|
-
end
|
37
|
-
end
|
data/specs/SimpleDigestTest.txt
DELETED
data/specs/richfile_spec.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'lib/richfile'
|
2
|
-
require "md5"
|
3
|
-
|
4
|
-
describe OpenSSL, "version" do
|
5
|
-
subject { OpenSSL::OPENSSL_VERSION_NUMBER }
|
6
|
-
it "should be greater than 0x00908000" do
|
7
|
-
subject.should be > 0x00908000
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe Richfile::Base, "example SimpleDigestTest.txt" do
|
12
|
-
subject { File.new(File.join(File.dirname(__FILE__), "SimpleDigestTest.txt")) }
|
13
|
-
|
14
|
-
it "should exist" do
|
15
|
-
subject.exists?.should == true
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have a size attribute" do
|
19
|
-
subject.should respond_to(:size)
|
20
|
-
subject.size.should be > 0
|
21
|
-
subject.size.should == File.size(subject)
|
22
|
-
end
|
23
|
-
it "should have a mtime attribute" do
|
24
|
-
subject.should respond_to(:mtime)
|
25
|
-
subject.mtime.should == File.mtime(subject)
|
26
|
-
end
|
27
|
-
it "should have a ctime attribute" do
|
28
|
-
subject.should respond_to(:ctime)
|
29
|
-
subject.ctime.should == File.ctime(subject)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should yield the same result as the built-in MD5 function" do
|
33
|
-
d = MD5.new
|
34
|
-
File.open(File.join(File.dirname(__FILE__), "SimpleDigestTest.txt")) do |f|
|
35
|
-
d << f.read
|
36
|
-
end
|
37
|
-
d.hexdigest.should == subject.md5!
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
{ #:dss => nil, - unsupported
|
42
|
-
:dss1 => "dee5ba176cb2d1cc7d9a5fc3a2240a37645d6b46",
|
43
|
-
:md2 => "8c13cca992d071c02fd338b6c13ab71b",
|
44
|
-
:md4 => "3575477e0da66828dcbba890b728d855",
|
45
|
-
:md5 => "927f712a74d0cf1281f93874499986c2",
|
46
|
-
#:mdc2 => nil, - unsupported
|
47
|
-
:ripemd160 => "e9b5c5c6e110022f0a5b493ed1b267c6face4c17",
|
48
|
-
:sha => "26f42cf9c6cfe3d95ab924d3b89b210a526a1ea1",
|
49
|
-
:sha1 => "dee5ba176cb2d1cc7d9a5fc3a2240a37645d6b46",
|
50
|
-
:sha224 => "e69ec20e01d6fac380b727b872dc0e14d1f255d40c3614e075d87de5",
|
51
|
-
:sha256 => "204e57f6dc0d8787f87e04347666129a2bd7deddf8949c735a78380b7c2ac65d",
|
52
|
-
:sha384 => "a2544e5c3b1a04b38ff0cf8cc29b81bd0fc08d12975949210123e51ae3af1da1538bf3fa6e1b73fc198bc0ac289f891f",
|
53
|
-
:sha512 => "137a67bfe730049222f7ac4969d14c3c79ee82d90bd1e223a0217abd8a73f617036222dce542d6243a7b94bc76ff1ee1359f073bb6a116df07c76c2164927800"
|
54
|
-
}.each do |cypher, checksum|
|
55
|
-
describe Richfile, ".#{cypher} message digest/checksum" do
|
56
|
-
subject { File.new(File.join(File.dirname(__FILE__), "SimpleDigestTest.txt")) }
|
57
|
-
it "should provide a #{cypher} attribute" do
|
58
|
-
subject.should respond_to(cypher)
|
59
|
-
subject.send(cypher).should == checksum
|
60
|
-
end
|
61
|
-
it "should provide a #{cypher}! method" do
|
62
|
-
subject.should respond_to("#{cypher}!".to_sym)
|
63
|
-
subject.send("#{cypher}!".to_sym).should == checksum
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
describe Richfile::Base do
|
70
|
-
subject { Richfile }
|
71
|
-
it "should have a DIGESTS constant with all digests" do
|
72
|
-
Richfile::DIGESTS.should == %w(DSS1 MD2 MD4 MD5 RIPEMD160 SHA SHA1 SHA224 SHA256 SHA384 SHA512)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe Richfile::Base, "refresh!" do
|
77
|
-
subject { File.new(File.join(File.dirname(__FILE__), "SimpleDigestTest.txt")) }
|
78
|
-
|
79
|
-
it "should refresh the file size if the size was used" do
|
80
|
-
subject.size
|
81
|
-
subject.should_receive(:size!).once
|
82
|
-
subject.refresh!
|
83
|
-
end
|
84
|
-
it "should not refresh the file size if the size was not used" do
|
85
|
-
subject.should_not_receive(:size!)
|
86
|
-
subject.refresh!
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should refresh the MD5 digest if the MD5 digest was used" do
|
90
|
-
subject.md5
|
91
|
-
subject.should_receive(:md5!).once
|
92
|
-
subject.refresh!
|
93
|
-
end
|
94
|
-
it "should not refresh the MD5 digest if the MD5 digest was not used" do
|
95
|
-
subject.should_not_receive(:md5!)
|
96
|
-
subject.refresh!
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should refresh the SHA1 digest if the SHA1 digest was used" do
|
100
|
-
subject.sha1
|
101
|
-
subject.should_receive(:sha1!).once
|
102
|
-
subject.refresh!
|
103
|
-
end
|
104
|
-
it "should not refresh the SHA1 digest if the SHA1 digest was not used" do
|
105
|
-
subject.should_not_receive(:sha1!)
|
106
|
-
subject.refresh!
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should refresh the SHA512 digest if the SHA512 digest was used" do
|
110
|
-
subject.sha512
|
111
|
-
subject.should_receive(:sha512!).once
|
112
|
-
subject.refresh!
|
113
|
-
end
|
114
|
-
it "should not refresh the SHA512 digest if the SHA512 digest was not used" do
|
115
|
-
subject.should_not_receive(:sha512!)
|
116
|
-
subject.refresh!
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe Richfile::Base, "refresh_all!" do
|
121
|
-
subject { File.new(File.join(File.dirname(__FILE__), "SimpleDigestTest.txt")) }
|
122
|
-
|
123
|
-
it "should refresh the file size" do
|
124
|
-
subject.should_receive(:size!).once
|
125
|
-
subject.refresh_all!
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should refresh the MD5 digest" do
|
129
|
-
subject.should_receive(:md5!).once
|
130
|
-
subject.refresh_all!
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should refresh the SHA1 digest" do
|
134
|
-
subject.should_receive(:sha1!).once
|
135
|
-
subject.refresh_all!
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should refresh the SHA512 digest" do
|
139
|
-
subject.should_receive(:sha512!).once
|
140
|
-
subject.refresh_all!
|
141
|
-
end
|
142
|
-
end
|
data/tasks/richfile_tasks.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'spec/rake/spectask'
|
3
|
-
|
4
|
-
ALWAYS_EXCLUDES=['specs/command_spec.rb']
|
5
|
-
EXCLUDES=['specsserver_spec.rb'].concat(ALWAYS_EXCLUDES)
|
6
|
-
|
7
|
-
def filelist(*opts)
|
8
|
-
exclude = []
|
9
|
-
o = *opts
|
10
|
-
if o
|
11
|
-
exclude = o[:exclude] if o[:exclude]
|
12
|
-
end
|
13
|
-
files = FileList['specs/**/*_spec.rb']
|
14
|
-
exclude.each do |f|
|
15
|
-
files.delete(f)
|
16
|
-
end
|
17
|
-
files
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Run all the specs"
|
21
|
-
Spec::Rake::SpecTask.new('specs') do |t|
|
22
|
-
t.pattern = nil
|
23
|
-
t.spec_files = filelist(:exclude => EXCLUDES)
|
24
|
-
t.rcov = false
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Run all specs with RCov"
|
28
|
-
Spec::Rake::SpecTask.new('rcov') do |t|
|
29
|
-
t.spec_files = filelist(:exclude => EXCLUDES)
|
30
|
-
t.rcov = true
|
31
|
-
t.rcov_opts = ['--exclude', 'specs/.*,buildlib/project\.rb,buildlib/buildlib\.rb,buildlib/command\.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
task :default => [:specs]
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|