README.md in daemon-ogre-1.5.0 vs README.md in daemon-ogre-2.0.0

- old
+ new

@@ -2,245 +2,46 @@ =========== Description ----------- -WARNING! -The gem will be not updated in the future but redirected to my other project: -Procemon -https://github.com/adamluzsi/procemon -All the functions are implemented and upgraded in all meaning there what you liked in daemon-ogre +This module made for easy argv based damonize for the app. +100% compatible with any framework -This gem is made for one purpose. - -Ruby meant to be for easy use, not hardcore coding! -And in terms for this, ogre will aid you in the brute way, so you can relax... - - -so all you need is enjoy your code! -Follow me on Github and send request, -if you have idea what can be usefull in creating your app :) - - - Installation ------------ ### [RubyGems](http://rubygems.org/) $ gem install 'daemon-ogre' - require 'daemon-ogre' - DaemonOgre.start +```ruby - -but we love config our beloved App! ------------------------------------ - - - DaemonOgre.start :name => "MySuperAppName!", #this will be the name of the application - :log_path => "./var/log/log_file_name", #this will be the logfile place and name - :pid_path => "./var/pid/pid_file_name", #this will be the pidfile place and name - :terminate => true #this command not let start your code if it's not started - # with "start" arguments like : - # ruby my_awsome_app.rb start - - -In use? -------- - - -you can simply use your terminal with arguments like -* start - for start the process if you choosed :terminate => true in code like above -start command will check does the application already running or not, so you dont have to worry about - -* stop - will terminate the running application -* restart - will stop the process if that is already running than start again -* debug or -d - this will show the fancy loadings if you want look busy by coding big stuffs :) (or debug your code) -* debugger - this will call the ruby debugger gem to aid you in trouble -you should use these commands: - - - set autolist on #show the code, and the position like and editor, in every step. - s #step in any kind of method, beware to use carefully because you end up in really deep somewhere in Alice world - n #step to next code/codeblock etc, without enter it (usefull when you find the right place) - l #list your current position - #simply hit enter to repeate the last one - - -* daemon -this will fork a child process by the given parameters -* log or -l -you can set the log file position n by terminal for one time run -* pid or -p -you can set the pid file position n name by terminal for one time run -* status or -s -this will tell you ,does your process is running not -* help -this will invoke some help to the terminal if you out of luck and forget everything from this page -* clear -this will remove every log by the prev given paths, usefull in debugging - -example: - - ruby my_awsome_app.rb start debugger - ruby my_awsome_app.rb start clear - ruby my_awsome_app.rb status - ruby my_awsome_app.rb stop - ruby my_awsome_app.rb debug - - -or if you dont use terminate command , than you can start simply as how you do normaly - - - -othere stuffs to use: ---------------------- -everybody love: require_relative... -so why should not try require_directory instead all the fuss -you can tell to it if you want some file to be excluded or just delayed loaded, -because you want them loaded in the last place -Example: - - - require_directory "some_dir_name_from_here_where_are_multi_dir_levels" - -or - - require_directory "some_dir_name_from_here_where_are_multi_dir_levels", - :delayed => ["files","to","be","delayed","in","load"], - :excluded => ["files","to","be","excluded","in","load"], - :type => "rb" - -remember, you can use any of those modifier hash-tag by it self only! :) -by default the type will be .rb files - - -Helpers -------- - -and ofc what else what we love if not our beloved yml-s -we should use a nice Config constant for this(or at least i love to do) - - CONFIG = require_ymls "some_dir_name_from_here_where_are_the_yml_files_in_multi_dir_level" - -the file names will be the hash-key and under that , there will be the yml file datas loaded in - -And if we are at hashs, than when you need remove an element perm, or not perm you can use -* remove will return the hash w/o the the key -* remove! will delete the key, than return the hash -example: - - CONFIG.remove key - CONFIG.remove! key - - - - - -if you need get a free port in a range or from, you can use this: - - get_port(from_nmb,to_nmb,host) - -or by simply - - get_port(number) - - -and if you hate find all the bugs... you can use error_logger at your command like this if you running your process on -background and cannot puts on the terminal: - - - exlogger msg, #anything after this is optionable - :path => "./per_relative-absoluth_path", - :prefix => "it's something..." - - -or with less fuss at the exception handle: - - - begin - - rescue Exception => ex - ex.logger - end - - -or the better way to do Exception handle is to rescue only those exceptions what we are know will be raised! so the app broke if something unexpected stupp come up! (development:) - - - begin - raise ArgumentError, "failed" - rescue ArgumentError => ex - ex.logger - end - - - - -if you need methods from any kind of class without the object methods, you should try this! - - - Xyclassname.class_methods - - -you want make some test script with rnd numbers, strings, dates, bools etc? use the Rnd class at your command - - - Rnd - -string - -integer - -boolean - -date - - -examples: - - - Rnd.number(100) - Rnd.string(15,2) #for rnd bla bla names - - - -You need get the index of an Array element? you can use: - - - - array_variable.index_of("something) - - -Do you wanted to know , does that process running on that pid or not? - - - - process_running?(nmbr) - - - - -in Short: ---------- - require 'daemon-ogre' - DaemonOgre.start - your_Super_app_code! + DaemonOgre.init +``` +after this, the app will check for the following tags in the input: +:d, :daemon, :daemonize for daemonize the app +:k, :kill, :terminate for terminate already initialized app instance +you can set the output folder if you dont like the default in the system tmp / "#{your_app_folder_name}_daemon" +```ruby -Contributing to daemon-ogre ---------------------------- + #> for example + DaemonOgre::OPTS.tmp_folder_path File.join(File.dirname(__FILE__),"tmp") -* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet. -* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it. -* Fork the project. -* Start a feature/bugfix branch. -* Commit and push until you are happy with your contribution. -* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. -* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. +``` + Copyright --------- Right to copy and use at your service fellow coder Copyright (c) 2013 adam.luzsi. See LICENSE.txt for further details. - daemon-ogre