Class: TTK::Strategies::Checkout
- Includes:
- Concrete
- Defined in:
- lib/ttk/strategies/Checkout.rb
Instance Attribute Summary
Attributes inherited from Strategy
Instance Method Summary collapse
Methods inherited from Strategy
#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #strategy, #strategy=, #symbols=, #testify, #timeout=, #to_s, #wclass=
Constructor Details
This class inherits a constructor from TTK::Strategies::Strategy
Instance Method Details
#prologue ⇒ Object
17 18 19 20 |
# File 'lib/ttk/strategies/Checkout.rb', line 17 def prologue super @url = URI.parse(@url) unless @url.is_a? URI end |
#run_impl ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ttk/strategies/Checkout.rb', line 22 def run_impl begin file, out, err = @url.checkout @log.my_stdout = out.read unless out.nil? or out.size.zero? @log.my_stderr = err.read unless err.nil? or err.size.zero? file = FileType.guess(file) if file.is_a? FileType::Directory @symtbl[:checkout_dir] = file.path @symtbl[:extract_dir] = file.path pass end unless file.is_a? FileType::Extractable fail("Bad file type #{file}:#{file.class}, not extractable") end path = file.extract fail("cannot extract #{file} returned path is nil") if path.nil? @symtbl[:checkout_dir] = path @symtbl[:extract_dir] = path rescue FileType::ExtractError => ex fail(ex) rescue URI::CheckoutError => ex fail(ex) end pass end |