little-dutch 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/little-dutch/configuration.rb +24 -6
- data/lib/little-dutch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 910c339774c1fc072441d17ff0d4b3549743e417
|
4
|
+
data.tar.gz: 600373a16055401f06edd5305102936a92dff76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef9cc921783612c37acf5e4d10fe8155d766e54ff15cf1525b02cf56a561b20fcef4a056d5f68fb295a17d057ae9c7b417491e8165db30c6c2fe10ecbe3121eb
|
7
|
+
data.tar.gz: 776fe373d7431dc99b7c85667d33146dae6d6886899e065d6bd13aae19c7b418f825e52bb5e73a32cc44586e8ab9ae7be1e5e5373d698ea3ca86e1ff4059868e
|
@@ -15,8 +15,8 @@ module LittleDutch
|
|
15
15
|
|
16
16
|
class << self
|
17
17
|
|
18
|
-
def
|
19
|
-
names.each { |n|
|
18
|
+
def option(*names)
|
19
|
+
names.each { |n| define_option n }
|
20
20
|
end
|
21
21
|
|
22
22
|
def env
|
@@ -29,27 +29,45 @@ module LittleDutch
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def
|
32
|
+
def define_option(name)
|
33
33
|
define_method name do
|
34
34
|
@options[name.to_s]
|
35
35
|
end
|
36
|
+
|
37
|
+
define_method "#{name}=" do |val|
|
38
|
+
@options[name.to_s] = val
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
end
|
39
43
|
|
40
|
-
|
41
|
-
|
44
|
+
attr_writer :logger
|
45
|
+
option :endpoint, :token, :enabled, :interval, :app_name, :instance_name
|
42
46
|
delegate :env, to: :class
|
43
47
|
|
44
48
|
def initialize(file)
|
45
49
|
@options = load(file)
|
46
|
-
FileUtils.mkdir_p File.dirname logfile
|
50
|
+
FileUtils.mkdir_p File.dirname logfile if logfile.is_a? String
|
47
51
|
end
|
48
52
|
|
49
53
|
def instance_id
|
50
54
|
@instance_id ||= [instance_name, uuid].join '.'
|
51
55
|
end
|
52
56
|
|
57
|
+
def logfile=(file)
|
58
|
+
@logger = nil
|
59
|
+
@options['logfile'] = file
|
60
|
+
end
|
61
|
+
|
62
|
+
def logfile
|
63
|
+
output = @options['logfile']
|
64
|
+
if output.to_s.downcase.in? %w{stdout stderr}
|
65
|
+
output.to_s.upcase.constantize
|
66
|
+
else
|
67
|
+
output
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
53
71
|
def logger
|
54
72
|
@logger ||= Logger.new logfile
|
55
73
|
end
|
data/lib/little-dutch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: little-dutch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Waldrip
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|