Loading ...
Sorry, an error occurred while loading the content.

goodpart:true with ruby

Expand Messages
  • walfisch_in_the_sea
    Hi, I use JSLint with Rhino. And as the goodparts sometimes change, I wrote a short rubyscript to update the options-string. Is there another way to get the
    Message 1 of 1 , Oct 31, 2009
    • 0 Attachment
      Hi,
      I use JSLint with Rhino. And as the goodparts sometimes change, I wrote a short rubyscript to update the options-string. Is there another way to get the most recent goodparts?

      (click on "Show Message Option" on the right, to change the font to monospace)
      The script:


      #!/usr/bin/env ruby

      require "net/http"

      r = []
      Net::HTTP.get("www.jslint.com", "/").
      scan(/<input[^>]*id="JSLINT_[^>]*>/i).
      each do |option|
      if /title=/i === option
      #option with boolean
      r.push([option.gsub(/<[^>]*title="(\w*)".*/, '\1'),
      (/name=goodpart/ === option).to_s].join(":"))
      elsif /value="\d+"/ === option
      #option with number
      r.push(option.gsub(/<[^>]*JSLINT_(\w*)[^>]*value="(\d*)"[^>]*>/,
      '\1:\2'))
      end
      end

      p "/*jslint " + r.join(", ").downcase + " */"





      #creates this:
      #/*jslint passfail:false, white:true, onevar:true, browser:false, widget:false, sidebar:false, rhino:false, safe:false, adsafe:false, debug:false, evil:false, laxbreak:false, forin:false, sub:false, css:false, cap:false, on:false, fragment:false, undef:true, nomen:true, eqeqeq:true, plusplus:true, bitwise:true, regexp:true, strict:true, newcap:true, immed:true, indent:4, maxerr:50 */
    Your message has been successfully submitted and would be delivered to recipients shortly.