ennui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +15 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +69 -0
- data/License.txt +20 -0
- data/README.md +33 -0
- data/Rakefile +36 -0
- data/ennui.gemspec +22 -0
- data/examples/usage.rb +7 -0
- data/features/support/env.rb +7 -0
- data/features/support/step_helpers.rb +0 -0
- data/lib/ennui.rb +17 -0
- data/spec/lib/ennui_spec.rb +41 -0
- data/spec/spec_helper.rb +4 -0
- data/travis.yml +3 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTZlOWY3YjlkM2E0M2Y5Y2JiZGYzZjU5NTkwY2MxYmVjMzQ5NDNmNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGFkODcwY2E2MmFkODM3MWEyZDA4NTRkODdkNzhkMWU3NTEwODU0Yw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzQ0MGVjYmIzODdjOThhNGM0YTI0MTU3MWJkZGFmZGE2NGU3ZTMwZDhmNjNi
|
10
|
+
NTQ1ODcxYzhiZTUwZWY2NjljOThmOWJlM2NkMDE4YzJmY2Y0OTFhMjYzODc0
|
11
|
+
OTY3MDY4MTEwZTE3ODIxMzkyMzhjMWUyZGRiZTEyOTM1MTIyMjg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MThlNzRjYzFlZGI0YTRkZmM4OWI0MzE0ZWNhYzc4OTQwMzY2ZGIzY2YyZTM3
|
14
|
+
NDQ3NjE1YjNhNWE2ZDMwZGM0YmI4OTYyNDI4YmJkYWE4NzVmMWNmMThmNTUz
|
15
|
+
NGU4NzEyMGU4NWZlZmUwODViZTZhMWZlMDFhYjE3ZGY1ZDIxZDI=
|
data/.gitignore
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/coverage
|
12
|
+
/log/*.log
|
13
|
+
/tmp
|
14
|
+
|
15
|
+
ennui-0.0.1.gem
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
group :development, :test do
|
4
|
+
gem 'pry'
|
5
|
+
gem 'pry-nav'
|
6
|
+
gem 'pry-doc'
|
7
|
+
gem 'rake'
|
8
|
+
gem 'rspec'
|
9
|
+
end
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem 'awesome_print'
|
13
|
+
gem 'cucumber', :require => false
|
14
|
+
gem 'fivemat'
|
15
|
+
gem 'guard-rspec'
|
16
|
+
gem 'simplecov'
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
awesome_print (1.1.0)
|
5
|
+
builder (3.0.4)
|
6
|
+
coderay (1.0.9)
|
7
|
+
cucumber (1.2.5)
|
8
|
+
builder (>= 2.1.2)
|
9
|
+
diff-lcs (>= 1.1.3)
|
10
|
+
gherkin (~> 2.11.7)
|
11
|
+
multi_json (~> 1.3)
|
12
|
+
diff-lcs (1.2.3)
|
13
|
+
fivemat (1.2.1)
|
14
|
+
formatador (0.2.4)
|
15
|
+
gherkin (2.11.8)
|
16
|
+
multi_json (~> 1.3)
|
17
|
+
guard (1.7.0)
|
18
|
+
formatador (>= 0.2.4)
|
19
|
+
listen (>= 0.6.0)
|
20
|
+
lumberjack (>= 1.0.2)
|
21
|
+
pry (>= 0.9.10)
|
22
|
+
thor (>= 0.14.6)
|
23
|
+
guard-rspec (2.5.3)
|
24
|
+
guard (>= 1.1)
|
25
|
+
rspec (~> 2.11)
|
26
|
+
listen (0.7.3)
|
27
|
+
lumberjack (1.0.3)
|
28
|
+
method_source (0.8.1)
|
29
|
+
multi_json (1.7.2)
|
30
|
+
pry (0.9.12)
|
31
|
+
coderay (~> 1.0.5)
|
32
|
+
method_source (~> 0.8)
|
33
|
+
slop (~> 3.4)
|
34
|
+
pry-doc (0.4.5)
|
35
|
+
pry (>= 0.9)
|
36
|
+
yard (>= 0.8)
|
37
|
+
pry-nav (0.2.3)
|
38
|
+
pry (~> 0.9.10)
|
39
|
+
rake (10.0.4)
|
40
|
+
rspec (2.13.0)
|
41
|
+
rspec-core (~> 2.13.0)
|
42
|
+
rspec-expectations (~> 2.13.0)
|
43
|
+
rspec-mocks (~> 2.13.0)
|
44
|
+
rspec-core (2.13.1)
|
45
|
+
rspec-expectations (2.13.0)
|
46
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
47
|
+
rspec-mocks (2.13.1)
|
48
|
+
simplecov (0.7.1)
|
49
|
+
multi_json (~> 1.0)
|
50
|
+
simplecov-html (~> 0.7.1)
|
51
|
+
simplecov-html (0.7.1)
|
52
|
+
slop (3.4.4)
|
53
|
+
thor (0.18.1)
|
54
|
+
yard (0.8.6.1)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
awesome_print
|
61
|
+
cucumber
|
62
|
+
fivemat
|
63
|
+
guard-rspec
|
64
|
+
pry
|
65
|
+
pry-doc
|
66
|
+
pry-nav
|
67
|
+
rake
|
68
|
+
rspec
|
69
|
+
simplecov
|
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007-2010 Todd Mohney
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Ennui
|
2
|
+
==============
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/toddmohney/ennui.png?branch=master)](https://travis-ci.org/toddmohney/ennui)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/toddmohney/ennui.png)](https://codeclimate.com/github/toddmohney/ennui)
|
6
|
+
|
7
|
+
A gem for when you just don't care what gets executed
|
8
|
+
|
9
|
+
Ennui provides a library of predicates which return true at various frequencies.
|
10
|
+
These predicates are useful when you wish to introduce a bit of randomness or
|
11
|
+
apathy to your view elements, for example.
|
12
|
+
|
13
|
+
Installing
|
14
|
+
--------------
|
15
|
+
sudo gem install ennui
|
16
|
+
|
17
|
+
Usage
|
18
|
+
--------------
|
19
|
+
```ruby
|
20
|
+
require 'ennui'
|
21
|
+
|
22
|
+
# sometimes this will print "meh", sometimes it won't
|
23
|
+
puts "meh" if Ennui.sometimes?
|
24
|
+
```
|
25
|
+
|
26
|
+
Contributing
|
27
|
+
--------------
|
28
|
+
If you'd like to contribute to this project, fork this repo, make your changes,
|
29
|
+
fixes, or additions, then send a pull request.
|
30
|
+
|
31
|
+
License
|
32
|
+
--------------
|
33
|
+
This code is free to use under the terms of the MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake/task'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
12
|
+
t.cucumber_opts = "features --format pretty"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => [ :spec ]
|
16
|
+
|
17
|
+
task :full_build => [ :gemspec, :build, :install, :spec ]
|
18
|
+
|
19
|
+
gemspec = eval(File.read(Dir["*.gemspec"].first))
|
20
|
+
|
21
|
+
desc "Validate the gemspec"
|
22
|
+
task :gemspec do
|
23
|
+
gemspec.validate
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Build gem locally"
|
27
|
+
task :build => :gemspec do
|
28
|
+
system "gem build #{gemspec.name}.gemspec"
|
29
|
+
FileUtils.mkdir_p "pkg"
|
30
|
+
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Install gem locally"
|
34
|
+
task :install => :build do
|
35
|
+
system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
|
36
|
+
end
|
data/ennui.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "ennui"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.authors = ["Todd Mohney"]
|
6
|
+
s.email = ["toddmohney@gmail.com"]
|
7
|
+
s.homepage = "https://github.com/toddmohney/ennui"
|
8
|
+
s.summary = "A gem for when you just don't care about what's executed"
|
9
|
+
s.description = "Ennui provides a library of predicates which return true at various frequencies."
|
10
|
+
s.license = "MIT"
|
11
|
+
s.rubyforge_project = s.name
|
12
|
+
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
14
|
+
|
15
|
+
# The list of files to be contained in the gem
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
# s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
18
|
+
# s.extensions = `git ls-files ext/extconf.rb`.split("\n")
|
19
|
+
|
20
|
+
s.require_path = 'lib'
|
21
|
+
s.post_install_message = "Eh, whatever."
|
22
|
+
end
|
data/examples/usage.rb
ADDED
File without changes
|
data/lib/ennui.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
describe Ennui do
|
5
|
+
|
6
|
+
describe "#sometimes?" do
|
7
|
+
before do
|
8
|
+
@truthiness_score = 0
|
9
|
+
|
10
|
+
100.times do
|
11
|
+
@truthiness_score += 1 if Ennui.sometimes?
|
12
|
+
end
|
13
|
+
|
14
|
+
puts "Truthiness score: #{@truthiness_score}"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "is true about %50 of the time" do
|
18
|
+
score = truthiness_score(1000, Proc.new { Ennui.sometimes? })
|
19
|
+
score.should be_within(0.10).of(0.50)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#who_cares?" do
|
24
|
+
it "is true about %25 of the time" do
|
25
|
+
score = truthiness_score(1000, Proc.new { Ennui.who_cares? })
|
26
|
+
score.should be_within(0.10).of(0.25)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def truthiness_score(iterations, proc)
|
31
|
+
truthiness = 0
|
32
|
+
iterations.times do
|
33
|
+
truthiness += 1 if proc.call
|
34
|
+
end
|
35
|
+
|
36
|
+
score = truthiness.to_f / iterations.to_f
|
37
|
+
puts "Truthiness score: #{score}"
|
38
|
+
score
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/travis.yml
ADDED
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ennui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Todd Mohney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Ennui provides a library of predicates which return true at various frequencies.
|
14
|
+
email:
|
15
|
+
- toddmohney@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- Gemfile
|
22
|
+
- Gemfile.lock
|
23
|
+
- License.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- ennui.gemspec
|
27
|
+
- examples/usage.rb
|
28
|
+
- features/support/env.rb
|
29
|
+
- features/support/step_helpers.rb
|
30
|
+
- lib/ennui.rb
|
31
|
+
- spec/lib/ennui_spec.rb
|
32
|
+
- spec/spec_helper.rb
|
33
|
+
- travis.yml
|
34
|
+
homepage: https://github.com/toddmohney/ennui
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message: Eh, whatever.
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 1.3.6
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project: ennui
|
54
|
+
rubygems_version: 2.0.3
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: A gem for when you just don't care about what's executed
|
58
|
+
test_files: []
|
59
|
+
has_rdoc:
|