bananas 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bananas.gemspec +24 -0
- data/bin/bananas +49 -0
- data/lib/bananas.rb +18 -0
- data/lib/bananas/version.rb +3 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b022ecc1e4073f1abdc3a318cdfc3cf9ca7ce5b
|
4
|
+
data.tar.gz: 5c38d4dac8a15fad0c053e0f516dee927f9bfc90
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a09159debc5321b1d5aa4bc2be192347359c9589736458cc1e447411c7f5ab25951065e05f193356e71dcf9f0b115e5f3aba527b3f2f9d2c5574f2aad069759
|
7
|
+
data.tar.gz: d466f427fd2ca80aada7309f0dd154b8adb3b6130eac65b168f210c2caea03a8e55ad91cc4bf1c0bdc35e5b9663a2e725d1b32807447f4632628364ec99eadd3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 nitroo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Bananas
|
2
|
+
|
3
|
+
Bananas is a library for displaying monkey patches defined on a given tree of objects. It uses simple criterion to introspect an object for externally-defined methods. It is intended to be used for debugging.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Bananas is available as a gem from RubyGems.
|
8
|
+
|
9
|
+
```sh
|
10
|
+
$ gem install bananas
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Bananas can be used as a module
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require "bananas"
|
19
|
+
Bananas.monkey_patches
|
20
|
+
```
|
21
|
+
|
22
|
+
or via the command line.
|
23
|
+
|
24
|
+
```
|
25
|
+
$ bananas --help
|
26
|
+
usage: bananas.rb [options]
|
27
|
+
-m, --module [MOD] The module to search for monkey patches. Required.
|
28
|
+
-r, --require X,Y,Z The list of dependencies to search with.
|
29
|
+
-h, --help Print this message.
|
30
|
+
```
|
data/Rakefile
ADDED
data/bananas.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 'bananas/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bananas"
|
8
|
+
spec.version = Bananas::VERSION
|
9
|
+
spec.authors = ["nitroo"]
|
10
|
+
spec.email = ["brysoncmyers@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A library that finds monkey patches.}
|
13
|
+
spec.description = %q{Bananas is a library for displaying monkey patches defined on a given tree of objects. It uses simple criterion to introspect an object for externally-defined methods. It is intended to be used for debugging.}
|
14
|
+
spec.homepage = "https://github.com/nitroo/bananas"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = ["bananas"]
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
data/bin/bananas
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "bananas"
|
3
|
+
require "optparse"
|
4
|
+
|
5
|
+
ARGV << "-h" if ARGV.empty?
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
o = OptionParser.new do |opts|
|
9
|
+
opts.banner = "usage: bananas.rb [options]"
|
10
|
+
|
11
|
+
opts.on("-m", "--module [MOD]", "The module to search for monkey patches. Required.") do |m|
|
12
|
+
options[:module] = m.capitalize
|
13
|
+
end
|
14
|
+
|
15
|
+
opts.on("-r", "--require X,Y,Z", "The list of dependencies to search with.") do |r|
|
16
|
+
options[:with] = Array( String(r).split(",") )
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-h", "--help", "Print this message.") do |h|
|
20
|
+
puts opts
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
o.parse!
|
27
|
+
rescue
|
28
|
+
puts o
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
if options[:module].nil?
|
33
|
+
puts o
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
options[:with].each {|r| require r } if options[:with]
|
39
|
+
rescue LoadError
|
40
|
+
puts "fatal: Couldn't require dependencies. '#{options[:with].join}'"
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
44
|
+
if Kernel.const_defined?(options[:module])
|
45
|
+
Bananas.monkey_patches(Kernel.const_get options[:module].capitalize)
|
46
|
+
else
|
47
|
+
puts "fatal: Couldn't find a module. '#{options[:module]}'"
|
48
|
+
exit
|
49
|
+
end
|
data/lib/bananas.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bananas/version"
|
2
|
+
|
3
|
+
module Bananas
|
4
|
+
GEMS = `gem list`
|
5
|
+
private_constant :GEMS
|
6
|
+
|
7
|
+
module_function def monkey_patches(mod = Object)
|
8
|
+
mod.constants.map {|c| mod.const_get(c) }.push(mod)
|
9
|
+
.keep_if {|c| c.respond_to?(:instance_methods) }
|
10
|
+
.map {|c| Hash[object: c, methods: c.instance_methods(false)
|
11
|
+
.map {|m| Hash[name: m, location: (Array(c.instance_method(m).source_location).first || next)] }.compact] }
|
12
|
+
.map {|h| h[:methods].keep_if {|m| m[:location].match(ENV["GEM_HOME"]) }; h }
|
13
|
+
.map {|h| h[:methods].reject! {|m| GEMS.match(/#{h[:object].instance_method(m[:name]).owner.to_s.split("::").first}/i)}; h }
|
14
|
+
.reject {|h| h[:methods].empty? }
|
15
|
+
.tap {|c| puts "Couldn't find any monkey patches for module '#{mod}'" if c.empty?}
|
16
|
+
.each {|c| puts "%{object}:" % c; c[:methods].each {|m| puts "\t%-20{name} %{location}" % m }; putc "\n" }
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bananas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nitroo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Bananas is a library for displaying monkey patches defined on a given
|
42
|
+
tree of objects. It uses simple criterion to introspect an object for externally-defined
|
43
|
+
methods. It is intended to be used for debugging.
|
44
|
+
email:
|
45
|
+
- brysoncmyers@gmail.com
|
46
|
+
executables:
|
47
|
+
- bananas
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".gitignore"
|
52
|
+
- ".rspec"
|
53
|
+
- ".travis.yml"
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bananas.gemspec
|
59
|
+
- bin/bananas
|
60
|
+
- lib/bananas.rb
|
61
|
+
- lib/bananas/version.rb
|
62
|
+
homepage: https://github.com/nitroo/bananas
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.4.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: A library that finds monkey patches.
|
86
|
+
test_files: []
|
87
|
+
has_rdoc:
|