Sha256: 05aa55c67e848e2c3637821ff67fed90c684929196086292f1bb617c04550605

Contents?: true

Size: 826 Bytes

Versions: 5

Compression:

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

5 entries across 5 versions & 1 rubygems

Version Path
sprinkle-0.7.7 lib/sprinkle/installers/npm.rb
sprinkle-0.7.6.2 lib/sprinkle/installers/npm.rb
sprinkle-0.7.6.1 lib/sprinkle/installers/npm.rb
sprinkle-0.7.6 lib/sprinkle/installers/npm.rb
sprinkle-0.7.5 lib/sprinkle/installers/npm.rb