logutils-activerecord 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemtest +0 -0
- data/{History.md → HISTORY.md} +0 -0
- data/Manifest.txt +3 -2
- data/Rakefile +2 -2
- data/lib/logutils/activerecord.rb +3 -5
- data/lib/logutils/activerecord/version.rb +1 -1
- data/test/helper.rb +14 -0
- data/test/test_logger.rb +41 -0
- metadata +9 -6
- data/lib/logutils/activerecord/deleter.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36689361f0d0638f7a51bb6c289acb9cc8693549
|
4
|
+
data.tar.gz: 57e7a25c121d6ec7375a98042c947c8d07c6be26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c25fd0c0dea6d9dd7accc203630e440fad453bd6c14dc67d93218dd7b57f16a03badb019abd68691be2e4ab7f8c76686193a2ce700acb479b9410fc5b4609e7
|
7
|
+
data.tar.gz: c1e203868530815040c2d6d24b3f73effbff8489e2b4bd0646d0cd89bd8a72ac532227ddb69cc5511273ce20779c8f40bb34205a886be706ec74e528bd33de44
|
data/.gemtest
ADDED
File without changes
|
data/{History.md → HISTORY.md}
RENAMED
File without changes
|
data/Manifest.txt
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
1
|
+
HISTORY.md
|
2
2
|
Manifest.txt
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
5
|
lib/logutils/activerecord.rb
|
6
|
-
lib/logutils/activerecord/deleter.rb
|
7
6
|
lib/logutils/activerecord/models.rb
|
8
7
|
lib/logutils/activerecord/schema.rb
|
9
8
|
lib/logutils/activerecord/version.rb
|
@@ -12,3 +11,5 @@ lib/logutils/server/public/style.css
|
|
12
11
|
lib/logutils/server/views/_version.erb
|
13
12
|
lib/logutils/server/views/index.erb
|
14
13
|
lib/logutils/server/views/layout.erb
|
14
|
+
test/helper.rb
|
15
|
+
test/test_logger.rb
|
data/Rakefile
CHANGED
@@ -13,11 +13,11 @@ Hoe.spec 'logutils-activerecord' do
|
|
13
13
|
|
14
14
|
self.author = 'Gerald Bauer'
|
15
15
|
self.email = 'opensport@googlegroups.com'
|
16
|
-
|
16
|
+
|
17
17
|
# switch extension to .markdown for gihub formatting
|
18
18
|
# -- Note: auto-changed when included in manifest
|
19
19
|
self.readme_file = 'README.md'
|
20
|
-
self.history_file = '
|
20
|
+
self.history_file = 'HISTORY.md'
|
21
21
|
|
22
22
|
self.licenses = ['Public Domain']
|
23
23
|
|
@@ -13,9 +13,6 @@ require 'active_record' ## todo: add sqlite3? etc.
|
|
13
13
|
require 'logutils/activerecord/version' # NOTE: let version always go first
|
14
14
|
require 'logutils/activerecord/models'
|
15
15
|
require 'logutils/activerecord/schema'
|
16
|
-
require 'logutils/activerecord/deleter'
|
17
|
-
|
18
|
-
|
19
16
|
|
20
17
|
|
21
18
|
module LogDb
|
@@ -38,7 +35,7 @@ module LogDb
|
|
38
35
|
# delete ALL records (use with care!)
|
39
36
|
def self.delete!
|
40
37
|
puts '*** deleting log table records/data...'
|
41
|
-
|
38
|
+
Model::Log.delete_all
|
42
39
|
end # method delete!
|
43
40
|
|
44
41
|
|
@@ -47,11 +44,12 @@ module LogDb
|
|
47
44
|
end
|
48
45
|
|
49
46
|
|
47
|
+
|
50
48
|
STDDBHANDLER = DbHandler.new # default/standard db handler
|
51
49
|
|
52
50
|
def self.setup # check: use different name? e.g. configure or connect ?? why or why not?
|
53
51
|
# turn on logging to db - assumes active connection
|
54
|
-
STDLOGGER.handlers << STDDBHANDLER
|
52
|
+
LogKernel::STDLOGGER.handlers << STDDBHANDLER
|
55
53
|
end
|
56
54
|
|
57
55
|
end # module LogDb
|
data/test/helper.rb
ADDED
data/test/test_logger.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
###
|
2
|
+
# to run use
|
3
|
+
# ruby -I ./lib -I ./test test/test_logger.rb
|
4
|
+
# or better
|
5
|
+
# rake test
|
6
|
+
|
7
|
+
require 'helper'
|
8
|
+
|
9
|
+
|
10
|
+
class TestLogger < MiniTest::Test
|
11
|
+
include LogUtils # lets us use Logger instead of LogUtils::Logger
|
12
|
+
|
13
|
+
|
14
|
+
def test_setup
|
15
|
+
|
16
|
+
# connect to in-memory db
|
17
|
+
## ActiveRecord::Base.logger = Logger.new( STDOUT )
|
18
|
+
ActiveRecord::Base.establish_connection( adapter: 'sqlite3',
|
19
|
+
database: ':memory:' )
|
20
|
+
|
21
|
+
LogDb.create
|
22
|
+
LogDb.setup
|
23
|
+
|
24
|
+
l1 = Logger[ self ]
|
25
|
+
l2 = Logger[ 'Test' ]
|
26
|
+
l3 = Logger[ TestLogger ]
|
27
|
+
|
28
|
+
### note: for now all return LogUtils::Kernel::STDLOGGER
|
29
|
+
assert l1 == LogKernel::STDLOGGER
|
30
|
+
assert l2 == LogKernel::STDLOGGER
|
31
|
+
assert l3 == LogKernel::STDLOGGER
|
32
|
+
|
33
|
+
l1.info( 'info msg from l1')
|
34
|
+
l1.warn( 'warn msg from li')
|
35
|
+
|
36
|
+
l1.info( "log count: #{LogDb::Model::Log.count}" )
|
37
|
+
|
38
|
+
assert true
|
39
|
+
end
|
40
|
+
|
41
|
+
end # class TestLogger
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logutils-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logutils
|
@@ -71,16 +71,16 @@ email: opensport@googlegroups.com
|
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files:
|
74
|
-
-
|
74
|
+
- HISTORY.md
|
75
75
|
- Manifest.txt
|
76
76
|
- README.md
|
77
77
|
files:
|
78
|
-
-
|
78
|
+
- ".gemtest"
|
79
|
+
- HISTORY.md
|
79
80
|
- Manifest.txt
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
82
83
|
- lib/logutils/activerecord.rb
|
83
|
-
- lib/logutils/activerecord/deleter.rb
|
84
84
|
- lib/logutils/activerecord/models.rb
|
85
85
|
- lib/logutils/activerecord/schema.rb
|
86
86
|
- lib/logutils/activerecord/version.rb
|
@@ -89,6 +89,8 @@ files:
|
|
89
89
|
- lib/logutils/server/views/_version.erb
|
90
90
|
- lib/logutils/server/views/index.erb
|
91
91
|
- lib/logutils/server/views/layout.erb
|
92
|
+
- test/helper.rb
|
93
|
+
- test/test_logger.rb
|
92
94
|
homepage: https://github.com/rubylibs/logutils-activerecord
|
93
95
|
licenses:
|
94
96
|
- Public Domain
|
@@ -115,4 +117,5 @@ rubygems_version: 2.4.2
|
|
115
117
|
signing_key:
|
116
118
|
specification_version: 4
|
117
119
|
summary: Another Logger - Addon for Database Support (LogDb, Log Model etc.)
|
118
|
-
test_files:
|
120
|
+
test_files:
|
121
|
+
- test/test_logger.rb
|