color-logger 0.0.1 → 0.0.2

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.
@@ -0,0 +1,11 @@
1
+ 0.0.2
2
+ =====
3
+
4
+ * Descriptions for methods
5
+ * Readme
6
+ * Changelog
7
+ * Remove temporary products
8
+
9
+ 0.0.1
10
+ =====
11
+ Initial version
data/Manifest CHANGED
@@ -1,4 +1,6 @@
1
- README
1
+ CHANGELOG.markdown
2
+ Manifest
3
+ README.markdown
2
4
  Rakefile
5
+ color-logger.gemspec
3
6
  lib/color-logger.rb
4
- Manifest
data/README.markdown ADDED
@@ -0,0 +1,20 @@
1
+ Instalation
2
+ ===========
3
+ Include `gem 'color-logger'` to youre Gemfile and run `bundle`.
4
+
5
+ Usage
6
+ =====
7
+ Open Ruby console (`irb`) and try following:
8
+
9
+ require 'rubygems'
10
+ require 'color-logger'
11
+ {:foo => 'bar'}.cputs :baz
12
+ [1,'a',Time.now].cputs
13
+ Hash.new.clog
14
+ [{:hash => :test}].clog 'tag example'
15
+
16
+ Also `.cputs` = `.cdump` and `.clog` = `.cdebug` but for Rails default logger
17
+
18
+ If you like [Cucumber](http://cukes.info/), try run `rails console` under youre project dir and execute something like this
19
+
20
+ User.first.to_table
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('color-logger', '0.0.1') do |p|
5
+ Echoe.new('color-logger', '0.0.2') do |p|
6
6
  p.description = "Colorized ruby logger"
7
7
  p.url = "http://github.com/hoblin/color-logger"
8
8
  p.author = "Evgeny Gurin"
data/color-logger.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{color-logger}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evgeny Gurin"]
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
10
10
  s.date = %q{2010-10-22}
11
11
  s.description = %q{Colorized ruby logger}
12
12
  s.email = %q{evgeny.gurin@gmail.com}
13
- s.extra_rdoc_files = ["README", "lib/color-logger.rb"]
14
- s.files = ["README", "Rakefile", "lib/color-logger.rb", "Manifest", "color-logger.gemspec"]
13
+ s.extra_rdoc_files = ["CHANGELOG.markdown", "README.markdown", "lib/color-logger.rb"]
14
+ s.files = ["CHANGELOG.markdown", "Manifest", "README.markdown", "Rakefile", "color-logger.gemspec", "lib/color-logger.rb"]
15
15
  s.homepage = %q{http://github.com/hoblin/color-logger}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Color-logger", "--main", "README"]
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Color-logger", "--main", "README.markdown"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{color-logger}
19
19
  s.rubygems_version = %q{1.3.7}
data/lib/color-logger.rb CHANGED
@@ -1,32 +1,20 @@
1
+ # Colorized Ruby logger
2
+ #
3
+ # Author:: Evgeny Gurin (mailto:evgeny.gurin@gmail.com)
4
+ #
5
+
1
6
  class Object
7
+ # Show object with default Rails logger
2
8
  def cdebug(tag=nil)
3
9
  RAILS_DEFAULT_LOGGER.info "\n\033[1;33;44m#{tag}\033[1;32;40m#{self.class} \033[0;30;47m#{self.inspect}\033[0m"
4
10
  end
11
+
12
+ # Show object with console
5
13
  def clog(tag=nil)
6
14
  puts "\n\033[1;33;44m#{tag}\033[1;32;40m#{self.class} \033[0;30;47m#{self.inspect}\033[0m"
7
15
  end
8
- def prepare_dump(tag=nil)
9
- @c_d_stack = []
10
- @c_d_stack << "\n\033[1;33;44m#{tag}\033[1;32;44m #{self.class}\033[0m\n"
11
- if self.class == Class
12
- @c_d_stack << "\033[1;34;47mMethods\033[0m\n"
13
- self.methods.sort.each{|m|@c_d_stack << "\t\033[1;36;40m#{m}\033[0m\n"}
14
- end
15
- if self.methods.include?('each_key')
16
- @c_d_stack << "\033[1;34;47mPairs\033[0m\n"
17
- self.each_key{|k|@c_d_stack << "\t\033[0;32;40m#{k} => \t\t\033[0;37;40m#{self[k].inspect}\033[0m\n"}
18
- end
19
- if self.methods.include?('each_index')
20
- @c_d_stack << "\033[1;34;47mValues\033[0m\n"
21
- self.each_index{|k|@c_d_stack << "\t\033[0;32;40m#{k}:\t\t\033[0;37;40m#{self[k].inspect}\033[0m\n"}
22
- end
23
- if self.methods.include?('attributes')
24
- @c_d_stack << "\033[1;34;47mAttributes\033[0m\n"
25
- self.attribute_names.sort.each{|a|@c_d_stack << "\t\033[0;35;40m#{a}:\t\t\033[0;37;40m#{self.send(a).inspect}\033[0m\n"}
26
- end
27
- @c_d_stack
28
- end
29
16
 
17
+ # Show object as Cucumber table with console
30
18
  def to_table
31
19
  table = [[],[]]
32
20
  self.attribute_names.sort.each do |name|
@@ -39,14 +27,40 @@ class Object
39
27
  puts '| '+table[1].join(' | ')+' |'
40
28
  end
41
29
 
30
+ # Show object dump with default Rails logger
42
31
  def cdump(tag=nil)
43
32
  RAILS_DEFAULT_LOGGER.info self.prepare_dump(tag).join("\n")
44
33
  @c_d_stack = []
45
34
  end
46
35
 
36
+ # Show object dump with console
47
37
  def cputs(tag=nil)
48
38
  puts self.prepare_dump(tag).join(' ')
49
39
  @c_d_stack = []
50
40
  nil
51
41
  end
42
+
43
+ private
44
+
45
+ def prepare_dump(tag=nil)
46
+ @c_d_stack = []
47
+ @c_d_stack << "\n\033[1;33;44m#{tag}\033[1;32;44m #{self.class}\033[0m\n"
48
+ if self.class == Class
49
+ @c_d_stack << "\033[1;34;47mMethods\033[0m\n"
50
+ self.methods.sort.each{|m|@c_d_stack << "\t\033[1;36;40m#{m}\033[0m\n"}
51
+ end
52
+ if self.methods.include?('each_key')
53
+ @c_d_stack << "\033[1;34;47mPairs\033[0m\n"
54
+ self.each_key{|k|@c_d_stack << "\t\033[0;32;40m#{k} => \t\t\033[0;37;40m#{self[k].inspect}\033[0m\n"}
55
+ end
56
+ if self.methods.include?('each_index')
57
+ @c_d_stack << "\033[1;34;47mValues\033[0m\n"
58
+ self.each_index{|k|@c_d_stack << "\t\033[0;32;40m#{k}:\t\t\033[0;37;40m#{self[k].inspect}\033[0m\n"}
59
+ end
60
+ if self.methods.include?('attributes')
61
+ @c_d_stack << "\033[1;34;47mAttributes\033[0m\n"
62
+ self.attribute_names.sort.each{|a|@c_d_stack << "\t\033[0;35;40m#{a}:\t\t\033[0;37;40m#{self.send(a).inspect}\033[0m\n"}
63
+ end
64
+ @c_d_stack
65
+ end
52
66
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: color-logger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evgeny Gurin
@@ -47,14 +47,16 @@ executables: []
47
47
  extensions: []
48
48
 
49
49
  extra_rdoc_files:
50
- - README
50
+ - CHANGELOG.markdown
51
+ - README.markdown
51
52
  - lib/color-logger.rb
52
53
  files:
53
- - README
54
- - Rakefile
55
- - lib/color-logger.rb
54
+ - CHANGELOG.markdown
56
55
  - Manifest
56
+ - README.markdown
57
+ - Rakefile
57
58
  - color-logger.gemspec
59
+ - lib/color-logger.rb
58
60
  has_rdoc: true
59
61
  homepage: http://github.com/hoblin/color-logger
60
62
  licenses: []
@@ -66,7 +68,7 @@ rdoc_options:
66
68
  - --title
67
69
  - Color-logger
68
70
  - --main
69
- - README
71
+ - README.markdown
70
72
  require_paths:
71
73
  - lib
72
74
  required_ruby_version: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1 +0,0 @@
1
- may be later =)