gom-core 0.2.1 → 0.2.2

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.
data/Guardfile CHANGED
@@ -4,6 +4,9 @@
4
4
  guard 'rspec', :version => 2, :cli => '-d' do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
6
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+
7
8
  watch('spec/spec_helper.rb') { "spec" }
8
9
  watch('lib/gom/core.rb') { "spec" }
10
+ watch('*.gemspec') { "spec" }
11
+ watch('Gemfile') { "spec" }
9
12
  end
@@ -1,4 +1,3 @@
1
1
  require 'gom/logger'
2
- require 'gom/log'
3
2
  require 'gom/core/primitive'
4
3
  require 'gom/core/version'
@@ -1,5 +1,5 @@
1
1
  module Gom
2
2
  module Core
3
- VERSION = "0.2.1"
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
@@ -17,25 +17,26 @@ module Gom
17
17
  # output defaults to STDOUT for rails test and non-rails apps, to a
18
18
  # logfile otherwise
19
19
  #
20
- DEFAULT_OUT = begin
21
- if (RAILS_ROOT.nil? rescue true)
22
- STDOUT
23
- else
24
- if 'test' === RAILS_ENV
25
- STDOUT
26
- else
27
- "#{RAILS_ROOT}/log/gom-#{RAILS_ENV}.log"
28
- end
29
- end
30
- end
31
-
32
- def initialize out = DEFAULT_OUT
33
- super out
20
+ def default_outstream
21
+ if ! (Object.const_defined? 'Rails')
22
+ STDOUT
23
+ else
24
+ if 'test' === ::Rails.env
25
+ STDOUT
26
+ else
27
+ "#{::Rails.root.to_s}/log/gom-#{::Rails.env}.log"
28
+ end
29
+ end
30
+ end
31
+
32
+ def initialize out = nil
33
+ super(out || default_outstream)
34
+ self.level = ::Logger::DEBUG
34
35
  end
35
36
 
36
37
  # this is to de-patch the rails formatting patch..
37
38
  def format_message(severity, timestamp, progname, msg)
38
- "#{timestamp.strftime '%Y-%m-%d %H:%M:%S'} #{severity[0,1]} #{msg}\n"
39
+ "#{timestamp.strftime '%Y-%m-%d %H:%M:%S'} #{severity.chars.first} #{msg}\n"
39
40
  end
40
41
 
41
42
  # experimental convenience function:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gom-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
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-07-11 00:00:00.000000000 Z
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -139,8 +139,6 @@ files:
139
139
  bGliL2dvbS9jb3JlL3ByaW1pdGl2ZS5yYg==
140
140
  - !binary |-
141
141
  bGliL2dvbS9jb3JlL3ZlcnNpb24ucmI=
142
- - !binary |-
143
- bGliL2dvbS9sb2cucmI=
144
142
  - !binary |-
145
143
  bGliL2dvbS9sb2dnZXIucmI=
146
144
  - !binary |-
@@ -1,47 +0,0 @@
1
- module Gom
2
- # GOM default Logger instance
3
- Log = Gom::Logger.new
4
-
5
- # TODO: runtime configuration might move to config/initializers/...
6
- Log.level = ::Logger::DEBUG
7
- end
8
-
9
- __END__
10
-
11
- Log = ::Logger.new case RAILS_ENV
12
- when "test"
13
- STDOUT
14
- else
15
- "#{RAILS_ROOT}/log/gom-#{RAILS_ENV}.log"
16
- end
17
-
18
- class << Log
19
- # this is to de-patch the rails formatting patch..
20
- def format_message(severity, timestamp, progname, msg)
21
- "#{timestamp.to_formatted_s(:db)} #{severity.first} #{msg}\n"
22
- end
23
-
24
- # experimental convenience function:
25
- #
26
- # Log.ex e
27
- #
28
- # does actually do:
29
- # Log.error e
30
- # Log.debug "#{e.backtrace.join "\n\t"}"
31
- #
32
- # and:
33
- # Log.ex e, "some message here"
34
- #
35
- # stands for:
36
- # Log.error "some message here"
37
- # Log.debug "#{e.backtrace.join "\n\t"}"
38
- #
39
- def ex e, msg = nil, level = :error
40
- send level, (msg || e)
41
- debug "#{e} -- error was: #{msg}\n\t#{e.backtrace.join "\n\t"}"
42
- end
43
- end
44
-
45
- # TODO: runtime configuration might move to config/initializers/...
46
- Log.level = ::Logger::DEBUG
47
- end