infinity_stones 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/thanos +19 -0
  3. data/lib/infinity_stones.rb +23 -0
  4. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb4d789be3c29b876df666eb4598d7629df70e23fb68634d03ff5a067dbe0b0a
4
+ data.tar.gz: baf16006b0a0dbc71bcb3b591a91291f207450964a0b2a95a6652e4b126b0cc6
5
+ SHA512:
6
+ metadata.gz: 48eb6255f7276f124c310067e5310809e47dd5ecec79b2959c635c2aa2ac60ade820688a3a2671ef584c73a9255b6fbb456ee484293cc4ee12b0e4a524d79f2e
7
+ data.tar.gz: c16a4c96a71c9819b9549e6640b46d40c42957381c3e696bb2786c6fa54303705b8c5bb01ed89249c0b31a55a083a135f70dc5cb37f6b5dfadd63bb88e9737ab
data/bin/thanos ADDED
@@ -0,0 +1,19 @@
1
+ require 'infinity_stones'
2
+
3
+ if ARGV[0] == '-h' or ARGV[0] == '--help'
4
+ puts "Deletes 50% of the files in the current directory (sub-directories included)."
5
+ puts "Usage: thanos snap --with-gauntlet"
6
+ puts ""
7
+ puts "--with-gauntlet \t Thanos wears the gauntlet before snapping."
8
+ else
9
+ if ARGV[0] == 'snap'
10
+ if ARGV.include? '--with-gauntlet'
11
+ Infinity_Stones.snap
12
+ else
13
+ puts "Thanos is now snapping while he listens to Darude Sandstorm."
14
+ end
15
+ else
16
+ puts "thanos: missing operand"
17
+ puts "Try thanos --help for more information."
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/ruby -w
2
+ class Infinity_Stones
3
+ def self.snap
4
+ # Find all the files and count them
5
+ total = 0
6
+ dirs = Dir.glob("**/*")
7
+ for i in 0..(dirs.size - 1)
8
+ filename = dirs.at(i)
9
+ next if File.directory?(filename) or filename.include? '.dust'
10
+ total += 1
11
+
12
+ # Delete if the total is an odd number
13
+ if total % 2 != 0
14
+ File.write(filename, '')
15
+ File.rename(filename, filename + '.dust')
16
+ puts filename + " turns into dust..."
17
+ end
18
+ end
19
+ puts ""
20
+ puts (total / 2).to_s + " file(s) turned to dust."
21
+ puts "Perfectly Balanced. As all things should be."
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: infinity_stones
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rosário Pereira Fernandes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Deletes 50% of the files in a directory.
14
+ email: rosariofernandes51@gmail.com
15
+ executables:
16
+ - thanos
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/thanos
21
+ - lib/infinity_stones.rb
22
+ homepage: https://rosariopfernandes.github.io/infinity_stones
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.7.6
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: All the Infinity Stones
46
+ test_files: []