corrupted 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/bin/corrupted +24 -0
- data/corrupted.gemspec +24 -0
- data/lib/corrupted.rb +18 -0
- data/lib/corrupted/version.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b1da319702e0800cf13d19f4c6eea4f592f3867e
|
4
|
+
data.tar.gz: 5ef06fd982ed9f42a615eb4257e4f539b1b009f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd0b25fbb117991a268e9aa346ca31ae457847c85f0dc19cb30a25031ca326cb56edef6fb70c7df61c0343a7cd9d83daed563dc0f871bb72142e5f98eb5cdfd7
|
7
|
+
data.tar.gz: 245f94b5a64fc042a8fd2efc8148b127e2305790c524656fe48dfd652cff445c453cb28a9a060cd4a22d922a6f9efda1e8ac231cc5ea1d36498fced9ed5485c3
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 joseramonc
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Corrupted
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'corrupted'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install corrupted
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/corrupted/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/corrupted
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
require 'corrupted'
|
6
|
+
|
7
|
+
program :version, Corrupted::VERSION
|
8
|
+
program :description, 'generates corrupted files for homeworks 🙊'
|
9
|
+
|
10
|
+
command :generate do |c|
|
11
|
+
c.syntax = 'corrupted generate NAME EXTENSION KB_SIZE '
|
12
|
+
c.summary = 'wut?'
|
13
|
+
c.description = 'ideal for homeworks'
|
14
|
+
c.example 'description', 'command example'
|
15
|
+
# c.option '--some-switch', 'Some switch that does something'
|
16
|
+
c.action do |args, options|
|
17
|
+
name = args[0] #name of the file
|
18
|
+
extension = args[1] # output extension
|
19
|
+
size = args[2] # file size in kilobytes
|
20
|
+
|
21
|
+
Corrupted.create(name, extension, size.to_i)
|
22
|
+
# Do something or c.when_called Corrupted::Commands::Generate
|
23
|
+
end
|
24
|
+
end
|
data/corrupted.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'corrupted/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "corrupted"
|
8
|
+
spec.version = Corrupted::VERSION
|
9
|
+
spec.authors = ["joseramonc", "arandilopez"]
|
10
|
+
spec.email = [""]
|
11
|
+
spec.summary = %q{Generate corrupted Files from CLI.}
|
12
|
+
spec.description = %q{Gem to generated corrupted files, ideal for homeworks 🙊.}
|
13
|
+
spec.homepage = "https://github.com/webONES/corrupted"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "commander", "~> 4.2"
|
24
|
+
end
|
data/lib/corrupted.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "corrupted/version"
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
module Corrupted
|
5
|
+
### name: The name of the file to create
|
6
|
+
### extension: The extension of the file to create
|
7
|
+
### size [optional]: The size (in kilobytes) of the file to create
|
8
|
+
|
9
|
+
def self.create name, extension, size=64
|
10
|
+
if File.exist?("#{name}.#{extension}")
|
11
|
+
puts "File alredy exists :("
|
12
|
+
else
|
13
|
+
File.open "#{name}.#{extension}", "w" do |f|
|
14
|
+
f.puts Random.new.bytes(size*1000) #convert kilobytes to bytes
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: corrupted
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- joseramonc
|
8
|
+
- arandilopez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.7'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.7'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: commander
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '4.2'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '4.2'
|
56
|
+
description: "Gem to generated corrupted files, ideal for homeworks \U0001F64A."
|
57
|
+
email:
|
58
|
+
- ''
|
59
|
+
executables:
|
60
|
+
- corrupted
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/corrupted
|
70
|
+
- corrupted.gemspec
|
71
|
+
- lib/corrupted.rb
|
72
|
+
- lib/corrupted/version.rb
|
73
|
+
homepage: https://github.com/webONES/corrupted
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Generate corrupted Files from CLI.
|
97
|
+
test_files: []
|