Sha256: c7fd5b5db154137b1142589dcb1856221bd00e80822f4a371cd36fdcb7b7289b

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

module Sprinkle
  module Installers
    # = Thor Installer
    #
    # This installer runs a thor command.
    # 
    # == Example Usage
    #
    # The following example runs the command "thor spec" on
    # the remote server.
    #
    #   package :spec do
    #     thor 'spec'
    #   end
    # 
    # Specify a Thorfile with the :thorfile option.
    #
    #   package :spec, :thorfile => "/var/setup/Thorfile" do
    #     thor 'spec'
    #   end
     
    class Thor < Installer
      
      api do
        def thor(name, options = {}, &block)
          install Sprinkle::Installers::Thor.new(self, name, options, &block)
        end  
      end
      
      def initialize(parent, commands, options = {}, &block) #:nodoc:
        super parent, options, &block
        @commands = commands
      end

      protected

        def install_commands #:nodoc:
          file = @options[:thorfile] ? "-f #{@options[:thorfile]} " : ""
          "thor #{file}#{@commands}"
        end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprinkle-0.5.0.rc1 lib/sprinkle/installers/thor.rb