README.md in procemon-1.2.1 vs README.md in procemon-2.0.0

- old
+ new

@@ -1,63 +1,80 @@ -procemon +Procemon ======== -Gotta catch em all! -This is a collection of my Ruby Procs in the adventure of becoming the best! +## Gotta catch em all! +With this tool you can hook singleton and instance methods alike in modules and classes -This is including Tons of monkey_patch for new features to classes, -meta-programing tricks, terminal argument controls, daemonise trick, -tmp folder helpers, Application centralized datas, folder structure logic , -meta data control, dynamic lib read etc -There is really lot of helper method, i mean i even lose my life love if i want to start describe all of them -you can generate rdoc if you want, i more like examples, so from now on, -i will make examples! +### Examples -# Examples +Check the "test.rb" in the examples +You need to add plus functionality like logger in the deepness of rack, ease than, and enjoy ruby awesomeness. -The "how_to_inject_with_extra_process_a_method" -tells you how to NOT monkey patch methods in modules. -You want use a module? sure awsome ! -You need to add plus functionality but dont want to follow the module updates -(in case of conflight with the monkey patch) -Than this is your tool. Tell the method to inject what method and it will , but remember +The hook code block will act like it's run in the target model/class params are always have to obey to the original method! +I recommend use "*args" like arguments input, when you need it. +If you dont care about the arguments, dont request it at the code-block -The "fun_with_procs_and_methods" -tells you how to play with proc and method objects source code, -combine them, manipulate them, and convert back into live code -with the right bindings -the "simple async processing" will let you use os threads (1.9.n+) -for multiprocessing so you can give multiple task to do and -until you ask for the value, the process will be in the background -You can also use OS threads instead of VM Threads for real Parallelism +```ruby -the "require_files" shows you how can you get files from directory -in a recursive way and stuffs like that so you can be lay +require "procemon" -## LICENSE +class TestT -(The MIT License) + def self.test + puts self + end -Copyright (c) 2009-2013 Adam Luzsi <adamluzsi@gmail.com> + def test string + puts self,string + end -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +end -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +TestT.hook_instance_method :test do |*args| + puts "before hook and str: " + args[0].to_s.inspect +end -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +TestT.hook_singleton_method :test, add: "after" do + puts "after hook for singleton" +end + +TestT.test +TestT.new.test "boogie man" + +# after,singleton case: +# --------------------- +# TestT +# after hook for singleton +# +# +# before,instance case: +# --------------------- +# before hook and str: "boogie man" +# #<TestT:0x000000027bebc8> +# boogie man + +``` + + +### After words + +With 2.0.0, the project had been cleaned out, +anything else than method hooks moved out. + +mpatch: meta-programing tricks, base class extensions, dsl making helpers + +argv: terminal argument controls, + +daemon-ogre: daemonise trick, + +tmp: tmp folder helpers, + +configer: Applications yaml and json datas in centralized object, based on folder structure logic, + +loader: meta data mounting (best used with configer), dynamic lib reading etc caller based paths + (require relative directory methods for modules in gems) + +Happy Coding! :) \ No newline at end of file