rickshaw 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -34
- data/lib/core_ext/string/to_sha1.rb +5 -5
- data/lib/core_ext/string/to_sha256.rb +5 -0
- data/lib/rickshaw.rb +33 -18
- data/lib/rickshaw/version.rb +1 -1
- data/rickshaw.gemspec +2 -2
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a38dc506e80cb438e33b33e1c598e5bca41c120a
|
4
|
+
data.tar.gz: 4dc19977ef4121a41ad5ded8f75e155f30fd5c8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c855f39a4a5f81af81eb3ad4246df01e0c83838012cbf26ce22de11903f611e5c4bccaa2fbd186a7acc8367bfaaf612eb554b127e95c58ad9b6b5986f5ed6e68
|
7
|
+
data.tar.gz: 1e5862c9f732860924281639708df572c988d2e48404eacac0ded5ba30ddd3440c8b01785567947f436cd688a18a1d0a7f184a0b6d36a90b0597aa7c368ba936
|
data/README.md
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
# Rickshaw
|
2
|
-
|
3
|
-
Easy way to get a SHA1 hash
|
4
|
-
|
5
|
-
yes I'm this lazy.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
gem 'rickshaw'
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install rickshaw
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
> Rickshaw::SHA1.hash('LICENSE.txt')
|
23
|
-
=> "4659d94e7082a65ca39e7b6725094f08a413250a"
|
24
|
-
|
25
|
-
> "hello world".to_sha1
|
26
|
-
=> "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
|
27
|
-
|
28
|
-
## Contributing
|
29
|
-
|
30
|
-
1. Fork it
|
31
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
-
5. Create new Pull Request
|
1
|
+
# Rickshaw
|
2
|
+
|
3
|
+
Easy way to get a SHA1 hash
|
4
|
+
|
5
|
+
yes I'm this lazy.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rickshaw'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rickshaw
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
> Rickshaw::SHA1.hash('LICENSE.txt')
|
23
|
+
=> "4659d94e7082a65ca39e7b6725094f08a413250a"
|
24
|
+
|
25
|
+
> "hello world".to_sha1
|
26
|
+
=> "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class String
|
2
|
-
def to_sha1
|
3
|
-
Digest::SHA1.hexdigest self
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class String
|
2
|
+
def to_sha1
|
3
|
+
Digest::SHA1.hexdigest self
|
4
|
+
end
|
5
|
+
end
|
data/lib/rickshaw.rb
CHANGED
@@ -1,18 +1,33 @@
|
|
1
|
-
require 'digest/sha1'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
1
|
+
require 'digest/sha1'
|
2
|
+
require 'digest/sha2'
|
3
|
+
require 'rickshaw/version'
|
4
|
+
require 'core_ext/string/to_sha1'
|
5
|
+
require 'core_ext/string/to_sha256'
|
6
|
+
|
7
|
+
module Rickshaw
|
8
|
+
module SHA1
|
9
|
+
def self.hash(file_path)
|
10
|
+
hash = Digest::SHA1.new
|
11
|
+
open(file_path, 'r') do |io|
|
12
|
+
until io.eof?
|
13
|
+
buffer = io.read(1024)
|
14
|
+
hash.update(buffer)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
hash.hexdigest
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module SHA256
|
22
|
+
def self.hash(file_path)
|
23
|
+
hash = Digest::SHA256.new
|
24
|
+
open(file_path, 'r') do |io|
|
25
|
+
until io.eof?
|
26
|
+
buffer = io.read(1024)
|
27
|
+
hash.update(buffer)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
hash.hexdigest
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/rickshaw/version.rb
CHANGED
data/rickshaw.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Rickshaw::VERSION
|
9
9
|
spec.authors = ["Gregory Ostermayr"]
|
10
10
|
spec.email = ["gregory.ostermayr@gmail.com"]
|
11
|
-
spec.description = %q{Get SHA1 hashes easily}
|
12
|
-
spec.summary = %q{Get SHA1 hashes easily}
|
11
|
+
spec.description = %q{Get SHA1 and other hashes easily}
|
12
|
+
spec.summary = %q{Get SHA1 and other hashes easily}
|
13
13
|
spec.homepage = "https://github.com/gregors/rickshaw"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rickshaw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Ostermayr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
|
-
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
|
-
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
23
|
requirements:
|
22
24
|
- - ~>
|
23
25
|
- !ruby/object:Gem::Version
|
24
26
|
version: '1.3'
|
25
|
-
prerelease: false
|
26
|
-
type: :development
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
|
-
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
|
-
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
37
|
requirements:
|
36
38
|
- - '>='
|
37
39
|
- !ruby/object:Gem::Version
|
38
40
|
version: '0'
|
39
|
-
|
40
|
-
type: :development
|
41
|
-
description: Get SHA1 hashes easily
|
41
|
+
description: Get SHA1 and other hashes easily
|
42
42
|
email:
|
43
43
|
- gregory.ostermayr@gmail.com
|
44
44
|
executables: []
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/core_ext/string/to_sha1.rb
|
54
|
+
- lib/core_ext/string/to_sha256.rb
|
54
55
|
- lib/rickshaw.rb
|
55
56
|
- lib/rickshaw/version.rb
|
56
57
|
- rickshaw.gemspec
|
@@ -58,7 +59,7 @@ homepage: https://github.com/gregors/rickshaw
|
|
58
59
|
licenses:
|
59
60
|
- MIT
|
60
61
|
metadata: {}
|
61
|
-
post_install_message:
|
62
|
+
post_install_message:
|
62
63
|
rdoc_options: []
|
63
64
|
require_paths:
|
64
65
|
- lib
|
@@ -73,9 +74,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
75
76
|
requirements: []
|
76
|
-
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
78
|
-
signing_key:
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.2.2
|
79
|
+
signing_key:
|
79
80
|
specification_version: 4
|
80
|
-
summary: Get SHA1 hashes easily
|
81
|
+
summary: Get SHA1 and other hashes easily
|
81
82
|
test_files: []
|