sleeproom 0.4.1 → 0.4.3

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
  SHA256:
3
- metadata.gz: 8e8ca3fc07a7a4dc3ed69aec76ad0d267bcaa60a9b4ef5c0adea7d068fe2c592
4
- data.tar.gz: 78b13ce764ae80d0b48d9ca5fa59c8bfe929572b90f3baa248d8412068ff606d
3
+ metadata.gz: 16490f0f3a48428466310c0a5ab4c89a7395aeeb9c71aaba2679b43894c145db
4
+ data.tar.gz: e03f35faf54bd848151501bbb0dd14c56ea935647fe7bc1e8b9f00095d665691
5
5
  SHA512:
6
- metadata.gz: 69ebf1096e11fe91773de30d73b2c6801a851e85680bbcf5e94839a9e546f0268528bea9f7940862c882eda2da838c5485f957fbabe03fa57ca718b9e1c324b1
7
- data.tar.gz: 076171c25ac3a74bcde2104f7db59e3cfbd549319a820a35e689eaee267f539fa6c17d104510b9a6c364c6d3dbca0bae83fff13bd5008a5a9f4915ab88cf05c5
6
+ metadata.gz: 819b5780ed280aefcc693986715e30c014128da80d110fc8abb35a23992efdda1f3344ec9b343a1ce746b29a8bd89cf2f90d1beb3989abf9c3d333b8b8f03d5c
7
+ data.tar.gz: 90a9e5e52b573c39b8627521b04ac7811067a8a1c6f379d597f7c35fbdb7b94a345980feaf74ef4bd49df793d35f40d6135b9e3984633937517d045d6b32140c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sleeproom (0.4.1)
4
+ sleeproom (0.4.3)
5
5
  async (~> 1.26.0)
6
6
  async-http-faraday (~> 0.9.0)
7
7
  async-websocket (~> 0.15.0)
@@ -110,7 +110,7 @@ module SleepRoom
110
110
  logger: {
111
111
  console: true,
112
112
  file: {
113
- use: true,
113
+ use: false,
114
114
  path: "#{sleeproom_dir}/log"
115
115
  }
116
116
  }
@@ -142,7 +142,8 @@ module SleepRoom
142
142
  end
143
143
  true
144
144
  rescue Errno::ENOENT => e
145
- error("Could not load file. \n#{e.message}")
145
+ info("Creating configuration...")
146
+ init_base
146
147
  false
147
148
  end
148
149
 
@@ -165,7 +166,7 @@ module SleepRoom
165
166
 
166
167
  def self.running?(pid=nil)
167
168
  pid = SleepRoom.load_config(:pid) if pid.nil?
168
- Process.getpgid(pid)
169
+ Process.kill(0, pid)
169
170
  true
170
171
  rescue
171
172
  false
@@ -194,35 +195,38 @@ module SleepRoom
194
195
  # @param string [String]
195
196
  # @return [nil]
196
197
  def self.info(string)
197
- log(:info, "[INFO] #{string}".colorize(:white))
198
+ log(:info, string)
198
199
  end
199
200
 
200
201
  # @param string [String]
201
202
  # @return [nil]
202
203
  def self.warning(string)
203
- log(:warning, "[WARN] #{string}".colorize(:yellow))
204
+ log(:warning, string)
204
205
  end
205
206
 
206
207
  # @param string [String]
207
208
  # @return [nil]
208
209
  def self.error(string)
209
- log(:error, "[ERROR] #{string}".colorize(:red))
210
+ log(:error, string)
210
211
  end
211
212
 
212
213
  def self.log(type, log)
213
- case type
214
- when :info
215
- puts(log)
216
- when :warning
217
- warn(log)
218
- when :error
219
- puts(log)
214
+ if configatron.logger.console == true
215
+ case type
216
+ when :info
217
+ puts("[INFO] #{log}".colorize(:white))
218
+ when :warning
219
+ warn("[WARN] #{log}".colorize(:yellow))
220
+ when :error
221
+ puts("[ERROR] #{log}".colorize(:red))
222
+ end
220
223
  end
221
224
  file_logger(type, log) if configatron.logger.file.use == true
222
225
  end
223
226
 
224
227
  def self.file_logger(type, log)
225
228
  path = configatron.logger.file.path
229
+ mkdir(File.dirname(path)) unless Dir.exist?(File.dirname(path))
226
230
  logger = Logger.new(path)
227
231
  case type
228
232
  when :info
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SleepRoom
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sleeproom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-17 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize