Every repository with this icon (
Every repository with this icon (
Running Red
Using Red-Herring
Red-herring is a super-lightweight runner built on top of Rack that serves Rubyish formats like Haml, Sass, and {color:#C80404}Red.
To get Red-herring running, go to the github page and click the Download button. Navigate into the folder that’s downloaded and create two files, e.g. example.html and application.red.
In example.html:
<html>
<head>
<script type="text/javascript" src="/application.red" charset="utf-8"></script>
</head>
<body>
<div id="example_div" style="width:100px;height:100px;background:#C80404"></div>
</body>
</html>
In application.red:
require 'redshift'
UserEvents.define(:shift_click, :base => 'click', :condition => proc {|elem,event| event.shift? })
Document.ready? do
Document['#example_div'].listen(:shift_click) do |element,event|
element.text = "You shift-clicked me!"
end
end
Rackup
Navigate to the Red-herring folder on the command line and run rackup. To check your {color:#C80404}Red application, visit http://localhost:9292/example.html in Firefox or Safari and shift-click the red box.
“Help! Nothing Happened!”
Make sure you have at least v4.1.7 of {color:#C80404}Red by running sudo gem install red. You may need to run gem update --system to get things working properly. Red-herring also may require that you gem install newgem and cucumber. Be sure to run gem cleanup after you’re finished installing.
Using Rails
You can install {color:#C80404}Red in Rails by following the instructions in the Red for Rails Tutorial.
To set up the above application in your Rails application, change the <script> tag in the HTML file you’re serving to:
<script type="text/javascript" src="/javascripts/application.js" charset="utf-8"></script>
Put the {color:#C80404}Red code above into the file public/javascripts/red/application.red. To check your application, start up your Rails server and visit the HTML file you’re serving in Firefox or Safari and shift-click the red box.







