dryad-core 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dryad.rb +0 -45
- data/lib/dryad/core/version.rb +1 -1
- metadata +4 -4
- data/lib/dryad/configuration.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 956b312daaa54743c8a70ef517de278ff8c8c9b020460202a30d9cb9e4cfded3
|
4
|
+
data.tar.gz: 5455ec427785a2e133ff4a5ebc0cb09d7f44b63220845970bbf0a4c58dd8f9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6ed34e33886f542e77f1337fbef99a2679ec6d12fd020d5c3a58d50f2c97b61bc70a617c2d61f4380cf3d24e44128b6bb2bd208a834ebfe3b6ba4a6b1620dd
|
7
|
+
data.tar.gz: b38d8bce4e89a57ba2065b67d59f88f7057afbccc12be69adbbf4d524fe275473a628cac889d9227b96075d8219217d45baaa1e0a4d7aae312b764dc18458e7c
|
data/Gemfile.lock
CHANGED
data/lib/dryad.rb
CHANGED
@@ -1,46 +1 @@
|
|
1
|
-
require "dryad/configuration"
|
2
1
|
require "dryad/core"
|
3
|
-
require "yaml"
|
4
|
-
require "erb"
|
5
|
-
|
6
|
-
DRYAD_COFNIG_FILE = ENV["DRYAD_CONFIG_FILE"] || "config/dryad.yml"
|
7
|
-
|
8
|
-
module Dryad
|
9
|
-
class Error < StandardError; end
|
10
|
-
|
11
|
-
class << self
|
12
|
-
attr_accessor :configuration
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.configuration
|
16
|
-
@configuration ||= Configuration.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.configure
|
20
|
-
yield(configuration)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.configure_with_file
|
24
|
-
environment = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "default"
|
25
|
-
opts = YAML.load(ERB.new(File.read(DRYAD_COFNIG_FILE)).result)[environment] || Configuration::DEFAULT_OPTIONS
|
26
|
-
|
27
|
-
if opts.respond_to? :deep_symbolize_keys!
|
28
|
-
opts.deep_symbolize_keys!
|
29
|
-
else
|
30
|
-
symbolize_keys_deep!(opts)
|
31
|
-
end
|
32
|
-
|
33
|
-
@configuration = Configuration.new(opts)
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def self.symbolize_keys_deep!(hash)
|
38
|
-
hash.keys.each do |k|
|
39
|
-
symkey = k.respond_to?(:to_sym) ? k.to_sym : k
|
40
|
-
hash[symkey] = hash.delete k
|
41
|
-
symbolize_keys_deep! hash[symkey] if hash[symkey].is_a? Hash
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
Dryad.configure_with_file if File.exist?(DRYAD_COFNIG_FILE)
|
data/lib/dryad/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dryad-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pan Jie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,7 +71,6 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- dryad-core.gemspec
|
73
73
|
- lib/dryad.rb
|
74
|
-
- lib/dryad/configuration.rb
|
75
74
|
- lib/dryad/core.rb
|
76
75
|
- lib/dryad/core/config_desc.rb
|
77
76
|
- lib/dryad/core/config_provider.rb
|
@@ -100,7 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
102
101
|
requirements: []
|
103
|
-
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.7.9
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Dryad core library.
|
data/lib/dryad/configuration.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Dryad
|
2
|
-
class Configuration
|
3
|
-
attr_accessor :consul, :namespace, :group, :registry, :provider, :service
|
4
|
-
|
5
|
-
DEFAULT_OPTIONS = {
|
6
|
-
consul: {
|
7
|
-
host: '127.0.0.1',
|
8
|
-
port: 8500
|
9
|
-
},
|
10
|
-
service: {}
|
11
|
-
}
|
12
|
-
|
13
|
-
def initialize(opts = {})
|
14
|
-
opts = DEFAULT_OPTIONS.merge(opts)
|
15
|
-
@consul = opts[:consul]
|
16
|
-
@namespace = opts[:namespace]
|
17
|
-
@group = opts[:group]
|
18
|
-
@registry = opts[:registry]
|
19
|
-
@provider = opts[:provider]
|
20
|
-
@service = opts[:service]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|