Sha256: c941f4cae9e41f5d5c1646dcf87484dbfab4d496c3a2bf158c849597c486ebb5

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

require 'open-uri'
require 'fileutils'

module Infect
  class Command
    include Infect::Colorize

    def self.build(command, arg ,opts)
      case command.to_sym
      when :bundle
        Bundle.new(arg, opts)
      else
        $stderr.puts "WARNING: #{command} is not a valid command, ignorning"
      end
    end

    protected

    def mkdir(path)
      expanded_path = File.expand_path(path)
      unless File.directory?(expanded_path)
        notice "Making dir #{path}"
        FileUtils.mkdir_p(expanded_path)
      end
    end

    def chdir(path)
      Dir.chdir(path)
    end

    def download(url, path)
      File.open(File.expand_path(path), "w") do |file|
        open(url) do |read_file|
          file.write(read_file.read)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
infect-0.0.5 lib/infect/command.rb