eucalypt 0.4.0 → 0.4.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30f59d26df1bd25928ccbc4f6ffed978bf3d3fc9387928d100ad3dbb21c419ae
|
4
|
+
data.tar.gz: 21e246723e17aa247f0c263018ad81864f65bb5184419f1f8d2ad2d27db80f5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 678240c6a339075aeab896c6eb08f1193581cd667d034a996d1041be4462a064d2d4a87179bb78bd5533cf1deaf4499acb04d5a1c4727602f03822a392f0243e
|
7
|
+
data.tar.gz: 491dccc27711788d533a81aeee63edbb4ee619575d6f9c52c76f251b8f96cff0e8488afaa8251461ab2533abf426aba0f17a2e8db905420a8e6bd042f78260a8
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class ApplicationController < Sinatra::Base
|
2
|
+
LOGGER = if (settings.logging == !!settings.logging)
|
3
|
+
Lumberjack::Logger.new $stdout
|
4
|
+
else
|
5
|
+
Lumberjack::Logger.new $stdout, level: settings.logging
|
6
|
+
end
|
7
|
+
|
8
|
+
set :logger, LOGGER
|
9
|
+
|
10
|
+
class DummyLogger
|
11
|
+
def initialize(silence = false, stdout = nil)
|
12
|
+
@silence = silence
|
13
|
+
@stdout = stdout
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_missing(m, *args, &block)
|
17
|
+
LOGGER.send(m, *args, &block)
|
18
|
+
$stdout.reopen(@stdout) if @silence
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
helpers do
|
23
|
+
def logger()
|
24
|
+
if settings.logging
|
25
|
+
return DummyLogger.new
|
26
|
+
else
|
27
|
+
stdout = $stdout.clone
|
28
|
+
$stdout.reopen IO::NULL
|
29
|
+
return DummyLogger.new(true, stdout)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private_constant :DummyLogger
|
35
|
+
|
36
|
+
if settings.log_file
|
37
|
+
time = Time.now.strftime settings.log_directory_format # Sanitize time!
|
38
|
+
path = Eucalypt.path('logs', time)
|
39
|
+
|
40
|
+
require 'fileutils'
|
41
|
+
FileUtils.mkdir_p path
|
42
|
+
|
43
|
+
$stderr.reopen File.new(File.join(path, "#{settings.environment}.stderr.log"), 'a+')
|
44
|
+
$stderr.sync = true
|
45
|
+
$stdout.reopen File.new(File.join(path, "#{settings.environment}.stdout.log"), 'a+')
|
46
|
+
$stdout.sync = true
|
47
|
+
end
|
48
|
+
end
|
@@ -1,29 +1,24 @@
|
|
1
|
-
require 'fileutils'
|
2
1
|
class ApplicationController < Sinatra::Base
|
3
|
-
|
4
|
-
|
2
|
+
configure :test do
|
3
|
+
disable :logging
|
4
|
+
disable :log_file
|
5
|
+
end
|
5
6
|
|
6
|
-
configure
|
7
|
-
|
7
|
+
configure :development do
|
8
|
+
enable :logging
|
9
|
+
disable :log_file
|
10
|
+
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
use Rack::CommonLogger, $stdout
|
12
|
+
configure :production do
|
13
|
+
set :logging, Lumberjack::Severity::UNKNOWN
|
14
|
+
enable :log_file
|
15
|
+
end
|
14
16
|
|
15
|
-
|
16
|
-
log_path = Eucalypt.path 'log', time.sub(/_\+/, ?p).sub(/_\-/, ?m)
|
17
|
-
FileUtils.mkdir_p log_path
|
17
|
+
set :log_directory_format, "%Y-%m-%d_%H-%M-%S"
|
18
18
|
|
19
|
-
|
20
|
-
$stderr.sync = true
|
21
|
-
$stdout.reopen File.new(File.join(log_path, "#{app_env}.stdout.log"), 'a+')
|
22
|
-
$stdout.sync = true
|
23
|
-
end
|
24
|
-
end
|
19
|
+
require 'eucalypt/core/helpers/logging'
|
25
20
|
|
26
21
|
# ActiveRecord logging
|
27
22
|
ActiveRecord::Base.logger = Logger.new STDOUT
|
28
|
-
ActiveRecord::Migration.verbose = true
|
23
|
+
ActiveRecord::Migration.verbose = true
|
29
24
|
end
|
File without changes
|
data/lib/eucalypt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eucalypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edwin Onuonga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- lib/eucalypt/core/cli/rake.rb
|
234
234
|
- lib/eucalypt/core/cli/test.rb
|
235
235
|
- lib/eucalypt/core/cli/version.rb
|
236
|
+
- lib/eucalypt/core/helpers/logging.rb
|
236
237
|
- lib/eucalypt/core/helpers/manifest.rb
|
237
238
|
- lib/eucalypt/core/helpers/partial.rb
|
238
239
|
- lib/eucalypt/core/templates/Gemfile.tt
|
@@ -259,7 +260,7 @@ files:
|
|
259
260
|
- lib/eucalypt/core/templates/eucalypt/config/database.yml
|
260
261
|
- lib/eucalypt/core/templates/eucalypt/config/initializers/.empty_directory
|
261
262
|
- lib/eucalypt/core/templates/eucalypt/config/logging.rb
|
262
|
-
- lib/eucalypt/core/templates/eucalypt/
|
263
|
+
- lib/eucalypt/core/templates/eucalypt/logs/.empty_directory
|
263
264
|
- lib/eucalypt/core/templates/eucalypt/spec/controllers/application_controller_spec.rb
|
264
265
|
- lib/eucalypt/core/templates/eucalypt/spec/helpers/application_helper_spec.rb
|
265
266
|
- lib/eucalypt/core/templates/eucalypt/spec/models/.empty_directory
|