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 +4 -4
- data/lib/sharp.rb +18 -8
- data/lib/sharp/action.rb +5 -1
- data/lib/sharp/version.rb +1 -1
- data/sharp.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf65dbc4e7f862641ed2fa05e82b8e458baeaa00
|
4
|
+
data.tar.gz: 807ca9b84328f0a12e6ed1ec8764753607b750c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05dd4be7be6089c5306ba0412c1763bc0cde434541f3d4bf62efe198dd87382b4a7a977607f8e9a953468cc8bcad153c22b05ab9a37250ce8da36edd46c4ec0
|
7
|
+
data.tar.gz: 73aea111c4fd89353d918b30eaba5b748ad3b2c9f0e73b92c0b0c57ab833291f71c3ead0af01c3f4a85a492ab5498226aa5088458adf9a14ed5b70aaafbf377d
|
data/lib/sharp.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/sharp/action.rb
CHANGED
@@ -21,7 +21,11 @@ module Sharp
|
|
21
21
|
if defined? @view_class
|
22
22
|
@view_class
|
23
23
|
else
|
24
|
-
@view_class =
|
24
|
+
@view_class = begin
|
25
|
+
view_name.constantize
|
26
|
+
rescue NameError
|
27
|
+
Sharp::View
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
data/lib/sharp/version.rb
CHANGED
data/sharp.gemspec
CHANGED
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.
|
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-
|
11
|
+
date: 2013-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|