Sha256: caa4c2bd74ef682bb10ae13e3d5b6b10d52db3e00ca1fdabf4e6fef02e81269d

Contents?: true

Size: 820 Bytes

Versions: 3

Compression:

Stored size: 820 Bytes

Contents

require 'pushapp/config'
require 'pushapp/logger'

module Pushapp
  module Tasks
    class Base
      attr_reader :options
      attr_reader :logger

      def initialize options={}
        @options = options
        @logger = Pushapp::Logger.new
      end

      def run
      end

      def env
        Hash[env_options.map {|k, v| [k.to_s, v.to_s] }]
      end

      def env_options
        options[:env] || {}
      end

      def sudo
        options[:sudo] || 'sudo'
      end

      def system cmd
        Pipe.run cmd
      end

      def app_name_from_path
        options[:remote].path ? options[:remote].path.split('/').last : nil
      end

      def self.register_as name
        Pushapp::Config.register_task name, self
      end

      def inspect
        options[:task_name]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pushapp-0.0.4 lib/pushapp/tasks/base.rb
pushapp-0.0.3 lib/pushapp/tasks/base.rb
pushapp-0.0.2 lib/pushapp/tasks/base.rb