Skip to content

Commit

Permalink
on branch experi
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophrinix committed Jul 9, 2011
1 parent e38c726 commit a695e99
Show file tree
Hide file tree
Showing 32 changed files with 3,082 additions and 90 deletions.
32 changes: 20 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,40 @@ source 'http://rubygems.org'

gem 'rails', '3.0.9'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'mysql2', '< 0.3'
gem 'fakefs', '0.2.1', :git => "http://github.com/defunkt/fakefs.git", :ref => "aa0cb96b8ebc81287a2e", :require => 'fakefs/safe'
# Use unicorn as the web server
# gem 'unicorn'

gem 'i18n'
# Deploy with Capistrano
# gem 'capistrano'
gem "fakefs", :require => "fakefs/safe"
gem 'chronic'

gem 'devise'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
gem 'jquery-rails'
gem 'ruby_parser'
gem 'racc'

#gem 'ruby2ruby'
#gem 'newrelic_rpm'
#gem 'madmimi'
#gem 'delayed_job'
#gem 'dalli'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'

gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
gem 'capybara'
gem 'rspec-rails'
gem 'cucumber-rails'
#gem 'factory-girl'
37 changes: 36 additions & 1 deletion app/controllers/application_controller.rb
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
2 changes: 2 additions & 0 deletions app/controllers/classic_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ClassicController < ApplicationController
end
85 changes: 85 additions & 0 deletions app/controllers/irb_controller.rb
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
2 changes: 2 additions & 0 deletions app/controllers/public_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class PublicController < ApplicationController
end
42 changes: 42 additions & 0 deletions app/controllers/tryruby_controller.rb
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
4 changes: 2 additions & 2 deletions app/controllers/tutorials_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class TutorialsController < ApplicationController
layout 'blank'
def intro

end

end
16 changes: 16 additions & 0 deletions app/helpers/application_helper.rb
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
2 changes: 2 additions & 0 deletions app/helpers/classic_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ClassicHelper
end
2 changes: 2 additions & 0 deletions app/helpers/irb_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module IrbHelper
end
2 changes: 2 additions & 0 deletions app/helpers/public_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PublicHelper
end
17 changes: 17 additions & 0 deletions app/views/irb/_form.html.erb
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 %>
6 changes: 6 additions & 0 deletions app/views/irb/edit.html.erb
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 %>
21 changes: 21 additions & 0 deletions app/views/irb/index.html.erb
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 %>
5 changes: 5 additions & 0 deletions app/views/irb/new.html.erb
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 %>
5 changes: 5 additions & 0 deletions app/views/irb/show.html.erb
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 %>
Loading

0 comments on commit a695e99

Please sign in to comment.