Sha256: b4baa8c2682df1cb8dd67a7d7f292d92b9f387ed6b976eeb49278ea76a2ba838

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 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 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.7.4 lib/sprinkle/installers/npm.rb