mattock 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  module Mattock
2
2
  class CommandRunResult
3
- def initialize(status, streams)
3
+ def initialize(command, status, streams)
4
+ @command = command
4
5
  @process_status = status
5
6
  @streams = streams
6
7
  end
@@ -31,7 +32,7 @@ module Mattock
31
32
  when 0
32
33
  return exit_code
33
34
  else
34
- fail "Command '#{name}' failed with exit status #{$?.exitstatus}: \n"
35
+ fail "Command #{@command.inspect} failed with exit status #{$?.exitstatus}: \n#{streams.inspect}"
35
36
  end
36
37
  end
37
38
  end
@@ -46,6 +47,10 @@ module Mattock
46
47
 
47
48
  attr_accessor :name, :executable, :options
48
49
 
50
+ def verbose
51
+ Rake.verbose && Rake.verbose != Rake::FileUtilsExt::DEFAULT
52
+ end
53
+
49
54
  def name
50
55
  @name || executable
51
56
  end
@@ -82,18 +87,18 @@ module Mattock
82
87
  pipe = IO.popen(command)
83
88
  pid = pipe.pid
84
89
  pid, status = Process.wait2(pid)
85
- result = CommandRunResult.new(status, {1 => pipe.read})
90
+ result = CommandRunResult.new(command, status, {1 => pipe.read})
86
91
  pipe.close
87
92
  return result
88
93
  end
89
94
 
90
95
  def run
91
- print command + " " if $verbose
96
+ print command + " " if verbose
92
97
  result = self.class.execute(command)
93
- print "=> #{result.exit_code}" if $verbose
98
+ print "=> #{result.exit_code}" if verbose
94
99
  return result
95
100
  ensure
96
- puts if $verbose
101
+ puts if verbose
97
102
  end
98
103
 
99
104
  def succeeds?
@@ -83,6 +83,10 @@ module Mattock
83
83
  end
84
84
  alias required_field required_fields
85
85
 
86
+ # @macro [attack] configurable_property
87
+ # @method $1
88
+ # @return [$2] The default value of $1
89
+ # @method $1=
86
90
  def setting(name, default_value = RequiredField)
87
91
  name = name.to_sym
88
92
  attr_accessor(name)
data/lib/mattock/task.rb CHANGED
@@ -26,7 +26,7 @@ module Mattock
26
26
  end
27
27
 
28
28
  def define
29
- task =task_class.define_task(*task_args) do
29
+ task = task_class.define_task(*task_args) do
30
30
  action
31
31
  end
32
32
  copy_settings_to(task)
@@ -1,5 +1,2 @@
1
1
  require 'rspec'
2
2
  require 'file-sandbox'
3
- require 'mattock/testing/record-commands'
4
-
5
- Mattock::CommandLine.command_recording_path = "/dev/null"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mattock
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Judson Lester
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-28 00:00:00 Z
13
+ date: 2012-02-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: corundum
@@ -189,7 +189,7 @@ rdoc_options:
189
189
  - --main
190
190
  - doc/README
191
191
  - --title
192
- - mattock-0.1.0 RDoc
192
+ - mattock-0.1.1 RDoc
193
193
  require_paths:
194
194
  - lib/
195
195
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - ">="
199
199
  - !ruby/object:Gem::Version
200
- hash: 737860559
200
+ hash: 512343233
201
201
  segments:
202
202
  - 0
203
203
  version: "0"