Class: Juicer::Install::JSLintInstaller
- Defined in:
- lib/juicer/install/jslint_installer.rb
Overview
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.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#latest ⇒ Object
readonly
Returns the value of attribute latest.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(install_dir = Juicer.home) ⇒ JSLintInstaller
constructor
A new instance of JSLintInstaller.
-
#install(version = nil) ⇒ Object
Install JSLint.
-
#uninstall(version = nil) ⇒ Object
Uninstalls JSLint.
Methods inherited from Base
#bin_path, #dependencies, #dependency, #download, #installed?, #log, #name, #path
Constructor Details
#initialize(install_dir = Juicer.home) ⇒ JSLintInstaller
Returns a new instance of JSLintInstaller.
15 16 17 18 19 20 21 22 |
# File 'lib/juicer/install/jslint_installer.rb', line 15 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 |
Instance Attribute Details
#latest ⇒ Object (readonly)
Returns the value of attribute latest.
13 14 15 |
# File 'lib/juicer/install/jslint_installer.rb', line 13 def latest @latest end |
Instance Method Details
#install(version = nil) ⇒ Object
Install JSLint. Downloads the two js files and stores them in the installation directory.
28 29 30 31 32 33 34 35 |
# File 'lib/juicer/install/jslint_installer.rb', line 28 def install(version = nil) version = super(version) #filename = download(File.join(@website, "rhino/jslint.js")) # TEMP fix, Crockford took down the Rhino version, bundle for now filename = File.join(File.(File.dirname(__FILE__)), "../../jslint/jslint-rhino.js") FileUtils.copy(filename, File.join(@install_dir, path, "bin", "jslint-#{version}.js")) end |
#uninstall(version = nil) ⇒ Object
Uninstalls JSLint
40 41 42 43 44 |
# File 'lib/juicer/install/jslint_installer.rb', line 40 def uninstall(version = nil) super(version) do |dir, version| File.delete(File.join(dir, "bin", "jslint-#{version}.js")) end end |