sharp 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8310087ef6112633f75cfb95a6650e0e2d537b93
4
- data.tar.gz: baa693a14b2b939b8a1d0057e6d4cb78ac6a47a1
3
+ metadata.gz: cf65dbc4e7f862641ed2fa05e82b8e458baeaa00
4
+ data.tar.gz: 807ca9b84328f0a12e6ed1ec8764753607b750c4
5
5
  SHA512:
6
- metadata.gz: 66f1f835d30829616adb8dadc7bcd5b763316f86476ddfc5849afd0f58a055e3751a017a9552ed9a86f6a8c5e4204d4e7f9b9d20976d2a6cc066ed7207b175cb
7
- data.tar.gz: 0e1fa475e408f3e69b6a084e00adf7891dabbc0446ed53b5ee24493fc05ff04e53ef0eedfe122c2f07e5779e44010ad2692b7d69339a9f41e3267f14ccc2abf2
6
+ metadata.gz: a05dd4be7be6089c5306ba0412c1763bc0cde434541f3d4bf62efe198dd87382b4a7a977607f8e9a953468cc8bcad153c22b05ab9a37250ce8da36edd46c4ec0
7
+ data.tar.gz: 73aea111c4fd89353d918b30eaba5b748ad3b2c9f0e73b92c0b0c57ab833291f71c3ead0af01c3f4a85a492ab5498226aa5088458adf9a14ed5b70aaafbf377d
@@ -16,7 +16,7 @@ require 'sharp/version'
16
16
  module Sharp
17
17
  class << self
18
18
  attr_reader :app
19
- delegate :logger, :boot, :root, :router, :env, :config, :route, :get, :post, :put, :delete, :head, :to => :app
19
+ delegate :logger, :logger=, :boot, :root, :router, :env, :config, :route, :get, :post, :put, :delete, :head, :to => :app
20
20
  delegate :routes, :to => :router
21
21
  end
22
22
 
@@ -129,15 +129,24 @@ module Sharp
129
129
  end
130
130
  end
131
131
 
132
+ def objects_logger_is_attached_to
133
+ @objects_logger_is_attached_to ||= [self]
134
+ end
135
+
136
+ def attach_logger(obj)
137
+ objects_logger_is_attached_to << obj
138
+ obj.logger = logger
139
+ end
140
+
141
+ def logger=(logger)
142
+ objects_logger_is_attached_to.each do |object|
143
+ object.logger = logger
144
+ end
145
+ end
146
+
132
147
  def logger_formatter
133
148
  @logger_formatter ||= proc do |severity, datetime, progname, msg|
134
- color = case severity
135
- when "ERROR" then '0;31'
136
- when "WARN" then '1;33'
137
- when "DEBUG" then '0;32'
138
- else '1;37'
139
- end
140
- "\e[#{ color }m#{datetime} #{msg}\e[0;0m\n"
149
+ "#{datetime} #{severity} #{msg}\n"
141
150
  end
142
151
  end
143
152
 
@@ -152,6 +161,7 @@ module Sharp
152
161
  protected
153
162
 
154
163
  def pre_initialization
164
+ attach_logger(Rack::Action)
155
165
  Dir.glob(root.join("app/initializers/pre/*.rb")) {|file| load file }
156
166
  end
157
167
 
@@ -21,7 +21,11 @@ module Sharp
21
21
  if defined? @view_class
22
22
  @view_class
23
23
  else
24
- @view_class = Object.const_defined?(view_name) ? view_name.constantize : Sharp::View
24
+ @view_class = begin
25
+ view_name.constantize
26
+ rescue NameError
27
+ Sharp::View
28
+ end
25
29
  end
26
30
  end
27
31
 
@@ -1,3 +1,3 @@
1
1
  module Sharp
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "sharp"
5
- gem.version = "0.3.5"
5
+ gem.version = "0.3.6"
6
6
  gem.authors = ["Paul Barry"]
7
7
  gem.email = ["mail@paulbarry.com"]
8
8
  gem.description = %q{A Ruby and Rack-based web framework}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-12 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport