repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/user_passwords_controller.rb | lib/controllers/frontend/spree/user_passwords_controller.rb | class Spree::UserPasswordsController < Devise::PasswordsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
include Spree::Core::ControllerHelpers::Store
include SpreeI18n::ControllerLocale... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/users_controller.rb | lib/controllers/frontend/spree/users_controller.rb | class Spree::UsersController < Spree::StoreController
before_action :set_current_order, except: :show
include Spree::Core::ControllerHelpers
def show
load_object
@orders = @user.orders.for_store(current_store).complete.order('completed_at desc')
end
def edit
load_object
end
def create
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/user_confirmations_controller.rb | lib/controllers/frontend/spree/user_confirmations_controller.rb | class Spree::UserConfirmationsController < Devise::ConfirmationsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
include Spree::Core::ControllerHelpers::Store
include SpreeI18n::Controll... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/auth/checkout_controller_decorator.rb | lib/controllers/frontend/spree/auth/checkout_controller_decorator.rb | require 'spree/core/validators/email' if Spree.version.to_f < 3.5
module Spree::Auth::CheckoutControllerDecorator
def self.prepended(base)
base.before_action :check_authorization
base.before_action :check_registration, except: [:registration, :update_registration]
end
def registration
@user = Spree.u... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/generators/spree/auth/install/install_generator.rb | lib/generators/spree/auth/install/install_generator.rb | module Spree
module Auth
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :migrate, type: :boolean, default: true, banner: 'Migrate the database'
def self.source_paths
paths = superclass.source_paths
paths << File.expand_path('../templates'... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/generators/spree/auth/install/templates/config/initializers/devise.rb | lib/generators/spree/auth/install/templates/config/initializers/devise.rb | Devise.secret_key = <%= SecureRandom.hex(50).inspect %> | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/mailers/spree/user_mailer.rb | lib/mailers/spree/user_mailer.rb | module Spree
class UserMailer < BaseMailer
def reset_password_instructions(user, token, opts = {})
@user = user
@current_store = current_store(opts)
@edit_password_reset_url = edit_password_url(token, @current_store)
mail to: user.email, from: from_address, reply_to: reply_to_address,
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/config/routes.rb | config/routes.rb | Spree::Core::Engine.add_routes do
scope '(:locale)', locale: /#{Spree.available_locales.join('|')}/, defaults: { locale: nil } do
devise_for :spree_user,
class_name: Spree.user_class.to_s,
controllers: { sessions: 'spree/user_sessions',
registrations: 's... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/config/initializers/warden.rb | config/initializers/warden.rb | # Merges users orders to their account after sign in and sign up.
Warden::Manager.after_set_user except: :fetch do |user, auth, _opts|
token = auth.cookies.signed[:guest_token] || auth.cookies.signed[:token]
token_attr = Spree::Order.has_attribute?(:token) ? :token : :guest_token
if token.present? && user.is_a?(... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/config/initializers/devise.rb | config/initializers/devise.rb | # Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = 'please-change-me@con... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/authentications_helper.rb | app/helpers/authentications_helper.rb | module AuthenticationsHelper
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/sessions_helper.rb | app/helpers/sessions_helper.rb | module SessionsHelper
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/layout_helper.rb | app/helpers/layout_helper.rb | # These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/moves_helper.rb | app/helpers/moves_helper.rb | module MovesHelper
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/users_helper.rb | app/helpers/users_helper.rb | module UsersHelper
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/messages_helper.rb | app/helpers/messages_helper.rb | module MessagesHelper
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/games_helper.rb | app/helpers/games_helper.rb | module GamesHelper
THUMB_DIR = Rails.root + "public" + "assets" + "games" + "thumbs"
def color_at(position, game = @game)
if game.black_positions_list.include? position then "b"
elsif game.white_positions_list.include? position then "w"
else "e"
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
def online_status(user)
content_tag(:span, raw("•"), :class => (user.online? ? "user_online" : "user_offline")) if user
end
def div_hidden_if(condition, options, &block)
options[:style] = "#{options[:style]}display:none;" if condition
content_tag(:div, options, &block)
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/helpers/error_messages_helper.rb | app/helpers/error_messages_helper.rb | module ErrorMessagesHelper
# Render error messages for the given objects. The :message and :header_message options are allowed.
def error_messages_for(*objects)
options = objects.extract_options!
options[:header_message] ||= "Invalid Fields"
options[:message] ||= "Correct the following errors and try ag... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/moves_controller.rb | app/controllers/moves_controller.rb | class MovesController < ApplicationController
def index
@game = Game.find(params[:game_id])
@moves = @game.moves_after(params[:after].to_i)
end
def create
@game = Game.find(params[:game_id])
@game.move(params[:move], current_user)
@game.queue_computer_move
Notifications.move(@game).delive... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/users_controller.rb | app/controllers/users_controller.rb | class UsersController < ApplicationController
before_filter :login_required, :except => [:show, :new, :create, :unsubscribe]
def show
@user = User.where(:guest => false).find(params[:id])
@games = @user.games.recent.paginate(:per_page => 5, :page => params[:page])
end
def new
if params[:email]
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/authentications_controller.rb | app/controllers/authentications_controller.rb | class AuthenticationsController < ApplicationController
def index
end
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
current_user.move_games_to(authentication.user) if current_u... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/games_controller.rb | app/controllers/games_controller.rb | class GamesController < ApplicationController
before_filter :login_required, :only => [:your, :edit, :update]
before_filter :fetch_games, :only => [:index, :show, :other, :your, :new]
def index
@users = User.where("publicized_at is not null").order("publicized_at desc").limit(7)
@other_games = @other_gam... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/messages_controller.rb | app/controllers/messages_controller.rb | class MessagesController < ApplicationController
before_filter :user_required
def create
@message = Message.new(params[:message])
@message.user = current_user
@message.save
Notifications.chat_message(@message).deliver if @message.send_email?
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/sessions_controller.rb | app/controllers/sessions_controller.rb | class SessionsController < ApplicationController
def new
end
def create
user = User.authenticate(params[:login], params[:password])
if user
remember_user(user)
flash[:notice] = "Logged in successfully."
redirect_to_target_or_default("/")
else
flash.now[:alert] = "Invalid login... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
include ControllerAuthentication
protect_from_forgery
before_filter :mark_user_request, :if => :logged_in?
before_filter :set_user_time_zone, :if => :logged_in?
private
def mark_user_request
current_user.update_attribute(:last_request_at, Time.now)
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/models/authentication.rb | app/models/authentication.rb | class Authentication < ActiveRecord::Base
belongs_to :user
def provider_name
if provider == 'open_id'
"OpenID"
else
provider.titleize
end
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/models/game.rb | app/models/game.rb | class Game < ActiveRecord::Base
#################
### Callbacks ###
#################
after_save :generate_thumbnail, :if => :update_thumbnail
def generate_thumbnail
GameThumb.generate(id, board_size, black_positions, white_positions) unless Rails.env.test?
end
####################
### Associatio... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/models/message.rb | app/models/message.rb | class Message < ActiveRecord::Base
attr_accessible :game_id, :content, :move_index
belongs_to :game
belongs_to :user
validate :ensure_player
validates_presence_of :user_id, :game_id, :content
before_create :remember_move_index
def ensure_player
if game && !game.player?(user)
errors.add :game_... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/models/profile.rb | app/models/profile.rb | class Profile
attr_accessor :captured, :handicap_or_komi, :user, :color, :score, :last_status, :current
def initialize(color)
@color = color
end
def user_id
user ? user.id : 0
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/models/user.rb | app/models/user.rb | class User < ActiveRecord::Base
attr_accessible :username, :email, :password, :password_confirmation, :guest, :rank, :email_on_invitation, :email_on_move, :email_on_message, :time_zone
has_many :authentications
has_many :messages
attr_accessor :password
before_save :prepare_password
before_create :generat... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/app/mailers/notifications.rb | app/mailers/notifications.rb | class Notifications < ActionMailer::Base
default :from => "noreply@govsgo.com"
def invitation(game)
@game = game
mail :to => @game.current_player.email, :subject => "[Go vs Go] Invitation from #{@game.opponent.username}"
end
def move(game)
@game = game
mail :to => @game.current_player.email, :... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/seeds.rb | db/seeds.rb | # 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 | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101028222332_add_token_to_users.rb | db/migrate/20101028222332_add_token_to_users.rb | class AddTokenToUsers < ActiveRecord::Migration
def self.up
add_column :users, :token, :string
add_index :users, :token
end
def self.down
remove_index :user, :token
remove_column :users, :token
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101215010754_add_email_options_to_users.rb | db/migrate/20101215010754_add_email_options_to_users.rb | class AddEmailOptionsToUsers < ActiveRecord::Migration
def self.up
add_column :users, :email_on_invitation, :boolean, :default => false, :null => false
add_column :users, :email_on_move, :boolean, :default => false, :null => false
add_column :users, :unsubscribe_token, :string
end
def self.down
r... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20110212190716_add_time_zone_to_users.rb | db/migrate/20110212190716_add_time_zone_to_users.rb | class AddTimeZoneToUsers < ActiveRecord::Migration
def self.up
add_column :users, :time_zone, :string
end
def self.down
remove_column :users, :time_zone
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20110212173010_create_messages.rb | db/migrate/20110212173010_create_messages.rb | class CreateMessages < ActiveRecord::Migration
def self.up
create_table :messages do |t|
t.integer :game_id
t.integer :user_id
t.text :content
t.integer :move_index
t.timestamps
end
end
def self.down
drop_table :messages
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101023213811_remove_valid_positions_from_games.rb | db/migrate/20101023213811_remove_valid_positions_from_games.rb | class RemoveValidPositionsFromGames < ActiveRecord::Migration
def self.up
remove_column :games, :valid_positions
end
def self.down
add_column :games, :valid_positions, :text
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101016012116_create_users.rb | db/migrate/20101016012116_create_users.rb | class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :username
t.string :email
t.string :password_hash
t.string :password_salt
t.timestamps
end
end
def self.down
drop_table :users
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101016203316_create_authentications.rb | db/migrate/20101016203316_create_authentications.rb | class CreateAuthentications < ActiveRecord::Migration
def self.up
create_table :authentications do |t|
t.integer :user_id
t.string :provider
t.string :uid
t.timestamps
end
end
def self.down
drop_table :authentications
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101017234019_add_indexes.rb | db/migrate/20101017234019_add_indexes.rb | class AddIndexes < ActiveRecord::Migration
def self.up
add_index :authentications, :user_id
add_index :games, :black_player_id
add_index :games, :white_player_id
add_index :games, :current_player_id
add_index :games, [:id, :current_player_id, :finished_at]
end
def self.down
remove_index :... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101022230300_add_rank_to_users.rb | db/migrate/20101022230300_add_rank_to_users.rb | class AddRankToUsers < ActiveRecord::Migration
def self.up
add_column :users, :rank, :string
end
def self.down
remove_column :users, :rank
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20110212191244_add_email_on_message_to_users.rb | db/migrate/20110212191244_add_email_on_message_to_users.rb | class AddEmailOnMessageToUsers < ActiveRecord::Migration
def self.up
add_column :users, :email_on_message, :boolean, :default => false, :null => false
end
def self.down
remove_column :users, :email_on_message
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101029233118_add_avatar_url_to_users.rb | db/migrate/20101029233118_add_avatar_url_to_users.rb | class AddAvatarUrlToUsers < ActiveRecord::Migration
def self.up
add_column :users, :avatar_url, :string
end
def self.down
remove_column :users, :avatar_url
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101216234423_add_publicized_at_to_users.rb | db/migrate/20101216234423_add_publicized_at_to_users.rb | class AddPublicizedAtToUsers < ActiveRecord::Migration
def self.up
add_column :users, :publicized_at, :datetime
end
def self.down
remove_column :users, :publicized_at
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101016000701_create_games.rb | db/migrate/20101016000701_create_games.rb | class CreateGames < ActiveRecord::Migration
def self.up
create_table :games do |t|
t.integer :black_player_id
t.integer :white_player_id
t.integer :current_player_id
t.float :black_score
t.float :white_score
t.text :black_positions
t.text :white_positions
t.text :mo... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101022221421_add_last_request_at_to_users.rb | db/migrate/20101022221421_add_last_request_at_to_users.rb | class AddLastRequestAtToUsers < ActiveRecord::Migration
def self.up
add_column :users, :last_request_at, :datetime
end
def self.down
remove_column :users, :last_request_at
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/db/migrate/20101016144720_add_guest_to_users.rb | db/migrate/20101016144720_add_guest_to_users.rb | class AddGuestToUsers < ActiveRecord::Migration
def self.up
add_column :users, :guest, :boolean, :default => false, :null => false
end
def self.down
remove_column :users, :guest
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/autotest/discover.rb | autotest/discover.rb | Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/factories.rb | spec/factories.rb | Factory.define :user do |f|
f.sequence(:username) { |n| "foo#{n}" }
f.sequence(:email) { |n| "foo#{n}@example.com" }
f.password "foobar"
f.password_confirmation { |u| u.password }
end
Factory.define :game do |f|
f.association(:black_player, :factory => :user)
f.association(:white_player, :factory => :user)... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/spec_helper.rb | spec/spec_helper.rb | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.jo... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/messages_controller_spec.rb | spec/controllers/messages_controller_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe MessagesController do
fixtures :all
render_views
describe "as guest" do
it "create action should redirect to signin url" do
get :create
response.should redirect_to(signin_url)
end
end
describe "as user" do
before(:each) do
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/sessions_controller_spec.rb | spec/controllers/sessions_controller_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe SessionsController do
fixtures :all
render_views
it "new action should render new template" do
get :new
response.should render_template(:new)
end
it "create action should render new template when authentication is invalid" do
User.stub... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/users_controller_spec.rb | spec/controllers/users_controller_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe UsersController do
fixtures :all
render_views
it "show action should render show template" do
user = Factory(:user)
get :show, :id => user
response.should render_template(:show)
end
it "show action should report 404 for guest user" do
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/authentications_controller_spec.rb | spec/controllers/authentications_controller_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe AuthenticationsController do
fixtures :all
render_views
it "index action should render index template" do
get :index
response.should render_template(:index)
end
it "create action should redirect to root after logging in a user when authent... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/moves_controller_spec.rb | spec/controllers/moves_controller_spec.rb | require 'spec_helper'
describe MovesController do
fixtures :all
render_views
it "should show moves in game" do
game = Factory(:game, :moves => "aa-bb-cc")
get "index", :game_id => game.id, :format => "js", :after => 1
response.body.should include("\"bb-cc\"")
end
it "should add a move and respo... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/controllers/games_controller_spec.rb | spec/controllers/games_controller_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe GamesController do
fixtures :all
render_views
it "index action should render index template" do
get :index
response.should render_template(:index)
end
it "show action should render show template" do
get :show, :id => Game.first
res... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/models/message_spec.rb | spec/models/message_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe Message do
it "should validate that the user is a player in a game" do
game = Factory(:game)
Factory.build(:message, :game => game, :user => game.black_player).should be_valid
Factory.build(:message, :game => game, :user => Factory(:user)).shoul... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/models/game_spec.rb | spec/models/game_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe Game do
before :each do
@game = Game.new
end
it "should require a valid board_size" do
@game.board_size = 50
@game.should have(1).error_on(:board_size)
@game.board_size = 9
@game.should have(:no).errors_on(:board_size)
end
it "... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/models/authentication_spec.rb | spec/models/authentication_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe Authentication do
it "should be valid" do
Authentication.new.should be_valid
end
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/models/user_spec.rb | spec/models/user_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe User do
before(:each) do
User.delete_all
end
it "should be valid" do
Factory.build(:user).should be_valid
end
it "guest should be valid when empty" do
User.new(:guest => true).should have(0).errors
end
it "guest should require pas... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/lib/game_engine_spec.rb | spec/lib/game_engine_spec.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe GameEngine do
describe "without gtp stub" do
before(:each) do
@gtp = Go::GTP.run_gnugo
@engine = GameEngine.new(@gtp)
end
after(:each) do
@gtp.quit
end
it "should raise illegal suicide move when placing a stone in sur... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/spec/mailers/notifications_spec.rb | spec/mailers/notifications_spec.rb | require "spec_helper"
describe Notifications do
it "invitation should send to current player of game" do
game = Factory(:game)
game.current_player = game.black_player
mail = Notifications.invitation(game)
mail.subject.should == "[Go vs Go] Invitation from #{game.white_player.username}"
mail.to.sh... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/lib/game_thumb.rb | lib/game_thumb.rb | require "fileutils"
module GameThumb
IMAGE_DIR = File.join(File.dirname(__FILE__), *%w[.. public images thumbnail])
THUMB_DIR = File.join(File.dirname(__FILE__), *%w[.. public assets games thumbs])
module_function
def generate(id, size, black_positions, white_positions)
images = File.join(IMAGE_DIR, size... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/lib/game_engine.rb | lib/game_engine.rb | class GameEngine
class Error < StandardError; end
class IllegalMove < Error; end
class OutOfTurn < Error; end
def self.run(options = {})
Go::GTP.run_gnugo do |gtp|
gtp.boardsize(options[:board_size]) unless options[:board_size].to_s.empty?
gtp.fixed_handicap(options[:handicap]) if options[:hand... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/lib/controller_authentication.rb | lib/controller_authentication.rb | # This module is included in your application controller which makes
# several methods available to all controllers and views. Here's a
# common example you might add to your application layout file.
#
# <% if logged_in? %>
# Welcome <%= current_user.username %>.
# <%= link_to "Edit profile", edit_user_path %... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/application.rb | config/application.rb | require File.expand_path('../boot', __FILE__)
require 'rails/all'
PRIVATE_CONFIG = YAML.load_file(File.expand_path('../private.yml', __FILE__))
# 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 d... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/environment.rb | config/environment.rb | # Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Govsgo::Application.initialize!
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/routes.rb | config/routes.rb | Govsgo::Application.routes.draw do
resources :messages
match 'auth/:provider/callback' => 'authentications#create'
match 'user/edit' => 'users#edit', :as => :edit_current_user
match 'signin' => 'authentications#index', :as => :signin
match 'signup' => 'users#new', :as => :signup
match 'logout' => 'sessions... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/god.rb | config/god.rb | # run with: god -c config/god.rb
RAILS_ROOT = File.expand_path("../..", __FILE__)
God.watch do |w|
w.name = "govsgo-worker"
w.interval = 30.seconds
w.env = {"RAILS_ENV" => "production"}
w.start = "#{RAILS_ROOT}/script/worker"
w.log = "#{RAILS_ROOT}/log/worker.log"
w.start_if do |start|
start.condition... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/deploy.rb | config/deploy.rb | require "bundler/capistrano"
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
default_run_options[:pty] = true
set :application, "govsgo.com"
role :app, application
role :web, application
role :db, application, :primary => true
set :user, "rbates"
set :dep... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/boot.rb | config/boot.rb | require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gem... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/schedule.rb | config/schedule.rb | set :output, "#{path}/log/cron.log"
every :reboot do
command "god -c #{path}/config/god.rb"
end
every 1.hour do
rake "queue_computer_moves" # just in case some computer moves slipped through the cracks
end
every 1.day do
rake "clear_stuck_games" # in case GNU Go gets stuck on some difficult games
end
| ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/security_fix.rb | config/initializers/security_fix.rb | # from https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ
# and https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/1h2DR63ViGo
ActiveSupport::XmlMini::PARSING.delete("symbol")
ActiveSupport::XmlMini::PARSING.delete("yaml")
ActionDispatch::ParamsParser::DEFAULT_PA... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/session_store.rb | config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Govsgo::Application.config.session_store :cookie_store, :key => '_govsgo_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake d... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/omniauth.rb | config/initializers/omniauth.rb | require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, PRIVATE_CONFIG["twitter_key"], PRIVATE_CONFIG["twitter_secret"]
provider :facebook, PRIVATE_CONFIG["facebook_id"], PRIVATE_CONFIG["facebook_secret"]
provider :open_id, OpenID::Store::Filesystem.new('/... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/inflections.rb | config/initializers/inflections.rb | # 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):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # 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 | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/initializers/secret_token.rb | config/initializers/secret_token.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/environments/test.rb | config/environments/test.rb | Govsgo::Application.configure do
# 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 s... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/environments/development.rb | config/environments/development.rb | Govsgo::Application.configure do
# 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 webser... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
ryanb/govsgo | https://github.com/ryanb/govsgo/blob/c8d739d59ddd3239dc6a34cb11c9331a5874e632/config/environments/production.rb | config/environments/production.rb | Govsgo::Application.configure do
# 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
# Full error reports are disabled and caching is turned on
... | ruby | MIT | c8d739d59ddd3239dc6a34cb11c9331a5874e632 | 2026-01-04T17:41:32.451186Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/gems.rb | gems.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2012-2025, by Samuel Williams.
source "https://rubygems.org"
gemspec
group :maintenance, optional: true do
gem "bake-gem"
gem "bake-modernize"
gem "bake-releases"
gem "agent-context"
gem "utopia-project"
end
group :development do... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake.rb | bake.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
# Update the project documentation with the new version number.
#
# @parameter version [String] The new version number.
def after_gem_release_version_increment(version)
context["releases:update"].call(version)
con... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/benchmark/string_vs_symbol.rb | benchmark/string_vs_symbol.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "benchmark/ips"
STRING_HASH = { "foo" => "bar" }
SYMBOL_HASH = { :foo => "bar" }
Benchmark.ips do |x|
x.report("string") {STRING_HASH["foo"]}
x.report("symbol") {SYMBOL_HASH[:foo]}
x.report("symbo... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/benchmark/const_vs_hash.rb | benchmark/const_vs_hash.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require "benchmark/ips"
module Foo
class Bar
end
end
THINGS = {
"Bar" => Foo::Bar
}
Benchmark.ips do |x|
x.report("const_get('Bar')") do |i|
while (i -= 1) > 0
Foo.const_get("Bar")
end
end
x.... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/benchmark/hash_vs_openstruct.rb | benchmark/hash_vs_openstruct.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "benchmark/ips"
require "ostruct"
# This benchmark compares accessing an instance variable vs accessing a struct member (via a function). The actual method dispatch is about 25% slower.
puts "Ruby #{R... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/benchmark/struct_vs_class.rb | benchmark/struct_vs_class.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "benchmark/ips"
# This benchmark compares accessing an instance variable vs accessing a struct member (via a function). The actual method dispatch is about 25% slower.
puts "Ruby #{RUBY_VERSION} at #{... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/benchmark/call_vs_check.rb | benchmark/call_vs_check.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require "benchmark/ips"
class A
end
class B
def self.do
end
end
class C
def self.do
end
end
Benchmark.ips do |x|
x.report("responds_to? (nothing)") do |times|
while (times -= 1) >= 0
A.do if A.res... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/fixtures/a_rack_application.rb | fixtures/a_rack_application.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "rack/test"
require "rack/builder"
ARackApplication = Sus::Shared("a rack app") do |rackup_path|
include Rack::Test::Methods
let(:rackup_directory) {File.dirname(rackup_path)}
let(:app) {Rack::Bui... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/command.rb | test/utopia/command.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "fileutils"
require "tmpdir"
require "yaml"
require "bundler"
describe "utopia command" do
let(:utopia_path) {File.expand_path("../..", __dir__)}
def around
Bundler.with_unbundled_env do
supe... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/path.rb | test/utopia/path.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2012-2025, by Samuel Williams.
require "utopia/path"
describe Utopia::Path do
with "#load / #dump" do
let(:string) {"foo/bar/baz"}
let(:path) {subject.load(string)}
it "loads a string" do
expect(path).to be_a(subject)
end
... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content.rb | test/utopia/content.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2012-2025, by Samuel Williams.
require "rack/test"
require "utopia/content"
describe Utopia::Content do
include Rack::Test::Methods
let(:app) {Rack::Builder.parse_file(File.expand_path("content.ru", __dir__))}
it "should generate ide... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/session.rb | test/utopia/session.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014-2025, by Samuel Williams.
# Copyright, 2019, by Huba Nagy.
require "rack"
require "rack/test"
require "utopia/session"
describe Utopia::Session do
include Rack::Test::Methods
let(:app) {Rack::Builder.parse_file(File.expand_path("s... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/empty.rb | test/utopia/empty.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2025, by Samuel Williams.
require "rack/test"
require "utopia/content"
describe Utopia::Content do
include Rack::Test::Methods
let(:app) {Rack::Builder.parse_file(File.expand_path("empty.ru", __dir__))}
it "should report 404 mis... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/performance.rb | test/utopia/performance.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "a_rack_application"
require "benchmark/ips" if ENV["BENCHMARK"]
require "ruby-prof" if ENV["PROFILE"]
require "flamegraph" if ENV["FLAMEGRAPH"]
describe "Utopia Performance" do
include_context ARack... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/extensions.rb | test/utopia/extensions.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014-2025, by Samuel Williams.
require "utopia/extensions/array_split"
require "utopia/extensions/date_comparisons"
describe Array do
it "should split in the middle" do
a = [1, 2, 3, 4, 5]
a, b, c = a.split_at{|x| x == 3}
expec... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/setup.rb | test/utopia/setup.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
# Copyright, 2017, by Huba Nagy.
require "utopia/setup"
describe Utopia::Setup do
let(:config_root) {File.expand_path("setup_spec/config", __dir__)}
let(:setup) {subject.new(config_root)}
let(:environment... | ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
socketry/utopia | https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/middleware.rb | test/utopia/middleware.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2015-2025, by Samuel Williams.
require "utopia/middleware"
describe Utopia do
it "should give a default path relative to the cwd" do
expect(File).to be(:exist?, Utopia.default_root(".content", __dir__))
end
end
| ruby | MIT | e8c13eb0a2333604ac73a86e6eae5811188b391d | 2026-01-04T17:41:40.378363Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.