code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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/server'
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/plugin'
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/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/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/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/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/destroy'
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/generate'
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
class AddAvatar < ActiveRecord::Migration def self.up add_column :users, :avatar, :string end def self.down remove_column :users, :avatar end end
Ruby
class AddSubdomain < ActiveRecord::Migration def self.up add_column :users, :subdomain, :string end def self.down remove_column :users, :subdomain end end
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 'digest/sha1' class User < ActiveRecord::Base # Virtual attribute for the unencrypted password attr_accessor :password validates_presence_of :login, :email validates_presence_of :password, :if => :password_required? validates_presence_of :password_confirmation, :if ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def random_color a = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] c1 = a[rand(16)] c2 = a[rand(16)] c3 = a[rand(16)] c4 = a[rand(16)] c5 = a[rand(16)] c6 =...
Ruby
module UsersHelper end
Ruby
module SessionsHelper end
Ruby
class RandomController < ApplicationController def css render :layout => false end end
Ruby
class BlogsController < ApplicationController def show @_user = User.find_by_subdomain(params[:sd]) @current = 'blog' render :template => 'blog/index', :layout => 'blog' end def upload_avatar user_id = params[:user_id] avatar = params[:user][:avatar] u = User.find(user_id) ...
Ruby
class MiscController < ApplicationController def index if request.subdomains.size > 1 redirect_to 'http://byelr.com' elsif request.subdomains.size == 1 and request.subdomains[0] != 'www' sd = request.subdomains[0] if sd and not sd.empty? and sd != 'www' @_user = User.find_by_s...
Ruby
# This controller handles the login/logout function of the site. class SessionsController < ApplicationController # Be sure to include AuthenticationSystem in Application Controller instead layout "error" # render new.rhtml def new render :layout => false if request.xhr? end def create self.curre...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_byelr_sess...
Ruby
class UsersController < ApplicationController # Be sure to include AuthenticationSystem in Application Controller instead layout "error" # render new.rhtml def new end def create cookies.delete :auth_token reset_session @user = User.new(params[:user]) @user.subdomain = URI.escape(@user.logi...
Ruby
module AuthenticatedTestHelper # Sets the current user in the session from the user fixtures. def login_as(user) @request.session[:user] = user ? users(user).id : nil end def authorize_as(user) @request.env["HTTP_AUTHORIZATION"] = user ? "Basic #{Base64.encode64("#{users(user).login}:test")}" : nil e...
Ruby
module AuthenticatedSystem protected # Returns true or false if the user is logged in. # Preloads @current_user with the user model if they're logged in. def logged_in? current_user != :false end # Accesses the current user from the session. Set it to :false if login fails # so tha...
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
ActionController::Routing::Routes.draw do |map| map.connect '', :controller => 'misc', :action => 'index' map.resources :users map.resources :sessions map.signup '/signup', :controller => 'users', :action => 'new' map.login '/login', :controller => 'sessions', :action => 'new' map.logout '/logout', :cont...
Ruby
require 'jcode' $KCODE = 'u' require 'action_controller' ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_domain => ".byelr.com") # 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...
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) unless defined?(Rails::Initializer) if File.directory?("#{RAILS_ROOT}/vendor/rails") require "#{RAILS_ROOT}/vendor/rails/railties/lib/init...
Ruby
#!D:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
#!D:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!D:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
#!D:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!D:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!D:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
# Steps definitions for security # Fixture instantiation Given /a "(.*)" group/ do |group| Given 'I visit admin/security' And 'I click the "Security Groups" link' And 'I click the "Create" button' And "I put \"#{group}\" in the \"Title\" field" And 'I click the "Save" button' end Given /a user called "(.*)...
Ruby
## FIXTURE GENERATON Given /^the site can be edited by the "([^\"]*)" group$/i do |arg1| pending end Given /^the "([^\"]*)" page can be edited by the "([^\"]*)" group$/i do |arg1, arg2| pending end Given /a "(.*)" page called "(.*)" as a child of "(.*)"/i do |type, title, parent| Given "I click the \"#{paren...
Ruby
# Log in Given /log in as (.*)$/ do |user| Given "I fill out the log in form with user \"#{user}\" and password \"password\"" And 'I see "You\'re logged in as"' end Given /log into the CMS as (.*)/ do |user| Given "I log in as #{user}" And "I visit admin/" And "I load the root node" end Given /log out$/ do ...
Ruby
## ## General rules for the SilverStripe CMS as a whole. They mostly have to do with the LeftAndMain ## interface # Match general CMS tabs, ModelAdmin needs another system Given /I click on the "([^\"]*)" tab/ do |tab| found = nil links = @salad.browser.links() links.each {|link| if /^tab-.+/.match(link.id) then...
Ruby
## ## Step definitions for testing the front-end site ## Given /I go to the draft site/ do pending Given 'I click the "viewStageSite" link' # |''element''|//a[@id="viewStageSite"]|''exists''| # |''checking timeout''|@{fast_checking_timeout}| # |''optionally''|''element''|//a[@id="viewStageSite"][@style=""]|''e...
Ruby
def loadFixture(fileName) if $baseURL and $browser then $browser.goto $baseURL + "dev/tests/sessionloadyml?fixture=" + fileName + "&flush=1" else fail("No \$baseUrl or \$browser found") end end def startSession # Reset database if $baseURL and $browser then $browser.goto $baseURL + 'dev/tests/endsession' e...
Ruby
require 'compass/import-once/activate' # Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "css" sass_dir = "scss" images_dir = "images" javascripts_dir = "javascript" line_comments = false
Ruby
# Steps definitions for security # Fixture instantiation Given /a "(.*)" group/ do |group| Given 'I visit admin/security' And 'I click the "Security Groups" link' And 'I click the "Create" button' And "I put \"#{group}\" in the \"Title\" field" And 'I click the "Save" button' end Given /a user called "(.*)...
Ruby
## FIXTURE GENERATON Given /^the site can be edited by the "([^\"]*)" group$/i do |arg1| pending end Given /^the "([^\"]*)" page can be edited by the "([^\"]*)" group$/i do |arg1, arg2| pending end Given /a "(.*)" page called "(.*)" as a child of "(.*)"/i do |type, title, parent| Given "I click the \"#{paren...
Ruby
# Log in Given /log in as (.*)$/ do |user| Given "I fill out the log in form with user \"#{user}\" and password \"password\"" And 'I see "You\'re logged in as"' end Given /log into the CMS as (.*)/ do |user| Given "I log in as #{user}" And "I visit admin/" And "I load the root node" end Given /log out$/ do ...
Ruby
## ## General rules for the SilverStripe CMS as a whole. They mostly have to do with the LeftAndMain ## interface # Match general CMS tabs, ModelAdmin needs another system Given /I click on the "([^\"]*)" tab/ do |tab| found = nil links = @salad.browser.links() links.each {|link| if /^tab-.+/.match(link.id) then...
Ruby
## ## Step definitions for testing the front-end site ## Given /I go to the draft site/ do pending Given 'I click the "viewStageSite" link' # |''element''|//a[@id="viewStageSite"]|''exists''| # |''checking timeout''|@{fast_checking_timeout}| # |''optionally''|''element''|//a[@id="viewStageSite"][@style=""]|''e...
Ruby
def loadFixture(fileName) if $baseURL and $browser then $browser.goto $baseURL + "dev/tests/sessionloadyml?fixture=" + fileName + "&flush=1" else fail("No \$baseUrl or \$browser found") end end def startSession # Reset database if $baseURL and $browser then $browser.goto $baseURL + 'dev/tests/endsession' e...
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
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resource...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of the Ext JS SDK relative to this file $ext_path = "../../extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resources/sass folder # <root>/resources/sass sass_path = File.dirname(__FILE__) # css_pat...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
Ruby
# # This file is only needed for Compass/Sass integration. If you are not using # Compass, you may safely ignore or delete this file. # # Change this to :production when ready to deploy the CSS to the live server. environment = :development #environment = :production # Location of the theme's resources. css_dir = "cs...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
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
require 'sinatra/activerecord/rake' require './main'
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
Gem::Specification.new do |gem| gem.name = "don" gem.version = "0.2" gem.authors = ["Rit Li"] gem.email = ["rit@carbonfive.com"] gem.description = %q{Simple command line interface to the Carbon Five Timesheet} gem.summary = %q{Command line interface to the Carbon Five Timesheet} gem.homepage = "http://cod...
Ruby
#!/usr/bin/env ruby # # Ruby class definition of the myCA autoplayer # require 'rubygems' require 'hpricot' require 'open-uri' require 'mechanize' require 'net/http' require 'irb' require 'parseconfig' require 'logger' require 'thread' module CAAutoplayer @WEBAGENT @ACCOUNT @USERINFOS @RESSOURCES @ARMY @BANK ...
Ruby
#!/usr/bin/env ruby require 'CAAutoplayer' # #Initialization CAAutoplayer.initialize()
Ruby
#!/usr/bin/env ruby # # Ruby class definition of the myCA autoplayer # require 'rubygems' require 'hpricot' require 'open-uri' require 'mechanize' require 'net/http' require 'irb' require 'parseconfig' require 'logger' require 'thread' module CAAutoplayer @WEBAGENT @ACCOUNT @USERINFOS @RESSOURCES @ARMY @BANK ...
Ruby
#!/usr/bin/env ruby require 'CAAutoplayer' # #Initialization CAAutoplayer.initialize()
Ruby
require 'thread' class ThreadPool class Worker def initialize @mutex = Mutex.new @thread = Thread.new do while true sleep 0.001 block = get_block if block block.call reset_block end end end end def get_block @mutex.synchronize {@block} end def set_block(...
Ruby
http_path = "/" css_dir = "/assets/css" images_dir = "/assets/img" fonts_dir = "/assets/fonts" relative_assets = true # dev #line_comments = true; # delivery line_comments = false; # prod/demo #line_comments = false; #output_style = :compressed;
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' }]) # Major.create(:name...
Ruby
class CreateActivos < ActiveRecord::Migration def self.up create_table :activos do |t| t.string :descripcion t.integer :marca_id t.string :modelo t.boolean :es_equipo t.boolean :es_asignado t.timestamps end end def self.down drop_table :activos end end
Ruby
class CreateProveedors < ActiveRecord::Migration def self.up create_table :proveedors do |t| t.string :nombre t.string :rif t.string :direccion t.string :contacto t.string :telefono t.timestamps end end def self.down drop_table :proveedors end end
Ruby
class CreateFacturas < ActiveRecord::Migration def self.up create_table :facturas do |t| t.timestamp :fecha t.integer :proveedor_id t.timestamps end end def self.down drop_table :facturas end end
Ruby
class CreateLineasAsignados < ActiveRecord::Migration def self.up create_table :lineas_asignados do |t| t.integer :existencia_id t.integer :asignado_id t.boolean :esta_activo t.timestamps end end def self.down drop_table :lineas_asignados end end
Ruby
class CreatePersonas < ActiveRecord::Migration def self.up create_table :personas do |t| t.string :cedula t.string :nombre t.string :apellido t.string :cargo t.integer :carea_id t.integer :ubicacione_id t.timestamps end end def self.down drop_table :personas...
Ruby
class CreateUbicaciones < ActiveRecord::Migration def self.up create_table :ubicaciones do |t| t.string :descripcion t.timestamps end end def self.down drop_table :ubicaciones end end
Ruby
class AddColumnFactura < ActiveRecord::Migration def self.up add_column "facturas", "factura", :integer end def self.down end end
Ruby
class CreateDespachos < ActiveRecord::Migration def self.up create_table :despachos do |t| t.integer :persona_id t.date :fecha t.timestamps end end def self.down drop_table :despachos end end
Ruby
class CreateMarcas < ActiveRecord::Migration def self.up create_table :marcas do |t| t.string :descripcion t.timestamps end end def self.down drop_table :marcas end end
Ruby
class CreateFichas < ActiveRecord::Migration def self.up create_table :fichas do |t| t.date :fecha t.string :componente t.integer :medida t.integer :umedida_id t.integer :activo_id t.timestamps end end def self.down drop_table :fichas end end
Ruby
class CreateCgenerals < ActiveRecord::Migration def self.up create_table :cgenerals do |t| t.string :nombre t.timestamps end end def self.down drop_table :cgenerals end end
Ruby
class RemoveColumnsActivos < ActiveRecord::Migration def self.up remove_column "activos", "es_asignado" remove_column "existencias", "lote" add_column "existencias", "serial", :string end def self.down end end
Ruby
class LineasDesasignados < ActiveRecord::Migration def self.up add_column :lineas_asignados, :desasignado_id, :integer end def self.down remove_column("lineas_asignados", "desasignado_id") end end
Ruby
class ProcesoFactura < ActiveRecord::Migration def self.up add_column :facturas, :estado, :string add_column :existencias, :esta_activo, :boolean end def self.down remove_column :existencias, :esta_activo remove_column :facturas, :estado end end
Ruby
class ModExistencia < ActiveRecord::Migration def self.up add_column "existencias", "es_asignado", :boolean end def self.down end end
Ruby
class CreateCareas < ActiveRecord::Migration def self.up create_table :careas do |t| t.string :nombre t.integer :cgeneral_id t.timestamps end end def self.down drop_table :careas end end
Ruby
class ModLineasDespachos < ActiveRecord::Migration def self.up remove_column("lineas_despachos", "depacho_id") add_column :lineas_despachos, :despacho_id, :integer end def self.down end end
Ruby
class CreateAsignados < ActiveRecord::Migration def self.up create_table :asignados do |t| t.date :fecha t.integer :persona_id t.integer :existencia_id t.boolean :esta_activo t.timestamps end end def self.down drop_table :asignados end end
Ruby
class AddDespachoEstaActivo < ActiveRecord::Migration def self.up add_column :despachos, :esta_activo, :boolean end def self.down remove_column("despachos", "esta_activo") end end
Ruby
class CreateExistencias < ActiveRecord::Migration def self.up create_table :existencias do |t| t.integer :factura_id t.integer :activo_id t.integer :lote t.integer :cantidad t.integer :saldo t.timestamps end end def self.down drop_table :existencias end end
Ruby
class CreateMotivos < ActiveRecord::Migration def self.up create_table :motivos do |t| t.string :descripcion t.timestamps end end def self.down drop_table :motivos end end
Ruby