Sha256: 2681d2cefc5e99c802cb93b6bca024b1a340e7da4e93582b032aca1fc9afb253

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

require "juicer"
require "juicer/install/base"
require "zip/zip"

module Juicer
  module Install
    #
    # Install and uninstall routines for the JSLint library by Douglas Crockford.
    # Installation downloads the jslintfull.js and rhino.js files and stores
    # them in the Juicer installation directory.
    #
    class JSLintInstaller < Base
      attr_reader :latest

      def initialize(install_dir = Juicer.home)
        super(install_dir)
        @latest = "1.0"
        @website = "http://www.jslint.com/"
        @path = "lib/jslint"
        @name = "JsLint"
        dependency :rhino
      end

      #
      # Install JSLint. Downloads the two js files and stores them in the
      # installation directory.
      #
      def install(version = nil)
        version = super(version)
        filename = download(File.join(@website, "rhino/jslint.js"))
        FileUtils.copy(filename, File.join(@install_dir, path, "bin", "jslint-#{version}.js"))
      end

      #
      # Uninstalls JSLint
      #
      def uninstall(version = nil)
        super(version) do |dir, version|
          File.delete(File.join(dir, "bin", "jslint-#{version}.js"))
        end
      end
    end

    #
    # This class makes it possible to do Juicer.install("jslint") instead of
    # Juicer.install("j_s_lint"). Sugar, sugar...
    #
    class JslintInstaller < JSLintInstaller
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
juicer-1.0.8 lib/juicer/install/jslint_installer.rb
juicer-1.0.7 lib/juicer/install/jslint_installer.rb
psyho_juicer-1.0.7 lib/juicer/install/jslint_installer.rb
juicer-1.0.6 lib/juicer/install/jslint_installer.rb
juicer-1.0.5 lib/juicer/install/jslint_installer.rb
juicer-1.0.4 lib/juicer/install/jslint_installer.rb
juicer-1.0.3 lib/juicer/install/jslint_installer.rb
juicer-1.0.2 lib/juicer/install/jslint_installer.rb
juicer-1.0.1 lib/juicer/install/jslint_installer.rb
psyho_juicer-1.0.0 lib/juicer/install/jslint_installer.rb
juicer-1.0.0 lib/juicer/install/jslint_installer.rb
ktheory-juicer-1.0.0.ktheory1 lib/juicer/install/jslint_installer.rb