code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/ruby1.8
#!/usr/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 performan... | Ruby |
#!/usr/bin/ruby1.8
#!/usr/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/... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.0... | Ruby |
# 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?
... | Ruby |
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module OrdersHelper
end
| Ruby |
module ClientHelper
end
| Ruby |
module EmployeeHelper
end
| Ruby |
class Employee < ActiveRecord::Base
validates_presence_of :fname
validates_presence_of :lname
validates_presence_of :email
validates_presence_of :admin
validates_length_of :fname, :minimum => 1
validates_length_of :lname, :minimum => 1
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :m... | Ruby |
class Client < ActiveRecord::Base
validates_presence_of :fname
validates_presence_of :lname
validates_presence_of :email
validates_presence_of :CCnumber
validates_presence_of :CCType
validates_presence_of :CCName
validates_presence_of :employeeID
validates_length_of :fname, :minimum => 1
validates_length_of :lname, :mi... | Ruby |
class Orders < ActiveRecord::Base
validates_presence_of :clientID
validates_presence_of :employeeID
validates_presence_of :itemID
validates_length_of :clientID, :minimum => 1
validates_length_of :employeeID, :minimum => 1
validates_length_of :itemID, :minimum => 1
def self.processing_orders
find(:all, :conditions => "... | Ruby |
class EmployeeController < ApplicationController
def index
@current_employees = Employee.current_employees
@current_admins = Employee.current_admins
end
def new
@employee = Employee.new
end
def create
@employee = Employee.new(params[:employee])
if @employee.save
flash[:notice] = 'Em... | Ruby |
class OrdersController < ApplicationController
def index
@processing_orders = Orders.processing_orders
@completed_orders = Orders.completed_orders
@cancelled_orders = Orders.cancelled_orders
end
def new
@order = Orders.new
end
def create
@order = Orders.new(params[:order])
if @order.save... | Ruby |
class ClientController < ApplicationController
def index
@clients_all = Client.clients_all
end
def new
@client = Client.new
end
def create
@client = Client.new(params[:client])
if @client.save
flash[:notice] = 'Client profile was successfully created.'
redirect_to :action => ... | Ruby |
# 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... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do |t|
t.string :clientID
t.string :employeeID
t.string :description
t.string :itemID
t.text :comments, :text
t.timestamps
end
end
def self.down
drop_table :orders
end
end
| Ruby |
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
t.string :email
t.string :password , :limit =>40, :default => "lab"
t.string :fname
t.string :lname
t.text :profile
t.boolean :admin, :default => true
t.timestamps
end
end
def self.down
drop_table :emplo... | Ruby |
class CreateClients < ActiveRecord::Migration
def self.up
create_table :clients do |t|
t.string :email
t.string :employeeID
t.string :fname
t.string :lname
t.integer :CCnumber
t.text :CCType, :limit =>5
t.text :CCName
t.text :profile, :text
t.timestamps
end
end
def self.down
drop_table :clie... | Ruby |
#!/usr/bin/ruby1.8
#!/usr/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 performan... | Ruby |
#!/usr/bin/ruby1.8
#!/usr/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/... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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" -- oth... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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" -- oth... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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 lo... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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" -- oth... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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" -- oth... | Ruby |
#!C:/Ruby/InstantRails-1.6-win/InstantRails/ruby/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 lo... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
source :rubygems
gem 'sinatra', '1.1.0'
gem 'thin', '1.2.7' | Ruby |
##
# This is a simple Web server, mainly for serving static content with some JavaScript in order
# to get started building a Web site.
#
# gpollice
##
require 'sinatra'
set :public_folder, File.dirname(__FILE__) + '/public'
get '/' do
redirect 'http://' + request.host_with_port() + '/index.html'
end
get '*' do
... | Ruby |
module ApplicationHelper
# Return a title on a per-page basis.
def title
base_title = "CS 441 - Project 4 - Survey Engine"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end
end
| Ruby |
module SurveyHelper
end
| Ruby |
module PagesHelper
end
| Ruby |
class Results < ActiveRecord::Base
attr_accessible :result, :question_id
belongs_to :question
validates :result, :presence => true
validates :question_id, :presence => true
end
| Ruby |
class User < ActiveRecord::Base
attr_accessible :name
validates :name, :presence => true,
:length => { :maximum => 50 },
:uniqueness => true
end
| Ruby |
class Survey < ActiveRecord::Base
attr_accessible :name
has_many :question, :dependent => :destroy
validates :name, :presence => true,
:length => { :maximum => 50 },
:uniqueness => true
end
| Ruby |
class Question < ActiveRecord::Base
attr_accessible :question, :survey_id
belongs_to :survey
has_many :result, :dependent => :destroy
validates :question, :presence => true, :length => { :maximum => 150 }
validates :survey_id, :presence => true
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
class QuestionsController < ApplicationController
def new
@question = Question.new
@title = "Add Question"
end
def create
@question = Question.new(params[:question][:survey_id])
if @question.save
flash[:success] = "Question successfully added to Survey"
redirect_to @question
else
@tit... | Ruby |
class SurveysController < ApplicationController
def new
@survey = Survey.new
@title = "Create Survey"
end
def create
@survey = Survey.new(params[:survey])
if @survey.save
flash[:success] = "Congratulations, survey successfullly created."
redirect_to sadmin_path
else
@title = "Crea... | Ruby |
class PagesController < ApplicationController
def home
@title = "Home"
#@users = User.all
@surveys = Survey.all
end
def sadmin
@title = "Survey Administration"
end
def qadmin
@title = "Question Administration"
end
def results
@title = "View Results"
end
def signup
@title = "... | Ruby |
class UsersController < ApplicationController
def new
@user = User.new
@title = "Sign up"
end
def create
@user = User.new(params[:user])
if @user.save
flash[:success] = "Welcome, you are now eligible to take a survey."
redirect_to @user
else
@title = "Sign up"
render 'new'
en... | Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for ... | Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateSurveys < ActiveRecord::Migration
def self.up
create_table :surveys do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :surveys
end
end
| Ruby |
class CreateResults < ActiveRecord::Migration
def self.up
create_table :results do |t|
t.integer :result
t.integer :quesion_id
t.timestamps
end
end
def self.down
drop_table :results
end
end
| Ruby |
class CreateQuestions < ActiveRecord::Migration
def self.up
create_table :questions do |t|
t.string :question
t.integer :survey_id
t.timestamps
end
add_index :questions, :survey_id
end
def self.down
drop_table :questions
end
end
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
Proj4::Application.load_tasks
| Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Proj4::Application
| Ruby |
Proj4::Application.routes.draw do
resources :users
resources :surveys
resources :questions
resources :results
match '/signup', :to => 'users#new'
match '/edit', :to => 'users#edit'
match '/news', :to => 'surveys#new'
match '/edits', :to => 'surveys#edit'
match '/uindex', :to => 'users#index... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Proj4
class Application < Rails::Application
# S... | Ruby |
Proj4::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserv... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.