raise_roulette 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/raise_roulette.rb +6 -0
- data/lib/raise_roulette/something_bad.rb +51 -0
- data/lib/raise_roulette/version.rb +3 -0
- data/raise_roulette.gemspec +19 -0
- metadata +57 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013 Mark Tabler
|
2
|
+
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# RaiseRoulette
|
2
|
+
|
3
|
+
A simulation of any sufficiently complex software project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install raise_roulette
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Currently, RaiseRoulette extends one module (SomethingBad) into the global namespace. SomethingBad has the following methods:
|
12
|
+
|
13
|
+
* #happens - raises a randomly selected error, sometimes with a stack trace, sometimes with a pithy comment
|
14
|
+
* #might_happen - about a 50% chance of calling #happens
|
15
|
+
* #could_happen - about a 30% chance of calling #happens
|
16
|
+
* #shouldnt_happen - about a 10% chance of calling #happens
|
17
|
+
* #absolutely_wont_happen - you and I both know this has a 100% chance of #happens
|
18
|
+
|
19
|
+
## WHY WOULD YOU DO THIS
|
20
|
+
|
21
|
+
If you're ever having a "great" "adventure" with someone's "completely" "robust" code (even your own) (especially your own) (past self you are such a jerk), you can now share that feeling with your fellow developers using the communicative power of Ruby.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module RaiseRoulette
|
2
|
+
module SomethingBad
|
3
|
+
|
4
|
+
def self.happens
|
5
|
+
raise some_error_or_another, 0, somewhere_or_another
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.might_happen
|
9
|
+
if rand(10) <= 5
|
10
|
+
happens
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.could_happen
|
15
|
+
if rand(10) <= 3
|
16
|
+
happens
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.shouldnt_happen
|
21
|
+
if rand(10) <= 1
|
22
|
+
happens
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def absolutely_wont_happen
|
27
|
+
happens
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def self.some_error_or_another
|
33
|
+
[LoadError, NotImplementedError, SyntaxError, SecurityError,
|
34
|
+
ArgumentError, IOError, FiberError, NameError, RuntimeError,
|
35
|
+
ThreadError, TypeError, ZeroDivisionError].sample
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.somewhere_or_another
|
39
|
+
if rand(10) <= 3
|
40
|
+
nil
|
41
|
+
else
|
42
|
+
["left field", "deep within the code", "decks five through eight",
|
43
|
+
"just south of Milwaukee", "somewhere, I have no idea", "haystack",
|
44
|
+
"0x800cbc9a", "within the self", "the butler", "outer space",
|
45
|
+
"profound philosophical differences", "a terrible decision",
|
46
|
+
"a reasonable, yet incorrect, guess"].sample
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'raise_roulette/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "raise_roulette"
|
8
|
+
gem.version = RaiseRoulette::VERSION
|
9
|
+
gem.authors = ["Mark Tabler\n"]
|
10
|
+
gem.email = ["mark.tabler@fallingmanstudios.net"]
|
11
|
+
gem.description = %q{A simulation of adventuretimes in softwareland}
|
12
|
+
gem.summary = %q{You've probably encountered code that feels like this already. If you can't beat 'em, join 'em.}
|
13
|
+
gem.homepage = "https://github.com/marktabler/raise_roulette"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raise_roulette
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- ! 'Mark Tabler
|
9
|
+
|
10
|
+
'
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
15
|
+
dependencies: []
|
16
|
+
description: A simulation of adventuretimes in softwareland
|
17
|
+
email:
|
18
|
+
- mark.tabler@fallingmanstudios.net
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- lib/raise_roulette.rb
|
29
|
+
- lib/raise_roulette/something_bad.rb
|
30
|
+
- lib/raise_roulette/version.rb
|
31
|
+
- raise_roulette.gemspec
|
32
|
+
homepage: https://github.com/marktabler/raise_roulette
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.24
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: You've probably encountered code that feels like this already. If you can't
|
56
|
+
beat 'em, join 'em.
|
57
|
+
test_files: []
|