Sha256: 6b273cf3eb7e7cc91944f343c3477a2ee681a6ac47534a2518a17cc88f184ebc

Contents?: true

Size: 982 Bytes

Versions: 11

Compression:

Stored size: 982 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 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

11 entries across 11 versions & 1 rubygems

Version Path
sprinkle-0.7.1.1 lib/sprinkle/installers/thor.rb
sprinkle-0.7.1 lib/sprinkle/installers/thor.rb
sprinkle-0.7 lib/sprinkle/installers/thor.rb
sprinkle-0.6.2 lib/sprinkle/installers/thor.rb
sprinkle-0.6.1.1 lib/sprinkle/installers/thor.rb
sprinkle-0.6.1 lib/sprinkle/installers/thor.rb
sprinkle-0.6.0 lib/sprinkle/installers/thor.rb
sprinkle-0.5.2 lib/sprinkle/installers/thor.rb
sprinkle-0.5.1.1 lib/sprinkle/installers/thor.rb
sprinkle-0.5.1 lib/sprinkle/installers/thor.rb
sprinkle-0.5.0 lib/sprinkle/installers/thor.rb