code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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/destroy' | 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/breakpointer' | 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/about' | 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/console' | 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/process/spawner'
| 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/inspector'
| 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/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/performance/benchmarker'
| 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/benchmarker'
| 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/generate' | Ruby |
module MonitorshipsHelper
end
| Ruby |
require 'md5'
module ApplicationHelper
def submit_tag(value = "Save Changes"[], options={} )
or_option = options.delete(:or)
return super + "<span class='button_or'>"+"or"[]+" " + or_option + "</span>" if or_option
super
end
def ajax_spinner_for(id, spinner="spinner.gif")
"<img src='/images/#{sp... | Ruby |
module ModeratorsHelper
end
| Ruby |
module SessionsHelper
end
| Ruby |
module TopicsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module PostsHelper
end
| Ruby |
module ForumsHelper
# used to know if a topic has changed since we read it last
def recent_topic_activity(topic)
return false if not logged_in?
return topic.replied_at > (session[:topics][topic.id] || last_active)
end
# used to know if a forum has changed since we read it last
def recent_forum_... | Ruby |
Session = CGI::Session::ActiveRecordStore::Session
Session.class_eval do
def self.sweep!
delete_all ['updated_at < ?', 15.minutes.ago.utc]
end
end | Ruby |
class UserMailer < ActionMailer::Base
def signup(user, domain, sent_at = Time.now)
@subject = 'Welcome to Beast'[:beast_welcome]
@body = {:user => user, :domain => domain}
@recipients = user.email
@from = 'beast@' + domain.split(":").first
@sent_on = sent_at
@headers = {}... | Ruby |
class Post < ActiveRecord::Base
belongs_to :forum, :counter_cache => true
belongs_to :user, :counter_cache => true
belongs_to :topic, :counter_cache => true
format_attribute :body
before_create { |r| r.forum_id = r.topic.forum_id }
after_create { |r| Topic.update_all(['replied_at = ?, replied_by = ?, las... | Ruby |
class Forum < ActiveRecord::Base
acts_as_list
validates_presence_of :name
has_many :moderatorships, :dependent => :destroy
has_many :moderators, :through => :moderatorships, :source => :user, :order => 'users.login'
has_many :topics, :order => 'sticky desc, replied_at desc', :dependent => :destroy do
d... | Ruby |
class Moderatorship < ActiveRecord::Base
belongs_to :forum
belongs_to :user
before_create { |r| count(:all, :conditions => ['forum_id = ? and user_id = ?', r.forum_id, r.user_id]).zero? }
end
| Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
has_many :moderatorships, :dependent => :destroy
has_many :forums, :through => :moderatorships, :order => 'forums.name'
has_many :posts
has_many :topics
has_many :monitorships
has_many :monitored_topics, :through => :monitorships, :conditions => ['moni... | Ruby |
class Monitorship < ActiveRecord::Base
belongs_to :user
belongs_to :topic
end
| Ruby |
class Topic < ActiveRecord::Base
belongs_to :forum, :counter_cache => true
belongs_to :user
has_many :monitorships
has_many :monitors, :through => :monitorships, :conditions => ['monitorships.active = ?', true], :source => :user, :order => 'users.login'
has_many :posts, :order => 'posts.created_at', :depende... | Ruby |
class PostsController < ApplicationController
before_filter :find_post, :except => [:index, :create, :monitored, :search]
before_filter :login_required, :except => [:index, :monitored, :search, :show]
@@query_options = { :per_page => 25, :select => 'posts.*, topics.title as topic_title, forums.name as forum_... | Ruby |
class MonitorshipsController < ApplicationController
before_filter :login_required
def create
@monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(current_user.id, params[:topic_id])
@monitorship.update_attribute :active, true
respond_to do |format|
format.html { redirect_to top... | Ruby |
class ModeratorsController < ApplicationController
before_filter :login_required
def destroy
Moderatorship.delete_all ['id = ?', params[:id]]
redirect_to user_path(params[:user_id])
end
alias authorized? admin?
end
| Ruby |
class SessionController < ApplicationController
def create
if open_id?(params[:login])
open_id_authentication params[:login]
else
password_authentication params[:login], params[:password]
end
end
def destroy
session.delete
cookies.delete :login_token
flash[:notice] = "You h... | Ruby |
class TopicsController < ApplicationController
before_filter :find_forum_and_topic, :except => :index
before_filter :login_required, :only => [:new, :create, :edit, :update, :destroy]
# before_filter :update_last_seen_at, :only => :show
def index
respond_to do |format|
format.html { redirect_to forum_... | Ruby |
class UsersController < ApplicationController
before_filter :login_required, :only => [:edit, :update, :destroy, :admin]
before_filter :find_user, :only => [:edit, :update, :destroy, :admin]
def index
respond_to do |format|
format.html do
@user_pages, @users = paginate(:users, :per_page =>... | Ruby |
class ApplicationController < ActionController::Base
init_gettext "beast" if Object.const_defined?(:GetText)
include ExceptionLoggable, BrowserFilters, AuthenticationSystem
session :session_key => '_beast_session_id'
helper_method :current_user, :logged_in?, :admin?, :last_active
before_filter :login_by_tok... | Ruby |
class ForumsController < ApplicationController
before_filter :login_required, :except => [ :index, :show ]
before_filter :find_or_initialize_forum, :except => :index
def index
@forums = Forum.find(:all, :order => "position")
# reset the page of each forum we have visited when we go back to index
sess... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.home '', :controller => 'forums', :action => 'index'
map.open_id_complete 'session', :controller => "session", :action => "create", :requirements => { :method => :get }
map.resource :session
map.resources :users, :member => { :admin => :post } do |user|
... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /mswin32/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
RAILS... | Ruby |
# Be sure to restart your web 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_VERSIO... | 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 |
# 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 |
# =============================================================================
# A set of rake tasks for invoking the Capistrano automation utility.
# =============================================================================
# Invoke the given actions via Capistrano
def cap(*parameters)
begin
require 'rubyg... | Ruby |
desc "freeze rails edge"
task :deploy_edge do
ENV['SHARED_PATH'] = '../../shared' unless ENV['SHARED_PATH']
ENV['RAILS_PATH'] ||= File.join(ENV['SHARED_PATH'], 'rails')
ENV['REPO_BRANCH'] ||= 'trunk'
checkout_path = File.join(ENV['RAILS_PATH'], 'trunk')
export_path = "#{ENV['RAILS_PATH']}/rev_#{ENV['REV... | Ruby |
module AuthenticationSystem
protected
# this is used to keep track of the last time a user has been seen (reading a topic)
# it is used to know when topics are new or old and which should have the green
# activity light next to them
#
# we cheat by not calling it all the time, but rather only when... | Ruby |
class CreateMemberships < ActiveRecord::Migration
def self.up
create_table :memberships do |t|
t.integer :repository_id
t.integer :user_id
t.timestamps
end
end
def self.down
drop_table :memberships
end
end
| Ruby |
class CreateRepositories < ActiveRecord::Migration
def self.up
create_table :repositories do |t|
t.string :name
t.string :path
t.text :desc
t.timestamps
end
end
def self.down
drop_table :repositories
end
end
| Ruby |
class CreateNotes < ActiveRecord::Migration
def self.up
create_table :notes do |t|
t.integer :user_id
t.integer :repository_id
t.string :title
t.text :body
t.timestamps
end
end
def self.down
drop_table :notes
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :login, :string
t.column :email, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :str... | 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 |
#!/usr/bin/ruby18
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 performance is severely impaired
... | Ruby |
#!/usr/bin/ruby18
#
# 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/log/fastcgi.crash.log
# ... | 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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
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/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/destroy'
| 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/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | 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/dbconsole'
| 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/plugin'
| 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/spawner'
| 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/reaper'
| 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/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/benchmarker'
| 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/generate'
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def only_for_admin
if logged_in? && @signed_user.is_admin?
yield
end
end
def display_sign_action
if logged_in?
link_to('°Sign-Out', signout_path)
else
"#{link_to('°Sign-In', signi... | Ruby |
module NotesHelper
def display_note_body(note)
BlueCloth::new( note.body ).to_html
end
end
| Ruby |
module SessionsHelper
end | Ruby |
module UsersHelper
end | Ruby |
module MembersHelper
end
| Ruby |
module RepositoriesHelper
end
| Ruby |
#
# Copyright (C) 2006 Warren Konkel and Bounty Source, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# T... | Ruby |
module MainHelper
end
| Ruby |
class Note < ActiveRecord::Base
belongs_to :repository
belongs_to :user
validates_presence_of :title, :body
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.