Sha256: cfda48ba6e897d9ca91dc199467d7faf0b83037a23d72ac30c9d7c808df47a95

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

module Sprinkle
  	module Installers
      # = Npm package Installed
      #
      # Installs an npm module
      # 
      # == Example Usage
      #
      #   package :magic_beans do
      #     npm 'grunt'
      #   end
      #
      #   verify { has_npm 'grunt' }
  		class Npm < Installer
        
  			attr_accessor :package_name
        
        api do
          def npm(package, &block)
            install Sprinkle::Installers::Npm.new(self, package, &block)
          end
        end
        
        verify_api do
          def has_npm(package)
            @commands << "npm --global list | grep \"#{package}@\""
          end
        end

  			def initialize(parent, package_name, &block) #:nodoc:
  				super parent, &block
  				@package_name = package_name
  			end

  			protected
  				def install_commands #:nodoc:
  					"npm install --global #{@package_name}"
  				end

  	end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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