uber_config 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ UberConfig is a config loader that will load config files from various locations.
2
+
3
+ Looks for `config.yml` file or name passed in via :file param.
4
+
5
+ Here is the order:
6
+
7
+ - $abt_config global variable (for https://github.com/iron-io/abt)
8
+ - test directory
9
+ - directory of file that calls UberConfig.load
10
+ - working directory
11
+ - ~/Dropbox/configs/#{working_directory_name}
12
+
13
+ :dir can be used to change working_directory_name.
14
+
data/lib/uber_config.rb CHANGED
@@ -24,12 +24,17 @@ module UberConfig
24
24
  file = options[:file]
25
25
  end
26
26
 
27
+ working_directory = Dir.pwd
28
+ #puts "working_dir: " + working_directory
29
+
27
30
  #p Kernel.caller
28
31
  caller_file = caller[0][0...(caller[0].index(":in"))]
29
32
  caller_file = caller_file[0...(caller_file.rindex(":"))]
30
33
  #p caller_file
31
34
  caller_dir = File.dirname(caller_file)
32
- #p caller_dir
35
+ #puts "caller_dir: " + caller_dir
36
+ caller_dir = File.expand_path(caller_dir)
37
+ #puts "caller_dir: " + caller_dir
33
38
  caller_dir_split = caller_dir.split("/")
34
39
  #p caller_dir_split
35
40
  auto_dir_name = caller_dir_split.last
@@ -37,14 +42,13 @@ module UberConfig
37
42
  caller_dir_split.pop
38
43
  auto_dir_name = caller_dir_split.last
39
44
  end
40
- #p auto_dir_name
41
45
 
42
46
  # Now check near caller file
43
47
  dir_and_file = dir.nil? ? [] : dir.dup
44
48
  dir_and_file << file
45
- #p dir_and_file
49
+ p dir_and_file
46
50
  location = File.join(dir_and_file)
47
- #p location
51
+ p location
48
52
  cf = File.expand_path(location, caller_dir)
49
53
  @config = load_from(cf)
50
54
  return @config if @config
@@ -54,6 +58,8 @@ module UberConfig
54
58
  @config = load_from(cf)
55
59
  return @config if @config
56
60
 
61
+ puts "auto_dir_name: #{auto_dir_name}"
62
+
57
63
 
58
64
  # Now check in Dropbox
59
65
  dropbox_folders = ["~", "Dropbox", "configs"]
@@ -1,3 +1,3 @@
1
1
  module UberConfig
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uber_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
12
+ date: 2012-07-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Loads configs from common locations.
15
15
  email:
@@ -20,6 +20,7 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - .gitignore
22
22
  - Gemfile
23
+ - README.md
23
24
  - Rakefile
24
25
  - lib/uber_config.rb
25
26
  - lib/uber_config/version.rb