code
stringlengths
1
1.73M
language
stringclasses
1 value
require "wondercap/lib/deployment/core/unused_deployments_finder" require "wondercap/lib/deployment/model/snapshot" module Wondercap module Deployment module OldSnapshotsCleaner module_function def create_unused_deployments_finder UnusedDeploymentsFinder.new end def clean_old_...
Ruby
require "wondercap/lib/utils/file_flag" module Wondercap module Deployment class LocalProjectBuild attr_reader :real_revision, :project_root attr_reader :src_path, :patched_src_path, :dist_path, :patched_dist_path attr_reader :checked_out, :src_patched, :built, :dist_patched def initialize(real_revision, p...
Ruby
module ::Wondercap module Deployment module DeploymentTransactionMixin def deployment_transaction_getter used_configurations = {} lambda do |deployment| used_configurations[deployment] ||= (configuration_defined?(deployment.name) ? configuration_clone(deployment.name) : ...
Ruby
#extension :task_notification => :xmpp do # # xmpp_notify = lambda do |text| # require "xmpp4r/client" # # #Jabber::debug = true # jid = Jabber::JID.new(fetch(:xmpp_jid)) # # cl = Jabber::Client.new(jid) # cl.use_ssl = fetch(:xmpp_use_ssl, false) # cl.connect fetch(:xmpp_host, nil), fetch(:xmpp...
Ruby
#require "rubygems" #require "action_mailer" # #module ::Wondercap # module MailNotifiers # class Mailer < ActionMailer::Base # def notification(from, to, subject, body) # self.from from # self.recipients to # self.subject subject # self.body body # end # end # end #e...
Ruby
#extension :task_notification => :none do # task :notify_task_success do # end # # task :notify_task_failure do # end # # task :notify_task_success_summary do # end # # task :notify_task_failure_summary do # end #end # #extension :deployment_notification => :none do # task :notify_deployment_success do...
Ruby
extension :debug => :dump_strategy do task :dump_strategy do ui = outer_configuration.ui task_name_groups = {} task_chains = {} extension_contexts.reverse_each do |ctx| ctx.tasks.each do |k,v| next if k =~ /^_/ (task_name_groups[ctx.substrategy] ||= []) << k unless task_chains.k...
Ruby
require "wondercap/lib/utils/dependency_resolver" require "yaml" name_filter :add_build_dependent do |names, configurations, options| local_area = Wondercap::Deployment::Area.find_by_name("local") next names unless local_area && local_area.current_snapshot confs = {} getter = lambda do |name| next confs[n...
Ruby
extension :restart => :empty_restart do task :restart do logger.debug "nothing to restart" end end configuration :base do use :restart => :empty_restart on :deployment_succeeded, :restart unless fetch(:norestart, false) end
Ruby
require 'net/http' require 'rexml/document' require 'rexml/formatters/transitive' require 'set' task :collect_hudson_plugins_list do wondercap.filter_names result = filtered_configurations.inject(Set.new) { |memo,conf| memo.merge(conf.hudson_plugins) } ui.say(ui.list(result.map { |name| name.to_s }.to_a)) end...
Ruby
extension :restart => :webobjects_wotaskd do set(:_hosts_and_ports) do site_configs = Hash.new { |h,k| h[k] = "" } run "cat #{fetch(:wotaskd_site_config_path, "/Library/WebObjects/Configuration/SiteConfig.xml")}" do |channel, stream, data| site_configs[channel] += data end result = s...
Ruby
extension :production_checking => :http_check do require "net/http" require "uri" task :check_production do execute_previous if previous_defined? url_to_check = fetch(:http_check_url, nil) || production_url url_to_check = "http://#{url_to_check}" unless url_to_check =~ /^http/ logger.info "check...
Ruby
extension :build => :_flex_builder_project do use :build => :shell do set :build_shell_cmd, "env ANT_OPTS=-Xmx500M ant" end module ::Wondercap module Extensions module FlexBuilderProject class BuildXmlBuilder def initialize(project_name) @doc = REXML::Document.new @proj...
Ruby
extension :dependencies => :wolips do set(:_wolips_dependencies) do sources classpath_fpath = File.join(revision_build.src_path, ".classpath") classpath_xml = nil open(classpath_fpath, "r") { |f| classpath_xml = f.read } doc = REXML::Document.new classpath_xml entries = REXML::XPath.match(do...
Ruby
Reported by bXXX.rXXX@oXXX.com, Mar 11, 2011 I found the need to have a nice start / stop / restart wrapper for shellinabox, and a quick way to add new configurations and URLS. Attached is a file that does just that. It is ruby based, and expects a conf directory in the shellinthebox home directory. All file(s) plac...
Ruby
#!/usr/bin/ruby #=============================================================================== # # FILE: siab.rb # # USAGE: ruby siab.rb [start|stop|restar|help] # # DESCRIPTION: a ShellInAbox control script and configuration system reader. # To auto-configure a shellinabox service creat...
Ruby
require 'rake' require 'rake/packagetask' PROTOTYPE_ROOT = File.expand_path(File.dirname(__FILE__)) PROTOTYPE_SRC_DIR = File.join(PROTOTYPE_ROOT, 'src') PROTOTYPE_DIST_DIR = File.join(PROTOTYPE_ROOT, 'dist') PROTOTYPE_PKG_DIR = File.join(PROTOTYPE_ROOT, 'pkg') PROTOTYPE_VERSION = '1.4.0' task :default => [:dis...
Ruby
require 'erb' class String def lines split $/ end def strip_whitespace_at_line_ends lines.map {|line| line.gsub(/\s+$/, '')} * $/ end end module Protodoc module Environment def include(*filenames) filenames.map {|filename| Preprocessor.new(filename).to_s}.join("\n") end end c...
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. # 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. # 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. # # 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. WolkenWebShop::Application.config.session_store :cookie_store, key: '_WolkenWebShop_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 w...
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
WolkenWebShop::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....
Ruby
WolkenWebShop::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 ...
Ruby
WolkenWebShop::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 t...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application WolkenWebShop::Application.initialize!
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
WolkenWebShop::Application.routes.draw do get "kasse/index" get "produkt_katalog/index" post "produkt_katalog/index" post "produkt_katalog/search" post "produkt_katalog/add" post "home/index" post "kasse/buy" get "home/index" get "user/index" get "user/pba" post "user/erg_expgl" post "user/erg...
Ruby
module ApplicationHelper end
Ruby
module ProduktKatalogHelper end
Ruby
module HomeHelper end
Ruby
module KasseHelper end
Ruby
class Lagerdeckung < ActiveRecord::Base attr_accessible :Datum, :LNr, :TNr end
Ruby
class Order < ActiveRecord::Base attr_accessible :id,:lStrasse,:datum,:lOrt,:lHausnr,:lPlz belongs_to :customer has_many :parts, :through => :orders_consists_of_parts end
Ruby
class Lager < ActiveRecord::Base attr_accessible :LNr, :TNr end
Ruby
class OrdersConsistsOfParts < ActiveRecord::Base attr_accessible :preisBestellung, :stueckzahl, :orderID, :partID set_table_name "orders_consists_of_parts" #migration ändern belongs_to :order belongs_to :parts end
Ruby
class Bedarf < ActiveRecord::Base attr_accessible :Datum, :TNr, :anzahl set_table_name "bedarfs" end
Ruby
class MayOrder < ActiveRecord::Base attr_accessible :customerID, :orderID end
Ruby
class Bedarfsableitung < ActiveRecord::Base attr_accessible :AuDatum, :AuTNr, :BeDatum, :BeTNr end
Ruby
class Auftrag < ActiveRecord::Base attr_accessible :Datum, :TNr, :anzahl end
Ruby
class Customer < ActiveRecord::Base attr_accessible :vorname,:name,:telnr,:email,:rOrt,:rPlz,:rHausNr,:rStr,:passwort,:isAdmin has_many :orders end
Ruby
class Parts < ActiveRecord::Base attr_accessible :preis,:id, :beschreibung,:produktbild,:name,:isProduct has_many :orders, :through => :orders_consists_of_parts has_many :parts, :through => :parts_consists_of_parts end
Ruby
class PartsConsistsOfParts < ActiveRecord::Base attr_accessible :menge, :oberteilID, :unterteilID set_table_name 'parts_consists_of_parts' belongs_to :parts end
Ruby
class Bedarfsdeckung < ActiveRecord::Base attr_accessible :AuDatum, :AuTNr, :BeDatum, :BeTNr end
Ruby
class HomeController < ApplicationController def index end end
Ruby
require './app/controllers/usermodules/primaerBedarfsAnalyse.rb' require './app/controllers/usermodules/ABC-Analyse.rb' class UserController < ApplicationController def index end def pba end def erg_expgl @e_expgl = Primaerbedarfsanalyse.exp_glaettung(params[:lPB].to_i,params[:lB].to_i,params[:alpha]....
Ruby
class ProduktKatalogController < ApplicationController def index @indexresult = Parts.where(:isProduct => true) end def search searchinput = params[:searchinput] @searchresult = Parts.where("name LIKE '%#{searchinput}%' AND isProduct = 't'") end def add addinput = params[:addinput] put...
Ruby
class KasseController < ApplicationController def index end def buy lStrasse, lHnr,lPlz, lOrt = params[:str] , params[:hnr] , params[:plz], params[:ort] o = Order.new({:lStrasse => lStrasse,:datum => DateTime.current() ,:lOrt => lOrt,:lHausnr => lHnr,:lPlz => lPlz }) o.save preisBestellung ...
Ruby
module ABCAnalyse #ABC-Analyse so wie ich sie verstanden habe: #1. Material-liste wird nach wert sortiert (von max. zu min. preis) #2. wert aller gueter bestimmen #3. elemente werden in A eingefuegt, solange nicht 75% des wertes aller gueter erreicht wurde #4. elemente werden in B eingefuegt, solange nicht ...
Ruby
# library-modul für Funktionen, welche Primärbedarfe ausrechnen module Primaerbedarfsanalyse #letzteBedarfe: Array[Integer] #return planBedarf: Integer def self.gleit_arith_mittel (letzteBedarfe) # pbm = planBedarf = letzteBedarfe.reduce (0) { |accu,b| accu + b } # (bm-n+ bm-n+...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery $warenkorbListe = [] # Integer Arrayliste der Produkt-ID's end
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__) WolkenWebShop::Application.load_tasks
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__) WolkenWebShop::Application.load_tasks
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.8' # 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
class DestroyOldStuff < ActiveRecord::Migration def up drop_table :produktes drop_table :kundes drop_table :bestandteile_bwa_bestandteiles drop_table :bestandteiles drop_table :bestellung_besteht_aus_produktens drop_table :bestellungs end def down raise ActiveRecord::IrreversibleMi...
Ruby
class CreateMayOrders < ActiveRecord::Migration def change create_table :may_orders, :id => false do |t| t.integer :customerID t.integer :orderID end end end
Ruby
class CreateLagerdeckungs < ActiveRecord::Migration def change create_table :lagerdeckungs do |t| t.integer :LNr t.integer :TNr t.date :Datum t.timestamps end end end
Ruby
class CreateCustomers < ActiveRecord::Migration def change create_table :customers do |t| t.primary_key :id t.string :name t.string :vorname t.integer :telnr t.string :email t.string :rStr t.integer :rPlz t.string :rOrt t.integer :rHausNr t.timestamps ...
Ruby
class CreateOrders < ActiveRecord::Migration def change create_table :orders do |t| t.primary_key :id t.string :lStrasse t.integer :lPlz t.integer :lHausnr t.string :lOrt t.date :datum t.timestamps end end end
Ruby
class CreateLagers < ActiveRecord::Migration def change create_table :lagers do |t| t.integer :LNr t.integer :TNr t.timestamps end end end
Ruby
class CreateParts < ActiveRecord::Migration def change create_table :parts do |t| t.primary_key :id t.decimal :preis t.text :beschreibung t.string :produktbild t.string :name t.timestamps end end end
Ruby
class CreateAuftrags < ActiveRecord::Migration def change create_table :auftrags do |t| t.integer :TNr t.date :Datum t.timestamps end end end
Ruby
class CreatePartsConsistsOfParts < ActiveRecord::Migration def change create_table :parts_consists_of_parts do |t| t.integer :menge t.timestamps end end end
Ruby
class AddPasswortToCustomers < ActiveRecord::Migration def change add_column :customers, :passwort, :string end end
Ruby
class CreateOrdersConsistsOfParts < ActiveRecord::Migration def change create_table :orders_consists_of_parts do |t| t.integer :stueckzahl t.decimal :preisBestellung t.timestamps end end end
Ruby
class AddIsAdminToCustomers < ActiveRecord::Migration def change add_column :customers, :isAdmin, :boolean end end
Ruby
class CreateBedarves < ActiveRecord::Migration def change create_table :bedarves do |t| t.integer :TNr t.date :Datum t.timestamps end end end
Ruby
class CreateBedarfsableitungs < ActiveRecord::Migration def change create_table :bedarfsableitungs do |t| t.integer :AuTNr t.integer :BeTNr t.date :AuDatum t.date :BeDatum t.timestamps end end end
Ruby
class CreateBedarfsdeckungs < ActiveRecord::Migration def change create_table :bedarfsdeckungs do |t| t.integer :AuTNr t.integer :BeTNr t.date :AuDatum t.date :BeDatum t.timestamps end end end
Ruby
class FuegeBeschreibungZuProdukteHinzu < ActiveRecord::Migration def up end def down end end
Ruby
class AddProduktBildToProduktes < ActiveRecord::Migration def change add_column :produktes, :produktbild, :string end end
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
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run WolkenWebShop::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 any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "" sass_dir = "sass" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :ne...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "/" sass_dir = "library/sass" images_dir = "library/images" javascripts_dir = "library/js" fonts_dir = "library/fonts" output_style = :expanded environment = :production # To enable relative...
Ruby
#! ruby require 'fileutils' task :woof => [] do Dir.chdir("vm"){ # system "mzc -k kernel.scm" # system "mzc -k machine-utils.scm" # system "mzc -k instructions.scm" # system "mzc -k primitives.scm" # system "mzc -k machine.scm" # system "mzc -k compiler.scm" # system "mzc -k main.sc...
Ruby
#! ruby require 'fileutils' ENV['CXX'] = "gcc" task :woof => [:compile_to_c, :link_woof] do Dir.chdir("vm"){ FileUtils.mv "woof.exe", "../" } end task :compile_to_c => [] do Dir.chdir("vm"){ system "gsc -link lib/sc2 lib/comlist lib/srfi-1 lib/vector lib/string lib/port-copying lib/test co...
Ruby
#! ruby require 'fileutils' ENV['CXX'] = "gcc" task :woof => [:compile_to_c, :link_woof] do Dir.chdir("vm"){ FileUtils.mv "woof.exe", "../" } end task :compile_to_c => [] do Dir.chdir("vm"){ system "gsc -link lib/sc2 lib/comlist lib/srfi-1 lib/vector lib/string lib/port-copying lib/test co...
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
n,m,t=100,2000,200 1.upto(m) {|i| a,b = rand(n),rand(n) a,b = rand(n),rand(n) while a==b puts "node#{a},node#{b},edge#{i},#{rand(65535)}" } puts 1.upto(t) { a,b = rand(n),rand(n) a,b = rand(n),rand(n) while a==b puts "node#{a},node#{b}" }
Ruby
fin = open("input.txt", "r") fin2 = open("ans.txt", "r") finLines = fin.readlines() fin2Lines = fin2.readlines() finLineIdx = 0 fin2LineIdx = 0 t = 0 finLineIdx=finLineIdx+1 while finLines[finLineIdx].strip.length==0 t = finLines[finLineIdx].to_i 1.upto(t) {|testcase| begin finLineIdx=finLineIdx+1 ...
Ruby
#inputs = gets.chomp.split(' ') #n,m = inputs.map! {|x| x.to_i} n,m = 40,100 puts 1 puts "#{n} #{m}" sizes = Array.new(n,0) 1.upto(n-1) {|i| sizes[i] = i} sum = 0; sumSize = sizes.map{|i| sum=sum+i} edges = Array.new(sumSize.last) 0.upto(sumSize.last-1) {|x| edges[x] = x} 0.upto(10*m){ a = rand(sumSize.las...
Ruby
require 'configuration_manager_hash' require 'configuration_manager'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the configuration_manager plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the configur...
Ruby
# desc "Explaining what the task does" # task :configuration_manager do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
# Install hook code here
Ruby
class ConfigurationManager # Expects the environment to load. # Second argument is path to a YAML file (defaults to RAILS_ROOT/config/configuration_manager.yml). # def self.new_manager(environment=RAILS_ENV, yaml_file=File.join(RAILS_ROOT,"/config/configuration_manager.yml")) yaml_file = File.expand_path(ya...
Ruby
class ConfigurationManagerHash < Hash def method_missing(method, *args) if self.keys.include?(method.to_s) result = self[method.to_s] if result.class == Hash result = self[method.to_s] = ConfigurationManagerHash.new_from_hash(result) end return result else super end ...
Ruby
require 'acts_as_fulltextable'
Ruby
class FulltextRowsGenerator < Rails::Generator::Base attr_accessor :models def initialize(*runtime_args) super(*runtime_args) @models = args.map {|m| Object.const_get(m.camelize) rescue nil}.compact.uniq end def manifest record do |m| m.migration_template("migration.rb", 'db/migrate', ...
Ruby
class CreateFulltextRows < ActiveRecord::Migration def self.up create_table :fulltext_rows, :options => 'ENGINE=MyISAM' do |t| t.column :fulltextable_type, :string, :null => false, :limit => 50 t.column :fulltextable_id, :integer, :null => false t.column :value, :text, :null...
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the acts_as_fulltextable plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the acts_as_f...
Ruby
# desc "Explaining what the task does" # task :acts_as_fulltextable do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby