mediashelf-loggable 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ pkg
2
+ doc
3
+ #/.rvmrc
4
+ /.bundle
5
+ /.yardoc
6
+ coverage
data/.rvmrc ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ ruby_string="ree-1.8.7"
7
+ gemset_name="loggable"
8
+
9
+ # Install rubies when used instead of only displaying a warning and exiting
10
+ rvm_install_on_use_flag=1
11
+
12
+ # Specify our desired <ruby>[@<gemset>], the @gemset name is optional.
13
+ environment_id="${ruby_string}@${gemset_name}"
14
+
15
+ # First, attempt to load the desired environment directly from the environment
16
+ # file. This is very fast and efficient compared to running through the entire
17
+ # CLI and selector. If you want feedback on which environment was used then
18
+ # insert the word 'use' after --create as this triggers verbose mode.
19
+ #
20
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
22
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
23
+ else
24
+ # If the environment file has not yet been created, use the RVM CLI to select.
25
+ rvm --create "$environment_id"
26
+ fi
27
+
28
+ # Ensure that Bundler is installed, install it if it is not.
29
+ if ! (command -v bundle > /dev/null) ; then
30
+ printf "The rubygem 'bundler' is not installed, installing it now.\n"
31
+ gem install bundler
32
+ fi
33
+
data/Gemfile CHANGED
@@ -1,8 +1,14 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+
3
4
  group :development, :test do
4
5
  gem "jeweler"
5
6
  gem "mocha"
6
7
  gem "jnunemaker-matchy"
7
8
  gem "thoughtbot-shoulda"
8
- end
9
+ gem "rcov"
10
+ gem "yard"
11
+ gem "RedCloth"
12
+ gem "ruby-debug"
13
+ end
14
+
@@ -1,6 +1,8 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ RedCloth (4.2.7)
5
+ columnize (0.3.4)
4
6
  gemcutter (0.6.1)
5
7
  git (1.2.5)
6
8
  jeweler (1.4.0)
@@ -9,18 +11,32 @@ GEM
9
11
  rubyforge (>= 2.0.0)
10
12
  jnunemaker-matchy (0.4.0)
11
13
  json_pure (1.4.6)
14
+ linecache (0.46)
15
+ rbx-require-relative (> 0.0.4)
12
16
  mocha (0.9.9)
13
17
  rake
14
18
  rake (0.8.7)
19
+ rbx-require-relative (0.0.5)
20
+ rcov (0.9.9)
21
+ ruby-debug (0.10.4)
22
+ columnize (>= 0.1)
23
+ ruby-debug-base (~> 0.10.4.0)
24
+ ruby-debug-base (0.10.4)
25
+ linecache (>= 0.3)
15
26
  rubyforge (2.0.4)
16
27
  json_pure (>= 1.1.7)
17
28
  thoughtbot-shoulda (2.11.1)
29
+ yard (0.6.8)
18
30
 
19
31
  PLATFORMS
20
32
  ruby
21
33
 
22
34
  DEPENDENCIES
35
+ RedCloth
23
36
  jeweler
24
37
  jnunemaker-matchy
25
38
  mocha
39
+ rcov
40
+ ruby-debug
26
41
  thoughtbot-shoulda
42
+ yard
data/Rakefile CHANGED
@@ -2,6 +2,9 @@ require 'rubygems'
2
2
  require 'rake/gempackagetask'
3
3
  require 'rake/testtask'
4
4
 
5
+ # adding tasks defined in lib/tasks
6
+ Dir.glob('lib/tasks/*.rake').each { |r| import r }
7
+
5
8
  begin
6
9
  require 'jeweler'
7
10
  Jeweler::Tasks.new do |gem|
@@ -37,4 +40,4 @@ rescue LoadError
37
40
  task :rcov do
38
41
  abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
42
  end
40
- end
43
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -15,11 +15,15 @@ module Loggable
15
15
  @@logger = logger
16
16
  end
17
17
 
18
- # If RAILS_DEFAULT_LOGGER is defined, that will be returned.
18
+ # If ::Rails.logger is defined, that will be returned.
19
19
  # If no logger has been defined, a new STDOUT Logger will be created.
20
20
  def logger
21
- # @@logger || LoggerStub.new
22
- @@logger ||= (defined?(::Rails) && !::Rails.logger.nil?) ? ::Rails.logger : ::Logger.new(STDOUT)
21
+ if (defined?(::Rails) && !::Rails.logger.nil?)
22
+ @@logger = ::Rails.logger
23
+ else
24
+ @@logger ||= ::Logger.new(STDOUT)
25
+ end
26
+ return @@logger
23
27
  end
24
28
 
25
29
  end
@@ -0,0 +1,44 @@
1
+ desc "Task to execute builds on a Hudson Continuous Integration Server."
2
+ task :hudson do
3
+ Rake::Task["loggable:doc"].invoke
4
+ Rake::Task["loggable:rcov"].invoke
5
+ Rake::Task["loggable:test"].invoke
6
+ end
7
+
8
+ namespace :loggable do
9
+
10
+ require 'rake/testtask'
11
+ Rake::TestTask.new(:test) do |test|
12
+ test.libs << 'lib' << 'test'
13
+ test.pattern = 'test/**/*_test.rb'
14
+ test.verbose = true
15
+ end
16
+
17
+ # Use yard to build docs
18
+ begin
19
+ require 'yard'
20
+ require 'yard/rake/yardoc_task'
21
+ project_root = File.expand_path("#{File.dirname(__FILE__)}/../../")
22
+ doc_destination = File.join(project_root, 'doc')
23
+
24
+ YARD::Rake::YardocTask.new(:doc) do |yt|
25
+ yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
26
+ [ File.join(project_root, 'README.rdoc') ]
27
+ yt.options = ['--output-dir', doc_destination, '--readme', 'README.rdoc']
28
+ end
29
+ rescue LoadError
30
+ desc "Generate YARD Documentation"
31
+ task :doc do
32
+ abort "Please install the YARD gem to generate rdoc."
33
+ end
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+
38
+ desc "Create a cross-referenced code coverage report."
39
+ Rcov::RcovTask.new(:rcov) do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/**/*_test.rb']
42
+ t.rcov_opts << "--exclude \"gems/*\" --rails"
43
+ end
44
+ end
@@ -1,69 +1,60 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mediashelf-loggable}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Patrick Reagan", "Matt Zumwalt"]
12
- s.date = %q{2011-03-21}
12
+ s.date = %q{2011-07-25}
13
13
  s.description = %q{A gem that provides logging capabilities to any class. Relies on Rails logger if it's available. Extended from loggable gem by viget}
14
14
  s.email = %q{matt.zumwalt@yourmediashelf.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- "Gemfile",
20
- "Gemfile.lock",
21
- "History.txt",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "lib/loggable.rb",
26
- "lib/loggable/log_methods.rb",
27
- "lib/loggable/logger_stub.rb",
28
- "lib/loggable/version.rb",
29
- "loggable.gemspec",
30
- "mediashelf-loggable.gemspec",
31
- "test/examples/log_methods_test.rb",
32
- "test/examples/logger_stub_test.rb",
33
- "test/test_helper.rb"
19
+ ".gitignore",
20
+ ".rvmrc",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "History.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/loggable.rb",
28
+ "lib/loggable/log_methods.rb",
29
+ "lib/loggable/logger_stub.rb",
30
+ "lib/loggable/version.rb",
31
+ "lib/tasks/loggable.rake",
32
+ "loggable.gemspec",
33
+ "mediashelf-loggable.gemspec",
34
+ "test/examples/log_methods_test.rb",
35
+ "test/examples/logger_stub_test.rb",
36
+ "test/test_helper.rb"
34
37
  ]
35
38
  s.homepage = %q{http://github.com/mediashelf/mediashelf-loggable}
39
+ s.rdoc_options = ["--charset=UTF-8"]
36
40
  s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.3.7}
41
+ s.rubygems_version = %q{1.6.2}
38
42
  s.summary = %q{A gem that provides logging capabilities to any class}
39
43
  s.test_files = [
40
44
  "test/examples/log_methods_test.rb",
41
- "test/examples/logger_stub_test.rb",
42
- "test/test_helper.rb"
45
+ "test/examples/logger_stub_test.rb",
46
+ "test/test_helper.rb"
43
47
  ]
44
48
 
45
49
  if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
50
  s.specification_version = 3
48
51
 
49
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_development_dependency(%q<jeweler>, [">= 0"])
51
- s.add_development_dependency(%q<mocha>, [">= 0"])
52
- s.add_development_dependency(%q<jnunemaker-matchy>, [">= 0"])
53
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
54
53
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
55
54
  else
56
- s.add_dependency(%q<jeweler>, [">= 0"])
57
- s.add_dependency(%q<mocha>, [">= 0"])
58
- s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
59
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
60
55
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
61
56
  end
62
57
  else
63
- s.add_dependency(%q<jeweler>, [">= 0"])
64
- s.add_dependency(%q<mocha>, [">= 0"])
65
- s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
66
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
67
58
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
68
59
  end
69
60
  end
@@ -51,4 +51,27 @@ class LogMethodsTest < Test::Unit::TestCase
51
51
  end
52
52
 
53
53
  end
54
+
55
+ context "MyModule in Rails3" do
56
+ setup do
57
+ class ::Rails
58
+ def self.logger
59
+ return "I'm a Rails Logger."
60
+ end
61
+ end
62
+ end
63
+
64
+ teardown do
65
+ Object.send(:remove_const, :Rails)
66
+ end
67
+
68
+ should "use Rails logger" do
69
+ MyModule.logger = nil
70
+ MyModule.logger.should == Rails.logger
71
+ end
72
+ should "switch to using Rails logger even if a default logger was already defined" do
73
+ MyModule.logger = Logger.new(STDOUT)
74
+ MyModule.logger.should == Rails.logger
75
+ end
76
+ end
54
77
  end
@@ -3,5 +3,7 @@ require 'test/unit'
3
3
  require 'mocha'
4
4
  require 'shoulda'
5
5
  require 'matchy'
6
+ require "ruby-debug"
6
7
 
7
8
  require File.dirname(__FILE__) + '/../lib/loggable'
9
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediashelf-loggable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Reagan
@@ -16,70 +16,13 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-21 00:00:00 -07:00
19
+ date: 2011-07-25 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- type: :development
24
- prerelease: false
25
- name: jeweler
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
- type: :development
38
- prerelease: false
39
- name: mocha
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
49
- requirement: *id002
50
- - !ruby/object:Gem::Dependency
51
- type: :development
52
- prerelease: false
53
- name: jnunemaker-matchy
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
- requirement: *id003
64
- - !ruby/object:Gem::Dependency
65
- type: :development
66
- prerelease: false
67
23
  name: thoughtbot-shoulda
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- requirement: *id004
78
- - !ruby/object:Gem::Dependency
79
- type: :development
80
24
  prerelease: false
81
- name: thoughtbot-shoulda
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
25
+ requirement: &id001 !ruby/object:Gem::Requirement
83
26
  none: false
84
27
  requirements:
85
28
  - - ">="
@@ -88,7 +31,8 @@ dependencies:
88
31
  segments:
89
32
  - 0
90
33
  version: "0"
91
- requirement: *id005
34
+ type: :development
35
+ version_requirements: *id001
92
36
  description: A gem that provides logging capabilities to any class. Relies on Rails logger if it's available. Extended from loggable gem by viget
93
37
  email: matt.zumwalt@yourmediashelf.com
94
38
  executables: []
@@ -98,6 +42,8 @@ extensions: []
98
42
  extra_rdoc_files:
99
43
  - README.rdoc
100
44
  files:
45
+ - .gitignore
46
+ - .rvmrc
101
47
  - Gemfile
102
48
  - Gemfile.lock
103
49
  - History.txt
@@ -108,6 +54,7 @@ files:
108
54
  - lib/loggable/log_methods.rb
109
55
  - lib/loggable/logger_stub.rb
110
56
  - lib/loggable/version.rb
57
+ - lib/tasks/loggable.rake
111
58
  - loggable.gemspec
112
59
  - mediashelf-loggable.gemspec
113
60
  - test/examples/log_methods_test.rb
@@ -118,8 +65,8 @@ homepage: http://github.com/mediashelf/mediashelf-loggable
118
65
  licenses: []
119
66
 
120
67
  post_install_message:
121
- rdoc_options: []
122
-
68
+ rdoc_options:
69
+ - --charset=UTF-8
123
70
  require_paths:
124
71
  - lib
125
72
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -143,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
90
  requirements: []
144
91
 
145
92
  rubyforge_project:
146
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.6.2
147
94
  signing_key:
148
95
  specification_version: 3
149
96
  summary: A gem that provides logging capabilities to any class