log_minimal 0.0.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 +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +10 -0
- data/lib/log_minimal.rb +6 -0
- data/lib/log_minimal/configuration.rb +11 -0
- data/lib/log_minimal/methods.rb +16 -0
- data/lib/log_minimal/railtie.rb +9 -0
- data/lib/log_minimal/version.rb +3 -0
- data/log_minimal.gemspec +23 -0
- data/test/log_minimal_test.rb +63 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 77c1d416d238085f2852192568c0ddd2fe6f6a02
|
4
|
+
data.tar.gz: a66fff3002cf43084effe77331cc170994eca11c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ee4c0602735811b390dc3263511e321819d698634bed93fadd3db4ff8020eece0b3212ec652a492df5218a964a8e1d87494f05b594de63e5045693d4d9fcb0c
|
7
|
+
data.tar.gz: df7ae5bb3ace9a206b5ddbb4f472845bdfa1f5f8e3ba1ca2804f0d2474b09b6709e96bb6c95ba704445679992ab7ef32e28018967b1d215ed93ac20b6a63b6c2
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 SHIBATA Hiroshi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# LogMinimal
|
2
|
+
|
3
|
+
Ruby port of Log::Minimal
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'log_minimal'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install log_minimal
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
(TBD)
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/log_minimal/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/log_minimal.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module LogMinimal
|
2
|
+
module Methods
|
3
|
+
[:fatal, :error, :warn, :info, :debug].each do |method|
|
4
|
+
define_method "#{method}f" do |message|
|
5
|
+
caller = "%s#%s:%s" % [self.class, caller(1)[0].scan(/in `(.*)'/)[0][0], caller(1)[0].scan(/:(\d+):/)[0][0]]
|
6
|
+
logger.send(method, "%s\t%s" % [caller, message])
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
unless respond_to?(:logger)
|
11
|
+
def logger
|
12
|
+
@_logger ||= Logger.new(Configuration.path)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/log_minimal.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'log_minimal/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "log_minimal"
|
8
|
+
spec.version = LogMinimal::VERSION
|
9
|
+
spec.authors = ["SHIBATA Hiroshi"]
|
10
|
+
spec.email = ["shibata.hiroshi@gmail.com"]
|
11
|
+
spec.summary = %q{Ruby port of Log::Minimal.}
|
12
|
+
spec.description = %q{Ruby port of Log::Minimal.}
|
13
|
+
spec.homepage = "https://github.com/paperboy-all/log_minimal"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'logger'
|
4
|
+
require 'log_minimal'
|
5
|
+
|
6
|
+
class ActionController
|
7
|
+
include LogMinimal::Methods
|
8
|
+
|
9
|
+
def logger
|
10
|
+
@logger ||= Logger.new(File.expand_path(File.dirname(__FILE__) + '/dummy.log'))
|
11
|
+
end
|
12
|
+
|
13
|
+
def show
|
14
|
+
fatalf("foo")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class ActionNoLoggerController
|
19
|
+
include LogMinimal::Methods
|
20
|
+
|
21
|
+
def show
|
22
|
+
fatalf("foo")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
module LogMinimalTestCase
|
28
|
+
def test_define
|
29
|
+
[:fatalf, :errorf, :warnf, :infof, :debugf].each do |method|
|
30
|
+
assert @controller.respond_to?(method)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_logger
|
35
|
+
@controller.show
|
36
|
+
assert File.exist? log
|
37
|
+
body = File.read(log)
|
38
|
+
assert body.include?('show')
|
39
|
+
assert body.include?('foo')
|
40
|
+
FileUtils.rm log
|
41
|
+
end
|
42
|
+
|
43
|
+
def log
|
44
|
+
File.expand_path(File.dirname(__FILE__) + '/dummy.log')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class LogMinimalTest < Test::Unit::TestCase
|
49
|
+
include LogMinimalTestCase
|
50
|
+
|
51
|
+
def setup
|
52
|
+
@controller = ActionController.new
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class LogMinimalNoLoggerTest < Test::Unit::TestCase
|
57
|
+
include LogMinimalTestCase
|
58
|
+
|
59
|
+
def setup
|
60
|
+
LogMinimal::Configuration.path = log
|
61
|
+
@controller = ActionNoLoggerController.new
|
62
|
+
end
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: log_minimal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SHIBATA Hiroshi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby port of Log::Minimal.
|
42
|
+
email:
|
43
|
+
- shibata.hiroshi@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/log_minimal.rb
|
55
|
+
- lib/log_minimal/configuration.rb
|
56
|
+
- lib/log_minimal/methods.rb
|
57
|
+
- lib/log_minimal/railtie.rb
|
58
|
+
- lib/log_minimal/version.rb
|
59
|
+
- log_minimal.gemspec
|
60
|
+
- test/log_minimal_test.rb
|
61
|
+
homepage: https://github.com/paperboy-all/log_minimal
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.2.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Ruby port of Log::Minimal.
|
85
|
+
test_files:
|
86
|
+
- test/log_minimal_test.rb
|
87
|
+
has_rdoc:
|