fume 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .DS_Store
2
- pkg/*
2
+ pkg/*
3
+ tmp/*
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
3
  :minor: 3
4
- :patch: 3
4
+ :patch: 4
5
5
  :major: 0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fume}
8
- s.version = "0.3.3"
8
+ s.version = "0.3.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sunteya"]
12
- s.date = %q{2010-01-25}
12
+ s.date = %q{2010-01-26}
13
13
  s.email = %q{Sunteya@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README"
@@ -60,21 +60,22 @@ module Fume
60
60
 
61
61
  def start
62
62
  return if already_running?
63
+ begin
64
+ register_trap
65
+ write_pid_file(Process.pid)
66
+ logger.info { "Daemon: #{daemon_name} starting ... PID: #{Process.pid}" }
63
67
 
64
- register_trap
65
- write_pid_file(Process.pid)
66
- logger.info { "Daemon: #{daemon_name} starting ... PID: #{Process.pid}" }
67
-
68
- @run = true
68
+ @run = true
69
69
 
70
- while @run
71
- self.execute
70
+ while @run
71
+ self.execute
72
+ end
73
+ logger.info { "Daemon: #{daemon_name} stoped ..." }
74
+ rescue Exception => e
75
+ logger.error(e)
76
+ ensure
77
+ remove_pid_file
72
78
  end
73
- logger.info { "Daemon: #{daemon_name} stoped ..." }
74
- rescue Exception => e
75
- logger.error(e)
76
- ensure
77
- remove_pid_file
78
79
  end
79
80
 
80
81
  def stop
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require "fileutils"
2
3
 
3
4
  describe Fume::Daemon do
4
5
  class TestDaemon
@@ -23,6 +24,7 @@ describe Fume::Daemon do
23
24
  before(:each) do
24
25
  ENV["PID_FILE"] = nil
25
26
  @pid_path = Rails.root.join("tmp", "pids", "test.pid").to_s
27
+ FileUtils.rm(@pid_path, :force => true)
26
28
  end
27
29
 
28
30
  it "should be create pid file by path" do
@@ -70,6 +72,7 @@ describe Fume::Daemon do
70
72
  d.write_pid_file(Process.pid)
71
73
  d.callback { fail("MUST exit at start") }
72
74
  end
75
+ File.exists?(@pid_path).should be_true
73
76
  end
74
77
 
75
78
  def build_and_start_test_daemon
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fume
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunteya
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-25 00:00:00 +08:00
12
+ date: 2010-01-26 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15