code
stringlengths
1
1.73M
language
stringclasses
1 value
# 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
require 'ldap' class LdapUser def self.authenticate(username,password) ldap=LDAP::Conn.new('172.16.0.17',389) ldap.bind("CN=#{username},DC=WORKSOFT,DC=COM,DC=CN",password) return ldap.bound? rescue LDAP::ResultError return false ensure ldap.unb...
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
task :upload => :appcast desc "uploads the artifacts to google code" task :upload do require 'yaml' yaml = YAML.load_file('ChangeLog.yml') version = yaml.first['version'] file = "build/Release/Time Tracker-#{version}.zip" html_file = "appcast/timetracker-#{version}.html" sh "python tasks/googlecode_upload....
Ruby
require 'yaml' require 'text/format' require 'builder' #task :build_release => [:spec, :features, :changelog] do desc "Builds the release package which can be uploaded" task :build_release => [:changelog] do sh "xcodebuild -configuration Release -target 'Release Package' -arch 'i386 x86_64 ppc' -project 'Time Tracke...
Ruby
require "rubygems" require "rake" Dir['tasks/**/*.rake'].each { |rake| load rake } task :clean => "objc:clean"
Ruby
# bim-tools.rb # # Copyright (C) 2014 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the License, ...
Ruby
# planars_from_faces.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 o...
Ruby
# toggle_geometry.rb # # Copyright (C) 2014 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lic...
Ruby
# walls_from_edges.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Li...
Ruby
# clear_properties.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Li...
Ruby
# clsBtLibrary.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the ...
Ruby
# clsBtProject.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the ...
Ruby
# bim-tools_loader.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of ...
Ruby
# clsPlanarElement.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of ...
Ruby
# clsIfcBase.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the License,...
Ruby
# clsIfcUnits.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the License...
Ruby
# clsIfcBuilding.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lice...
Ruby
# clsIfcGeometry.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lice...
Ruby
# project_data.rb # # Copyright 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lice...
Ruby
# clsBtSelection.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lice...
Ruby
module Brewsky module BimTools # Custom WebDialog wrapper that works around problems with WebDialog#set_html # under OSX after Safari 5.0.6 is installed. # # Example is bare bone without any error checking. Expand as you find fit. class WebDialogPatch < UI::WebDialog # @note S...
Ruby
# clsIfcExport.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the ...
Ruby
# ObserverManager.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of t...
Ruby
# dlgSecPLanarsFromFaces.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of ...
Ruby
# clsBuildingElement.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 o...
Ruby
# find_ifc_entities.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the L...
Ruby
# bt_dialog_js.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the ...
Ruby
# bt_dialog_css.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the...
Ruby
# toolbar.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the License, or...
Ruby
# clsWallsFromEdges.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the L...
Ruby
# clsBtUi.rb # # Copyright (C) 2013 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the License, or...
Ruby
# bt_dialog.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Lic...
Ruby
# clsDialogSection.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Li...
Ruby
# clsWallsFromEdges.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the L...
Ruby
# dlgSecPLanarsFromFaces.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of ...
Ruby
# dlgSecPLanarsFromFaces.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of ...
Ruby
# clsEntityInfo.rb # # Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl> # # 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 3 of the Licen...
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 DefaultTrialsAndTravails < ActiveRecord::Migration def self.up TrialsAndTravails.delete_all TrialsAndTravails.create(:name => 'The Hand of War') TrialsAndTravails.create(:name => 'Press-Ganged') TrialsAndTravails.create(:name => 'Calamity') TrialsAndTravails.create(:name => 'Ship-Lorn')...
Ruby
class DefaultRoles < ActiveRecord::Migration def self.up Role.delete_all Role.create(:name => 'Admin') Role.create(:name => 'Registered') Role.create(:name => 'Guest') end def self.down Role.delete_all end end
Ruby
class AddGenderToCharacters < ActiveRecord::Migration def self.up add_column :characters, :gender, :string end def self.down remove_column :characters, :gender end end
Ruby
class AddRoleIdToUsers < ActiveRecord::Migration def self.up add_column :users, :role_id, :integer, :default => Role.find_by_name("Registered").id end def self.down remove_column :users, :role_id end end
Ruby
class AddUsernameToUsers < ActiveRecord::Migration def self.up add_column :users, :username, :string end def self.down remove_column :users, :username end end
Ruby
class DefaultCareers < ActiveRecord::Migration def self.up Career.delete_all Career.create(:name => 'Astropath Transcendent') Career.create(:name => 'Arch-Militant') Career.create(:name => 'Void-Master') Career.create(:name => 'Explorator') Career.create(:name => 'Missionary') Career....
Ruby
class AddStatsToCharacters < ActiveRecord::Migration def self.up add_column :characters, :weapon_skill, :integer, :null => false add_column :characters, :ballistic_skill, :integer, :null => false add_column :characters, :strength, :integer, :null => false add_column :characters, :toughness, :integer, ...
Ruby
class AddHomeWorldToCharacters < ActiveRecord::Migration def self.up add_column :characters, :home_world_id, :integer end def self.down remove_column :characters, :home_world_id end end
Ruby
class CreateLureOfTheVoids < ActiveRecord::Migration def self.up create_table :lure_of_the_voids do |t| t.string :name t.timestamps end end def self.down drop_table :lure_of_the_voids end end
Ruby
class CreateTrialsAndTravails < ActiveRecord::Migration def self.up create_table :trials_and_travails do |t| t.string :name t.timestamps end end def self.down drop_table :trials_and_travails end end
Ruby
class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null => false t.recoverable t.rememberable t.trackable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.tok...
Ruby
class CreateBirthrights < ActiveRecord::Migration def self.up create_table :birthrights do |t| t.string :name t.timestamps end end def self.down drop_table :birthrights end end
Ruby
class AddSessionsTable < ActiveRecord::Migration def self.up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sessions end end
Ruby
class DefaultHomeWorlds < ActiveRecord::Migration def self.up HomeWorld.delete_all HomeWorld.create(:name => 'Death World') HomeWorld.create(:name => 'Void Born') HomeWorld.create(:name => 'Forge World') HomeWorld.create(:name => 'Hive World') HomeWorld.create(:name => 'Imperial World') ...
Ruby
class AddTrialsAndTravailsToCharacters < ActiveRecord::Migration def self.up add_column :characters, :trials_and_travails_id, :integer end def self.down remove_column :characters, :trials_and_travails_id end end
Ruby
class CreateHomeWorlds < ActiveRecord::Migration def self.up create_table :home_worlds do |t| t.string :name t.timestamps end end def self.down drop_table :home_worlds end end
Ruby
class DefaultMotivations < ActiveRecord::Migration def self.up Motivation.delete_all Motivation.create(:name => 'Endurance') Motivation.create(:name => 'Fortune') Motivation.create(:name => 'Vengeance') Motivation.create(:name => 'Renown') Motivation.create(:name => 'Pride') Motivatio...
Ruby
class AddMotivationToCharacters < ActiveRecord::Migration def self.up add_column :characters, :motivation_id, :integer end def self.down remove_column :characters, :motivation_id end end
Ruby
class CreateCharacters < ActiveRecord::Migration def self.up create_table :characters do |t| t.string :name t.integer :user_id t.integer :career_path_id t.integer :experience_to_spend, :default => 500 t.integer :experience_spent, :default => 4500 t.timestamps end end ...
Ruby
class AddBirthrightToCharacters < ActiveRecord::Migration def self.up add_column :characters, :birthright_id, :integer end def self.down remove_column :characters, :birthright_id end end
Ruby
class CreateCareers < ActiveRecord::Migration def self.up create_table :careers do |t| t.string :name t.timestamps end end def self.down drop_table :careers end end
Ruby
class AddCareerToCharacters < ActiveRecord::Migration def self.up add_column :characters, :career_id, :integer end def self.down remove_column :characters, :career_id end end
Ruby
class AddLureOfTheVoidToCharacters < ActiveRecord::Migration def self.up add_column :characters, :lure_of_the_void_id, :integer end def self.down remove_column :characters, :lure_of_the_void_id end end
Ruby
class DefaultLureOfTheVoids < ActiveRecord::Migration def self.up LureOfTheVoid.delete_all LureOfTheVoid.create(:name => 'Tainted') LureOfTheVoid.create(:name => 'Criminal') LureOfTheVoid.create(:name => 'Renegade') LureOfTheVoid.create(:name => 'Duty Bound') LureOfTheVoid.create(:name =>...
Ruby
class CreateRoles < ActiveRecord::Migration def self.up create_table :roles do |t| t.string :name t.timestamps end end def self.down drop_table :roles end end
Ruby
class CreateMotivations < ActiveRecord::Migration def self.up create_table :motivations do |t| t.string :name t.timestamps end end def self.down drop_table :motivations end end
Ruby
class DefaultBirthrights < ActiveRecord::Migration def self.up Birthright.delete_all Birthright.create(:name => 'Scavenger') Birthright.create(:name => 'Scapegrace') Birthright.create(:name => 'Stubjack') Birthright.create(:name => 'Child of the Creed') Birthright.create(:name => 'Savant'...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'http://rubygems.org' gem 'rails', '3.0.0.beta4' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql' gem 'devise', '1.1.rc2' gem 'warden', '0.10.7' gem 'cancan', '1.1.1' gem 'nifty-generators', '0.4.0' gem 'formtastic-rails3', '0.9.10.0' gem 'pg' # Use unicorn a...
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
module ApplicationHelper end
Ruby
module HomeWorldsHelper end
Ruby
module LureOfTheVoidsHelper end
Ruby
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 a...
Ruby
module BirthrightsHelper end
Ruby
module CharactersHelper end
Ruby
module OriginPathStagesHelper end
Ruby
module TrialsAndTravailsHelper end
Ruby
module CareersHelper end
Ruby
module RolesHelper end
Ruby
module OriginPathsHelper end
Ruby
# 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
module MotivationsHelper end
Ruby
class Character < ActiveRecord::Base attr_accessible :name, :user_id, :experience_to_spend, :experience_spent, :id, :weapon_skill, :ballistic_skill, :strength, :toughness, :agility, :intelligence, :perception, :will_power, :fellowship, :home_world_id, :lure_of_the_void_id, :motivation_id, :birthright_id, :car...
Ruby
class TrialsAndTravails < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class Career < ActiveRecord::Base attr_accessible :name end
Ruby
class OriginPathStage < ActiveRecord::Base attr_accessible :name has_many :origin_paths end
Ruby
class LureOfTheVoid < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class HomeWorld < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class Birthright < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class OriginPath < ActiveRecord::Base attr_accessible :origin_path_stage_id, :name, :description belongs_to :origin_path_stage end
Ruby
class User < ActiveRecord::Base belongs_to :role has_many :characters # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable ...
Ruby
class Ability include CanCan::Ability def initialize(user) user ||= User.new(:role_id => Role.find_by_name("Guest").id) if user.role.name == 'Admin' can :manage, :all else if user.role.name == 'Registered' can :read, :all can :create, Character can :update, Ch...
Ruby
class Role < ActiveRecord::Base has_many :users attr_accessible :name, :id end
Ruby
class Motivation < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class CharactersController < ApplicationController load_and_authorize_resource def index @characters = Character.all end def show end def new session[:character_params] = {} @character.user_id = current_user.id @character.weapon_skill = Character.generate_stat @character.ballisti...
Ruby
class OriginPathStagesController < ApplicationController load_and_authorize_resource def index @origin_path_stages = OriginPathStage.all end def show end def new end def create if @origin_path_stage.save flash[:notice] = "Successfully created origin path stage." redirect_t...
Ruby