require 'rake' require "bundler/gem_tasks" require 'jslint-v8' begin require 'jasmine' load 'jasmine/tasks/jasmine.rake' rescue LoadError task :jasmine do abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine" end end namespace :js do JSLintV8::RakeTask.new do |task| task.name = "lint" task.description = "runs jslint against all important javascript files" task.output_stream = STDOUT task.include_pattern = "js/transistor/*.js" task.browser = true # predefine Browser globals task.nomen = false # allow _identifier end desc 'Build min and src version of transistor' task :build => :lint do if !`git diff --cached`.empty? raise "Staged changes have to be commited first" end if !`git diff`.empty? raise "Unstaged changes have to be staged and commited first" end system "rm -fr build/* && jake && cp build/src/*.js lib/assets/javascripts/ && git add build lib/assets/javascripts && git commit -m 'rake js:build.'" end end task :build => 'js:build'