Permalink
Browse files

walk around the freaky bug of jasmine, separate jasmine and spec in b…

…uild
  • Loading branch information...
1 parent 5325cb9 commit 29d6e90a9acdd338141dc1bc239141674bb99850 @suoqin suoqin committed Aug 21, 2012
View
@@ -7,16 +7,24 @@ function push {
}
function build {
- RAILS_ENV=test bundle exec rake app:db:drop app:db:create app:db:migrate spec app:coffee:compile_spec app:jasmine:ci
+ RAILS_ENV=test bundle exec rake app:db:migrate spec && \
+ RAILS_ENV=test bundle exec rake app:coffee:compile_spec app:coffee:compile app:jasmine:ci
}
function guard {
+ RAILS_ENV=test bundle exec rake app:db:migrate app:coffee:compile_spec app:coffee:compile && \
RAILS_ENV=test bundle exec guard
}
+
+function jasmine {
+ RAILS_ENV=test bundle exec rake app:jasmine
+}
+
function main {
case $1 in
push) push;;
g) guard;;
+ j) jasmine;;
*) build;;
esac
}
View
@@ -1,18 +1,36 @@
require 'find'
+require 'fileutils'
namespace :coffee do
- src_dir = "#{Rails.root}/../../spec/coffeescripts"
- dist_dir = "#{Rails.root}/../../spec/javascripts"
-
- task :compile_spec => :clean do
+
+ def compile_coffee src_dir, dist_dir
+ FileUtils.mkdir_p(dist_dir)
Dir["#{src_dir}/*.coffee"].each do |f|
src_file = File.open(f)
dist = File.open("#{dist_dir}/#{File.basename(src_file, '.coffee')}", 'a+')
dist.write CoffeeScript.compile(src_file)
dist.close
end
end
+
+
+ task :compile_spec => :clean_spec do
+ src_dir = "#{Rails.root}/../../spec/coffeescripts"
+ dist_dir = "#{Rails.root}/../../spec/javascripts"
+ compile_coffee src_dir, dist_dir
+ end
+ task :compile do
+ src_dir = "#{Rails.root}/../../app/assets/javascripts/facebook_share_widget"
+ dist_dir = "#{Rails.root}/../../public/javascripts/compiled"
+ compile_coffee src_dir, dist_dir
+ end
+
task :clean do
- `rm #{dist_dir}/*.js`
+ `rm #{Rails.root}/../../public/javascripts/compiled/*.js`
+ end
+
+ task :clean_spec do
+ `rm #{Rails.root}/../../spec/javascripts/*.js`
end
+
end
@@ -1,9 +0,0 @@
-beforeEach(function() {
- this.addMatchers({
- toBePlaying: function(expectedSong) {
- var player = this.actual;
- return player.currentlyPlayingSong === expectedSong &&
- player.isPlaying;
- }
- });
-});
@@ -0,0 +1 @@
+#= require application
@@ -0,0 +1 @@
+#= require application

0 comments on commit 29d6e90

Please sign in to comment.