mundane 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20449c7c8e3ff9ad2aeec4956726476ba8b07b06
4
+ data.tar.gz: 501721ae5254cb5f8a9e76245aa64c222b7c5b87
5
+ SHA512:
6
+ metadata.gz: 58e185cd77bb6b55ece2ad35f0e865a11b02fc3c6c00f2299f72c452d133ee1c5b0644d2d80edc136cf0b3eb64ad4d36412bf750150a3846cca98c262535b70d
7
+ data.tar.gz: a44b72ae6c9ff63edb8155f7916e0bd193596a4319bb9d06f59b401a3fd91b4fda38579b1d6dfdef2f52fe8669d291391293bdb1e1f760c29a25e5cb5aa9625d
data/README ADDED
@@ -0,0 +1,15 @@
1
+ Oh, why, hello there. I'm Notary Sojac, and you are inspecting one of my scripts which was designed to take all the files in the current working folder, and put them into \out. The catch? Oh yes, the catch is that they will become .zip files meaning that you will need to decrypt them before reading/seeing/interacting with them. There are no free lunches.
2
+
3
+ To make it do:
4
+
5
+ 1) Have ruby installed on your machine
6
+
7
+ 2) do $ gem install rubyzip to install the dependancy
8
+
9
+ 3) Copy my snazzy script files_to_zips.rb into the folder you have laying around which contains the files you would like individually zipped.
10
+
11
+ 4) Run my script in that directory ($ ruby files_to_zips.rb)
12
+
13
+ 5) Investigate the "out" directory which was created throughout this process.
14
+
15
+ 6) Profit
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'mundane'
5
+
6
+ class MundaneRunner < Thor
7
+
8
+ #default_task :help
9
+
10
+ desc "files2zips", "reads each file in the directory and zips it, placing it in a new folder named 'out'."
11
+ def files2zips
12
+ Mundane.files_to_zips
13
+ end
14
+
15
+ desc "version", "Prints Mundane's version"
16
+ def version
17
+ puts Mundane.version
18
+ end
19
+
20
+ end
21
+
22
+ MundaneRunner.start
@@ -0,0 +1,19 @@
1
+ require 'pry'
2
+ require 'zip'
3
+
4
+ require 'mundane/version'
5
+ require 'mundane/files_to_zips'
6
+
7
+
8
+ module Mundane
9
+
10
+ def self.files_to_zips
11
+ FilesToZips.execute
12
+ #puts "this here is a stub"
13
+ end
14
+
15
+ def self.version
16
+ puts Mundane::VERSION
17
+ end
18
+
19
+ end
@@ -0,0 +1,65 @@
1
+ module Mundane
2
+ class FilesToZips
3
+
4
+ def self.execute
5
+ binding.pry
6
+ user_wants_to_proceed = ask_user_if_theyd_like_to_make_zips
7
+
8
+ if user_wants_to_proceed
9
+ make_output_directory
10
+
11
+ files = get_files_in_current_folder
12
+
13
+ compress_files_and_write_to_out_as_zips(files)
14
+ end
15
+
16
+ end
17
+
18
+ def self.compress_files_and_write_to_out_as_zips(files)
19
+ files.each do
20
+ |f|
21
+ pretty_name = f.chomp(File.extname(f))
22
+ if File.exists?("out/#{pretty_name}.zip")
23
+ puts "out/#{pretty_name}.zip ALREADY EXISTED, SKIPPING FILE. DELETE MANUALLY IF PREFERED =/"
24
+ next
25
+ end
26
+ Zip::File.open("out/#{pretty_name}.zip", Zip::File::CREATE) {
27
+ |zipfile|
28
+ zipfile.add(f, f)
29
+ }
30
+ end
31
+ end
32
+
33
+ def self.get_files_in_current_folder
34
+ files = []
35
+ Dir.foreach(".") do
36
+ |f|
37
+ next if File.directory?(f) or f == __FILE__ # skip directory names and the script we're running...
38
+ files << f
39
+ end
40
+ return files
41
+ end
42
+
43
+ def self.make_output_directory
44
+ Dir.mkdir("out") unless Dir.exists?("out")
45
+ end
46
+
47
+ def self.ask_user_if_theyd_like_to_make_zips
48
+ puts "Are you sure you want to make X zip files and put them into ./out/ ?"
49
+ puts "[Y/n]"
50
+ proceed = STDIN.gets.strip.downcase
51
+
52
+ if proceed == "y" or proceed == "yes" or proceed == ""
53
+ proceed = true
54
+ else
55
+ proceed = false
56
+ end
57
+ return proceed
58
+ end
59
+
60
+
61
+
62
+ end
63
+ end
64
+
65
+
@@ -0,0 +1,3 @@
1
+ module Mundane
2
+ VERSION = '0.0.0'
3
+ end
File without changes
@@ -0,0 +1,11 @@
1
+ require './spec/spec_helper'
2
+
3
+ require './lib/mundane'
4
+
5
+ describe "get testing" do
6
+
7
+ it 'should test' do
8
+ Mundane.files_to_zips
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mundane
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ''
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubyzip
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: |-
98
+ files2zips - converts a bunch of files into individual .zip files
99
+ zips2files - unpacks all the zip files in a directory spilling there contents into /out
100
+ email: ''
101
+ executables:
102
+ - mundane
103
+ extensions: []
104
+ extra_rdoc_files:
105
+ - README
106
+ files:
107
+ - bin/mundane
108
+ - lib/mundane.rb
109
+ - lib/mundane/version.rb
110
+ - lib/mundane/files_to_zips.rb
111
+ - spec/unit/mundane_spec.rb
112
+ - spec/spec_helper.rb
113
+ - README
114
+ homepage: https://github.com/TheNotary/files_to_zips
115
+ licenses: []
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options:
119
+ - --charset=UTF-8
120
+ require_paths:
121
+ - - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project: mundane
134
+ rubygems_version: 2.1.8
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Mundane automates the mundane file operations you sometimes wind up needing
138
+ to do such as unzipping a billion files, or zipping a billion so they work on xbox
139
+ or w/e
140
+ test_files: []