Sha256: 0f0ef4a1f0aafdca8c911cdcbeda4fefb29626f8307700bf92f3175ab6bd0d25

Contents?: true

Size: 1022 Bytes

Versions: 11

Compression:

Stored size: 1022 Bytes

Contents

module Sprinkle
  module Installers
    # = Script Installer
    #
    # The Script installer runs a script file to install software
    #
    # == Example Usage
    #
    #   package :magic_beans do
    #     script '/some/path/to/install/script/for/magic_beans'
    #   end
    class Script < Installer
      attr_accessor :script_file, :script_path #:nodoc:
      @@command_delimiter = (RUBY_PLATFORM =~ /win32/ ? ' & ' : '; ')

      def initialize(parent, name, options={}, &block) #:nodoc:
        super parent, options, &block
        @script_path, @script_file = File.split name
      end

      protected

        def install_commands #:nodoc:
          commands = []
          commands << "pushd \"#{@script_path}\"" if @script_path
          
          command = @script_file
          command << ' > NUL' if RUBY_PLATFORM =~ /win32/ and not logger.debug?
          commands << command

          commands << "popd" if @script_path

          commands.join(@@command_delimiter)
        end

      end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lachlan-sprinkle-0.0.10 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.11 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.13 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.14 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.15 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.16 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.5 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.6 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.7 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.8 lib/sprinkle/installers/script.rb
lachlan-sprinkle-0.0.9 lib/sprinkle/installers/script.rb