md5sum 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZmRhNTUxNjI5Y2I1MTVlNzM0ODBhNzVlYzU0MTNjNjE3ZGE5NmEwOA==
5
- data.tar.gz: !binary |-
6
- YTc2MTFmNDk2NmY4N2IwOGFiNDIwYzhkZWJiNDIyODc0YjY0OTI0ZQ==
2
+ SHA1:
3
+ metadata.gz: 2ed6f3f605723bfbb8643eef9adccc829b367623
4
+ data.tar.gz: bb9a1e005d59e8d9bedbe9769c52b51fcd3d3cda
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MDE3NjViNjg1NjE3MGYzNzM1MGVkYTBmZmQ3ZDIyYzYyZWNhMTVlMGQyYmFi
10
- OTNiMDAxMTlkZTg3ZGFkNmI0M2I2ZWQ0M2JlNmYxMWRlNjUxYzdiNWI3NWVi
11
- YTZmNjMzYWVkZGI2YjZlOTUzMDkxYjUyNjcxYTc1YjkwY2QzMWY=
12
- data.tar.gz: !binary |-
13
- Yjc4MzcxMmJiMmRmZTg1NGU2MmM3ZDNiYjg5YjE4MDEzYzU4YjU5ZWE3NmIz
14
- YzRlNGQ4YWU3ZGZkMDkyNTlmOWJhZjk5NGM5MDRjZjZkMTQwYzM2MDQ3YzIz
15
- MGE5MGIzY2EyYjQwN2FhMThlMmNkYzQyMDQ3MDgxNDVmMjlmNmQ=
6
+ metadata.gz: db32e96236f590df1055474ca7a9767ba8d94ebc8f70c03c2a98cf78b50d22dd66e0f4f398acfa753775620e76f034c322ea8136a2fd3b532bdde7b7a2bd8776
7
+ data.tar.gz: 1319062066810163f38818d76ca8a1b4e970e0b8a145c7a50c14685ecf329dc0d598175eaa641a8c2a2780d63894acf1eea841a4d025630d6a41445e349e1445
@@ -1,27 +1,35 @@
1
1
  #!/System/Executables/ruby -w
2
2
  # Encoding: ASCII-8BIT
3
- # ====================================================================== #
3
+ # =========================================================================== #
4
4
  # require 'md5sum'
5
- # ====================================================================== #
5
+ # =========================================================================== #
6
6
  begin
7
7
  require 'digest/md5'
8
8
  rescue Exception => error
9
9
  puts error
10
10
  end
11
11
 
12
+ require 'alias_e'
13
+
12
14
  class Md5sum
13
15
 
14
16
  N = "\n"
15
17
 
18
+ include AliasE
19
+
16
20
  # ========================================================================= #
17
21
  # === initialize
18
22
  # ========================================================================= #
19
23
  def initialize(
20
- input = ARGV,
24
+ input = ARGV,
21
25
  run_already = true
22
26
  )
27
+ case run_already
28
+ when false, :do_not_run_yet, :dont_run_yet
29
+ run_already = false
30
+ end
23
31
  set_input(input)
24
- run_it if run_already
32
+ run if run_already
25
33
  end
26
34
 
27
35
  # ========================================================================= #
@@ -29,21 +37,11 @@ class Md5sum
29
37
  # ========================================================================= #
30
38
  def set_input(i = '')
31
39
  i = '' if i.nil?
32
- i = i[0] if i.is_a? Array
33
- i = i.to_s
34
- i = i.dup
40
+ i = i.first if i.is_a? Array
41
+ i = i.to_s.dup
35
42
  @input = i # Assign to input.
36
43
  end
37
44
 
38
- # ========================================================================= #
39
- # === run_it
40
- # Will return the md5sum.
41
- # ========================================================================= #
42
- def run_it(shall_we_show_the_result = true)
43
- set_result
44
- show_result if shall_we_show_the_result
45
- end; alias run run_it # Run tag.
46
-
47
45
  # ========================================================================= #
48
46
  # === show_result
49
47
  # ========================================================================= #
@@ -51,24 +49,9 @@ class Md5sum
51
49
  e @result unless @input.nil? # must pass 1 arg
52
50
  end
53
51
 
54
- # ========================================================================= #
55
- # === return_md5sum
56
- # Example results:
57
- # 1897a33110ebfee800fb9562711cac02
58
- # ========================================================================= #
59
- def return_md5sum(input = @input)
60
- if input.is_a? Array
61
- input.each { |file|
62
- digest = Digest::MD5.hexdigest(File.read(file))
63
- return digest
64
- }
65
- else
66
- return Digest::MD5.hexdigest(File.read(input))
67
- end
68
- end
69
-
70
52
  # ========================================================================= #
71
53
  # === reverse_md5
54
+ #
72
55
  # This reverses a md5 hash, by using making use of the Digest module.
