utopia 1.9.4 → 1.9.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a4f99328db2c8c6246dd0106078a47f172e08c7
4
- data.tar.gz: 7af566aaf349482f40cc5dcfde3104b3f384d223
3
+ metadata.gz: 7de15ab25d817b448a1c21a6f4d182997f4f05f2
4
+ data.tar.gz: 312bb8afd81ed6d896023c91b3967e8ecb9e685a
5
5
  SHA512:
6
- metadata.gz: b117b99e129ffcc91b35f29d6e49d69b142cec155c1fa177db4acf02724c2f84006dfedecefce709f0003d8aaf00bddb48c4dbccbd587846bb95219291609bcd
7
- data.tar.gz: 4c87195b6a26203e983f339255ae1f8cb768ba47f4400d82c0ce5ef5ac2b4e1cadf8b0eb871576fd317056d36f207f9d45a2045196688b9fe94f10551e86db13
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
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "1.9.4"
22
+ VERSION = "1.9.5"
23
23
  end
@@ -71,9 +71,6 @@ Dir.chdir(GIT_WORK_TREE) do
71
71
  end
72
72
 
73
73
  if File.exist? 'Rakefile'
74
- sudo %W{bundle exec rake deploy}
75
-
76
- puts "Restarting server..."
77
- sudo %W{bundle exec rake restart}
74
+ sudo %W{bundle exec rake deploy restart}
78
75
  end
79
76
  end
@@ -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'
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'mime-types', '~> 3.0'
29
29
 
30
30
  spec.add_dependency 'samovar', '~> 1.2'
31
+ spec.add_dependency 'rainbow', '~> 2.0'
31
32
 
32
33
  spec.add_dependency 'rack', '~> 2.0'
33
34
 
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
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-09 00:00:00.000000000 Z
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