code
stringlengths
1
1.73M
language
stringclasses
1 value
class CreateVestalVersions < ActiveRecord::Migration def self.up create_table :versions do |t| t.belongs_to :versioned, :polymorphic => true t.belongs_to :user, :polymorphic => true t.string :user_name t.text :modifications t.integer :number t.integer :reverted_from t...
Ruby
class CreateVisuals < ActiveRecord::Migration def self.up create_table :visuals do |t| t.references :app t.timestamps end add_index :visuals, :app_id end def self.down drop_table :visuals end end
Ruby
class CreateRatings < ActiveRecord::Migration def self.up create_table :ratings do |t| t.string :rating t.integer :ratingCount t.integer :downloadCount t.string :downloadCountText t.references :app t.timestamps end add_index :ratings, :app_id, :unique => true end ...
Ruby
class CreateAppPermissions < ActiveRecord::Migration def self.up create_table :app_permissions do |t| t.references :app t.references :permission t.timestamps end add_index :app_permissions, :app_id add_index :app_permissions, :permission_id end def self.down drop_table :ap...
Ruby
class CreateAppTargets < ActiveRecord::Migration def self.up create_table :app_targets do |t| t.references :app t.references :target t.timestamps end add_index :app_targets, :app_id add_index :app_targets, :target_id end def self.down drop_table :app_targets end end
Ruby
class CreateComments < ActiveRecord::Migration def self.up create_table :comments do |t| t.integer :rating t.string :creationTime t.string :authorName t.string :text t.string :authorId t.references :app t.timestamps end add_index :comments, :app_id add_index ...
Ruby
class CreateApps < ActiveRecord::Migration def self.up create_table :apps do |t| t.string :creator t.string :packageName t.string :title t.text :description t.string :appId t.string :category t.text :recentChanges t.string :email t.string :phone t.string...
Ruby
class CreateTargets < ActiveRecord::Migration def self.up create_table :targets do |t| t.string :name t.timestamps end add_index :targets, :name, :unique => true end def self.down drop_table :targets end end
Ruby
class CreatePermissions < ActiveRecord::Migration def self.up create_table :permissions do |t| t.string :name t.timestamps end add_index :permissions, :name, :unique => true end def self.down drop_table :permissions end end
Ruby
class AddAttachmentImageToVisual < ActiveRecord::Migration def self.up add_column :visuals, :image_file_name, :string add_column :visuals, :image_content_type, :string add_column :visuals, :image_file_size, :integer add_column :visuals, :image_updated_at, :datetime end def self.down remove_co...
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
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Marketplace::Application
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
require 'sinatra/activerecord/rake' require './main'
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.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
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
module FusionChartsHelper #Contains an array of colors to be used as default set of colors for FusionCharts #arr_FCColors is the array that would contain the hex code of colors #ALL COLORS HEX CODES TO BE USED WITHOUT # #We also initiate a counter variable to help us cyclically rotate through #the array of ...
Ruby
module XmlHelper # This function helps you escape special characters in XML attribute values # Here, we have escaped only single quotes for xml attribute values # You can escape other characters which might be causing issues as xml attribute values def XmlHelper.escape_xml_attribute_values(string_to_escape,...
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): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # i...
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
# 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
# Be sure to restart your 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 set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.0...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
#Creates xml with values for factory output along with their names. It also creates #a link to javascript function updateChart #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name","factory_output" and "f...
Ruby
#Creates xml with values for monthly sales data #The values required for building the xml are hard-coded in this file xml = Builder::XmlMarkup.new xml.graph(:caption=>'Monthly Unit Sales', :xAxisName=>'Month', :yAxisName=>'Units', :decimalPrecision=>'0', :formatNumberScale=>'0') do xml.set(:name=>'Jan',:value=>'...
Ruby
# Builds xml for sales of various product categories # of a Restaurant to be shown in form of a pie-chart. # The values required here are got as parameters # Expected parameters: str_soups,str_salads,str_sandwiches,str_beverages,str_desserts xml = Builder::XmlMarkup.new xml.graph(:caption=>'Sales by Product Categ...
Ruby
#Creates xml with values for sales data of products #along with their names. #The values required for building the xml is obtained from the corresponding controller action pie_data #It accesses the factory_data array from the controller. #It expects factory_data to be an array in which each element is #itself an...
Ruby
#Creates xml with values for Factory Output #along with their names. #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name" and "factory_output" xml = Builder::XmlMarkup.new xml.graph(:caption=>'Factory ...
Ruby
#Creates xml with values for sales data of products #and the quantity of sales in each quarter of a year #by a combination of differing scales of two y-axes. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first eleme...
Ruby
#Creates xml with values for sales data of products #for the current year and the previous year. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first element as label, second element as current year sales value #and ...
Ruby
#Creates xml with values for sales data of product A and product B #in each quarter. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first element as label, second element as sales of product A #and third element as s...
Ruby
#Creates xml with values for sales data of products #along with their names. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first element as label and second element as value xml = Builder::XmlMarkup.new xml.graph(:...
Ruby
#Creates xml with values for date of production and quantity for a particular factory #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "date_of_production" and "quantity_number" #The colors for the columns are obta...
Ruby
#Creates xml with values for Factory Output #along with their names and a link to detailed action for each factory. #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name", "factory_output" and "str_data_ur...
Ruby
# Methods added to this helper will be available to all templates in the application. # These methods can be used to render the chart using FusionCharts module ApplicationHelper require "fusioncharts_helper" include FusionChartsHelper end
Ruby
#Model class to store data of factory id and name. #As per Ruby On Rails conventions, we have the corresponding table #factory_masters in the database. class Fusioncharts::FactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc' end
Ruby
class Fusioncharts::JapaneseFactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc', :foreign_key=>"factory_master_id" end
Ruby
class Fusioncharts::FrenchFactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc', :foreign_key=>"factory_master_id" end
Ruby
#Model class to store output data of factories. #As per Ruby On Rails conventions, we have the corresponding table #factory_output_quantities in the database. class Fusioncharts::FactoryOutputQuantity < ActiveRecord::Base belongs_to :factory_master end
Ruby
class Fusioncharts::DbDrilldownController < ApplicationController #This is the layout which all functions in this controller make use of. layout "common" #In this function, we obtain total output of quantities and name of each factory from the database and plot them on a pie-chart. #It stores URL to the...
Ruby
# This controller demonstrates the generation of pie-chart # by using the values from a form. # Only the chart.html.erb view related to the chart action uses the "common" layout. # Here, we have given a simple example, where the form fields do not belong to any database # In real-world, you would have fields corre...
Ruby
# This controller class will show ways of generating chart by # * using sales data of products with their names present in an array. # * using sales data of products for current year and previous year with their names present in an array. # * using sales figure and quantity sold in each quarter of a year of a produ...
Ruby
# Contains actions to show the UTF-8 chart examples. #To use FusionCharts with UTF-8 characters, remember the following: #* dataURL method has to be used to get the xml. #* Rotated text cannot render UTF-8 characters. For example, UTF-8 characters in the rotated labels will not be rendered correctly. #* B...
Ruby
#There are two examples in this controller. #*Pie-chart for total ouput quantities of each factory by getting data from database and using dataXML method #*Pie-chart for total ouput quantities of each factory and a link to another chart #which gives detailed information for selected factory #All the views related ...
Ruby
# Contains functions to generate chart by # * adopting the dataURL method of FusionCharts and using render_chart function from the helper class. # * adopting the dataXML method of FusionCharts and using render_chart function from the helper class. # * adopting the dataURL method of FusionCharts and using render_cha...
Ruby
# This controller is used to display the list of actions # from different controllers in this application. class Fusioncharts::IndexController < ApplicationController def index end end
Ruby
# In this controller, we will plot a pie-chart showing total output of quantities # and name of each factory in a pie-section. # On clicking on a pie-section, we obtain detailed information on the quantity # produced and date of production of the factory by using javascript. class Fusioncharts::DbJsController < A...
Ruby
# This controller class shows how to render a pie-chart by retrieving # factory name and total output quantity dynamically at run-time, # from the database. setDataURL method is used here. # As per Ruby On Rails conventions, we have the corresponding views with the same name # as the function name in the controll...
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 helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details...
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
#!/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/runner'
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/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/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/plugin'
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/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/console'
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/process/inspector'
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/spawner'
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/generate'
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/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateFusionchartsFactoryMasterGermen < ActiveRecord::Migration def self.up create_table :fusioncharts_factory_master_germen do |t| t.timestamps end end def self.down drop_table :fusioncharts_factory_master_germen end end
Ruby
class CreateFactoryMasters < ActiveRecord::Migration def self.up create_table :factory_masters do |t| t.primary_key :id t.string :name end end def self.down drop_table :factory_masters end end
Ruby
class CreateFusionchartsFrenchFactoryMasters < ActiveRecord::Migration def self.up create_table :fusioncharts_french_factory_masters do |t| t.timestamps end end def self.down drop_table :fusioncharts_french_factory_masters end end
Ruby
class CreateFactoryOutputQuantities < ActiveRecord::Migration def self.up create_table :factory_output_quantities do |t| t.primary_key :id t.integer :factory_master_id t.datetime :date_pro t.integer :quantity end end def self.down drop_table :factory_output_quantities end en...
Ruby
class CreateFusionchartsGermanFactoryMasters < ActiveRecord::Migration def self.up create_table :fusioncharts_german_factory_masters do |t| t.timestamps end end def self.down drop_table :fusioncharts_german_factory_masters end end
Ruby
module FusionChartsHelper #Contains an array of colors to be used as default set of colors for FusionCharts #arr_FCColors is the array that would contain the hex code of colors #ALL COLORS HEX CODES TO BE USED WITHOUT # #We also initiate a counter variable to help us cyclically rotate through #the array of ...
Ruby
module XmlHelper # This function helps you escape special characters in XML attribute values # Here, we have escaped only single quotes for xml attribute values # You can escape other characters which might be causing issues as xml attribute values def XmlHelper.escape_xml_attribute_values(string_to_escape,...
Ruby
#!c:/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
#!c:/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
#!c:/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
#!c:/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
#!c:/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
#!c:/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
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