code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
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 content_type(type)
@request.env['Content-Type'] = type
end
def accept(accept)
@request.env["HTTP_ACCEPT"] = accept
en... | Ruby |
namespace :xchain do
namespace :test do
desc "Load fake customers"
task :load_customers => :environment do
require 'Faker'
Customer.find(:all, :conditions => "email LIKE('%XCHAIN_%')").each { |c| c.destroy }
1..300.times do
c = Customer.new
c.status_id = rand(3) + 1
... | Ruby |
# Credit for this task comes from here. No license or copyright notice so assumed
# legitmate to include this.
namespace :db do
namespace :fixtures do
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database. Set RAILS_ENV to override.'
task :dump => :enviro... | Ruby |
@=~
~p maximum_input_line_length = infinity
$Id: $ */
Lido Structure Specification
============================
~O~<Lido.con~>~{
~<Specifications~>
~<Symbol Specifications~>
~<Attribute Specifications~>
~<CHAIN specification~>
~<RULE specifications~>
~<Productions~>
~<Computations~>
~<Basic computation... | 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: 'Emanuel... | Ruby |
class CreateInstances < ActiveRecord::Migration
def change
create_table :instances do |t|
t.string :instance_id, :limit => 64
t.string :project_id, :limit => 64
t.timestamps
end
add_index(:instances, :instance_id)
add_index(:instances, :project_id)
end
end
| 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 |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CloudFront::Application.load_tasks
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.1.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'execjs'
gem 'therubyracer'
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-... | Ruby |
module ApplicationHelper
attr :tag_stack
def render_notice_if_notice
html = ""
notice_keys = [:error, :success, :info]
notice_keys.each do |key|
if flash.key? key
html += tag_start :div, :class => [:alert, "alert-#{key.to_s}"]
html += make_tag :a, '×', :class => :close, "data-... | Ruby |
module ServersHelper
end
| Ruby |
class Instance < ActiveRecord::Base
end
| Ruby |
class CloudSetting < ActiveRecord::Base
@@configs = YAML.load_file("#{RAILS_ROOT}/config/cloud_settings.yml")[ENV['RAILS_ENV']]
cattr_reader :configs
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
private
def authorize
ticket = get_ticket
if ticket == nil
require_login
else
check_ticket ticket
end
end
def get_ticket
ticket = params.key?(:ticket) ? params[:ticket] : nil
if ticket == nil
... | Ruby |
require 'sm'
class ServersController < ApplicationController
before_filter :authorize
before_filter :second
before_filter :find_instances, :only => [:index]
def index
if params[:project_id] == nil
flash.now[:error] = [t(:error), t(:please_choose_a_project)]
end
#tt = CloudSetting.configs['se... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# 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 |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# 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 |
# 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 |
# Be sure to restart your server when you modify this file.
CloudFront::Application.config.session_store :cookie_store, key: '_cloud-front_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 "... | Ruby |
CloudFront::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'pr... | Ruby |
require 'rubygems'
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CloudFront::Application.initialize!
| Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.act... | Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the we... | Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.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 te... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CloudFront::Application
| Ruby |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CloudFront::Application.load_tasks
| Ruby |
require "net/http"
require 'cgi'
def logger
ActionController::Base.logger
end
module SM
class Config
attr_accessor :server_manager
class << self
def get_instance
@instance ||= Config.new()
return @instance
end
end
def initialize()
self.server_manager = CloudSetti... | 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: 'Emanuel... | Ruby |
class CreateInstances < ActiveRecord::Migration
def change
create_table :instances do |t|
t.string :instance_id, :limit => 64
t.string :project_id, :limit => 64
t.timestamps
end
add_index(:instances, :instance_id)
add_index(:instances, :project_id)
end
end
| 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 |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CloudFront::Application.load_tasks
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.1.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'execjs'
gem 'therubyracer'
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-... | Ruby |
module ApplicationHelper
attr :tag_stack
def render_notice_if_notice
html = ""
notice_keys = [:error, :success, :info]
notice_keys.each do |key|
if flash.key? key
html += tag_start :div, :class => [:alert, "alert-#{key.to_s}"]
html += make_tag :a, '×', :class => :close, "data-... | Ruby |
module ServersHelper
end
| Ruby |
class Instance < ActiveRecord::Base
end
| Ruby |
class CloudSetting < ActiveRecord::Base
@@configs = YAML.load_file("#{RAILS_ROOT}/config/cloud_settings.yml")[ENV['RAILS_ENV']]
cattr_reader :configs
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
private
def authorize
ticket = get_ticket
if ticket == nil
require_login
else
check_ticket ticket
end
end
def get_ticket
ticket = params.key?(:ticket) ? params[:ticket] : nil
if ticket == nil
... | Ruby |
require 'sm'
class ServersController < ApplicationController
before_filter :authorize
before_filter :second
before_filter :find_instances, :only => [:index]
def index
if params[:project_id] == nil
flash.now[:error] = [t(:error), t(:please_choose_a_project)]
end
#tt = CloudSetting.configs['se... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# 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 |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# 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 |
# 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 |
# Be sure to restart your server when you modify this file.
CloudFront::Application.config.session_store :cookie_store, key: '_cloud-front_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 "... | Ruby |
CloudFront::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'pr... | Ruby |
require 'rubygems'
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CloudFront::Application.initialize!
| Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.act... | Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the we... | Ruby |
CloudFront::Application.configure do
# Settings specified here will take precedence over those in config/application.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 te... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CloudFront::Application
| Ruby |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CloudFront::Application.load_tasks
| Ruby |
require "net/http"
require 'cgi'
def logger
ActionController::Base.logger
end
module SM
class Config
attr_accessor :server_manager
class << self
def get_instance
@instance ||= Config.new()
return @instance
end
end
def initialize()
self.server_manager = CloudSetti... | 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 |
# 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 |
<embed src="chat_queue.swf" width="1" height="1" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">
| Ruby |
require 'rubygems'
require 'zlib'
JQUERY_MANIFEST_FILE = 'mask.jquery.json'
JMASK_FILE = 'src/jquery.mask.js'
JMASK_MIN_FILE = 'dist/jquery.mask.min.js'
GHPAGES_JMASK_MIN_FILE = 'js/jquery.mask.min.js'
JMASK_GZIP_FILE = 'dist/jquery.mask.min.js.gz'
JMASK_VERSION = `stepup version --next-release`.delete("\n")
BOWER_MAN... | Ruby |
DOT_NET_PATH = "C:/Windows/Microsoft.NET/Framework/v3.5/"
NUNIT_PATH = "tools//nunit-2.4.6//nunit-console.exe"
PACKAGE_PATH = "build/package"
SOLUTION = "src/XF.sln"
CONFIG = "Debug"
task :default => ["build:all"]
namespace :build do
task :all => [:compile, :harvest, :test]
desc "Use MSBuild to buil... | Ruby |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.decimal :article_id,:precision=>8
t.string :name
t.text :comment
t.timestamps
end
end
def self.down
drop_table :comments
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name,:password
t.timestamps
end
User.create(:name=>"admin",:password=>"admin")
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateArticles < ActiveRecord::Migration
def self.up
create_table :articles do |t|
t.string :title
t.decimal :user_id ,:precision=>5
t.text :content
t.integer :views
t.timestamps
end
end
def self.down
drop_table :articles
end
end
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
#!/usr/bin/ruby1.8
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired... | Ruby |
#!/usr/bin/ruby1.8
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
#... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module LoginHelper
end
| Ruby |
module BlogHelper
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.