code
stringlengths
1
1.73M
language
stringclasses
1 value
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.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
# 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 AddMemberToProject < ActiveRecord::Migration def change add_column :projects, :title, :string add_column :projects, :summary, :string add_column :projects, :description, :string end end
Ruby
class AddWjpmProject < ActiveRecord::Migration def self.up Project.delete_all Project.create(:title => 'WJ Project Development Management Website Project', :projectnum => 'WJPM_0_0_1', :summary => 'WJProject Development Management Website Project First Edition', :description => %{WJ Project De...
Ruby
class CreatePosts < ActiveRecord::Migration def change create_table :posts do |t| t.string :poster t.string :title t.text :body t.references :project t.timestamps end add_index :posts, :project_id end end
Ruby
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.timestamps end end end
Ruby
class AddProjectnumToProject < ActiveRecord::Migration def change add_column :projects, :projectnum, :string 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
source 'https://rubygems.org' gem 'rails', '3.2.7' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3...
Ruby
module ApplicationHelper end
Ruby
module ProjectsHelper end
Ruby
module PostsHelper end
Ruby
class Post < ActiveRecord::Base belongs_to :project attr_accessible :body, :poster, :title validates_presence_of :title, :body end
Ruby
class Project < ActiveRecord::Base attr_accessible :title, :summary, :description, :projectnum validates_presence_of :title, :summary, :description, :projectnum validates_uniqueness_of :projectnum has_many :posts, :dependent => :destroy end
Ruby
class PostsController < ApplicationController def index @post = Post.all respond_to do |format| format.html # index.html.erb format.json { render json: @posts } end end def show @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.j...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class ProjectsController < ApplicationController # GET /projects # GET /projects.json def index @projects = Project.all respond_to do |format| format.html # index.html.erb format.json { render json: @projects } end end # GET /projects/1 # GET /projects/1.json def show @projec...
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
# I18n.default_locale = 'en' # # LOCALES_DIRECTORY = "#{RAILS_ROOT}/config/locales" # # LANGUAGES = { # 'English' => 'en' # }
Ruby
# Be sure to restart your server when you modify this file. Wjpm::Application.config.session_store :cookie_store, key: '_wjpm_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 "rails generat...
Ruby
Wjpm::Application.routes.draw do get "posts/index" resources :projects do resources :posts end # 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 t...
Ruby
require 'rubygems' # 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 Wjpm::Application.initialize!
Ruby
Wjpm::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.action_co...
Ruby
Wjpm::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 web serve...
Ruby
Wjpm::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 test suite...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Wjpm::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__) Wjpm::Application.load_tasks
Ruby
# coding: utf-8 # Title: LightPack API wrapper for Ruby # Author: Mikhail S. Pobolovets # License: GPL v3 # Date: 2011/08/15 # API Version: 5.5 require 'socket' class LightPack include Socket::Constants # host = '127.0.0.1' # The remote host # port = 3636 ...
Ruby
#!/usr/bin/ruby require 'zinnia'; input = "(character (value と)(width 1000)(height 1000)(strokes ((243 273)(393 450))((700 253)(343 486)(280 716)(393 866)(710 880))))" s = Zinnia::Character.new r = Zinnia::Recognizer.new r.open("/usr/local/lib/zinnia/model/tomoe/handwriting-ja.model") begin die s.what() if (!s....
Ruby
require 'mkmf' zinnia_config = with_config('zinnia-config', 'zinnia-config') use_zinnia_config = enable_config('zinnia-config') have_library("zinnia") have_header('zinnia.h') && create_makefile('zinnia')
Ruby
#!/usr/bin/ruby require 'zinnia'; input = "(character (value と)(width 1000)(height 1000)(strokes ((243 273)(393 450))((700 253)(343 486)(280 716)(393 866)(710 880))))" s = Zinnia::Character.new r = Zinnia::Recognizer.new r.open("/usr/local/lib/zinnia/model/tomoe/handwriting-ja.model") begin die s.what() if (!s....
Ruby
# Copyright (C) 2010 Tom Verbeure # # 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 wri...
Ruby
#! /usr/bin/env ruby # Copyright (C) 2010 Tom Verbeure # # 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 l...
Ruby
#!/usr/bin/env ruby # # Bootloader for wmii configuration. # #-- # Copyright protects this work. # See LICENSE file for details. #++ # create a logger to aid debugging require 'logger' LOG = Logger.new(__FILE__ + '.log', 5) class << LOG # emulate IO.write alias write << def flush # ignore end end # capt...
Ruby
# DSL for wmiirc configuration. #-- # Copyright protects this work. # See LICENSE file for details. #++ require 'shellwords' require 'pathname' require 'yaml' require 'rubygems' gem 'rumai', '~> 3' require 'rumai' include Rumai class Handler < Hash def initialize super {|h,k| h[k] = [] } end ## # If a ...
Ruby
require 'java' class Element def initialize(elm, is_out=false) @elm = elm @is_out = is_out end def name return @elm.name end def value return @elm.value end def get_or_create_child(node_name) java_elm = @elm.getChildByName(node_name) if java_elm == nil && @is_out ...
Ruby
#!/usr/bin/ruby # # Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your opti...
Ruby
#!/usr/bin/ruby # # Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your opti...
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
require 'rake' require 'yui/compressor' desc 'Aggregate all javascript files' task :aggregate, :compress do |t, args| args.with_defaults(:compress => false) output_file = ENV['output'] || 'ajax-solr.min.js' core = [ 'Core', 'AbstractManager', 'ParameterStore', 'Parameter', 'AbstractWidget', ...
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
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
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
require 'sinatra/activerecord/rake' require './main'
Ruby
# Generates a list of the html colors colors =<<EOF aliceblue 240,248,255 antiquewhite 250,235,215 aqua 0,255,255 aquamarine 127,255,212 azure 240,255,255 beige 245,245,220 bisque 255,228,196 black 0,0,0 blanchedalmond 255,235,205 blue 0,0,255 blueviolet 138,43,226 brown 165,42,42 burlywood 222,184,135 cadetblue 95,15...
Ruby
#!/usr/bin/ruby # Processes meshes and prepares to upload them to the internets. # # Steps: # * Check size of the mesh is reasonable # * Check naming conventions # * Makes names unique in the mesh # * Creates a zip #url = $*[0] or raise "Usage: rootify " require 'ftools' guid = "12345" resource_prefix = "/i...
Ruby
#!/usr/bin/ruby # Processes meshes and prepares to upload them to the internets. # # Steps: # * Check size of the mesh is reasonable # * Check naming conventions # * Makes names unique in the mesh # * Creates a zip #url = $*[0] or raise "Usage: rootify " require 'ftools' guid = "12345" resource_prefix = "/i...
Ruby
require 'RMagick' class NumberImageGenerator @@IMAGE_DIR = 'numbers-hdpi/' def generate(text, fs=18) #filename = "b" + sprintf("%03d", text) + ".png"; filename = "" + sprintf("%03d", text) + ".png"; font_size = fs; height = 35; width = 35; image = Magick::Image.new(width, height) {self.ba...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 project = 'battery-indicator' user = `cat ~/.netrc | awk '{print $4;}'`.strip pass = `cat ~/.netrc | awk '{print $6;}'`.strip version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1] apk_location = "BatteryIndicatorPro-#{version}.apk" system("cp bin/*-release.ap...
Ruby
#!/usr/bin/env ruby require 'net/http' require 'uri' LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/' langs = Net::HTTP.get(URI.parse(LANGS_URI)).split() langs.each do |lang| if lang.length == 2 dir = 'res/values-' << lang else dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2] end if ! D...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 require 'nokogiri' # read in convert.xml to see which how to convert the string-arrays # for each strings.xml in res/values res/values-?? res/values-??-* # find the string-arrays that match the ones in convert.xml and for each # remove opening and closing string-array tag #...
Ruby
begin require 'Plist' rescue LoadError raise 'You must "gem install plist" to get plist parser' end ROOT = File.expand_path('..') SRC = ROOT DST = File.join(ROOT, 'build') DST_THEMES = File.join(DST, 'themes') TMP = File.join(ROOT, 'tmp') THEMES_DIR = File.expand_path("~/Library/Application\\ Support/TextMate/The...
Ruby
require "test/unit" class TestMigrated @@_ar_test_migrated = false def self._ar_test_migrated @@_ar_test_migrated end def self._ar_test_migrated=(val) @@_ar_test_migrated = val end end module ActiveRecordTestCase def setup begin ActiveRecord::Base.connection rescue logger = ...
Ruby
require 'test/unit/testcase' module Test module Unit class TestCase def method_stub(cls, method_name) cls_stub = Class.new(cls) cls_stub.class_eval do (public_instance_methods(true) + private_instance_methods(true) + protected_instance_methods(true) - (Object.private_instance_methods + Ob...
Ruby
require "rubygems" require "rake" require "rake/testtask" task :default => [:test_units] desc "Run basic tests" Rake::TestTask.new("test_units") { |t| t.pattern = "#{File.dirname(__FILE__)}/**/*_test.rb" t.libs << "#{File.dirname(__FILE__)}/../lib" t.verbose = true t.warning = true }
Ruby
module Wondercap module Syscmd def syscmd(command, output_io = nil, no_log = false) logger.info(command) command_output = %x(#{command}) output_io.write(command_output) if output_io logger.debug(command_output) unless no_log $?.exitstatus end def syscmd_ou...
Ruby
module Wondercap module TimeConverter def time_to_int(time) Integer(time_to_str(time)) end module_function :time_to_int def int_to_time(int) str_to_time(int.to_s) end module_function :int_to_time def time_to_str(time) time.strftime("%Y%m%d%H%M%S") end mo...
Ruby
require "logger" require 'set' require 'stringio' module Wondercap module Logging class LoggerDeviceWrapper attr_reader :output_devs def initialize(*devs) @output_devs = Set.new(devs) @output = StringIO.new @output_devs << @output end def method_missing(name, *args, &block) ...
Ruby
require "fileutils" module Wondercap class FileFlag attr_reader :path def initialize(path) @path = path end def installed check_file end alias_method :installed?, :installed def installed=(flag) if flag touch_file else erase_file ...
Ruby
require "set" module Wondercap class DependencyResolver def initialize(get_required_dependencies_proc) @get_required_dependencies_proc = get_required_dependencies_proc end def build_dependencies(names) deps = {} names.each do |name| required_deps = @get_required_dependencie...
Ruby
require "rubygems" require "capistrano" module Wondercap class MultiConfiguration include Enumerable attr_accessor :extension_modules, :initializers def initialize(extension_modules = [], initializers = []) @configurations = {} @extension_modules = extension_modules @initiali...
Ruby
require "highline" require "wondercap/lib/multi_configuration/multi_configuration" require "wondercap/lib/multi_configuration/files_reader" require "wondercap/lib/utils/logging" namespace :wondercap do class << self include Wondercap::Logging attr_reader :ui, :mc end task :init_highline do ...
Ruby
require "wondercap/lib/multi_configuration/files_reader" module Wondercap module Deployment module OuterConfigurationMixin attr :area, true attr :snapshot, true attr :top_task, true # a hack actually - to get the top_task reference def self.included(base) base.send :alias_method, :trigger_without_out...
Ruby
require "wondercap/lib/multi_configuration/multi_configuration" module Wondercap module Define def define_cfg(name, *args, &block) #multi_configuration is provided by the importer-class config = multi_configuration.get_configuration(name) #TODO: cleaner implementation (http://blogger.jayfie...
Ruby
module Wondercap class TaskExecutorError < RuntimeError attr_reader :executor, :errors def initialize(executor) @executor = executor @errors = {} end def [](key) @errors[key] end def message lines = [] @errors.each_pair do |k,v| lines <...
Ruby
require "set" require "wondercap/lib/deployment/core/strategy_base" require "wondercap/lib/deployment/core/versioned_strategy" module Wondercap module Deployment module InnerConfigurationMixin def self.included(base) base.send :alias_method, :task_without_inner_configuration_mixin, :task base.send :...
Ruby
require "wondercap/lib/utils/logging" require "wondercap/lib/multi_configuration/define" module Wondercap class FileReader include Logging def initialize(path, multi_configuration, context) @path = path @multi_configuration = multi_configuration @context = context end def ...
Ruby
require "rubygems" require "highline" require "capistrano" module Wondercap class CLIError < RuntimeError end module CLIParser attr_reader :command, :arg, :vars def parse_args(argv, env) @command = argv[0] @arg = argv[1] if argv.length >= 2 (argv[2..-1] || []).each do |ar| ...
Ruby
namespace :wondercap do task :dump_strategy do names.each do |name| puts "#{name}:" p mc.find_configuration(name).strategy.extensions_info puts end end task :dump_dependencies do names.each do |name| conf = mc.find_configuration(name) runtime_deps = conf.strategy.runt...
Ruby
require "pathname" additional_path = Pathname.new(__FILE__).realpath.dirname.join("..", "..", "..", "..") $: << additional_path load_paths << additional_path require "logger" require "fileutils" require "set" require "wondercap/lib/deployment/core/outer_configuration_mixin" require "wondercap/lib/deployment/core/inne...
Ruby
require "activerecord" require "wondercap/lib/deployment/model/area" require "wondercap/lib/deployment/model/deployment" require "wondercap/lib/deployment/model/snapshot" namespace :wondercap do default_wondercap_db_path = "/usr/local/wondercap/db/wondercap.db" before "wondercap:init_multi_configuration", "won...
Ruby
# this file should be included on top of the configurations that wish to use only # wondercap's compatible extensions require "pathname" additional_path = Pathname.new(__FILE__).realpath.dirname.join("..", "..", "..", "..") $: << additional_path load_paths << additional_path require "wondercap/lib/deployment/core/out...
Ruby
require "wondercap/lib/multi_configuration/task_executor" namespace :wondercap do task :process_filters do class << self attr :filters end @filters = fetch(:filters, "").split(/,/).map do |filter_name| get_name_filter filter_name end end task :process_names do class << se...
Ruby
require "rubygems" require "activerecord" class AddExistsAttributeToSnapshots < ActiveRecord::Migration def self.up add_column :snapshots, :exists, :boolean, :default => false end def self.down remove_column :snapshots, :exists end end
Ruby
require "rubygems" require "activerecord" class AddMissingSnapshotIdToDeployments < ActiveRecord::Migration def self.up add_column :deployments, :snapshot_id, :integer end def self.down remove_column :deployments, :snapshot_id end end
Ruby
require "rubygems" require "activerecord" class AddRequiredDependenciesAttributeToDeployments < ActiveRecord::Migration def self.up add_column :deployments, :required_dependencies, :text end def self.down remove_column :deployments, :required_dependencies end end
Ruby
require "rubygems" require "activerecord" require "wondercap/lib/deployment/model/deployment" class RemoveStaticDependenciesAttributeFromDeployment < ActiveRecord::Migration include Wondercap::Deployment def self.up remove_column :deployments, :static_dependencies end end
Ruby
require "rubygems" require "activerecord" class FixIndices < ActiveRecord::Migration def self.up remove_index :snapshots, [:area_id, :created_at] remove_index :snapshots, [:area_id, :created_at, :exists] remove_index :deployments, [:snapshot_id, :name] add_index :snapshots, [:area_id, :exists...
Ruby
require "rubygems" require "activerecord" class RenameRequiredDependenciesToRuntimeDependencies < ActiveRecord::Migration def self.up rename_column :deployments, :required_dependencies, :runtime_dependencies end def self.down rename_column :deployments, :runtime_dependencies, :required_dependencies...
Ruby
require "rubygems" require "activerecord" class Initial < ActiveRecord::Migration def self.up create_table :areas do |table| table.column :name, :text, :null => false end create_table :snapshots do |table| table.column :created_at, :datetime, :null =>false table.column :area_id,...
Ruby
require "rubygems" require "activerecord" class AddCurrentAttributeToSnapshot < ActiveRecord::Migration def self.up add_column :snapshots, :current, :boolean, :default => false end def self.down remove_column :snapshots, :current end end
Ruby
require "rubygems" require "activerecord" class AddHostsAttributeToAreas < ActiveRecord::Migration def self.up add_column :areas, :hosts, :text end def self.down remove_column :areas, :hosts end end
Ruby
require "rubygems" require "activerecord" require "wondercap/lib/deployment/model/deployment" require "wondercap/lib/deployment/model/snapshot" class AddDeployedAtAttributeToDeployment < ActiveRecord::Migration include Wondercap::Deployment def self.up add_column :deployments, :deployed_at, :null => false ...
Ruby
require "rubygems" require "activerecord" class AddUnfinishedSnapshotIdAttributeToAreas < ActiveRecord::Migration def self.up add_column :areas, :unfinished_snapshot_id, :integer end def self.down remove_column :areas, :unfinished_snapshot_id end end
Ruby
require "rubygems" require "activerecord" class RemoveCurrentAttributeFromSnapshotsAndAddCurrentSnapshotIdAttributeToArea < ActiveRecord::Migration def self.up add_column :areas, :current_snapshot_id, :integer remove_column :snapshots, :current end def self.down remove_column :areas, :current_s...
Ruby
require "rubygems" require "activerecord" class CreateIndices < ActiveRecord::Migration def self.up add_index :areas, :name add_index :snapshots, :area_id add_index :snapshots, [:area_id, :created_at] add_index :snapshots, [:area_id, :created_at, :exists] add_index :deployments, [:snapshot_id,...
Ruby
require "rubygems" require "activerecord" require "wondercap/lib/deployment/model/deployment" class AddStaticDependenciesAttributeToDeployment < ActiveRecord::Migration include Wondercap::Deployment def self.up add_column :deployments, :static_dependencies, :text Deployment.reset_column_information ...
Ruby
require "rubygems" require "activerecord" module Wondercap module Deployment class Snapshot < ActiveRecord::Base include Enumerable has_many :deployments, :dependent => :delete_all belongs_to :area has_one :current_area, :class_name => "Area", :foreign_key => "current_snapshot_id", :dependent => :nulli...
Ruby
require "set" require "rubygems" require "activerecord" module Wondercap module Deployment class Deployment < ActiveRecord::Base belongs_to :snapshot serialize :runtime_dependencies def assign(dep) self.attributes = dep.attributes end def dup result = Deployment.new result....
Ruby
require "rubygems" require "activerecord" module Wondercap module Deployment class Area < ActiveRecord::Base has_many :snapshots, :dependent => :delete_all belongs_to :current_snapshot, :class_name => "Snapshot" belongs_to :unfinished_snapshot, :class_name => "Snapshot" serialize :hosts def build_snapsho...
Ruby