Sha256: 56b8038ec3b3b5b9fa49ee97fd633b68c78aba8b9ac406dcabe2f6c6ebdf0a01

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

# Author::    Marco Tessari  <marco.tessari@epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: Extract.rb 567 2005-04-13 08:00:06Z polrop $


require 'filetype'

module TTK

  module Strategies

    # I'm deprecated, use Checkout instead.
    class Extract < Strategy
      include Concrete

      def run_impl
        if @file.is_a? String
          @file = FileType.guess(@file)
          if @file.is_a? FileType::Directory
            @symtbl[:extract_dir] = @file.path
            skip
          end
          unless @file.is_a? FileType::Extractable
            fail("Bad file type #@file:#{@file.class}, not extractable")
          end
        end
        path = nil
        begin
          path = @file.extract
        rescue FileType::ExtractError => ex
          fail(ex)
        end
        fail("cannot extract #@file returned path is nil") if path.nil?
        @symtbl[:extract_dir] = path
        pass
      end

      attribute :file, 'path to the tarball', :mandatory

    end # class Extract

  end # module Strategies

end # module TTK

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/Extract.rb
ttk-0.1.580 lib/ttk/strategies/Extract.rb
ttk-0.1.579 lib/ttk/strategies/Extract.rb
ttk-0.2.0 lib/ttk/strategies/Extract.rb
ttk-0.2.1 lib/ttk/strategies/Extract.rb