logworm_amqp 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ v0.9.9
2
+ - Support for multiple .logworm files, for each environment the app may be run on. When configuring logworm
3
+ it first looks for .logworm_#{ENV['RACK_ENV'] || ENV['RAILS_ENV']} and uses it if present.
4
+ Otherwise, it defaults to the regular .logworm file.
5
+ So, for example, you may have .logworm_development and .logworm_production
6
+
1
7
  v0.9.8
2
8
  - Set ip address to HTTP_X_REAL_IP if present --otherwise, it is set to Heroku's internal routing machine
3
9
  - Moved the return statement outside of the ensure block --see
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('logworm_amqp', '0.9.8') do |p|
2
+ Echoe.new('logworm_amqp', '0.9.9') do |p|
3
3
  p.description = "logworm - logging service"
4
4
  p.url = "http://www.logworm.com"
5
5
  p.author = "Pomelo, LLC"
@@ -15,15 +15,19 @@ module Logworm
15
15
 
16
16
  def reset
17
17
  @file_found = false
18
+ @filename = nil
18
19
  @url = nil
19
20
  end
20
21
 
21
22
  def read
22
23
  begin
23
- f = File.new("./" + FILENAME, 'r')
24
+ @filename = (env_filename && File.exists?(env_filename)) ? env_filename : basic_filename
25
+ f = File.new(@filename, 'r')
24
26
  @url = f.readline.strip
25
27
  @file_found = true
28
+ $stderr.puts "logworm: Using configuration file #{@filename}"
26
29
  rescue Errno::ENOENT => e
30
+ $stderr.puts "logworm: Configuration file #{@filename} not found"
27
31
  end
28
32
  self
29
33
  end
@@ -37,12 +41,24 @@ module Logworm
37
41
  end
38
42
 
39
43
  def save(url)
40
- File.open("./" + FILENAME, 'w') do |f|
44
+ newfile = env_filename || basic_filename
45
+ File.open(newfile, 'w') do |f|
41
46
  f.puts url
42
47
  end rescue Exception
43
- %x[echo #{FILENAME} >> .gitignore]
48
+ %x[echo #{newfile} >> .gitignore]
44
49
  end
45
50
 
51
+ private
52
+ def env_filename
53
+ env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
54
+ env ? "./#{FILENAME}_#{env}" : nil
55
+ end
56
+
57
+ def basic_filename
58
+ "./#{FILENAME}"
59
+ end
60
+
61
+
46
62
  end
47
63
 
48
64
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logworm_amqp}
5
- s.version = "0.9.8"
5
+ s.version = "0.9.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pomelo, LLC"]
9
- s.date = %q{2010-09-29}
9
+ s.date = %q{2010-12-05}
10
10
  s.description = %q{logworm - logging service}
11
11
  s.email = %q{schapira@pomelollc.com}
12
12
  s.executables = ["lw-compute", "lw-tail"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logworm_amqp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 8
10
- version: 0.9.8
9
+ - 9
10
+ version: 0.9.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pomelo, LLC
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-29 00:00:00 -04:00
18
+ date: 2010-12-05 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency