Sha256: 6c652f1ff3b65ddcb055b04f856fb19bff01ebec4c32e9cb0930fbd717a777e7

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'
require File.dirname(__FILE__) + '/../lib/i_can_daemonize'

class SimpleDaemon
  include ICanDaemonize

  arg '--test=VALUE', 'Test Arg' do |value|
    @test = value
  end

  arg '-s', '--short-test=VALUE', 'Test arg with shortname' do |value|
    @short_test = value
  end

  sig(:int, :term) do
  end

  counter = 0
  daemonize do
    if @options[:loop_every]
      counter += 1
      File.open(TEST_FILE, 'w'){|f| f << counter}
    elsif @test
      File.open(TEST_FILE, 'w'){|f| f << "#{@test}|#{@short_test}"}
    else
      File.open(TEST_FILE, 'w'){|f| f << "#{log_file}|#{pid_file}"}
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
wonko9-i_can_daemonize-0.7.1 test/simple_daemon.rb
wonko9-i_can_daemonize-0.7.2 test/simple_daemon.rb
wonko9-i_can_daemonize-0.8.0 test/simple_daemon.rb
sa-i_can_daemonize-0.8.0 test/simple_daemon.rb