Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add jshint task #357

Closed
wants to merge 2 commits into from

3 participants

stereobooster Mark Hayes Matt Kelly
stereobooster

It's just suggestion. If you use ruby anyway, why not use rake

Matt Kelly mkelly12 was assigned
Mark Hayes mhayes was assigned
Mark Hayes

Closing this, although as we get closer to Foundation 4 we may look into adding js lint validation.

Mark Hayes mhayes closed this
Mark Hayes mhayes was unassigned by stereobooster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2012
  1. stereobooster

    add jshint task

    stereobooster authored
Commits on Mar 26, 2012
  1. stereobooster
This page is out of date. Refresh to see the latest.
Showing with 185 additions and 42 deletions.
  1. +7 −0 Gemfile
  2. +35 −0 Gemfile.lock
  3. +97 −0 Rakefile
  4. +0 −42 build.rb
  5. +46 −0 config/mime.type
7 Gemfile
View
@@ -1,3 +1,10 @@
source :rubygems
gem "jammit", "~> 0.6.5"
+gem "rake"
+gem "jshintrb", ">= 0.1.1"
+
+group :websrver do
+ gem "puma"
+ gem "rack-contrib"
+end
35 Gemfile.lock
View
@@ -0,0 +1,35 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ POpen4 (0.1.4)
+ Platform (>= 0.4.0)
+ open4
+ Platform (0.4.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ jammit (0.6.5)
+ yui-compressor (>= 0.9.3)
+ jshintrb (0.1.1)
+ execjs
+ multi_json
+ rake
+ multi_json (1.1.0)
+ open4 (1.3.0)
+ puma (0.9.5)
+ rack (>= 1.2, < 2.0)
+ rack (1.4.1)
+ rack-contrib (1.1.0)
+ rack (>= 0.9.1)
+ rake (0.9.2.2)
+ yui-compressor (0.9.6)
+ POpen4 (>= 0.1.4)
+
+PLATFORMS
+ x86-mingw32
+
+DEPENDENCIES
+ jammit (~> 0.6.5)
+ jshintrb (>= 0.1.1)
+ puma
+ rack-contrib
+ rake
97 Rakefile
View
@@ -0,0 +1,97 @@
+#!/usr/bin/env ruby
+
+VERSION_STRING = '2.1.5'
+
+require 'bundler'
+Bundler.setup :default
+
+def prepend_text(file_name, text)
+ `exec 3<> '#{file_name}' && awk -v TEXT="#{text}" 'BEGIN {print TEXT}{print}' '#{file_name}' >&3`
+end
+
+desc "Creates a zip file of the Foundation template and the compressed assets"
+task :build do
+ `rm -rf public marketing/files/foundation-download.zip`
+ `bundle exec jammit`
+ `mkdir public/src public/src/javascripts public/src/stylesheets`
+ `cp -R humans.txt images index.html robots.txt public/src`
+ `cp public/assets/foundation.js public/src/javascripts`
+ `cp stylesheets/ie.css public/src/stylesheets/ie.css`
+ `cp stylesheets/app.css public/src/stylesheets/app.css`
+ `cp javascripts/app.js public/src/javascripts/app.js`
+ `cp javascripts/modernizr.foundation.js public/src/javascripts/modernizr.foundation.js`
+ `cp javascripts/jquery.min.js public/src/javascripts/jquery.min.js`
+
+ File.open('public/src/stylesheets/foundation.css', "w") do |file|
+ %w{stylesheets/globals.css stylesheets/typography.css stylesheets/grid.css stylesheets/ui.css stylesheets/forms.css stylesheets/orbit.css stylesheets/reveal.css stylesheets/mobile.css}.each do |stylesheet|
+ file.puts File.read(stylesheet)
+ end
+ end
+
+ file_name = 'public/src/index.html'
+
+ text = File.read(file_name)
+ text.gsub!(/<!-- Combine and Compress These CSS Files -->.+<!-- End Combine and Compress These CSS Files -->/m, "<link rel=\"stylesheet\" href=\"stylesheets/foundation.css\">")
+ text.gsub!(/<!-- Combine and Compress These JS Files -->.+<!-- End Combine and Compress These JS Files -->/m, "<script src=\"javascripts/foundation.js\"></script>")
+
+ File.open(file_name, "w") do |file|
+ file.puts text
+ end
+
+ %w{public/src/javascripts/app.js public/src/javascripts/foundation.js public/src/stylesheets/app.css public/src/stylesheets/foundation.css public/src/stylesheets/ie.css}.each do |file_name|
+ prepend_text(file_name, "/* Foundation v#{VERSION_STRING} http://foundation.zurb.com */")
+ end
+
+ `cd public/src && zip -r ../../marketing/files/foundation-download-#{VERSION_STRING}.zip *`
+ `rm -rf public`
+end
+
+task :default => :build
+
+require "jshintrb/jshinttask"
+Jshintrb::JshintTask.new :jshint do |t|
+ t.pattern = 'javascripts/*.js'
+ t.exclude_pattern = 'javascripts/jquery.min.js'
+ t.options = :defaults
+end
+
+desc "Run local web server for testing"
+task :server do
+ Bundler.require :websrver
+
+ current_dir = File.expand_path(File.dirname(__FILE__))
+
+ begin
+ require 'webrick/httputils'
+ mime_types = File.join current_dir, "config", "mime.type"
+ list = WEBrick::HTTPUtils.load_mime_types(mime_types)
+ Rack::Mime::MIME_TYPES.merge!(list)
+ rescue LoadError
+ puts "Unable to load webrick/httputils"
+ end
+
+ require 'rack/contrib/try_static'
+ app = Rack::Builder.app do
+ use Rack::CommonLogger
+ use Rack::ContentLength
+ use Rack::TryStatic, :root => current_dir, :urls => %w[/], :try => ['index.html']
+
+ run lambda { |env|
+ path = File.join current_dir, Rack::Utils.unescape(env['PATH_INFO'])
+ if File.exists?(path) && File.directory?(path)
+ Rack::Directory.new(current_dir).call(env)
+ else
+ file_name = File.join current_dir, "404.html"
+ if File.exists?(file_name) then
+ contents = File.read(file_name)
+ else
+ contents = '<h1>404 Not found</h1>'
+ end
+ [404, {'Content-Type' => 'text/html'}, [contents]]
+ end
+ }
+ end
+
+ require 'rack/handler/puma'
+ Rack::Handler::Puma.run app
+end
42 build.rb
View
@@ -1,42 +0,0 @@
-#!/usr/bin/env ruby
-# Creates a zip file of the Foundation template and the compressed assets
-
-VERSION_STRING = '2.1.5'
-
-def prepend_text(file_name, text)
- `exec 3<> '#{file_name}' && awk -v TEXT="#{text}" 'BEGIN {print TEXT}{print}' '#{file_name}' >&3`
-end
-
-`rm -rf public marketing/files/foundation-download.zip`
-`jammit`
-`mkdir public/src public/src/javascripts public/src/stylesheets`
-`cp -R humans.txt images index.html robots.txt public/src`
-`cp public/assets/foundation.js public/src/javascripts`
-`cp stylesheets/ie.css public/src/stylesheets/ie.css`
-`cp stylesheets/app.css public/src/stylesheets/app.css`
-`cp javascripts/app.js public/src/javascripts/app.js`
-`cp javascripts/modernizr.foundation.js public/src/javascripts/modernizr.foundation.js`
-`cp javascripts/jquery.min.js public/src/javascripts/jquery.min.js`
-
-File.open('public/src/stylesheets/foundation.css', "w") do |file|
- %w{stylesheets/globals.css stylesheets/typography.css stylesheets/grid.css stylesheets/ui.css stylesheets/forms.css stylesheets/orbit.css stylesheets/reveal.css stylesheets/mobile.css}.each do |stylesheet|
- file.puts File.read(stylesheet)
- end
-end
-
-file_name = 'public/src/index.html'
-
-text = File.read(file_name)
-text.gsub!(/<!-- Combine and Compress These CSS Files -->.+<!-- End Combine and Compress These CSS Files -->/m, "<link rel=\"stylesheet\" href=\"stylesheets/foundation.css\">")
-text.gsub!(/<!-- Combine and Compress These JS Files -->.+<!-- End Combine and Compress These JS Files -->/m, "<script src=\"javascripts/foundation.js\"></script>")
-
-File.open(file_name, "w") do |file|
- file.puts text
-end
-
-%w{public/src/javascripts/app.js public/src/javascripts/foundation.js public/src/stylesheets/app.css public/src/stylesheets/foundation.css public/src/stylesheets/ie.css}.each do |file_name|
- prepend_text(file_name, "/* Foundation v#{VERSION_STRING} http://foundation.zurb.com */")
-end
-
-`cd public/src && zip -r ../../marketing/files/foundation-download-#{VERSION_STRING}.zip *`
-`rm -rf public`
46 config/mime.type
View
@@ -0,0 +1,46 @@
+# ----------------------------------------------------------------------
+# Proper MIME type for all files
+# ----------------------------------------------------------------------
+
+text/html html htm
+application/xhtml+xml xhtml xht
+application/xml xml xsl
+application/xml-dtd dtd
+
+# JavaScript
+# Normalize to standard type (it's sniffed in IE anyways)
+# tools.ietf.org/html/rfc4329#section-7.2
+application/javascript js
+
+# Audio
+audio/ogg oga ogg
+audio/mp4 m4a
+
+# Video
+video/ogg ogv
+video/mp4 mp4 m4v
+video/webm webm
+
+# SVG
+# Required for svg webfonts on iPad
+# twitter.com/FontSquirrel/status/14855840545
+ image/svg+xml svg svgz
+AddEncoding gzip svgz
+
+# Webfonts
+application/vnd.ms-fontobject eot
+application/x-font-ttf ttf ttc
+font/opentype otf
+application/x-font-woff woff
+
+# Assorted types
+image/x-icon ico
+image/webp webp
+text/cache-manifest appcache manifest
+text/x-component htc
+application/x-chrome-extension crx
+application/x-opera-extension oex
+application/x-xpinstall xpi
+application/octet-stream safariextz
+application/x-web-app-manifest+json webapp
+text/x-vcard vcf
Something went wrong with that request. Please try again.