Fix option parser

This commit is contained in:
Dzmitry Plashchynski
2016-01-20 20:41:26 +02:00
parent acbfea2308
commit 16ca450033
4 changed files with 25 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
crono (1.0.0.pre2) crono (1.0.0.pre3)
activerecord (~> 4.0) activerecord (~> 4.0)
activesupport (~> 4.0) activesupport (~> 4.0)

View File

@@ -131,23 +131,38 @@ serialized using JSON.generate
Crono.perform(TestJob, 'some', 'args').every 1.day, at: {hour: 12, min: 15} Crono.perform(TestJob, 'some', 'args').every 1.day, at: {hour: 12, min: 15}
``` ```
#### Run daemon #### Run
To run Crono daemon, in your Rails project root directory: To run Crono, in your Rails project root directory:
bundle exec crono RAILS_ENV=development bundle exec crono RAILS_ENV=development
crono usage: crono usage:
``` ```
Usage: crono [options] start|stop|restart|run Usage: crono [options] [start|stop|restart|run]
-C, --cronotab PATH Path to cronotab file (Default: config/cronotab.rb) -C, --cronotab PATH Path to cronotab file (Default: config/cronotab.rb)
-L, --logfile PATH Path to writable logfile (Default: log/crono.log) -L, --logfile PATH Path to writable logfile (Default: log/crono.log)
--piddir PATH Path to piddir (Default: tmp/pids) -P, --pidfile PATH Deprecated! use --piddir with --process_name; Path to pidfile (Default: )
-N, --process_name name Name of the process (Default: crono) -D, --piddir PATH Path to piddir (Default: tmp/pids)
-N, --process_name NAME Name of the process (Default: crono)
-d, --[no-]daemonize Deprecated! Instead use crono [start|stop|restart] without this option; Daemonize process (Default: false)
-m, --monitor Start monitor process for a deamon (Default false) -m, --monitor Start monitor process for a deamon (Default false)
-e, --environment ENV Application environment (Default: development) -e, --environment ENV Application environment (Default: development)
``` ```
#### Run as daemon
To run Crono as daemon, please add to your Gemfile:
```ruby
gem 'daemons'
```
Then:
bundle install; bundle exec crono start RAILS_ENV=development
There are "start", "stop", and "restart" commands.
## Web UI ## Web UI

View File

@@ -122,7 +122,7 @@ module Crono
def parse_options(argv) def parse_options(argv)
@argv = OptionParser.new do |opts| @argv = OptionParser.new do |opts|
opts.banner = "Usage: crono [options] start|stop|restart|run" opts.banner = "Usage: crono [options] [start|stop|restart|run]"
opts.on("-C", "--cronotab PATH", "Path to cronotab file (Default: #{config.cronotab})") do |cronotab| opts.on("-C", "--cronotab PATH", "Path to cronotab file (Default: #{config.cronotab})") do |cronotab|
config.cronotab = cronotab config.cronotab = cronotab
@@ -136,7 +136,7 @@ module Crono
config.pidfile = pidfile config.pidfile = pidfile
end end
opts.on("--piddir PATH", "Path to piddir (Default: #{config.piddir})") do |piddir| opts.on("-D", "--piddir PATH", "Path to piddir (Default: #{config.piddir})") do |piddir|
config.piddir = piddir config.piddir = piddir
end end

View File

@@ -1,3 +1,3 @@
module Crono module Crono
VERSION = '1.0.0.pre2' VERSION = '1.0.0.pre3'
end end