Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0dcf303
Showing
90 changed files
with
8,216 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Filters added to this controller apply to all controllers in the application. | ||
# Likewise, all the methods added will be available for all controllers. | ||
|
||
class ApplicationController < ActionController::Base | ||
helper :all # include all helpers, all the time | ||
|
||
# See ActionController::RequestForgeryProtection for details | ||
# Uncomment the :secret if you're not using the cookie session store | ||
protect_from_forgery # :secret => '9130aadf73a0469f57dfb3d8e06f528b' | ||
|
||
# See ActionController::Base for details | ||
# Uncomment this to filter the contents of submitted sensitive data parameters | ||
# from your application log (in this case, all fields with names like "password"). | ||
# filter_parameter_logging :password | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Methods added to this helper will be available to all templates in the application. | ||
module ApplicationHelper | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
require 'rubygems' | ||
require 'hpricot' | ||
require 'open-uri' | ||
require 'rufus/scheduler' | ||
|
||
# Uses the rufus scheduler to check for builds that passed or failed. Performs X10 action with bottlerocket's 'br' command | ||
|
||
class Scheduler | ||
include Singleton | ||
|
||
def start | ||
@last = {} | ||
@failing_builds = Set.new | ||
|
||
scheduler = Rufus::Scheduler.start_new | ||
scheduler.every "10s" do | ||
parse(Conf.ruby1_url) | ||
parse(Conf.build1_url) | ||
end | ||
end | ||
|
||
|
||
def parse(url) | ||
file = open(url); | ||
doc = Hpricot.XML(file) | ||
file.close | ||
# name="2008-07-25-homepage" activity="Sleeping" lastBuildStatus="Failure" lastBuildLabel="" lastBuildTime="2008-10-01T20:51:46" | ||
doc.search("/projects/project").each do |project| | ||
project_name = project.attributes["name"] | ||
status = project.attributes["lastBuildStatus"] | ||
time = project.attributes["lastBuildTime"] | ||
|
||
followed_builds = Conf.branches.split(",").map {|x| x.strip} | ||
|
||
if followed_builds.include?(project_name) | ||
previous_build = @last[project_name] | ||
@last[project_name] = {"project" => project_name, "time" => time, "status" => status} | ||
|
||
if status.include?("Fail") | ||
@failing_builds << project_name | ||
on_fail(project_name) | ||
elsif !previous_build.nil? && (previous_build["time"] != time) && status.include?("Success") | ||
@failing_builds.delete(project_name) | ||
if (!previous_build["status"].include?("Fail")) | ||
on_pass(project_name) | ||
off_pass | ||
off_pass | ||
elsif @failing_builds.empty? | ||
off_fail | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
def on_pass(project_name) | ||
puts "#{project_name} Bubbles!!!!!" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_pass_device} ON") | ||
sleep 3 | ||
end | ||
|
||
def off_pass | ||
puts "Bubbles Off" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_pass_device} OFF") | ||
sleep 2 | ||
end | ||
|
||
def on_fail(project_name) | ||
puts "#{project_name} Red Light!!!" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_failure_device} ON") | ||
end | ||
|
||
def off_fail | ||
puts "Light Off" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_failure_device} OFF") | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
require 'rubygems' | ||
require 'hpricot' | ||
require 'open-uri' | ||
require 'rufus/scheduler' | ||
|
||
# Uses the rufus scheduler to check for builds that passed or failed. Performs X10 action with bottlerocket's 'br' command | ||
# Author: Patrick Foley | ||
|
||
class Scheduler | ||
include Singleton | ||
|
||
def start | ||
@last = {} | ||
@failing_builds = Set.new | ||
|
||
scheduler = Rufus::Scheduler.start_new | ||
scheduler.every "10s" do | ||
parse(Conf.ruby1_url) | ||
parse(Conf.build1_url) | ||
end | ||
end | ||
|
||
|
||
def parse(url) | ||
file = open(url); | ||
doc = Hpricot.XML(file) | ||
file.close | ||
# name="2008-07-25-homepage" activity="Sleeping" lastBuildStatus="Failure" lastBuildLabel="" lastBuildTime="2008-10-01T20:51:46" | ||
doc.search("/projects/project").each do |project| | ||
project_name = project.attributes["name"] | ||
status = project.attributes["lastBuildStatus"] | ||
time = project.attributes["lastBuildTime"] | ||
|
||
followed_builds = Conf.branches.split(",").map {|x| x.strip} | ||
|
||
if followed_builds.include?(project_name) | ||
previous_build = @last[project_name] | ||
@last[project_name] = {"project" => project_name, "time" => time, "status" => status} | ||
|
||
if status.include?("Fail") | ||
@failing_builds << project_name | ||
on_fail(project_name) | ||
elsif !previous_build.nil? && (previous_build["time"] != time) && status.include?("Success") | ||
@failing_builds.delete(project_name) | ||
if (!previous_build["status"].include?("Fail")) | ||
on_pass(project_name) | ||
off_pass | ||
off_pass | ||
elsif @failing_builds.empty? | ||
off_fail | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
def on_pass(project_name) | ||
puts "#{project_name} Bubbles!!!!!" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_pass_device} ON") | ||
sleep 3 | ||
end | ||
|
||
def off_pass | ||
puts "Bubbles Off" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_pass_device} OFF") | ||
sleep 2 | ||
end | ||
|
||
def on_fail(project_name) | ||
puts "#{project_name} Red Light!!!" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_failure_device} ON") | ||
end | ||
|
||
def off_fail | ||
puts "Light Off" | ||
system("br #{Conf.x10_house_code}#{Conf.x10_failure_device} OFF") | ||
end | ||
|
||
end |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
To build the guides: | ||
|
||
* Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html) | ||
* Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master) | ||
* Run `rake guides` from the railties directory |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
|
||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
<title>The page you were looking for doesn't exist (404)</title> | ||
<style type="text/css"> | ||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } | ||
div.dialog { | ||
width: 25em; | ||
padding: 0 4em; | ||
margin: 4em auto 0 auto; | ||
border: 1px solid #ccc; | ||
border-right-color: #999; | ||
border-bottom-color: #999; | ||
} | ||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<!-- This file lives in public/404.html --> | ||
<div class="dialog"> | ||
<h1>The page you were looking for doesn't exist.</h1> | ||
<p>You may have mistyped the address or the page may have moved.</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
|
||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
<title>The change you wanted was rejected (422)</title> | ||
<style type="text/css"> | ||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } | ||
div.dialog { | ||
width: 25em; | ||
padding: 0 4em; | ||
margin: 4em auto 0 auto; | ||
border: 1px solid #ccc; | ||
border-right-color: #999; | ||
border-bottom-color: #999; | ||
} | ||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<!-- This file lives in public/422.html --> | ||
<div class="dialog"> | ||
<h1>The change you wanted was rejected.</h1> | ||
<p>Maybe you tried to change something you didn't have access to.</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
|
||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
<title>We're sorry, but something went wrong (500)</title> | ||
<style type="text/css"> | ||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } | ||
div.dialog { | ||
width: 25em; | ||
padding: 0 4em; | ||
margin: 4em auto 0 auto; | ||
border: 1px solid #ccc; | ||
border-right-color: #999; | ||
border-bottom-color: #999; | ||
} | ||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<!-- This file lives in public/500.html --> | ||
<div class="dialog"> | ||
<h1>We're sorry, but something went wrong.</h1> | ||
<p>We've been notified about this issue and we'll take a look at it shortly.</p> | ||
<p><small>(If you're the administrator of this website, then please read | ||
the log file "<%=h RAILS_ENV %>.log" | ||
to find out what went wrong.)</small></p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/opt/local/bin/ruby | ||
|
||
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | ||
|
||
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: | ||
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired | ||
require "dispatcher" | ||
|
||
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) | ||
Dispatcher.dispatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/opt/local/bin/ruby | ||
# | ||
# You may specify the path to the FastCGI crash log (a log of unhandled | ||
# exceptions which forced the FastCGI instance to exit, great for debugging) | ||
# and the number of requests to process before running garbage collection. | ||
# | ||
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log | ||
# and the GC period is nil (turned off). A reasonable number of requests | ||
# could range from 10-100 depending on the memory footprint of your app. | ||
# | ||
# Example: | ||
# # Default log path, normal GC behavior. | ||
# RailsFCGIHandler.process! | ||
# | ||
# # Default log path, 50 requests between GC. | ||
# RailsFCGIHandler.process! nil, 50 | ||
# | ||
# # Custom log path, normal GC behavior. | ||
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log' | ||
# | ||
require File.dirname(__FILE__) + "/../config/environment" | ||
require 'fcgi_handler' | ||
|
||
RailsFCGIHandler.process! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/opt/local/bin/ruby | ||
|
||
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | ||
|
||
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: | ||
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired | ||
require "dispatcher" | ||
|
||
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) | ||
Dispatcher.dispatch |
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.