lib/recipes/centos/backgroundjob.rb in capitate-0.3.5 vs lib/recipes/centos/backgroundjob.rb in capitate-0.3.6
- old
+ new
@@ -3,39 +3,18 @@
namespace :centos do
desc <<-DESC
Setup backgroundjob for application.
- <dl>
- <dt>backgroundjob_bin_path</dt>
- <dd>Path to start.
- <dd class="default">Defaults to:
- <pre>
- \#{current_path}/script/bj --forever --rails_env=production --rails_root=\#{current_path} --redirect \
- --redirect=\#{backgroundjob_log_path} --pidfile=\#{backgroundjob_pid_path} &
- </pre>
- </dd>
- <dt>backgroundjob_pid_path</dt>
- <dd>Path to backgroundjob pid file</dd>
- <dd class="default">Defaults to @\#{shared_path}/pids/bj.pid@</dd>
-
- <dt>backgroundjob_log_path</dt>
- <dd>Path to backgroundjob log file</dd>
- <dd class="default">Defaults to @\#{shared_path}/logs/bj.log@</dd>
- </dl>
"Source":#{link_to_source(__FILE__)}
DESC
+ task_arg(:backgroundjob_bin_path, "Path to backgroundjob",
+ :default => Proc.new{"#{current_path}/script/bj run --forever --rails_env=production --rails_root=#{current_path} --redirect=#{backgroundjob_log_path} --log=#{backgroundjob_log_path} --pidfile=#{backgroundjob_pid_path} --daemon"},
+ :default_desc => "\#{current_path}/script/bj run --forever --rails_env=production --rails_root=\#{current_path} --redirect=\#{backgroundjob_log_path} --log=\#{backgroundjob_log_path} --pidfile=\#{backgroundjob_pid_path} --daemon")
+ task_arg(:backgroundjob_pid_path, "Path to backgroundjob pid file", :default => Proc.new{"#{shared_path}/pids/bj.pid"}, :default_desc => "\#{shared_path}/pids/bj.pid")
+ task_arg(:backgroundjob_log_path, "Path to backgroundjob log file", :default => Proc.new{"#{shared_path}/log/bj.log"}, :default_desc => "\#{shared_path}/log/bj.log")
task :setup do
- # Settings
- fetch_or_default(:backgroundjob_pid_path, "#{shared_path}/pids/bj.pid")
- fetch_or_default(:backgroundjob_log_path, "#{shared_path}/log/bj.log")
- default_bin_path = "#{current_path}/script/bj run --forever --rails_env=production --rails_root=#{current_path} \
---redirect=#{backgroundjob_log_path} --pidfile=#{backgroundjob_pid_path} &"
-
- fetch_or_default(:backgroundjob_bin_path, default_bin_path)
-
-
# Install initscript
utils.install_template("backgroundjob/backgroundjob.initd.centos.erb", "/etc/init.d/backgroundjob_#{application}")
# Enable service
run_via "/sbin/chkconfig --level 345 backgroundjob_#{application} on"
\ No newline at end of file