-
Notifications
You must be signed in to change notification settings - Fork 79
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
Showing
32 changed files
with
3,082 additions
and
90 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,3 +1,38 @@ | ||
# Filters added to this controller apply to all controllers in the application. | ||
# Likewise, all the methods added will be available for all controllers. | ||
#require File.dirname(__FILE__) + '/../../lib/tryruby' | ||
|
||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
|
||
|
||
|
||
|
||
layout 'tryruby' | ||
|
||
# attr_accessor :past_commands, :current_statement, :start_time | ||
|
||
|
||
# attr_accessor :past_commands, :current_statement, :start_time | ||
|
||
|
||
|
||
|
||
|
||
=begin | ||
#attr_accessor :session | ||
TryRuby.session = session | ||
TryRuby.session['start_time'] ||= Time.now | ||
TryRuby.session['current_statement'] ||= '' | ||
TryRuby.session['past_commands'] ||= '' | ||
helper :all # include all helpers, all the time | ||
protect_from_forgery # See ActionController::RequestForgeryProtection for details | ||
# Scrub sensitive parameters from your log | ||
# filter_parameter_logging :password | ||
#class << self | ||
=end | ||
# not needed | ||
#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,2 @@ | ||
class ClassicController < ApplicationController | ||
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,85 @@ | ||
class IrbController < ApplicationController | ||
# GET /irb | ||
# GET /irb.xml | ||
def index | ||
|
||
@irb = [] | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.to_json | ||
format.xml { render :xml => @irb } | ||
end | ||
end | ||
|
||
# GET /irb/1 | ||
# GET /irb/1.xml | ||
def show | ||
@irb = Irb.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.xml { render :xml => @irb } | ||
end | ||
end | ||
|
||
# GET /irb/new | ||
# GET /irb/new.xml | ||
def new | ||
@irb = Irb.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @irb } | ||
end | ||
end | ||
|
||
# GET /irb/1/edit | ||
def edit | ||
@irb = Irb.find(params[:id]) | ||
end | ||
|
||
# POST /irb | ||
# POST /irb.xml | ||
def create | ||
@irb = Irb.new(params[:irb]) | ||
|
||
respond_to do |format| | ||
if @irb.save | ||
format.html { redirect_to(@irb, :notice => 'Irb was successfully created.') } | ||
format.xml { render :xml => @irb, :status => :created, :location => @irb } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @irb.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /irb/1 | ||
# PUT /irb/1.xml | ||
def update | ||
@irb = Irb.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @irb.update_attributes(params[:irb]) | ||
format.html { redirect_to(@irb, :notice => 'Irb was successfully updated.') } | ||
format.xml { head :ok } | ||
else | ||
format.html { render :action => "edit" } | ||
format.xml { render :xml => @irb.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /irb/1 | ||
# DELETE /irb/1.xml | ||
def destroy | ||
@irb = Irb.find(params[:id]) | ||
@irb.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to(irb_url) } | ||
format.xml { head :ok } | ||
end | ||
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,2 @@ | ||
class PublicController < ApplicationController | ||
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,42 @@ | ||
|
||
class TryrubyController < ApplicationController | ||
|
||
layout 'tryruby' | ||
def index | ||
end | ||
|
||
def run | ||
eval(params[:cmd]) | ||
|
||
#@cmd=params[:cmd] | ||
# @a= run_script(@cmd) | ||
# @b = "handleJSON({\"type\": #{@a.type.to_json}, \"output\":#{@a.output.to_json},\"result\":#{@a.result.inspect.to_json}, \"error\": #{@a.error.inspect.to_json}})" | ||
|
||
begin | ||
render :json => @b | ||
rescue | ||
end | ||
end | ||
|
||
|
||
def run_script(command) | ||
#output = begin | ||
eval(command) | ||
# rescue StandardError => e | ||
# e.message + ". On the " | ||
begin | ||
# Tryrubyengine.session ||= TRSession.new | ||
#TryRuby.run_line(TryRuby.session.cgi['cmd']).format | ||
#Tryrubyengine.new | ||
# @c= Tryrubyengine.session | ||
# @c.inspect | ||
# Tryrubyengine.run_line(command) | ||
rescue | ||
|
||
end | ||
# end | ||
|
||
# return "=> #{output}" + ", says yoda" | ||
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
class TutorialsController < ApplicationController | ||
layout 'blank' | ||
def intro | ||
|
||
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 |
---|---|---|
@@ -1,2 +1,18 @@ | ||
module ApplicationHelper | ||
|
||
def google_analytics_js | ||
ua_code = "UA-2365371-3" | ||
'<script type="text/javascript"> | ||
var _gaq = _gaq || []; _gaq.push(["_setAccount","'+ua_code+'"}]); | ||
_gaq.push(["_trackPageview"]); | ||
(function() { var ga = document.createElement("script"); | ||
ga.type = "text/javascript"; | ||
ga.async = true; | ||
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js"; | ||
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s); })(); | ||
</script>' | ||
|
||
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,2 @@ | ||
module ClassicHelper | ||
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,2 @@ | ||
module IrbHelper | ||
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,2 @@ | ||
module PublicHelper | ||
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,17 @@ | ||
<%= form_for(@irb) do |f| %> | ||
<% if @irb.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@irb.errors.count, "error") %> prohibited this irb from being saved:</h2> | ||
|
||
<ul> | ||
<% @irb.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="actions"> | ||
<%= f.submit %> | ||
</div> | ||
<% 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,6 @@ | ||
<h1>Editing irb</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Show', @irb %> | | ||
<%= link_to 'Back', irb_path %> |
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,21 @@ | ||
<h1>Listing irb</h1> | ||
|
||
<table> | ||
<tr> | ||
<th></th> | ||
<th></th> | ||
<th></th> | ||
</tr> | ||
|
||
<% @irb.each do |irb| %> | ||
<tr> | ||
<td><%= link_to 'Show', irb %></td> | ||
<td><%= link_to 'Edit', edit_irb_path(irb) %></td> | ||
<td><%= link_to 'Destroy', irb, :confirm => 'Are you sure?', :method => :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New Irb', new_irb_path %> |
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 @@ | ||
<h1>New irb</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Back', irb_path %> |
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 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
|
||
<%= link_to 'Edit', edit_irb_path(@irb) %> | | ||
<%= link_to 'Back', irb_path %> |
Oops, something went wrong.