73
56
  # reverse_md5 '5f4dcc3b5aa765d61d8327deb882cf99'
74
57
  # ========================================================================= #
@@ -80,6 +63,7 @@ class Md5sum
80
63
 
81
64
  # ========================================================================= #
82
65
  # === Md5sum.reverse_md5
66
+ #
83
67
  # Usage examples:
84
68
  # require 'md5sum'; Md5sum.reverse_md5("/Depot/jjj/lalalala.flv")
85
69
  # ========================================================================= #
@@ -94,7 +78,42 @@ class Md5sum
94
78
  @result = return_md5sum(@input)
95
79
  end
96
80
 
97
- alias e puts
81
+ # ========================================================================= #
82
+ # === run (run tag)
83
+ #
84
+ # Will return the md5sum.
85
+ # ========================================================================= #
86
+ def run(shall_we_show_the_result = true)
87
+ set_result
88
+ show_result if shall_we_show_the_result
89
+ end
90
+
91
+ # ========================================================================= #
92
+ # === return_md5sum
93
+ #
94
+ # Example results:
95
+ # 1897a33110ebfee800fb9562711cac02
96
+ # ========================================================================= #
97
+ def return_md5sum(input = @input)
98
+ if input.is_a? Array
99
+ input.each { |file|
100
+ if File.file? file
101
+ dataset = File.read(file)
102
+ else
103
+ dataset = file
104
+ end
105
+ digest = Digest::MD5.hexdigest(dataset)
106
+ return digest
107
+ }
108
+ else
109
+ if File.file? input
110
+ dataset = File.read(input)
111
+ else
112
+ dataset = input
113
+ end
114
+ return Digest::MD5.hexdigest(dataset)
115
+ end
116
+ end
98
117
 
99
118
  end
100
119
 
@@ -5,7 +5,7 @@
5
5
  Gem::Specification.new { |s|
6
6
 
7
7
  s.name = 'md5sum'
8
- s.version = '1.0.2'
8
+ s.version = '1.0.3'
9
9
  s.date = Time.now.strftime('%Y-%m-%d')
10
10
 
11
11
  s.summary = <<-EOF
@@ -32,8 +32,9 @@ Gem::Specification.new { |s|
32
32
  s.authors = ['Robert A. Heiler']
33
33
  s.licenses = 'GPL 2'
34
34
  s.email = 'shevegen@gmail.com'
35
- s.files = Dir.glob('**/*')
35
+ s.files = Dir['**/*']
36
36
  s.homepage = 'http://rubygems.org/gems/md5sum'
37
- s.rubygems_version = '2.1.11'
38
37
 
39
- }
38
+ s.rubygems_version = '2.4.8'
39
+
40
+ }
@@ -0,0 +1,4 @@
1
+ require 'pp'
2
+ require 'md5sum'
3
+
4
+ pp Md5sum.new('mahavishnuorchestra')
metadata CHANGED
@@ -1,26 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md5sum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert A. Heiler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-11 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: ! " A simple project to make it easier to calculate\n md5sums.\n"
13
+ description: |2
14
+ A simple project to make it easier to calculate
15
+ md5sums.
14
16
  email: shevegen@gmail.com
15
17
  executables: []
16
18
  extensions: []
17
19
  extra_rdoc_files:
18
20
  - USAGE.rdoc
19
21
  files:
20
- - lib/md5sum/md5sum.rb
21
- - lib/md5sum.rb
22
22
  - USAGE.rdoc
23
+ - lib/md5sum.rb
24
+ - lib/md5sum/md5sum.rb
23
25
  - md5sum.gemspec
26
+ - test/testing_md5sum.rb
24
27
  homepage: http://rubygems.org/gems/md5sum
25
28
  licenses:
26
29
  - GPL 2
@@ -31,20 +34,20 @@ require_paths:
31
34
  - lib
32
35
  required_ruby_version: !ruby/object:Gem::Requirement
33
36
  requirements:
34
- - - ! '>='
37
+ - - ">="
35
38
  - !ruby/object:Gem::Version
36
39
  version: '0'
37
40
  required_rubygems_version: !ruby/object:Gem::Requirement
38
41
  requirements:
39
- - - ! '>='
42
+ - - ">="
40
43
  - !ruby/object:Gem::Version
41
44
  version: '0'
42
45
  requirements: []
43
46
  rubyforge_project:
44
- rubygems_version: 2.1.11
47
+ rubygems_version: 2.4.8
45
48
  signing_key:
46
49
  specification_version: 4
47
- summary: ! 'A simple project to make it easier to calculate md5sums. If you have
48
- specific suggestions to make this gem more useful for others, please drop me an
49
- email at: shevegen@gmail.com. Thank you.'
50
+ summary: 'A simple project to make it easier to calculate md5sums. If you have specific
51
+ suggestions to make this gem more useful for others, please drop me an email at:
52
+ shevegen@gmail.com. Thank you.'
50
53
  test_files: []