asetus 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7b6f2d2fe862c7f73dc66b6b89d9b16a047715f
4
- data.tar.gz: 427e3edc155554b1bb485a42fab2305b1257e29a
3
+ metadata.gz: 618b53db8015a756a96a2124fab7f5e396c4e0b6
4
+ data.tar.gz: a1629c5542af8474466df4dc82e195ee3f8e743f
5
5
  SHA512:
6
- metadata.gz: 72fc1f6121e50e1e38252357a34cda8a1e47bdd7aa13384874ce8a32bc5d4d67f7a6b6d750a517f65a8a026e0fb1039201e2648a220eabe8e406b50dd9e27520
7
- data.tar.gz: fd9af0ea0655956b2f47a75ecb8e18bef02bd4d0f319b3dd6424812a2d7c828ba311dffddda831c75cb36b39c4f2256af94de70cbaa5079336ab2bbd1163dca3
6
+ metadata.gz: a5097f86b83858a1094de6aa5be95a4337cf395c39a4f103f49821e478ec3f4f3e94e9921421e75627d9cf846afc76b27ecda001e0e442ced70ecd7db64d0d26
7
+ data.tar.gz: 480a2a7f5afbe0c7284ae2bb8d1acba54decb08bcd69fec5e8ffdc670ee43b8d56286201de95a76a0cb8c5786f6c7fe500bb2ef6e28458ba5ab65bf994c80279
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Asetus
2
- Configuration library for ruby with YAML/JSON backends with unified object
2
+ Configuration library for ruby with YAML/JSON/TOML backends with unified object
3
3
  access
4
4
 
5
5
  ## Install
data/asetus.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'asetus'
3
- s.version = '0.1.2'
3
+ s.version = '0.2.0'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti' ]
7
7
  s.email = %w( saku@ytti.fi )
8
8
  s.homepage = 'http://github.com/ytti/asetus'
9
9
  s.summary = 'configuration library'
10
- s.description = 'configuration library with object access to YAML/JSON/CSON backends'
10
+ s.description = 'configuration library with object access to YAML/JSON/TOML backends'
11
11
  s.rubyforge_project = s.name
12
12
  s.files = `git ls-files`.split("\n")
13
13
  s.executables = %w( )
@@ -0,0 +1,27 @@
1
+ class Asetus
2
+
3
+ def to_toml config
4
+ Adapter::TOML.to config._asetus_to_hash
5
+ end
6
+
7
+ def from_toml toml
8
+ Adapter::TOML.from toml
9
+ end
10
+
11
+ class Adapter
12
+ class TOML
13
+ class << self
14
+ def to hash
15
+ require 'toml'
16
+ ::TOML::Generator.new(hash).body
17
+ end
18
+
19
+ def from toml
20
+ require 'toml'
21
+ ::TOML.load toml
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ end
data/lib/asetus.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require_relative 'asetus/configstruct'
2
2
  require_relative 'asetus/adapter/yaml'
3
3
  require_relative 'asetus/adapter/json'
4
+ require_relative 'asetus/adapter/toml'
4
5
  require 'fileutils'
5
6
 
6
7
  class AsetusError < StandardError; end
@@ -89,7 +90,7 @@ class Asetus
89
90
 
90
91
  # @param [Hash] opts options for Asetus.new
91
92
  # @option opts [String] :name name to use for asetus (/etc/name/, ~/.config/name/) - autodetected if not defined
92
- # @option opts [String] :adapter adapter to use 'yaml' or 'json' for now
93
+ # @option opts [String] :adapter adapter to use 'yaml', 'json' or 'toml' for now
93
94
  # @option opts [String] :usrdir directory for storing user config ~/.config/name/ by default
94
95
  # @option opts [String] :sysdir directory for storing system config /etc/name/ by default
95
96
  # @option opts [String] :cfgfile configuration filename by default CONFIG_FILE
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asetus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
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-22 00:00:00.000000000 Z
11
+ date: 2014-12-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: configuration library with object access to YAML/JSON/CSON backends
13
+ description: configuration library with object access to YAML/JSON/TOML backends
14
14
  email:
15
15
  - saku@ytti.fi
16
16
  executables: []
@@ -24,6 +24,7 @@ files:
24
24
  - asetus.gemspec
25
25
  - lib/asetus.rb
26
26
  - lib/asetus/adapter/json.rb
27
+ - lib/asetus/adapter/toml.rb
27
28
  - lib/asetus/adapter/yaml.rb
28
29
  - lib/asetus/configstruct.rb
29
30
  homepage: http://github.com/ytti/asetus