fsck 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.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in fsck.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fsck (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.2)
10
+ rspec (2.3.0)
11
+ rspec-core (~> 2.3.0)
12
+ rspec-expectations (~> 2.3.0)
13
+ rspec-mocks (~> 2.3.0)
14
+ rspec-core (2.3.0)
15
+ rspec-expectations (2.3.0)
16
+ diff-lcs (~> 1.1.2)
17
+ rspec-mocks (2.3.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ fsck!
24
+ rspec (~> 2.3)
data/README.rdoc ADDED
@@ -0,0 +1,49 @@
1
+ # Fsck
2
+ Fsck allows you to express your feelings while you're developing. It does this by allowing you to add words to method names on the fly.
3
+
4
+ ## Examples
5
+ Fsck allows you to have a sense of closure during your everyday development life. Here's some examples:
6
+
7
+ *A difficult problem causing you frustration? Tell it how you feel.*
8
+
9
+ # all i want is to sum the goddamn elements
10
+ sum = 0
11
+ (1..10).each_fucking_element { |e| sum += e }
12
+
13
+ *Find a method that you think rocks? Show it your praise.*
14
+
15
+ # inject rocks!
16
+ (1..10).awesome_inject_is_awesome(&:+)
17
+
18
+ ## Usage
19
+ **Spot Usage**
20
+ Fsck comes as a module that you can include wherever you want.
21
+
22
+ require "fsck"
23
+
24
+ class MyClass
25
+ include Fsck
26
+
27
+ def my_method
28
+ 42
29
+ end
30
+ end
31
+
32
+ my_object = MyClass.new
33
+ my_object.calling_my_awesome_method # => 42
34
+
35
+ **Deep Usage**
36
+ Fsck also provides a way to use its functionality on every object in ruby.
37
+
38
+ require "fsck/deep"
39
+
40
+ 42.gimme_succ # => 43
41
+ ary = Array.new_array_please # => []
42
+
43
+ ## Origin
44
+ Fsck is named after the use of the Unix file system utility, specifically as it is applied to [profanity](http://en.wikipedia.org/wiki/Fsck#Use_as_profanity).
45
+
46
+ **NOTE:** This gem has nothing to do with the Unix file system utility
47
+
48
+ ## License
49
+ MIT License. Copyright 2011 Chris Thorn.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/fsck.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "fsck/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "fsck"
7
+ s.version = Fsck::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Chris Thorn"]
10
+ s.email = ["thorncp@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = "A gem that allows you to be yourself while writing code."
13
+ s.description = s.summary
14
+
15
+ s.rubyforge_project = "fsck"
16
+
17
+ s.required_ruby_version = "~> 1.9.1"
18
+
19
+ s.add_development_dependency "rspec", "~> 2.3"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
data/lib/fsck.rb ADDED
@@ -0,0 +1,15 @@
1
+ module Fsck
2
+ def method_missing(sym, *args, &block)
3
+ matches = methods.select do |m|
4
+ words = m.to_s.split("_").map { |w| Regexp.escape(w) }
5
+ sym =~ /^(\w*_)?#{words.join('\w*_\w*')}(_\w*)?$/
6
+ end
7
+
8
+ if matches.empty?
9
+ super
10
+ else
11
+ method = matches.sort_by(&:length).last
12
+ send method, *args, &block
13
+ end
14
+ end
15
+ end
data/lib/fsck/deep.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "fsck"
2
+
3
+ class Object
4
+ include Fsck
5
+ end
@@ -0,0 +1,3 @@
1
+ module Fsck
2
+ VERSION = "0.0.1"
3
+ end
data/license.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Chris Thorn
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ require "spec_helper"
2
+
3
+ describe Fsck do
4
+ describe "method is called" do
5
+ before :each do
6
+ @class = Class.new do
7
+ include Fsck
8
+
9
+ def the_method
10
+ end
11
+ end
12
+ end
13
+
14
+ it "should match method with fluff at the beginning" do
15
+ obj = @class.new
16
+ obj.should_receive(:the_method)
17
+ obj.call_the_method
18
+ end
19
+
20
+ it "should match method with fluff at the end" do
21
+ obj = @class.new
22
+ obj.should_receive(:the_method)
23
+ obj.the_method_is_called
24
+ end
25
+
26
+ it "should match method with fluff in the middle" do
27
+ obj = @class.new
28
+ obj.should_receive(:the_method)
29
+ obj.the_awesome_method
30
+ end
31
+ end
32
+
33
+ describe "return value" do
34
+ before :each do
35
+ @class = Class.new do
36
+ include Fsck
37
+
38
+ def the_method
39
+ 42
40
+ end
41
+ end
42
+ end
43
+
44
+ it "should return the value from the method" do
45
+ obj = @class.new
46
+ obj.the_method_will_obey.should eql(42)
47
+ end
48
+ end
49
+
50
+ describe "method parameters" do
51
+ before :each do
52
+ @class = Class.new do
53
+ include Fsck
54
+
55
+ def the_method(*args)
56
+ end
57
+ end
58
+ end
59
+
60
+ it "should pass along all parameters" do
61
+ obj = @class.new
62
+ obj.should_receive(:the_method).with(42, [1,2,3], "yo dawg")
63
+ obj.the_awesome_method(42, [1,2,3], "yo dawg")
64
+ end
65
+ end
66
+
67
+ describe "whacky method names" do
68
+ before :each do
69
+ @class = Class.new do
70
+ include Fsck
71
+
72
+ def []
73
+ end
74
+
75
+ def the_method
76
+ end
77
+ end
78
+ end
79
+
80
+ it "should pass the regex when containing regex special characters" do
81
+ obj = @class.new
82
+ obj.should_receive(:[])
83
+ obj.send "square_[]_brackets"
84
+ end
85
+
86
+ it "should not match within words" do
87
+ obj = @class.new
88
+ obj.should_not_receive(:the_method)
89
+ obj.the_methods
90
+ end
91
+ end
92
+ end
@@ -0,0 +1 @@
1
+ require "fsck"
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fsck
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Chris Thorn
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-04 00:00:00 -09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 3
31
+ version: "2.3"
32
+ type: :development
33
+ version_requirements: *id001
34
+ description: A gem that allows you to be yourself while writing code.
35
+ email:
36
+ - thorncp@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - Gemfile.lock
47
+ - README.rdoc
48
+ - Rakefile
49
+ - fsck.gemspec
50
+ - lib/fsck.rb
51
+ - lib/fsck/deep.rb
52
+ - lib/fsck/version.rb
53
+ - license.txt
54
+ - spec/fsck/fsck_spec.rb
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: ""
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 9
73
+ - 1
74
+ version: 1.9.1
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project: fsck
86
+ rubygems_version: 1.3.7
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: A gem that allows you to be yourself while writing code.
90
+ test_files:
91
+ - spec/fsck/fsck_spec.rb
92
+ - spec/spec_helper.rb