freyr 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/freyr/command.rb +15 -9
  3. metadata +5 -7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
data/lib/freyr/command.rb CHANGED
@@ -4,13 +4,13 @@ module Freyr
4
4
  extend Forwardable
5
5
 
6
6
  ROOT_PIDS = '/var/run/freyr'
7
- FREYR_PIDS = ENV['USER'] == 'root' ? ROOT_PIDS : File.expand_path('.freyr', '~')
7
+ USER_PIDS = File.expand_path('.freyr', '~')
8
8
 
9
- if !File.exist?(FREYR_PIDS)
10
- Dir.mkdir(FREYR_PIDS)
11
- elsif !File.directory?(FREYR_PIDS)
12
- File.delete(FREYR_PIDS)
13
- Dir.mkdir(FREYR_PIDS)
9
+ if !File.exist?(USER_PIDS)
10
+ Dir.mkdir(USER_PIDS)
11
+ elsif !File.directory?(USER_PIDS)
12
+ File.delete(USER_PIDS)
13
+ Dir.mkdir(USER_PIDS)
14
14
  end
15
15
 
16
16
  attr_reader :command, :name, :service
@@ -30,11 +30,17 @@ module Freyr
30
30
  end
31
31
 
32
32
  def pid_file
33
- File.join(file_dir,"#{@name}.pid")
33
+ path = File.join(file_dir,"#{@name}.pid")
34
+ if File.exist?(path)
35
+ path
36
+ else
37
+ File.join(file_dir(true),"#{@name}.pid")
38
+ end
34
39
  end
35
40
 
36
- def file_dir
37
- admin? ? ROOT_PIDS : FREYR_PIDS
41
+ def file_dir(force_user = false)
42
+ return USER_PIDS if force_user
43
+ admin? ? ROOT_PIDS : USER_PIDS
38
44
  end
39
45
 
40
46
  def read_pid
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freyr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tal Atlas
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-03 00:00:00 -04:00
19
- default_executable: freyr
18
+ date: 2011-08-31 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
@@ -101,7 +100,6 @@ files:
101
100
  - spec/freyr_spec.rb
102
101
  - spec/spec.opts
103
102
  - spec/spec_helper.rb
104
- has_rdoc: true
105
103
  homepage: http://github.com/Talby/freyr
106
104
  licenses: []
107
105
 
@@ -131,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
129
  requirements: []
132
130
 
133
131
  rubyforge_project:
134
- rubygems_version: 1.6.2
132
+ rubygems_version: 1.8.8
135
133
  signing_key:
136
134
  specification_version: 3
137
135
  summary: Service manager and runner