diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..c60a730 --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm ruby-1.9.3-p0@pivotal_rocket_gems --create diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..d7bfa71 --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +source 'http://rubygems.org' + +gem "rake", "~> 0.9.0" +gem 'sprockets', '~> 2.0' +gem "coffee-script", "~> 2.2.0" +gem "uglifier", ">= 1.2.0" +gem "therubyracer", ">= 0.9.9" +gem "less" +gem "jasmine", ">= 1.0.0" +gem "actionpack", ">= 3.1.0" +gem "activesupport", ">= 3.1.0" diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..65f5322 --- /dev/null +++ b/Rakefile @@ -0,0 +1,44 @@ +#!/usr/bin/env rake +require 'rake' +require 'coffee-script' +require 'uglifier' + +desc 'Default: compress js and css.' +task :default => :'pack:default' + +######################################### +### JS and CSS tasks +######################################### + +namespace :pack do + desc "do all pack tasks" + task :default => [:compile] + + desc "compile coffee-scripts from ./assets/javascripts to ./javascripts" + task :compile do + source = "#{File.dirname(__FILE__)}/assets/javascripts/" + javascripts = "#{File.dirname(__FILE__)}/javascripts/" + + Dir.foreach(source) do |cf| + unless cf == '.' || cf == '..' + js_compiled = CoffeeScript.compile File.read("#{source}#{cf}") + js = Uglifier.compile js_compiled + open "#{javascripts}#{cf.gsub('.coffee', '.js')}", 'w' do |f| + f.puts js + end + end + end + + puts "All done." + end +end + +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 + diff --git a/assets/javascripts/pivotal_api_lib.coffee b/assets/javascripts/pivotal_api_lib.coffee new file mode 100644 index 0000000..562ba35 --- /dev/null +++ b/assets/javascripts/pivotal_api_lib.coffee @@ -0,0 +1,4 @@ +class window.PivotalApiLib + constructor: -> + console.log "init" + \ No newline at end of file diff --git a/javascripts/pivotal_api_lib.js b/javascripts/pivotal_api_lib.js new file mode 100644 index 0000000..19c21cc --- /dev/null +++ b/javascripts/pivotal_api_lib.js @@ -0,0 +1 @@ +((function(){window.PivotalApiLib=function(){function a(){console.log("init")}return a}()})).call(this)