Sha256: be620a392817b071d93420c9e7fa2ee444e74a8e582922c0bfac4ebbc5917cfe

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

module Infect
  class Command
    class Bundle < Command
      attr_reader :bundle, :name, :location
      def initialize(args)
        @bundle = args[0]
        @name = File.basename(bundle)
        @location = File.expand_path("#{BUNDLE_DIR}/#{name}")
      end

      def url
        "git@github.com:#{bundle}.git"
      end

      def install
        notice "Installing #{name}... "
        mkdir BUNDLE_DIR
        chdir BUNDLE_DIR
        git "clone '#{url}'"
      end

      def update
        notice "Updating #{name}... "
        chdir @location
        git "pull"
      end

      def call
        if File.exists? @location
          update
        else
          install
        end
      end

      private

      def git(args)
        `git #{args}`
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
infect-0.0.4 lib/infect/command/bundle.rb
infect-0.0.3 lib/infect/command/bundle.rb