td-logger 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ == 2012-07-26 version 0.3.14
3
+
4
+ * Rails agent assumes TREASURE_DATA_YML environment variable is an
5
+ absolute path if it starts with '/'
6
+
7
+
2
8
  == 2012-07-26 version 0.3.13
3
9
 
4
10
  * Rails agent supports TREASURE_DATA_YML environment variable to change
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.14
@@ -47,36 +47,41 @@ module Agent::Rails
47
47
 
48
48
  def self.init
49
49
  logger = ::Logger.new(STDERR)
50
- if File.exist?("#{::Rails.root}/#{CONFIG_PATH}")
51
- load_file(logger)
50
+
51
+ if CONFIG_PATH[0] == ?/
52
+ config_path = CONFIG_PATH
52
53
  else
53
- if File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
54
- load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
55
- elsif File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
56
- load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
57
- else
58
- load_env(logger)
59
- end
54
+ config_path = "#{::Rails.root}/#{CONFIG_PATH}"
55
+ end
56
+
57
+ if File.exist?(config_path)
58
+ load_file(logger, config_path)
59
+ elsif File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
60
+ load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
61
+ elsif File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
62
+ load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
63
+ else
64
+ load_env(logger)
60
65
  end
61
66
  end
62
67
 
63
- def self.load_file(logger)
68
+ def self.load_file(logger, path="#{::Rails.root}/#{CONFIG_PATH}")
64
69
  require 'yaml'
65
70
  require 'erb'
66
71
 
67
72
  begin
68
- src = File.read("#{::Rails.root}/#{CONFIG_PATH}")
73
+ src = File.read(path)
69
74
  yaml = ERB.new(src).result
70
75
  env_conf = YAML.load(yaml)
71
76
  rescue
72
- logger.warn "WARNING: Can't load #{CONFIG_PATH} file: #{$!}"
77
+ logger.warn "WARNING: Can't load #{path} file: #{$!}"
73
78
  logger.warn "WARNING: Disabling Treasure Data event logger."
74
79
  return nil
75
80
  end
76
81
 
77
82
  conf = env_conf[::Rails.env] if env_conf.is_a?(Hash)
78
83
  unless conf
79
- logger.warn "WARNING: #{CONFIG_PATH} doesn't include setting for current environment (#{::Rails.env})."
84
+ logger.warn "WARNING: #{path} doesn't include setting for current environment (#{::Rails.env})."
80
85
  logger.warn "WARNING: Disabling Treasure Data event logger."
81
86
  return nil
82
87
  end
@@ -84,7 +89,7 @@ module Agent::Rails
84
89
  begin
85
90
  return Config.new(conf)
86
91
  rescue
87
- logger.warn "WARNING: #{CONFIG_PATH}: #{$!}."
92
+ logger.warn "WARNING: #{path}: #{$!}."
88
93
  logger.warn "WARNING: Disabling Treasure Data event logger."
89
94
  return nil
90
95
  end
@@ -1,7 +1,7 @@
1
1
  module TreasureData
2
2
  module Logger
3
3
 
4
- VERSION = '0.3.13'
4
+ VERSION = '0.3.14'
5
5
 
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: