utopia 1.9.4 → 1.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/utopia/logger.rb +33 -0
- data/lib/utopia/logger/compact_formatter.rb +46 -0
- data/lib/utopia/version.rb +1 -1
- data/setup/server/git/hooks/post-receive +1 -4
- data/setup/site/tasks/log.rake +17 -0
- data/setup/site/tasks/utopia.rake +3 -0
- data/utopia.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de15ab25d817b448a1c21a6f4d182997f4f05f2
|
4
|
+
data.tar.gz: 312bb8afd81ed6d896023c91b3967e8ecb9e685a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 438c588e37cfe3bc2ebf0014cf138bfcee0843a77c31478ca33bb888d6018fe8c1dd38ba62686a77ba357f4d105bd88ca3f8464178c247ba49094794b0e35add
|
7
|
+
data.tar.gz: 1ee534d2c10acc63dacf401dcf3b8c530895f5eef38a2134dc98ccc03e5cc9a9b314c47fc8596e6917235fe77f2e6e64ace21909acab428d1278301e99eef2ef
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'logger/compact_formatter'
|
22
|
+
|
23
|
+
module Utopia
|
24
|
+
module Logger
|
25
|
+
def self.new(output: STDERR, level: ::Logger::WARN)
|
26
|
+
log = ::Logger.new(output)
|
27
|
+
log.level = level
|
28
|
+
log.formatter = Utopia::Logger::CompactFormatter.new
|
29
|
+
|
30
|
+
return log
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'logger'
|
22
|
+
require 'rainbow'
|
23
|
+
|
24
|
+
module Utopia
|
25
|
+
module Logger
|
26
|
+
class CompactFormatter
|
27
|
+
def initialize
|
28
|
+
@start = Time.now
|
29
|
+
end
|
30
|
+
|
31
|
+
def time_offset_string
|
32
|
+
offset = Time.now - @start
|
33
|
+
|
34
|
+
"T+#{offset.round(1).to_s.ljust(5)}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def call(severity, datetime, progname, message)
|
38
|
+
if progname
|
39
|
+
"#{Rainbow(time_offset_string).bright.blue} #{Rainbow(progname).bright}: #{message}\n"
|
40
|
+
else
|
41
|
+
"#{Rainbow(time_offset_string).bright.blue} #{message}\n"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/utopia/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
task :log do
|
3
|
+
require 'utopia/logger'
|
4
|
+
LOGGER = Utopia::Logger.new
|
5
|
+
end
|
6
|
+
|
7
|
+
namespace :log do
|
8
|
+
desc "Increase verbosity of logger to info."
|
9
|
+
task :info => :log do
|
10
|
+
LOGGER.level = Logger::INFO
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Increase verbosity of global debug."
|
14
|
+
task :debug => :log do
|
15
|
+
LOGGER.level = Logger::DEBUG
|
16
|
+
end
|
17
|
+
end
|
@@ -15,6 +15,9 @@ end
|
|
15
15
|
desc 'Set up the environment for running your web application'
|
16
16
|
task :environment do
|
17
17
|
require_relative '../config/environment'
|
18
|
+
|
19
|
+
# We ensure this is part of the shell environment so if other commands are invoked they will work correctly.
|
20
|
+
ENV['RACK_ENV'] = RACK_ENV.to_s
|
18
21
|
end
|
19
22
|
|
20
23
|
desc 'Run a server for testing your web application'
|
data/utopia.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rainbow
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rack
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,6 +364,8 @@ files:
|
|
350
364
|
- lib/utopia/http.rb
|
351
365
|
- lib/utopia/locale.rb
|
352
366
|
- lib/utopia/localization.rb
|
367
|
+
- lib/utopia/logger.rb
|
368
|
+
- lib/utopia/logger/compact_formatter.rb
|
353
369
|
- lib/utopia/middleware.rb
|
354
370
|
- lib/utopia/path.rb
|
355
371
|
- lib/utopia/path/matcher.rb
|
@@ -392,6 +408,7 @@ files:
|
|
392
408
|
- setup/site/spec/website_context.rb
|
393
409
|
- setup/site/spec/website_spec.rb
|
394
410
|
- setup/site/tasks/bower.rake
|
411
|
+
- setup/site/tasks/log.rake
|
395
412
|
- setup/site/tasks/test.rake
|
396
413
|
- setup/site/tasks/utopia.rake
|
397
414
|
- setup/site/tmp/readme.txt
|