asetus 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/asetus.gemspec +2 -3
- data/lib/asetus.rb +6 -4
- metadata +9 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3c763701092ea923250405a4adab73a3d136fc
|
4
|
+
data.tar.gz: 64545850f1db20c25d0d5052d35657f36710aae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b3a7c81d79d7aca59f3489ac064adbb9eb3c3fce822f469f716ecb738ff8ddce97aaa0d052d563085a1276b6885507e1901aa555ce4c804bd2099ffbb98724
|
7
|
+
data.tar.gz: 1f2c5ab1f16fc2a8557c12638ef43f304a1e77d40e3417cdddfc11f426f5d9d31f42953c591e0215c630500bd3eb0278097081d4bf92db476aaa9771ca2e70d5
|
data/asetus.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'asetus'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.1'
|
4
|
+
s.licenses = ['Apache-2.0']
|
4
5
|
s.platform = Gem::Platform::RUBY
|
5
6
|
s.authors = [ 'Saku Ytti' ]
|
6
7
|
s.email = %w( saku@ytti.fi )
|
@@ -11,6 +12,4 @@ Gem::Specification.new do |s|
|
|
11
12
|
s.files = `git ls-files`.split("\n")
|
12
13
|
s.executables = %w( )
|
13
14
|
s.require_path = 'lib'
|
14
|
-
|
15
|
-
s.add_dependency 'slop'
|
16
15
|
end
|
data/lib/asetus.rb
CHANGED
@@ -23,7 +23,7 @@ class UnknownOption < AsetusError; end
|
|
23
23
|
# ssh_hosts = CFG.ssh.hosts
|
24
24
|
class Asetus
|
25
25
|
CONFIG_FILE = 'config'
|
26
|
-
attr_reader :cfg, :default
|
26
|
+
attr_reader :cfg, :default, :file
|
27
27
|
attr_accessor :system, :user
|
28
28
|
|
29
29
|
class << self
|
@@ -92,6 +92,7 @@ class Asetus
|
|
92
92
|
# @option opts [String] :adapter adapter to use 'yaml' or 'json' for now
|
93
93
|
# @option opts [String] :usrdir directory for storing user config ~/.config/name/ by default
|
94
94
|
# @option opts [String] :sysdir directory for storing system config /etc/name/ by default
|
95
|
+
# @option opts [String] :cfgfile configuration filename by default CONFIG_FILE
|
95
96
|
# @option opts [Hash] :default default settings to use
|
96
97
|
# @option opts [boolean] :load automatically load+merge system+user config with defaults in #cfg
|
97
98
|
# @option opts [boolean] :key_to_s convert keys to string by calling #to_s for keys
|
@@ -100,6 +101,7 @@ class Asetus
|
|
100
101
|
@adapter = (opts.delete(:adapter) or 'yaml')
|
101
102
|
@usrdir = (opts.delete(:usrdir) or File.join(Dir.home, '.config', @name))
|
102
103
|
@sysdir = (opts.delete(:sysdir) or File.join('/etc', @name))
|
104
|
+
@cfgfile = (opts.delete(:cfgfile) or CONFIG_FILE
|
103
105
|
@default = ConfigStruct.new opts.delete(:default)
|
104
106
|
@system = ConfigStruct.new
|
105
107
|
@user = ConfigStruct.new
|
@@ -112,8 +114,8 @@ class Asetus
|
|
112
114
|
end
|
113
115
|
|
114
116
|
def load_cfg dir
|
115
|
-
file = File.join dir,
|
116
|
-
file = File.read file
|
117
|
+
@file = File.join dir, @cfgfile
|
118
|
+
file = File.read @file
|
117
119
|
ConfigStruct.new(from(@adapter, file), :key_to_s=>@key_to_s)
|
118
120
|
rescue Errno::ENOENT
|
119
121
|
ConfigStruct.new
|
@@ -121,7 +123,7 @@ class Asetus
|
|
121
123
|
|
122
124
|
def save_cfg dir, config
|
123
125
|
config = to(@adapter, config)
|
124
|
-
file = File.join dir,
|
126
|
+
file = File.join dir, @cfgfile
|
125
127
|
FileUtils.mkdir_p dir
|
126
128
|
File.write file, config
|
127
129
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asetus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saku Ytti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: slop
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
11
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: configuration library with object access to YAML/JSON/CSON backends
|
28
14
|
email:
|
29
15
|
- saku@ytti.fi
|
@@ -31,7 +17,7 @@ executables: []
|
|
31
17
|
extensions: []
|
32
18
|
extra_rdoc_files: []
|
33
19
|
files:
|
34
|
-
- .gitignore
|
20
|
+
- ".gitignore"
|
35
21
|
- Gemfile
|
36
22
|
- README.md
|
37
23
|
- Rakefile
|
@@ -41,7 +27,8 @@ files:
|
|
41
27
|
- lib/asetus/adapter/yaml.rb
|
42
28
|
- lib/asetus/configstruct.rb
|
43
29
|
homepage: http://github.com/ytti/asetus
|
44
|
-
licenses:
|
30
|
+
licenses:
|
31
|
+
- Apache-2.0
|
45
32
|
metadata: {}
|
46
33
|
post_install_message:
|
47
34
|
rdoc_options: []
|
@@ -49,17 +36,17 @@ require_paths:
|
|
49
36
|
- lib
|
50
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
38
|
requirements:
|
52
|
-
- -
|
39
|
+
- - ">="
|
53
40
|
- !ruby/object:Gem::Version
|
54
41
|
version: '0'
|
55
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
43
|
requirements:
|
57
|
-
- -
|
44
|
+
- - ">="
|
58
45
|
- !ruby/object:Gem::Version
|
59
46
|
version: '0'
|
60
47
|
requirements: []
|
61
48
|
rubyforge_project: asetus
|
62
|
-
rubygems_version: 2.
|
49
|
+
rubygems_version: 2.2.2
|
63
50
|
signing_key:
|
64
51
|
specification_version: 4
|
65
52
|
summary: configuration library
|