You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/02/13 15:26:26 UTC

[whimsy.git] [1/2] Commit f22dfc1: Facilitate local testing

Commit f22dfc1c7361fcf4de7626db33591e4518db7620:
    Facilitate local testing


Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>

------------------------------------------------------------
www/roster/Gemfile                                           | ++++ ----
www/roster/README                                            | +++ 
www/roster/Rakefile                                          | +++++++++++++ 
------------------------------------------------------------
37 changes: 33 additions, 4 deletions.
------------------------------------------------------------


diff --git a/www/roster/Gemfile b/www/roster/Gemfile
index 60444fc..d7127d4 100644
--- a/www/roster/Gemfile
+++ b/www/roster/Gemfile
@@ -16,9 +16,9 @@ gem 'wunderbar', '>= 1.0.0'
 gem 'ruby2js', '>= 2.0.0'
 gem 'sinatra'
 gem 'nokogumbo'
-gem 'execjs', ('<2.5.1' if RUBY_VERSION =~ /^1/)
-gem 'listen', ('~> 2.10' if RUBY_VERSION =~ /^1/)
+gem 'execjs'
 
-group :demo do
-  gem 'puma'
+group :development do
+  gem 'passenger'
+  gem 'listen'
 end
diff --git a/www/roster/README b/www/roster/README
new file mode 100644
index 0000000..578fec1
--- /dev/null
+++ b/www/roster/README
@@ -0,0 +1,3 @@
+To test locally, run:
+
+    rake server
diff --git a/www/roster/Rakefile b/www/roster/Rakefile
new file mode 100644
index 0000000..323029b
--- /dev/null
+++ b/www/roster/Rakefile
@@ -0,0 +1,26 @@
+require 'bundler'
+Bundler.require(:default, :development)
+
+task :server => :listen do
+  ENV['RACK_ENV']='development'
+  sh 'passenger start'
+end
+
+task :listen do
+  dirs = [
+    File.expand_path('..', File.realpath(__FILE__)),
+    File.expand_path('../../../lib', File.realpath(__FILE__))
+  ]
+
+  listener = Listen.to(*dirs) do |modified, added, removed|
+    puts "detected update: #{(modified + added + removed).join(', ')}"
+    FileUtils.touch "#{dirs.first}/tmp/restart.txt"
+  end
+
+  listener.ignore /~$/
+  listener.ignore /^\..*\.sw\w$/
+  listener.ignore /passenger.\d+\.(log|pid(\.lock)?)$/
+
+  listener.start
+end
+