cap-util 0.1.2 → 0.2.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/lib/cap-util/run.rb CHANGED
@@ -5,9 +5,9 @@ module CapUtil
5
5
  def self.run_locally(cmd_str)
6
6
  cmd = Scmd.new(cmd_str)
7
7
 
8
- log "running `#{cmd}'"
8
+ say " * running `#{cmd}'"
9
9
  cmd.run
10
- log_error(cmd.stderr) if !cmd.success?
10
+ say_error(cmd.stderr) if !cmd.success?
11
11
 
12
12
  cmd
13
13
  end
@@ -15,9 +15,9 @@ module CapUtil
15
15
  def self.run_locally_with_stdin(cmd_str, input)
16
16
  cmd = Scmd.new(cmd_str)
17
17
 
18
- log "running `#{cmd}'"
18
+ say " * running `#{cmd}'"
19
19
  cmd.run(input)
20
- log_error(cmd.stderr) if !cmd.success?
20
+ say_error(cmd.stderr) if !cmd.success?
21
21
 
22
22
  cmd
23
23
  end
data/lib/cap-util/say.rb CHANGED
@@ -7,19 +7,15 @@ module CapUtil
7
7
  end
8
8
 
9
9
  def self.say(msg, *args)
10
- Capistrano::CLI.ui.say(" #{msg}", *args)
10
+ Capistrano::CLI.ui.say(msg, *args)
11
11
  end
12
12
 
13
- def self.log(msg, *args)
14
- say("* #{msg}", *args)
13
+ def self.say_error(msg, *args)
14
+ say(" #{color "[ERROR]", :bold, :red} #{msg}", *args)
15
15
  end
16
16
 
17
- def self.log_error(msg, *args)
18
- say(" #{color "[ERROR]", :bold, :red} #{msg}", *args)
19
- end
20
-
21
- def self.log_warning(msg, *args)
22
- say(" #{color "[WARN]", :bold, :yellow} #{msg}", *args)
17
+ def self.say_warning(msg, *args)
18
+ say(" #{color "[WARN]", :bold, :yellow} #{msg}", *args)
23
19
  end
24
20
 
25
21
  module Say
@@ -32,9 +28,8 @@ module CapUtil
32
28
  module SayMethods
33
29
  def color(*args); CapUtil.color(*args); end
34
30
  def say(*args); CapUtil.say(*args); end
35
- def log(*args); CapUtil.log(*args); end
36
- def log_error(*args); CapUtil.log_error(*args); end
37
- def log_warning(*args); CapUtil.log_warning(*args); end
31
+ def say_error(*args); CapUtil.say_error(*args); end
32
+ def say_warning(*args); CapUtil.say_warning(*args); end
38
33
  end
39
34
 
40
35
  end
data/lib/cap-util/time.rb CHANGED
@@ -3,7 +3,7 @@ require 'cap-util/timer'
3
3
  module CapUtil
4
4
 
5
5
  def self.time(timer_set, name, &block)
6
- timer_set[name] = CapUtil::Timer.new(name)
6
+ timer_set[name] ||= CapUtil::Timer.new(name)
7
7
  if !block.nil?
8
8
  begin
9
9
  timer_set[name].start
@@ -1,3 +1,3 @@
1
1
  module CapUtil
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -10,7 +10,7 @@ module CapUtil
10
10
  subject { @mod }
11
11
 
12
12
  should have_imeth :halt, :time
13
- should have_imeths :color, :say, :log, :log_error, :log_warning
13
+ should have_imeths :color, :say, :say_error, :say_warning
14
14
  should have_imeths :run_locally, :run_locally_with_stdin
15
15
 
16
16
  end
@@ -35,8 +35,8 @@ module CapUtil
35
35
  should have_cmeth :halt
36
36
  should have_imeth :halt
37
37
 
38
- should have_cmeths :color, :say, :log, :log_error, :log_warning
39
- should have_imeths :color, :say, :log, :log_error, :log_warning
38
+ should have_cmeths :color, :say, :say_error, :say_warning
39
+ should have_imeths :color, :say, :say_error, :say_warning
40
40
 
41
41
  should have_cmeths :run_locally, :run_locally_with_stdin
42
42
  should have_imeths :run_locally, :run_locally_with_stdin
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-util
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding