mattock 0.1.0 → 0.1.1
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/doc/Specifications +21 -21
- data/doc/coverage/index.html +296 -242
- data/lib/mattock/command-line.rb +11 -6
- data/lib/mattock/configurable.rb +4 -0
- data/lib/mattock/task.rb +1 -1
- data/spec_help/spec_helper.rb +0 -3
- metadata +4 -4
    
        data/lib/mattock/command-line.rb
    CHANGED
    
    | @@ -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  | 
| 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  | 
| 96 | 
            +
                  print command + " " if verbose
         | 
| 92 97 | 
             
                  result = self.class.execute(command)
         | 
| 93 | 
            -
                  print "=> #{result.exit_code}" if  | 
| 98 | 
            +
                  print "=> #{result.exit_code}" if verbose
         | 
| 94 99 | 
             
                  return result
         | 
| 95 100 | 
             
                ensure
         | 
| 96 | 
            -
                  puts if  | 
| 101 | 
            +
                  puts if verbose
         | 
| 97 102 | 
             
                end
         | 
| 98 103 |  | 
| 99 104 | 
             
                def succeeds?
         | 
    
        data/lib/mattock/configurable.rb
    CHANGED
    
    | @@ -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
    
    
    
        data/spec_help/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: mattock
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.1. | 
| 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 | 
| 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. | 
| 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:  | 
| 200 | 
            +
                  hash: 512343233
         | 
| 201 201 | 
             
                  segments: 
         | 
| 202 202 | 
             
                  - 0
         | 
| 203 203 | 
             
                  version: "0"
         |