Improved error reporting
This commit is contained in:
		
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
									
									
									
									
								
							@@ -5,29 +5,16 @@ HotFix; Quickly patch and fix system
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
    $ hotfix pastebin:1234abcd
 | 
			
		||||
    Downloading hotfix...
 | 
			
		||||
    Checking signature...
 | 
			
		||||
    Good signature from <bob@domain.com>
 | 
			
		||||
 | 
			
		||||
    Info:
 | 
			
		||||
    This hotfix will install this driver for you
 | 
			
		||||
 | 
			
		||||
    Do you want to proceed?
 | 
			
		||||
    Yes, No or Inspect [noi]: y
 | 
			
		||||
 | 
			
		||||
    $ hotfix apply pastebin:1234abcd
 | 
			
		||||
    $ hotfix apply gist:user/hash
 | 
			
		||||
    $ hotfix apply http://some.site/url.to.fix
 | 
			
		||||
 | 
			
		||||
### Applying local patches
 | 
			
		||||
 | 
			
		||||
    $ hotfix apply --unsigned test.hotfix
 | 
			
		||||
    Skipping signature check of test.hotfix
 | 
			
		||||
 | 
			
		||||
    Info:
 | 
			
		||||
    ...
 | 
			
		||||
    $ hotfix apply --insecure test.hotfix
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Signing
 | 
			
		||||
 | 
			
		||||
    $ hotfix sign -o test-signed.hotfix test.hotfix
 | 
			
		||||
    ...
 | 
			
		||||
    $ hotfix sign test.hotfix
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,10 @@ class ApplyCommand extends Command
 | 
			
		||||
            $output->writeln("<error>Error: ".$e->getMessage()."</error>");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!$hotfix) {
 | 
			
		||||
            $output->writeln("<error>Could not load hotfix</error>");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $output->writeln("");
 | 
			
		||||
        if (($signer = $hotfix->getSignedBy())) {
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,9 @@ class Hotfix
 | 
			
		||||
 | 
			
		||||
    protected function load($hotfix)
 | 
			
		||||
    {
 | 
			
		||||
        // echo $hotfix."\n\n";
 | 
			
		||||
        if (strpos($hotfix, "\n---\n")===false) {
 | 
			
		||||
            throw new \Exception("Hotfix is missing a proper header, is line endings wrong?");
 | 
			
		||||
        }
 | 
			
		||||
        list ($header, $body) = explode("\n---\n", $hotfix, 2);
 | 
			
		||||
        $header = Yaml::parse($header);
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ class Loader
 | 
			
		||||
            }
 | 
			
		||||
            return new Hotfix($body, $signer);
 | 
			
		||||
        }
 | 
			
		||||
        fprintf(STDERR, "Error: Couldn't load '%s'", $fix);
 | 
			
		||||
        fprintf(STDERR, "Error: Couldn't load '%s'\n", $fix);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function verifySignature($body, $signature)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,10 @@ class HttpLoader implements LoaderInterface
 | 
			
		||||
{
 | 
			
		||||
    public function load($fix)
 | 
			
		||||
    {
 | 
			
		||||
        if (preg_match("/^http[s]?:/", $fix)) {
 | 
			
		||||
            $body = file_get_contents($fix);
 | 
			
		||||
            return $body;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user