maxconf 1.0.0
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 +7 -0
- data/lib/maxconf.rb +48 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 92751117009c945e3c3ed8f8af892a82a88b4a29
|
4
|
+
data.tar.gz: 27e41d35085b1487a47fb3b78cad288bdd00360d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dd2f2e6a4a67aeabe5da6668e4d0cce837e695141b825ec0cb562b9392dfd66a346278f07f9c0164ad97cf7740697c417e9a72016cb5f9ef36f93299088f1706
|
7
|
+
data.tar.gz: b7765e188d723470dcfb958c7359ea25f9994ec3f30887cf68f14c455ce33043de3ddf490a90de75e3f43862c02786e6693a09df3c9da3163b9dc4c09e6fafd6
|
data/lib/maxconf.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
DEFAULT_FILE = ENV['HOME'] + '/.maxcdn.yml'
|
4
|
+
|
5
|
+
###
|
6
|
+
# option: default :: description
|
7
|
+
# ------------------------------------
|
8
|
+
# "file": undefined :: config file to be used, default is
|
9
|
+
# '$HOME/.maxcdn.yml'
|
10
|
+
# "[opt]": n/a :: set or overide [opt]
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
#
|
14
|
+
# require 'maxconf'
|
15
|
+
#
|
16
|
+
# conf = MaxConf.load()
|
17
|
+
# puts conf["alias"]
|
18
|
+
# => YOUR_ALIAS
|
19
|
+
#
|
20
|
+
# conf = MaxConf.load("/path/to/maxcdn.yml")
|
21
|
+
# puts conf["alias"]
|
22
|
+
# => YOUR_ALIAS
|
23
|
+
#
|
24
|
+
# opts = {
|
25
|
+
# "file" => "/path/to/maxcdn.yml",
|
26
|
+
# "alias" => "ALIAS_OVERIDE"
|
27
|
+
# }
|
28
|
+
# conf = MaxConf.load(opts)
|
29
|
+
# puts conf["alias"]
|
30
|
+
# => ALIAS_OVERIDE
|
31
|
+
###
|
32
|
+
module MaxConf
|
33
|
+
def self.load opts={}
|
34
|
+
if opts.class == String
|
35
|
+
opts = { "file" => opts }
|
36
|
+
end
|
37
|
+
|
38
|
+
file = opts.delete("file") || opts.delete(:file) || DEFAULT_FILE
|
39
|
+
conf = YAML.load_file(file)
|
40
|
+
|
41
|
+
# overide config with passed options
|
42
|
+
opts.each do |key, val|
|
43
|
+
conf[key] = val
|
44
|
+
end
|
45
|
+
|
46
|
+
return conf
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: maxconf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joshua P. Mervine
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A sub-stack lib for configuring ruby-maxcdn using maxcli configuration
|
14
|
+
method.
|
15
|
+
email: joshua@mervine.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/maxconf.rb
|
21
|
+
homepage: https://github.com/MaxCDN/maxconf.rb
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.2.2
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: maxconf
|
45
|
+
test_files: []
|