alephant-logger 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 208aa5c838eb069a7f3d5e538bbf012b5b80534b
4
+ data.tar.gz: ed9e40f027e4b8b83f88c7d3eca0f0065a33d68c
5
+ SHA512:
6
+ metadata.gz: fd866de65b4b58e2531565438392e502831175aee6d4f630256444bd7293f58791c6a18408598f62c65d31641d395c3954355ba56c3fd2791cead2cfe5c5974d
7
+ data.tar.gz: 25d5c75be310787bd0004e350849a913d54c3a788e244e9277719674413dcebf2aa016af03a7798368a7e55d06b456c8fe94894838360244b4d7efef0e20fc22
@@ -0,0 +1,10 @@
1
+ /config/*.yaml
2
+ /config/*.yml
3
+ Gemfile.lock
4
+ .rspec
5
+ *.gem
6
+
7
+ /pkg
8
+ /tmp
9
+ /components
10
+
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "jruby"
4
+ notifications:
5
+ email:
6
+ recipients:
7
+ - kenoir@gmail.com
8
+ on_failure: change
9
+ on_success: never
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in alephant-logger.gemspec
4
+ gemspec
@@ -0,0 +1,6 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/.+\.rb$})
4
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Robert Kenny
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.
@@ -0,0 +1,51 @@
1
+ # Alephant::Logger
2
+
3
+ Logger functionality for Alephant
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'alephant-logger'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install alephant-logger
18
+
19
+ ## Usage
20
+
21
+ ```rb
22
+ require 'alephant/logger'
23
+
24
+ # Using the standard logger
25
+ class IncludesLogger
26
+ include Alephant::Logger
27
+
28
+ def calls_logger
29
+ logger.warn "MUCH WARN. WOW."
30
+ end
31
+ end
32
+
33
+ # Sets a logger
34
+ class SetsLogger
35
+ include Alephant::Logger
36
+
37
+ def calls_logger
38
+ Alephant::Logger.set_logger(CustomLogger.new)
39
+ logger.warn "SUCH CUSTOM. MUCH LOG."
40
+ end
41
+ end
42
+
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it ( http://github.com/<my-github-username>/alephant-logger/fork )
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create new Pull Request
@@ -0,0 +1,9 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+
3
+ require 'rspec/core/rake_task'
4
+ require 'bundler/gem_tasks'
5
+ require 'alephant/logger'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'alephant/logger/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "alephant-logger"
8
+ spec.version = Alephant::Logger::VERSION
9
+ spec.authors = ["Robert Kenny"]
10
+ spec.email = ["kenoir@gmail.com"]
11
+ spec.summary = %q{Logger functionality for Alephant}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "rspec"
21
+ spec.add_development_dependency "rspec-nc"
22
+ spec.add_development_dependency "guard"
23
+ spec.add_development_dependency "guard-rspec"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "pry-remote"
26
+ spec.add_development_dependency "pry-nav"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.5"
29
+ spec.add_development_dependency "rake"
30
+ end
@@ -0,0 +1,21 @@
1
+ require "alephant/logger/version"
2
+ require 'logger'
3
+
4
+ module Alephant
5
+ module Logger
6
+ @@logger = nil
7
+
8
+ def logger
9
+ Alephant::Logger.get_logger
10
+ end
11
+
12
+ def self.get_logger
13
+ @@logger ||= ::Logger.new(STDOUT)
14
+ end
15
+
16
+ def self.set_logger(value)
17
+ @@logger = value
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,5 @@
1
+ module Alephant
2
+ module Logger
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::Logger do
4
+ describe ".get_logger" do
5
+
6
+ context "no logger set" do
7
+ it "returns standard Logger" do
8
+ expect(subject.get_logger).to be_a Logger
9
+ end
10
+ end
11
+
12
+ context "subject.set_logger(:foo)" do
13
+ it "returns @@logger" do
14
+ subject.class_variable_set(:@@logger, :foo)
15
+ expect(subject.get_logger).to eq(:foo)
16
+ end
17
+ end
18
+ end
19
+
20
+ describe ".set_logger(:foo)" do
21
+ it "sets foo as @@logger" do
22
+ subject.set_logger(:bar)
23
+ expect(subject.class_variable_get(:@@logger)).to eq(:bar)
24
+ end
25
+ end
26
+
27
+ context "when included in a class" do
28
+
29
+ class IncludesLog
30
+ include Alephant::Logger
31
+
32
+ def calls_logger
33
+ logger
34
+ end
35
+ end
36
+
37
+ context "called via '#logger'" do
38
+ it "returns the value of @@logger" do
39
+ subject.class_variable_set(:@@logger, :baz)
40
+ expect(IncludesLog.new.calls_logger).to eq(:baz)
41
+ end
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ $: << File.join(File.dirname(__FILE__),"..", "lib")
2
+
3
+ require 'pry'
4
+ require 'alephant/logger'
5
+
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alephant-logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Robert Kenny
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-nc
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-remote
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-nav
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '1.5'
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ~>
121
+ - !ruby/object:Gem::Version
122
+ version: '1.5'
123
+ prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ prerelease: false
138
+ type: :development
139
+ description:
140
+ email:
141
+ - kenoir@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - .gitignore
147
+ - .travis.yml
148
+ - Gemfile
149
+ - Guardfile
150
+ - LICENSE.txt
151
+ - README.md
152
+ - Rakefile
153
+ - alephant-logger.gemspec
154
+ - lib/alephant/logger.rb
155
+ - lib/alephant/logger/version.rb
156
+ - spec/logger_spec.rb
157
+ - spec/spec_helper.rb
158
+ homepage: ''
159
+ licenses:
160
+ - MIT
161
+ metadata: {}
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - '>='
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.1.9
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Logger functionality for Alephant
182
+ test_files:
183
+ - spec/logger_spec.rb
184
+ - spec/spec_helper.rb