ccp 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ccp.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'logger'
1
2
  require "typed"
2
3
  require "pathname"
3
4
  require "dsl_accessor"
@@ -1,5 +1,3 @@
1
- require 'logger'
2
-
3
1
  module Ccp
4
2
  module Invokers
5
3
  class Base
@@ -15,7 +13,7 @@ module Ccp
15
13
 
16
14
  profile false
17
15
  comment true
18
- logger Logger.new($stderr)
16
+ logger Logger.new(STDOUT)
19
17
 
20
18
  ######################################################################
21
19
  ### Class Methods
@@ -2,6 +2,7 @@ module Ccp
2
2
  module Receivers
3
3
  autoload :Core , 'ccp/receivers/core'
4
4
  autoload :Base , 'ccp/receivers/base'
5
+ autoload :Loggable , 'ccp/receivers/loggable'
5
6
  autoload :Global , 'ccp/receivers/global'
6
7
  autoload :Settings , 'ccp/receivers/settings'
7
8
  autoload :Variables , 'ccp/receivers/variables'
@@ -2,6 +2,7 @@ module Ccp
2
2
  module Receivers
3
3
  class Base
4
4
  include Core
5
+ include Loggable
5
6
  include Settings
6
7
  include Variables
7
8
  include Commentable
@@ -24,10 +24,8 @@ module Ccp
24
24
  end
25
25
 
26
26
  def show_comments(*args)
27
- opts = Optionize.new(args, :output)
28
- output = opts[:output] || $stderr
29
27
  comments.each_value do |comment|
30
- output.puts comment.colorized
28
+ logger.info comment.colorized
31
29
  end
32
30
  end
33
31
  end
@@ -0,0 +1,14 @@
1
+ module Ccp
2
+ module Receivers
3
+ module Loggable
4
+ def logger
5
+ @logger ||= data?(:logger) ? data[:logger] : (data[:logger] = build_logger)
6
+ end
7
+
8
+ private
9
+ def build_logger
10
+ Logger.new(STDOUT)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -31,9 +31,8 @@ module Ccp
31
31
  end
32
32
 
33
33
  def show_profiles(*args, &block)
34
- opts = Optionize.new(args, :benchs, :output)
34
+ opts = Optionize.new(args, :benchs)
35
35
  benchs = opts[:benchs] || profiles
36
- output = opts[:output] || $stderr
37
36
 
38
37
  # search worst item
39
38
  total = 0
@@ -49,7 +48,7 @@ module Ccp
49
48
  if block
50
49
  block.call(profiled)
51
50
  else
52
- output.puts profiled
51
+ logger.info profiled
53
52
  end
54
53
  end
55
54
  end
@@ -16,8 +16,7 @@ module Ccp
16
16
  end
17
17
 
18
18
  def notify_skip(cmd)
19
- @logger ||= data.set?(:logger) ? data[:logger] : Logger.new(STDOUT)
20
- @logger.debug Utils::Colorize.pink("[SKIP] #{cmd.class}")
19
+ logger.debug Utils::Colorize.pink("[SKIP] #{cmd.class}")
21
20
  end
22
21
  end
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module Ccp
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ccp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-26 00:00:00.000000000 Z
12
+ date: 2014-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -246,6 +246,7 @@ files:
246
246
  - lib/ccp/receivers/executable.rb
247
247
  - lib/ccp/receivers/fixtures.rb
248
248
  - lib/ccp/receivers/global.rb
249
+ - lib/ccp/receivers/loggable.rb
249
250
  - lib/ccp/receivers/none.rb
250
251
  - lib/ccp/receivers/profileable.rb
251
252
  - lib/ccp/receivers/settings.rb