evilr 1.0.0-x86-mswin32-60

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/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010-2011 Jeremy Evans
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
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell 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
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+
data/README.rdoc ADDED
@@ -0,0 +1,148 @@
1
+ = evilr
2
+
3
+ evilr subverts ruby's runtime and lets you do things you shouldn't
4
+ do, such as changing the classes of objects. It's inspired by
5
+ evil.rb, but is a C extension as opposed to ruby code that uses DL.
6
+
7
+ == Why?
8
+
9
+ It's a good way to learn about how ruby works under the hood. It's
10
+ fun to push the boundries of ruby's runtime, to see the difference
11
+ between what's just not allowed (i.e. changing classes) and what's
12
+ not possible for technical reasons (i.e. sharing singleton classes,
13
+ instance variables, or method tables).
14
+
15
+ == Installation
16
+
17
+ gem install evilr
18
+
19
+ == What evil is currently available?
20
+
21
+ * Object
22
+ * class= : Change the class of an object
23
+ * detach_singleton_class : Make current singleton class not a
24
+ singleton, becoming the object's main class.
25
+ * dup_singleton_class : Make a copy of the current singleton
26
+ class as a regular class.
27
+ * evilr_debug_print : Print method ancestry chain to standard
28
+ output.
29
+ * extend_between : Given a module and a block, calls the block
30
+ repeatedly with two arguments, each a module or class in the super
31
+ chain. The first time the block returns true, the module argument
32
+ given to the method is inserted between the given extended modules.
33
+ Starts with the object's singleton class and continues until
34
+ the object's class. If the argument given already extends the
35
+ object, will remove it and reinsert it. If the argument is
36
+ already included in the object's class, raises an exception.
37
+ * pop_singleton_class : Remove closest singleton class from the
38
+ object
39
+ * push_singleton_class : Add a new singleton class to the object
40
+ in front of any existing singleton class.
41
+ * remove_singleton_class : Remove an object's singleton class
42
+ and any modules that extend the object.
43
+ * remove_singleton_classes : Remove all singleton classes
44
+ and extended modules.
45
+ * set_singleton_class : Take a given class and make it the object's
46
+ singleton class, replacing any existing singleton class.
47
+ * swap : Completely swap two objects (singleton class, class,
48
+ instance variables).
49
+ * swap_singleton_class : Swap an object's singleton class with
50
+ another object's singleton class.
51
+ * swap_instance_variables: Swap two instance's instance variables.
52
+ * unextend : Remove a module that extends the object from the super
53
+ chain.
54
+ * unfreeze : Unfreeze the object.
55
+ * Kernel
56
+ * segfault : Dereferences NULL.
57
+ * seppuku : kill -KILL's the current process.
58
+ * set_safe_level : Allows you to lower ruby's $SAFE level.
59
+ * Module
60
+ * include_between : Given a module and a block, calls the block
61
+ repeatedly with two arguments, each a module or class in the super
62
+ chain. The first time the block returns true, the module argument
63
+ given to the method is inserted between the given modules. Continues
64
+ until the end of the super chain. If the argument given is already
65
+ included, will remove it and reinsert it.
66
+ * swap_method_tables : Swap the method tables of the receiver with
67
+ the ones in the given module/class.
68
+ * to_class : Return a copy of the module as a class.
69
+ * uninclude : Remove the given module from the super chain, including
70
+ going into superclasses if the receiver is a class.
71
+ * Class
72
+ * detach_singleton : If the class is a singleton class, remove
73
+ its singleton status.
74
+ * inherit : Allows inheriting from multiple classes, basically
75
+ including them as modules.
76
+ * singleton_class_instance : If the class is a singleton class,
77
+ return the related instance.
78
+ * superclass= : Modify the superclass of the receiver.
79
+ * to_module : Return a copy of the class as a module.
80
+ * UnboundMethod
81
+ * force_bind : Bind the method to the object even if it is a different
82
+ class than the method.
83
+ * Proc
84
+ * self : Get the default receiver of the proc's methods
85
+ * self= : Change the default receiver of the proc's methods
86
+ * Empty
87
+ * A class with no superclass, only allocate, new, initialize, and
88
+ superclass defined. More basic than even BasicObject.
89
+
90
+ == Good bugs
91
+
92
+ If bugs are evil in good code, then surely bugs in evil code are good:
93
+
94
+ http://github.com/jeremyevans/evilr/issues
95
+
96
+ == Contributing
97
+
98
+ I'm happy to accept more evil, hopefully without good bugs and with
99
+ evil specs:
100
+
101
+ http://github.com/jeremyevans/evilr
102
+
103
+ evilr currently requires:
104
+
105
+ * rake
106
+ * rake-compiler
107
+ * rspec
108
+
109
+ == Running the specs
110
+
111
+ Even evil code should have specs! The default rake task runs the
112
+ specs:
113
+
114
+ rake
115
+
116
+ == Platforms Tested
117
+
118
+ === Operating Systems/Platforms
119
+
120
+ * OpenBSD (amd64, i386)
121
+ * Linux (i386)
122
+ * Windows XP (i386)
123
+
124
+ === Compiler Versions
125
+
126
+ * gcc 4.2.1
127
+ * gcc 4.4.5
128
+
129
+ == Ruby Versions
130
+
131
+ * ruby 1.8.6
132
+ * ruby 1.8.7
133
+ * ruby 1.9.2
134
+
135
+ ruby 1.9.1 is not supported. It mostly works but has spec failures.
136
+
137
+ If your platform, compiler version, or ruby version is not listed
138
+ above, please test and send me a report including:
139
+
140
+ * Your operating system and platform (e.g. i386, x86_64/amd64)
141
+ * Your compiler
142
+ * Your ruby version
143
+ * The output of rake
144
+
145
+ == Author
146
+
147
+ Jeremy Evans <code@jeremyevans.net>
148
+
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require "rake"
2
+ require "rake/clean"
3
+
4
+ CLEAN.include %w'*.core doc ext/evilr/Makefile ext/evilr/evilr.o ext/evilr/evilr.so lib tmp evilr-*.gem'
5
+
6
+ desc "Build the gem"
7
+ task :gem do
8
+ sh %{gem build evilr.gemspec}
9
+ end
10
+
11
+ begin
12
+ require 'rake/extensiontask'
13
+ Rake::ExtensionTask.new('evilr')
14
+ dependencies = [:compile]
15
+ rescue LoadError
16
+ dependencies = []
17
+ end
18
+
19
+ begin
20
+ require "spec/rake/spectask"
21
+
22
+ Spec::Rake::SpecTask.new("spec" => dependencies) do |t|
23
+ t.spec_files = ["spec/evilr_spec.rb"]
24
+ end
25
+ task :default => :spec
26
+
27
+ rescue LoadError
28
+ end
29
+
30
+ desc "Start an IRB shell using the extension"
31
+ task :irb => dependencies do
32
+ require 'irb'
33
+ $:.unshift 'lib'
34
+ require 'evilr'
35
+ c = IRB.conf
36
+ def c.[]=(k,v)
37
+ super unless k == :SCRIPT
38
+ end
39
+ IRB.start
40
+ end
41
+