Sha256: a0b5b2546e8ddac29fcc122816cf3c63c4948e028f03bdbbaaf81794eb2cf983

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

module Astrovan
  module Rake
    # Execute a rake task on the remote servers.
    #
    # Options:
    # * +rakefile+ - specify the path to a rakefile (if not in the default location)
    def rake(*tasks)
      options = tasks.last.is_a?(Hash) ? tasks.pop : {}
      rake = 'rake'
      rakefile = options.delete(:rakefile) || self.rakefile
      rake << ' -f ' << rakefile if rakefile
      exec "#{rake} #{tasks.join(' ')}", options
    end

    # Map one or more rake tasks to deployment methods.
    def surrogate(map)
      map.each do |method,task|
        raise ArgumentError, "Method <#{method}> already defined" if methods.include?(method.to_s)
        instance_eval "def #{method}; rake '#{task}'; end"
      end
    end
    alias_method :surrogates, :surrogate
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sbfaulkner-astrovan-0.5.0 lib/astrovan/rake.rb
sbfaulkner-astrovan-0.5.2 lib/astrovan/rake.rb
sbfaulkner-astrovan-0.5.3 lib/astrovan/rake.rb
sbfaulkner-astrovan-0.5.4 lib/astrovan/rake.rb