monkey_patcher_patcher 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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in monkey_patcher_patcher.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brandon Dewitt
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.
@@ -0,0 +1,61 @@
1
+ # MonkeyPatcherPatcher
2
+
3
+ MonkeyPatcherPatcher patches monkey patches on your code, it's your code!!!!
4
+
5
+ (but seriously don't ever use this)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'monkey_patcher_patcher'
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install monkey_patcher_patcher
16
+
17
+ ## Usage
18
+
19
+ You want to write poor code and then someone else comes along and has an unexpected need and you don't want it to be met
20
+ (and/or you don't want to pull in their pull requests)
21
+
22
+ Instead of allowing a monkey patcher to patch your code you can use MonkeyPatcherPatcher
23
+
24
+ Your methods won't change from your definitions!!!!!
25
+
26
+ ```ruby
27
+ class Hello
28
+ include MonkeyPatcherPatcher
29
+
30
+ def hello
31
+ puts "hello"
32
+ end
33
+
34
+ monkey_patcher_patcher :hello
35
+ end
36
+
37
+ hello = Hello.new
38
+ hello.hello # => "hello"
39
+
40
+ # Some monkey patcher comes along and patches your code!!!!
41
+ class Hello
42
+ def hello
43
+ puts "not hello at all"
44
+ end
45
+ end
46
+
47
+ hello = Hello.new
48
+ hello.hello # => "hello"
49
+
50
+ # Huzzah!! we have conquered the patchers (sometimes, maybe, and only if they aren't very good)
51
+ ```
52
+
53
+ AGAIN - DON'T USE THIS
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,39 @@
1
+ require "monkey_patcher_patcher/version"
2
+
3
+ module MonkeyPatcherPatcher
4
+
5
+ def self.included(klass)
6
+ klass.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ def method_added(method_name)
11
+ return if @_monkey_patcher_at_work
12
+
13
+ @_monkey_patcher_patcher_methods ||= []
14
+ if @_monkey_patcher_patcher_methods.include?("#{method_name}")
15
+ monkey_patcher_alias_method_name = "_monkey_patcher_patcher_alias_#{method_name}"
16
+
17
+ class_eval do
18
+ @_monkey_patcher_at_work = true
19
+ alias_method method_name.to_sym, monkey_patcher_alias_method_name.to_sym
20
+ @_monkey_patcher_at_work = false
21
+ end
22
+ end
23
+ end
24
+
25
+ def monkey_patcher_patcher(*method_names)
26
+ @_monkey_patcher_patcher_methods ||= []
27
+ @_monkey_patcher_patcher_method_aliases ||= {}
28
+
29
+ method_names.each do |method_name|
30
+ @_monkey_patcher_patcher_methods << "#{method_name}"
31
+ monkey_patcher_alias_method_name = "_monkey_patcher_patcher_alias_#{method_name}"
32
+
33
+ class_eval do
34
+ alias_method monkey_patcher_alias_method_name.to_sym, method_name.to_sym
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module MonkeyPatcherPatcher
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'monkey_patcher_patcher/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "monkey_patcher_patcher"
8
+ gem.version = MonkeyPatcherPatcher::VERSION
9
+ gem.authors = ["Brandon Dewitt"]
10
+ gem.email = ["brandonsdewitt+monkey_patcher_patcher@gmail.com"]
11
+ gem.description = %q{ Don't ever use this, but sometimes you want to just use it }
12
+ gem.summary = %q{ MonkeyPatcherPatcher Patches Monkey Patches in your Ruby Code }
13
+ gem.homepage = ""
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
+
20
+ gem.add_development_dependency 'rake'
21
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monkey_patcher_patcher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brandon Dewitt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ! ' Don''t ever use this, but sometimes you want to just use it '
31
+ email:
32
+ - brandonsdewitt+monkey_patcher_patcher@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/monkey_patcher_patcher.rb
43
+ - lib/monkey_patcher_patcher/version.rb
44
+ - monkey_patcher_patcher.gemspec
45
+ homepage: ''
46
+ licenses: []
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ segments:
58
+ - 0
59
+ hash: -372560619961241166
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ segments:
67
+ - 0
68
+ hash: -372560619961241166
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: MonkeyPatcherPatcher Patches Monkey Patches in your Ruby Code
75
+ test_files: []