figi 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5567063a6f470027f7f02a805aa86e68ffe680c5579adeddadccc7274637e434
4
- data.tar.gz: f3dee70a950f553e9892b265cc3415b9c6bf6b52ae307a634f937a34508fca54
3
+ metadata.gz: 686b3e1f4a642c2a61da5ea00c3298f5aae2a0f5ec9459af15f6819b078cb536
4
+ data.tar.gz: f506cdca7d6e98309c0f8b754bd1480cd5f5e860f76318a0dda56ef6714d0162
5
5
  SHA512:
6
- metadata.gz: 448f56d87f7b147e697a6bd362f66bb245fef5f3429ddc6e9706a10dfe0a6937180a4a638f68ebc9c75d35aa49dbf046cf9d920b72efec2235a4d44a0ba2897d
7
- data.tar.gz: 24cf0ce537fcea387bcc2a37980378c2ec1cfbfecc6375a26546fefaf905d6956c852eb591b3921b3b21faca5686035ba85e95e25b7d77e036ee154a5c970106
6
+ metadata.gz: 9f9930a14c0ef9b3129f2e3f32d8a08e53fbd7b534277d99776d3ca6b62372c51ff2ed698e7367743e61a41643ff3f56a71a655b2cee4a536425a2b948200bbd
7
+ data.tar.gz: 1693dda4788956248ac18d56d003aee9b1a71bb0e4d6596fc53298559e4b34715d7d49a75f93ff3b456f4f62db0c14d1a9e4f344db353be21c040f829af3e1f8
data/.gitignore CHANGED
@@ -1,2 +1,14 @@
1
- .idea/
2
- Gemfile.lock
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # JetBrains
14
+ .idea/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.1
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in figi.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ figi (0.1.1)
5
+ hashie (~> 3.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ hashie (3.6.0)
12
+ rake (10.5.0)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 2.0)
32
+ figi!
33
+ rake (~> 10.0)
34
+ rspec (~> 3.0)
35
+
36
+ BUNDLED WITH
37
+ 2.0.1
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 ztz
3
+ Copyright (c) 2019 ztz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,23 +2,80 @@
2
2
 
3
3
  FIGI is a super simple configuration library you can use in your ruby application.
4
4
 
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
5
9
  ```ruby
6
- require 'figi'
10
+ gem 'figi'
11
+ ```
7
12
 
8
- # config once
9
- Figi::Config.load(environment: 'production', username: 'root')
13
+ And then execute:
14
+
15
+ $ bundle
10
16
 
11
- # then use everywhere
12
- puts(figi.environment) # => production
13
- puts(figi.username) # => root
17
+ Or install it yourself as:
18
+
19
+ $ gem install test
20
+
21
+ ## Usage
22
+
23
+ - Support JSON and YAML file
24
+
25
+ ```ruby
26
+ require 'figi'
14
27
 
15
- # also support loading from json or yaml file
16
28
  Figi::Config.from_json('config/config.json')
17
29
  Figi::Config.from_yaml('config/config.yml')
18
30
 
19
- figi.environment = 'development'
20
- puts(figi.environment) # => development
31
+ puts figi.environment
32
+ # => development
33
+ ```
34
+
35
+ - Method access
36
+
37
+ ```ruby
38
+ require 'figi'
39
+
40
+ figi.host = 'localhost'
41
+ puts figi.host
42
+ # => localhost
43
+
44
+ puts figi.host?
45
+ # => true
46
+
47
+ puts figi.not_exists?
48
+ # => false
49
+ ```
21
50
 
51
+ - Config once, use everywhere
52
+
53
+ ```ruby
54
+ require 'figi'
55
+
56
+ Figi::Config.load(environment: 'production', username: 'root')
57
+
58
+ puts figi.environment
59
+ # => production
60
+ puts figi.username
61
+ # => root
62
+ ```
63
+
64
+ - Config with DSL
65
+
66
+ ```ruby
67
+ Figi::Config.load do |config|
68
+ config.environment = 'production'
69
+ config.username = 'root'
70
+ end
71
+
72
+ puts figi.environment
73
+ # => production
74
+ ```
75
+
76
+ - Nested method access
77
+
78
+ ```ruby
22
79
  # nested access
23
80
  figi.db = {
24
81
  host: 'localhost',
@@ -26,4 +83,12 @@ figi.db = {
26
83
  }
27
84
  puts(figi.db.host) # => localhost
28
85
  puts(figi.db.port) # => 27017
29
- ```
86
+ ```
87
+
88
+ ## Contributing
89
+
90
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zt2/figi.
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/figi.gemspec CHANGED
@@ -1,18 +1,30 @@
1
- $LOAD_PATH.unshift(File.expand_path(File.join(__dir__, 'lib')))
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
2
4
  require 'figi/version'
3
5
 
4
6
  Gem::Specification.new do |gem|
5
- gem.name = 'figi'
6
- gem.version = Figi::Version.to_s
7
- gem.date = '2018-11-12'
8
- gem.authors = ['ztz']
9
- gem.email = ['hi_ztz@protonmail.com']
10
- gem.description = 'Figi is a simple and easy ruby config library'
11
- gem.summary = 'Easy config library'
12
- gem.homepage = 'https://github.com/zt2/figi'
13
- gem.license = 'MIT'
7
+ gem.name = 'figi'
8
+ gem.version = Figi::Version.to_s
9
+ gem.authors = ['ztz']
10
+ gem.email = ['hi_ztz@protonmail.com']
11
+
12
+ gem.summary = 'Easy config library'
13
+ gem.description = 'Figi is a simple and easy ruby config library'
14
+ gem.homepage = 'https://github.com/zt2/figi'
15
+ gem.license = 'MIT'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ gem.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
14
22
 
15
- gem.files = `git ls-files`.split
16
23
  gem.require_paths = ['lib']
24
+
25
+ gem.add_development_dependency 'bundler', '~> 2.0'
26
+ gem.add_development_dependency 'rake', '~> 10.0'
27
+ gem.add_development_dependency 'rspec', '~> 3.0'
28
+
17
29
  gem.add_runtime_dependency 'hashie', '~> 3.6'
18
30
  end
data/lib/figi/version.rb CHANGED
@@ -3,10 +3,9 @@ module Figi
3
3
  # Version
4
4
  #
5
5
  module Version
6
-
7
6
  MAJOR = '0'.freeze
8
7
  MINOR = '1'.freeze
9
- PATCH = '0'.freeze
8
+ PATCH = '1'.freeze
10
9
 
11
10
  class << self
12
11
  def to_s
@@ -14,4 +13,4 @@ module Figi
14
13
  end
15
14
  end
16
15
  end
17
- end
16
+ end
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ztz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: hashie
15
57
  requirement: !ruby/object:Gem::Requirement
@@ -32,8 +74,13 @@ extensions: []
32
74
  extra_rdoc_files: []
33
75
  files:
34
76
  - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - Gemfile.lock
35
81
  - LICENSE
36
82
  - README.md
83
+ - Rakefile
37
84
  - figi.gemspec
38
85
  - lib/figi.rb
39
86
  - lib/figi/config.rb
@@ -57,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
104
  - !ruby/object:Gem::Version
58
105
  version: '0'
59
106
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 2.7.7
107
+ rubygems_version: 3.0.3
62
108
  signing_key:
63
109
  specification_version: 4
64
110
  summary: Easy config library