From 94a578e4b294a9b1be1bf0ea1349540c0279acf0 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Tue, 30 Apr 2013 12:43:21 +1000 Subject: [PATCH] ignore assets fix runner so it works on mac get rid of some test warnings --- .gitignore | 2 ++ lib/autospec/runner.rb | 9 +++++---- lib/oneboxer.rb | 15 +++++++++------ lib/oneboxer/rottentomatoes_onebox.rb | 11 +++++++---- spec/models/admin_dashboard_data_spec.rb | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 38958ddeaca..ed6add00e47 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ dump.rdb /cache /coverage/* +/public/assets/* + config/database.yml config/redis.yml config/discourse.pill diff --git a/lib/autospec/runner.rb b/lib/autospec/runner.rb index b3633c82866..e40cae7aebd 100644 --- a/lib/autospec/runner.rb +++ b/lib/autospec/runner.rb @@ -56,7 +56,7 @@ class Autospec::Runner Signal.trap("SIGINT") {stop_spork; exit } puts "Forced polling (slower) - inotify does not work on network filesystems, use local filesystem to avoid" if force_polling - + Thread.start do Listen.to('.', force_polling: force_polling, filter: /^app|^spec|^lib/, relative_paths: true) do |modified, added, removed| process_change([modified, added].flatten.compact) @@ -68,7 +68,8 @@ class Autospec::Runner @signal.signal end - Process.wait + Process.wait(@spork_pid) + puts "Spork has been terminated, exiting" rescue => e puts e @@ -84,7 +85,7 @@ class Autospec::Runner sleep(0.001) end end - t.join + t.join rescue nil end def force_polling? @@ -293,7 +294,7 @@ class Autospec::Runner sleep 1 end - @spork_pid = Process.spawn("RAILS_ENV=test bundle exec spork") + @spork_pid = Process.spawn({'RAILS_ENV' => 'test'}, "bundle exec spork") write_pid_file(spork_pid_file, @spork_pid) running = false diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb index cda02d3678d..f8810a193ee 100644 --- a/lib/oneboxer.rb +++ b/lib/oneboxer.rb @@ -10,13 +10,16 @@ Dir["#{Rails.root}/lib/oneboxer/*_onebox.rb"].each {|f| module Oneboxer extend Oneboxer::Base - Result = Struct.new(:doc, :changed) do - def to_html - doc.to_html - end + # keep reloaders happy + unless defined? Oneboxer::Result + Result = Struct.new(:doc, :changed) do + def to_html + doc.to_html + end - def changed? - changed + def changed? + changed + end end end diff --git a/lib/oneboxer/rottentomatoes_onebox.rb b/lib/oneboxer/rottentomatoes_onebox.rb index 580ed68e1da..0b94aa0b336 100644 --- a/lib/oneboxer/rottentomatoes_onebox.rb +++ b/lib/oneboxer/rottentomatoes_onebox.rb @@ -3,10 +3,13 @@ require_dependency 'oneboxer/handlebars_onebox' module Oneboxer class RottentomatoesOnebox < HandlebarsOnebox - SYNOPSIS_MAX_TEXT = 370 - ROTTEN_IMG = 'http://images.rottentomatoescdn.com/images/icons/rt.rotten.med.png' - FRESH_IMG = 'http://images.rottentomatoescdn.com/images/icons/rt.fresh.med.png' - POPCORN_IMG = 'http://images.rottentomatoescdn.com/images/icons/popcorn_27x31.png' + # keep reloaders happy + unless defined? SYNOPSIS_MAX_TEXT + SYNOPSIS_MAX_TEXT = 370 + ROTTEN_IMG = 'http://images.rottentomatoescdn.com/images/icons/rt.rotten.med.png' + FRESH_IMG = 'http://images.rottentomatoescdn.com/images/icons/rt.fresh.med.png' + POPCORN_IMG = 'http://images.rottentomatoescdn.com/images/icons/popcorn_27x31.png' + end matcher /^http:\/\/(?:www\.)?rottentomatoes\.com(\/mobile)?\/m\/.*$/ favicon 'rottentomatoes.png' diff --git a/spec/models/admin_dashboard_data_spec.rb b/spec/models/admin_dashboard_data_spec.rb index 87e0e102d3a..03846b9f8a7 100644 --- a/spec/models/admin_dashboard_data_spec.rb +++ b/spec/models/admin_dashboard_data_spec.rb @@ -187,4 +187,4 @@ describe AdminDashboardData do end end -end \ No newline at end of file +end