-
Notifications
You must be signed in to change notification settings - Fork 0
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
unknown
authored and
unknown
committed
Apr 20, 2008
0 parents
commit 7bc36e2
Showing
88 changed files
with
11,786 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
OWN PASTIE | ||
|
||
a smallish pastie site using radiograph (ultraviolet + textpow) |
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 @@ | ||
# 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 => '381c0a61fe231551469ee3a6d6e66a1e' | ||
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 PastesController < ApplicationController | ||
# GET /pastes | ||
# GET /pastes.xml | ||
def index | ||
@pastes = Paste.find(:all) | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.xml { render :xml => @pastes } | ||
end | ||
end | ||
|
||
# GET /pastes/1 | ||
# GET /pastes/1.xml | ||
def show | ||
@paste = Paste.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.xml { render :xml => @paste } | ||
end | ||
end | ||
|
||
# GET /pastes/new | ||
# GET /pastes/new.xml | ||
def new | ||
@paste = Paste.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @paste } | ||
end | ||
end | ||
|
||
# GET /pastes/1/edit | ||
def edit | ||
@paste = Paste.find(params[:id]) | ||
end | ||
|
||
# POST /pastes | ||
# POST /pastes.xml | ||
def create | ||
@paste = Paste.new(params[:paste]) | ||
|
||
respond_to do |format| | ||
if @paste.save | ||
flash[:notice] = 'Paste was successfully created.' | ||
format.html { redirect_to(@paste) } | ||
format.xml { render :xml => @paste, :status => :created, :location => @paste } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @paste.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /pastes/1 | ||
# PUT /pastes/1.xml | ||
def update | ||
@paste = Paste.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @paste.update_attributes(params[:paste]) | ||
flash[:notice] = 'Paste was successfully updated.' | ||
format.html { redirect_to(@paste) } | ||
format.xml { head :ok } | ||
else | ||
format.html { render :action => "edit" } | ||
format.xml { render :xml => @paste.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /pastes/1 | ||
# DELETE /pastes/1.xml | ||
def destroy | ||
@paste = Paste.find(params[:id]) | ||
@paste.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to(pastes_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,3 @@ | ||
# Methods added to this helper will be available to all templates in the application. | ||
module ApplicationHelper | ||
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 PastesHelper | ||
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 Paste < ActiveRecord::Base | ||
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,20 @@ | ||
<!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>Pastes: <%= controller.action_name %></title> | ||
<%= stylesheet_link_tag 'scaffold' %> | ||
<%- %w{active4d all_hallows_eve amy blackboard brilliance_black brilliance_dull cobalt dawn eiffel espresso_libre idle iplastic lazy mac_classic magicwb_amiga pastels_on_dark spacecadet sunburst twilight zenburnesque}.each do |theme| -%> | ||
<%= require_syntax_css theme%> | ||
<%- end -%> | ||
<%= javascript_include_tag :defaults %> | ||
</head> | ||
<body> | ||
|
||
<p style="color: green"><%= flash[:notice] %></p> | ||
<%= yield %> | ||
|
||
</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,20 @@ | ||
<h1>Editing paste</h1> | ||
|
||
<%= error_messages_for :paste %> | ||
|
||
<% form_for(@paste) do |f| %> | ||
<p> | ||
<b>Language</b><br /> | ||
<%= f.select :language, SYNTAXES %> | ||
</p> | ||
<p> | ||
<b>Code</b><br /> | ||
<%= f.text_area :code %> | ||
</p> | ||
<p> | ||
<%= f.submit "Update" %> | ||
</p> | ||
<% end %> | ||
|
||
<%= link_to 'Show', @paste %> | | ||
<%= link_to 'Back', pastes_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,22 @@ | ||
<h1>Listing pastes</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>Code</th> | ||
<th>Language</th> | ||
</tr> | ||
|
||
<% for paste in @pastes %> | ||
<tr> | ||
<td><%=h paste.code[0, 25] %></td> | ||
<td><%=h paste.language %></td> | ||
<td><%= link_to 'Show', paste %></td> | ||
<td><%= link_to 'Edit', edit_paste_path(paste) %></td> | ||
<td><%= link_to 'Destroy', paste, :confirm => 'Are you sure?', :method => :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New paste', new_paste_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,19 @@ | ||
<h1>New paste</h1> | ||
|
||
<%= error_messages_for :paste %> | ||
|
||
<% form_for(@paste) do |f| %> | ||
<p> | ||
<b>Language</b><br /> | ||
<%= f.select :language, SYNTAXES %> | ||
</p> | ||
<p> | ||
<b>Code</b><br /> | ||
<%= f.text_area :code %> | ||
</p> | ||
<p> | ||
<%= f.submit "Create" %> | ||
</p> | ||
<% end %> | ||
|
||
<%= link_to 'Back', pastes_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,16 @@ | ||
Theme: <%= select_tag :themes, options_for_select(%w{active4d all_hallows_eve amy blackboard brilliance_black brilliance_dull cobalt dawn eiffel espresso_libre idle iplastic lazy mac_classic magicwb_amiga pastels_on_dark spacecadet sunburst twilight zenburnesque}), :onChange => "changeStyle(this.value)", :id => "theme_picker" %><br/> | ||
<p> | ||
<b>Language:</b> | ||
<%=h @paste.language %> | ||
</p> | ||
<div id="code"> | ||
<p> | ||
<b>Code:</b> | ||
<%=c @paste.code, :syntax => @paste.language %> | ||
</p> | ||
</div> | ||
|
||
|
||
|
||
<%= link_to 'Edit', edit_paste_path(@paste) %> | | ||
<%= link_to 'Back', pastes_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,109 @@ | ||
# Don't change this file! | ||
# Configure your app in config/environment.rb and config/environments/*.rb | ||
|
||
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | ||
|
||
module Rails | ||
class << self | ||
def boot! | ||
unless booted? | ||
preinitialize | ||
pick_boot.run | ||
end | ||
end | ||
|
||
def booted? | ||
defined? Rails::Initializer | ||
end | ||
|
||
def pick_boot | ||
(vendor_rails? ? VendorBoot : GemBoot).new | ||
end | ||
|
||
def vendor_rails? | ||
File.exist?("#{RAILS_ROOT}/vendor/rails") | ||
end | ||
|
||
# FIXME : Ruby 1.9 | ||
def preinitialize | ||
load(preinitializer_path) if File.exists?(preinitializer_path) | ||
end | ||
|
||
def preinitializer_path | ||
"#{RAILS_ROOT}/config/preinitializer.rb" | ||
end | ||
end | ||
|
||
class Boot | ||
def run | ||
load_initializer | ||
Rails::Initializer.run(:set_load_path) | ||
end | ||
end | ||
|
||
class VendorBoot < Boot | ||
def load_initializer | ||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" | ||
end | ||
end | ||
|
||
class GemBoot < Boot | ||
def load_initializer | ||
self.class.load_rubygems | ||
load_rails_gem | ||
require 'initializer' | ||
end | ||
|
||
def load_rails_gem | ||
if version = self.class.gem_version | ||
gem 'rails', version | ||
else | ||
gem 'rails' | ||
end | ||
rescue Gem::LoadError => load_error | ||
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) | ||
exit 1 | ||
end | ||
|
||
class << self | ||
def rubygems_version | ||
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion | ||
end | ||
|
||
def gem_version | ||
if defined? RAILS_GEM_VERSION | ||
RAILS_GEM_VERSION | ||
elsif ENV.include?('RAILS_GEM_VERSION') | ||
ENV['RAILS_GEM_VERSION'] | ||
else | ||
parse_gem_version(read_environment_rb) | ||
end | ||
end | ||
|
||
def load_rubygems | ||
require 'rubygems' | ||
|
||
unless rubygems_version >= '0.9.4' | ||
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.) | ||
exit 1 | ||
end | ||
|
||
rescue LoadError | ||
$stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org) | ||
exit 1 | ||
end | ||
|
||
def parse_gem_version(text) | ||
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ | ||
end | ||
|
||
private | ||
def read_environment_rb | ||
File.read("#{RAILS_ROOT}/config/environment.rb") | ||
end | ||
end | ||
end | ||
end | ||
|
||
# All that for this: | ||
Rails.boot! |
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,19 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3-ruby (not necessary on OS X Leopard) | ||
development: | ||
adapter: sqlite3 | ||
database: db/development.sqlite3 | ||
timeout: 5000 | ||
|
||
# Warning: The database defined as 'test' will be erased and | ||
# re-generated from your development database when you run 'rake'. | ||
# Do not set this db to the same as development or production. | ||
test: | ||
adapter: sqlite3 | ||
database: db/test.sqlite3 | ||
timeout: 5000 | ||
|
||
production: | ||
adapter: sqlite3 | ||
database: db/production.sqlite3 | ||
timeout: 5000 |
Oops, something went wrong.