procodile 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ebcd819297e20dd833878b4eb0f260174cf24eb
4
- data.tar.gz: aa26143241c51ecb562e0d6216741b49df4e82af
3
+ metadata.gz: cc9014711e488092ae55249f9fcda8dbb2fb9cc1
4
+ data.tar.gz: 9181ab265781b1b39a20524705eab6b6c31117e9
5
5
  SHA512:
6
- metadata.gz: e573069a30bfedc7d7547afb23e30b96353133cd64e5b72e50fe13a0bdc839e5b7d69ea72c3997a0b62cde12717d85b6eead0fb7baec388e146a54c4c95685ee
7
- data.tar.gz: eb34037464dcc04ed0ebda4f259c3c3ad09debcb9e2ade88e78a8ee5c3b16b67ddcc9189f1d40aa78558d13894723cb2518cc8006fd6bb38264ad94ca36b237f
6
+ metadata.gz: 4b12e1eb9fb33548ea5b01d757a73cf377a024cc6e5a0877168fe1240e359c29f569a9b7fcc888c1d8d20008dcdad54497292b79471db1d5efc44b848b2f48a6
7
+ data.tar.gz: 135e12b6084a9cddad8736913bec02ab0dd591728f212340e60e7f83302887dc80551adc09b19cf220306ebde3e742f8b6fc6669cc7794228f84d1f0a39546c7
@@ -99,7 +99,22 @@ module Procodile
99
99
  end
100
100
 
101
101
  def log_path
102
- @log_path ||= File.expand_path(fetch(local_options['log_path']) || fetch(options['log_path']) || 'procodile.log', @root)
102
+ log_path = fetch(local_options['log_path']) || fetch(options['log_path'])
103
+ if log_path
104
+ File.expand_path(log_path, @root)
105
+ elsif log_path.nil? && self.log_root
106
+ File.join(self.log_root, 'procodile.log')
107
+ else
108
+ File.expand_path("procodile.log", @root)
109
+ end
110
+ end
111
+
112
+ def log_root
113
+ if log_root = (fetch(local_options['log_root']) || fetch(options['log_root']))
114
+ File.expand_path(log_root, @root)
115
+ else
116
+ nil
117
+ end
103
118
  end
104
119
 
105
120
  def sock_path
@@ -128,9 +143,13 @@ module Procodile
128
143
 
129
144
  def fetch(value, default = nil)
130
145
  if value.is_a?(Hash)
131
- value[@environment] || default
146
+ if value.has_key?(@environment)
147
+ value[@environment]
148
+ else
149
+ default
150
+ end
132
151
  else
133
- value || default
152
+ value.nil? ? default : value
134
153
  end
135
154
  end
136
155
 
@@ -121,6 +121,9 @@ module Procodile
121
121
  @supervisor.add_instance(self, io)
122
122
  ::Process.detach(@pid)
123
123
  Procodile.log(@process.log_color, description, "Started with PID #{@pid}" + (@tag ? " (tagged with #{@tag})" : ''))
124
+ if self.process.log_path
125
+ Procodile.log(@process.log_color, description, "Logging to #{self.process.log_path}")
126
+ end
124
127
  @started_at = Time.now
125
128
  end
126
129
  end
@@ -70,7 +70,26 @@ module Procodile
70
70
  # none, output will be written to the supervisor log.
71
71
  #
72
72
  def log_path
73
- @options['log_path'] ? File.expand_path(@options['log_path'], @config.root) : nil
73
+ @options['log_path'] ? File.expand_path(@options['log_path'], @config.root) : default_log_path
74
+ end
75
+
76
+ #
77
+ # Return the defualt log file name
78
+ #
79
+ def default_log_file_name
80
+ @options['log_file_name'] || "#{@name}.log"
81
+ end
82
+
83
+ #
84
+ # Return the log path for this process if no log path is provided and split logs
85
+ # is enabled
86
+ #
87
+ def default_log_path
88
+ if @config.log_root
89
+ File.join(@config.log_root, default_log_file_name)
90
+ else
91
+ nil
92
+ end
74
93
  end
75
94
 
76
95
  #
@@ -1,3 +1,3 @@
1
1
  module Procodile
2
- VERSION = '1.0.9'
2
+ VERSION = '1.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procodile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-27 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -75,4 +75,3 @@ specification_version: 4
75
75
  summary: This gem will help you run Ruby processes from a Procfile on Linux servers
76
76
  in the background.
77
77
  test_files: []
78
- has_rdoc: