nub 0.0.34 → 0.0.35

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nub/config.rb +9 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cf925a7cd5d2cf8c28a7c30cd254aba66e956717bea8adaaaa3587f494bd170
4
- data.tar.gz: 6d544b6ecf927a507816ff25540d52a2ecb4dfa92f04692aa9aee192cdf4dead
3
+ metadata.gz: 14efb7fa976af799cce7a81dc1c380a9693fc9e7662d79c4db611011b44dbf9f
4
+ data.tar.gz: 718d3542289f23b057c6278e9c9f17e0ab6a16184cbabada6f44136c2e4dd915
5
5
  SHA512:
6
- metadata.gz: 5724872db7f4aad0d12bb8f93f0566bb7d847da0bd9f844006ea25bd19b3641bade73e0b33e03f372d6b8b1097edfb8ff191694143e2a9c63c279657fb48e6c2
7
- data.tar.gz: a872d28e8f0fc5d670bb80692f00d84b85e83fa15e1f233e3668b23e5219d2772b6896cc97b596fac583b6a40daea17d06b5deadf999cca3dd48ced09b3fa108
6
+ metadata.gz: 805fd25ade06515accbf5d82616200d21e2c84447512a761bbfb8aeb85634440ce5c8e79cae9b15bfcfc72eb871716a2dc69d2aa8ff953c762749f7b4d099876
7
+ data.tar.gz: df51f2ac8b2c5d129a75dbe796d27c887f89471b1c0b8b7a315e2f86eedd8c88bc170e8050611e5adbb44db27b05e3de5b144df591b14c0cde53a7cfd668f5b1
data/lib/nub/config.rb CHANGED
@@ -38,9 +38,15 @@ module Config
38
38
  end
39
39
 
40
40
  # Singleton new alternate
41
- # @param config_name [String] name of the config file
42
- def self.init(config_name)
43
- @path = "/home/#{User.name}/.config/#{config_name}"
41
+ # @param config [String] name or path of the config file
42
+ def self.init(config)
43
+
44
+ # Determine caller's file path to look for sidecar config
45
+ caller_path = caller_locations(1, 1).first.path
46
+ @path = File.expand_path(File.join(File.dirname(caller_path), config))
47
+ if !File.exists?(@path)
48
+ @path = "/home/#{User.name}/.config/#{config.split('/').first}"
49
+ end
44
50
 
45
51
  # Open the config file or create in memory yml
46
52
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34
4
+ version: 0.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Crummett