cobalt 0.0.1 → 0.1.0
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.
- data/README.rdoc +45 -11
- data/VERSION +1 -1
- data/cobalt.gemspec +51 -0
- data/lib/cobalt.rb +6 -22
- metadata +9 -10
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -1,16 +1,50 @@
|
|
1
1
|
= cobalt
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
==
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
Console for ruby is: Colored, Nesting, Multiple, Smart logging management.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
$ gem install cobalt
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
[http://github.com/ktlacaelel/cobalt/wiki/example.png]
|
11
|
+
Try it yourself!
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'cobalt'
|
15
|
+
|
16
|
+
stdout = Logger.new(STDOUT) # log to std out, and but dont prefix with anything!
|
17
|
+
stdout.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
|
18
|
+
|
19
|
+
console = Cobalt::Console.new :loggers => [stdout]
|
20
|
+
|
21
|
+
console.space
|
22
|
+
console.log 'Initializing Console sample..'
|
23
|
+
console.separator '-'
|
24
|
+
console.indent
|
25
|
+
console.notice 'notice'
|
26
|
+
console.warn 'warn'
|
27
|
+
console.error 'error'
|
28
|
+
console.outdent
|
29
|
+
|
30
|
+
console.space
|
31
|
+
console.log 'Remember the color, for a few lines..'
|
32
|
+
console.separator '='
|
33
|
+
console.color(:pink) do
|
34
|
+
console.log 'all this'
|
35
|
+
console.log 'will be'
|
36
|
+
console.log 'colored pink'
|
37
|
+
end
|
38
|
+
|
39
|
+
console.space
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
== Contributors
|
44
|
+
|
45
|
+
* Fernando Trasviña
|
46
|
+
* Pablo Antonio Gonzalez Cervantes
|
47
|
+
* Kazuyoshi Tlacaelel
|
14
48
|
|
15
49
|
== Copyright
|
16
50
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/cobalt.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cobalt}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Fernando Trasvi\303\261a", "Pablo Antonio Gonzalez Cervantes", "kazuyoshi tlacaelel"]
|
12
|
+
s.date = %q{2012-04-03}
|
13
|
+
s.description = %q{Colored, Nesting, Multiple logging management.}
|
14
|
+
s.email = %q{kazu.dev@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"cobalt.gemspec",
|
26
|
+
"lib/cobalt.rb",
|
27
|
+
"test/helper.rb",
|
28
|
+
"test/test_cobalt.rb"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/ktlacaelel/cobalt}
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
s.rubygems_version = %q{1.3.7}
|
33
|
+
s.summary = %q{Console for ruby.}
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
41
|
+
s.add_development_dependency(%q<isna>, [">= 0"])
|
42
|
+
else
|
43
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
44
|
+
s.add_dependency(%q<isna>, [">= 0"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
|
+
s.add_dependency(%q<isna>, [">= 0"])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/lib/cobalt.rb
CHANGED
@@ -6,13 +6,11 @@ module Cobalt
|
|
6
6
|
|
7
7
|
class Console
|
8
8
|
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :separator_length
|
10
10
|
|
11
11
|
def initialize( options = {} )
|
12
12
|
@indent = 0
|
13
13
|
@loggers = options[:loggers] || [::Logger.new(STDOUT)]
|
14
|
-
@keep_in_buffer = false
|
15
|
-
@temporal_buffer = []
|
16
14
|
@separator_length = 120
|
17
15
|
@color = :white
|
18
16
|
end
|
@@ -25,30 +23,12 @@ module Cobalt
|
|
25
23
|
@loggers = @loggers - [logger]
|
26
24
|
end
|
27
25
|
|
28
|
-
def release_buffer
|
29
|
-
@keep_in_buffer = false
|
30
|
-
@temporal_buffer.each do |line|
|
31
|
-
@loggers.each { |logger| logger.info(line) }
|
32
|
-
end
|
33
|
-
@temporal_buffer = []
|
34
|
-
nil
|
35
|
-
end
|
36
|
-
|
37
26
|
def log(*objects)
|
38
27
|
objects.each do |object|
|
39
|
-
|
40
28
|
the_string = object.to_s
|
41
29
|
the_string = the_string.to_ansi.send(@color).to_s
|
42
30
|
the_string = the_string.gsub(/^/, ' ' * @indent)
|
43
|
-
|
44
|
-
@loggers.each do |logger|
|
45
|
-
if @keep_in_buffer
|
46
|
-
@temporal_buffer << the_string
|
47
|
-
next
|
48
|
-
end
|
49
|
-
logger.info the_string
|
50
|
-
end
|
51
|
-
|
31
|
+
@loggers.each { |logger| logger.info(the_string) }
|
52
32
|
end
|
53
33
|
self
|
54
34
|
end
|
@@ -63,6 +43,10 @@ module Cobalt
|
|
63
43
|
log(dump)
|
64
44
|
end
|
65
45
|
|
46
|
+
def info(*objects)
|
47
|
+
notice(*objects)
|
48
|
+
end
|
49
|
+
|
66
50
|
def notice(*objects)
|
67
51
|
color(:cyan) { log(*objects) }
|
68
52
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobalt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Fernando Trasvi\xC3\xB1a"
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-03
|
20
|
+
date: 2012-04-03 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -59,11 +59,11 @@ extra_rdoc_files:
|
|
59
59
|
- README.rdoc
|
60
60
|
files:
|
61
61
|
- .document
|
62
|
-
- .gitignore
|
63
62
|
- LICENSE
|
64
63
|
- README.rdoc
|
65
64
|
- Rakefile
|
66
65
|
- VERSION
|
66
|
+
- cobalt.gemspec
|
67
67
|
- lib/cobalt.rb
|
68
68
|
- test/helper.rb
|
69
69
|
- test/test_cobalt.rb
|
@@ -72,8 +72,8 @@ homepage: http://github.com/ktlacaelel/cobalt
|
|
72
72
|
licenses: []
|
73
73
|
|
74
74
|
post_install_message:
|
75
|
-
rdoc_options:
|
76
|
-
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
77
|
require_paths:
|
78
78
|
- lib
|
79
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -101,6 +101,5 @@ rubygems_version: 1.3.7
|
|
101
101
|
signing_key:
|
102
102
|
specification_version: 3
|
103
103
|
summary: Console for ruby.
|
104
|
-
test_files:
|
105
|
-
|
106
|
-
- test/test_cobalt.rb
|
104
|
+
test_files: []
|
105
|
+
|