Z
zimbatm ...
*monkeypatch* is a new ruby projects that tries to protect you from
patch
collisions.
== Project info
*monkeypatch* introduces a small API that you can use when you want to
fix
external libraries. The mechanism is meant to be as straightforward as
possible. Also, by adding monkeypatch as a gem dependency, you declare
that
your package is fixing other package's code.
Version: 0.1.2
Stability: unstable
Source code: http://github.com/zimbatm/monkeypatch/
RDoc: http://rdoc.info/projects/zimbatm/monkeypatch
Blog: http://oree.ch
== A small example
-----
my_patch = MonkeyPatch.add_method
to_blob) do
def to_blog; "<blob>" end
end
my_patch.patch_class(String)
"hello".to_blob #=> "<blob>"
------
== How does it work ?
When applying a patch, there are two mechanism that enters the game ;
conditions and conflicts.
* Conditions are not fatal. If they don't match, the patch is simply not
applied, and a message is passed to the MonkeyPatch.logger.
Conditions are for library version matching for example. They are
extensible buy using: #add_condition(msg, &cond)
* Conflicts are fatal, in that they raise a ConflictError if they don't
match. Conflicts are for patch collision. They are not extensible and
provided by
the API. The idea is that if your code has conflicting patches, you
will
get notified by a crashing application, so that you can fix it as
early as
possible.
Another aspect are PatchSet (s). If you have a bundle of patches you
want to
apply, you can aggregate them with the & operator. You then get a
PatchSet
instance which you can use like a Patch. This is not fully done now, but
theoritically, your bundle does not apply unless all patch conditions
are met.
== What's next ?
This project API is intentionally unstable for now. What I'm really
looking for
now, is community feedback. I also intend to look at real-world patches
to
see how this library can be made more useful.
So if you have some real-world patches or any comments, please give me
your
feedback !
Cheers,
zimbatm
patch
collisions.
== Project info
*monkeypatch* introduces a small API that you can use when you want to
fix
external libraries. The mechanism is meant to be as straightforward as
possible. Also, by adding monkeypatch as a gem dependency, you declare
that
your package is fixing other package's code.
Version: 0.1.2
Stability: unstable
Source code: http://github.com/zimbatm/monkeypatch/
RDoc: http://rdoc.info/projects/zimbatm/monkeypatch
Blog: http://oree.ch
== A small example
-----
my_patch = MonkeyPatch.add_method
def to_blog; "<blob>" end
end
my_patch.patch_class(String)
"hello".to_blob #=> "<blob>"
------
== How does it work ?
When applying a patch, there are two mechanism that enters the game ;
conditions and conflicts.
* Conditions are not fatal. If they don't match, the patch is simply not
applied, and a message is passed to the MonkeyPatch.logger.
Conditions are for library version matching for example. They are
extensible buy using: #add_condition(msg, &cond)
* Conflicts are fatal, in that they raise a ConflictError if they don't
match. Conflicts are for patch collision. They are not extensible and
provided by
the API. The idea is that if your code has conflicting patches, you
will
get notified by a crashing application, so that you can fix it as
early as
possible.
Another aspect are PatchSet (s). If you have a bundle of patches you
want to
apply, you can aggregate them with the & operator. You then get a
PatchSet
instance which you can use like a Patch. This is not fully done now, but
theoritically, your bundle does not apply unless all patch conditions
are met.
== What's next ?
This project API is intentionally unstable for now. What I'm really
looking for
now, is community feedback. I also intend to look at real-world patches
to
see how this library can be made more useful.
So if you have some real-world patches or any comments, please give me
your
feedback !
Cheers,
zimbatm