code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class RemoveRequisicaosTable < ActiveRecord::Migration
def up
drop_table :requisicaos
end
def down
create_table :hospedagems_servicos, :id => false do |t|
t.integer :hospedagem_id
t.integer :servico_id
t.float :preco_unitario
t.integer :qtd
t.boolean :estornado
end
a... | Ruby |
class CreateReservas < ActiveRecord::Migration
def change
create_table :reservas do |t|
t.references :funcionario
t.references :hospede
t.references :quarto
t.integer :status
t.datetime :data_encerramento
t.datetime :data_entrada_hospedagem
t.datetime :data_saida_hospedagem
t.timestamps
... | Ruby |
class CreateHospedagemsServicosJoinTable < ActiveRecord::Migration
def up
create_table :hospedagems_servicos, :id => false do |t|
t.integer :hospedagem_id
t.integer :servico_id
t.float :preco_unitario
t.integer :qtd
t.boolean :estornado
end
end
def down
drop_table :hosped... | Ruby |
class AddStatusField2Hospedagem < ActiveRecord::Migration
def up
add_column :hospedagems, :aberta, :boolean
end
def down
remove_column :hospedagems, :aberta
end
end | Ruby |
class AddShortAndLongDescriptionToServico < ActiveRecord::Migration
def change
change_table :servicos do |t|
t.remove :descricao
t.string :desc_curta
t.string :desc_longa
end
end
end
| Ruby |
class RemoveStatusFromReserva < ActiveRecord::Migration
def change
remove_column :reservas, :status
end
end
| Ruby |
class CreateHospedagems < ActiveRecord::Migration
def change
create_table :hospedagems do |t|
t.references :hospede
t.references :funcionario
t.references :quarto
t.datetime :data_encerramento
t.timestamps
end
add_index :hospedagems, :hospede_id
add_index :hospedagems, :... | Ruby |
class CreateServicos < ActiveRecord::Migration
def change
create_table :servicos do |t|
t.string :descricao
t.float :preco
t.timestamps
end
end
end
| Ruby |
class CreateAdmins < ActiveRecord::Migration
def change
create_table :admins do |t|
t.timestamps
end
end
end
| Ruby |
class CreateRequisicaos < ActiveRecord::Migration
def change
create_table :requisicaos do |t|
t.references :hospedagem
t.references :servico
t.integer :qtd
t.float :preco_unitario
t.boolean :estornado
t.timestamps
end
add_index :requisicaos, :hospedagem_id
add_inde... | Ruby |
class MudaNomeParaNumeroQuarto < ActiveRecord::Migration
def up
change_table :quartos do |t|
t.remove :nome
t.integer :numero
end
end
def down
end
end
| Ruby |
class CreateQuartos < ActiveRecord::Migration
def change
create_table :quartos do |t|
t.string :nome
t.references :tipo_quarto
t.timestamps
end
add_index :quartos, :tipo_quarto_id
end
end
| Ruby |
class CriaTabelaEstados < ActiveRecord::Migration
def up
end
def down
end
end
| Ruby |
class CreateUsuarios < ActiveRecord::Migration
def change
create_table :usuarios do |t|
t.string :login
t.string :senha
t.string :nome
t.string :rua
t.integer :numero
t.integer :apt
t.string :bairro
t.string :cidade
t.string :estado
t.string :telefone
... | Ruby |
class ChangeDatetime2Date < ActiveRecord::Migration
def up
change_column :reservas, :data_entrada_hospedagem, :date
change_column :Reservas, :data_saida_hospedagem, :date
end
def down
change_column :reservas, :data_entrada_hospedagem, :datetime
change_column :Reservas, :data_saida_hospedagem, :dateti... | Ruby |
class ChangeHabtm2HasManyThrough < ActiveRecord::Migration
def up
add_column :hospedagems_servicos, :id, :primary_key
rename_table :hospedagems_servicos, :requisicaos
end
def down
rename_table :requisicaos, :hospedagems_servicos
remove_column :hospedagems_servicos, :id
end
end
| Ruby |
class CreateEstados < ActiveRecord::Migration
def change
create_table :estados do |t|
t.string :sigla
t.string :nome
t.timestamps
end
end
end
| Ruby |
class AddUsersHierarchy < ActiveRecord::Migration
def up
add_column :usuarios, :type, :string
end
def down
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 Apsoo::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 '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 'nokogiri'
string_to_remove = ['pref_cat_themes',
'theme_settings',
'theme_settings_summary',
'theme_settings_help']
string_files = []
Dir.glob('res/values*').each do |d|
file = d << "/strings.xml"
string_files << file if Fil... | 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 |
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 |
require "mkmf"
drive = File::PATH_SEPARATOR == ";" ? /\A\w:/ : /\A/
print "\n"
print "arch = "
print CONFIG["arch"]
print "\n"
print "ruby_version = "
print Config::CONFIG["ruby_version"]
print "\n"
print "prefix = "
print CONFIG["prefix"].sub(drive, "")
print "\n"
print "exec_prefix = "
print CONFIG["exec_prefix"].sub... | Ruby |
require "mkmf"
drive = File::PATH_SEPARATOR == ";" ? /\A\w:/ : /\A/
print "arch = "
print CONFIG["arch"]
print "\n"
print "ruby_version = "
print Config::CONFIG["ruby_version"]
print "\n"
print "prefix = "
print with_destdir(CONFIG["prefix"].sub(drive, ""))
print "\n"
print "exec_prefix = "
print with_destdir(CONFIG["e... | Ruby |
#
# DBD::SQLRelay
# $Id: SQLRelay.rb,v 1.2 2004/02/15 17:59:45 mused Exp $
#
# Version : 0.1
# Author : Michael Neumann (neumann@s-direktnet.de)
#
# Copyright (c) 2001 Michael Neumann
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as ... | Ruby |
require "mkmf"
drive = File::PATH_SEPARATOR == ";" ? /\A\w:/ : /\A/
print "arch = "
print CONFIG["arch"]
print "\n"
print "sitearch = "
print CONFIG["sitearch"]
print "\n"
print "ruby_version = "
print Config::CONFIG["ruby_version"]
print "\n"
print "prefix = "
print with_destdir(CONFIG["prefix"].sub(drive, ""))
print ... | Ruby |
Pod::Spec.new do |s|
s.name = 'DIYMenu'
s.version = '0.2.2'
s.license = 'Apache 2.0'
s.summary = 'A little menu intended to drop down below a titlebar.'
s.homepage = 'https://github.com/dongle/DIYMenu'
s.authors = {'Jon Beilin' => 'jon@diy.org'}
s.source = { :git => 'https://github.com/dongle/DI... | Ruby |
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#====================================================================... | Ruby |
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
cl... | Ruby |
=begin
Arabic Reading Right to left
Author: Bulletxt
Version: 0.5
Date: 12/07/2009
=end
# this is an id switch, if ON it will reverse the letters of a word.
# example: "Hello World" will be "olleH dlroW"
REVERSE_LETTERS_OF_WORD = 1
# this is an id switch, if ON it will reverse the... | Ruby |
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class ... | Ruby |
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================
clas... | 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 |
# Install hook code here
| Ruby |
namespace :backup do
namespace :db do
# Get the build number by parsing the svn info data.
# This function is inside the rake task so we can use it with sake
def get_build_number
begin
f = File.open "#{RAILS_ROOT}/.svn/entries"
# The revision information is on 4 lines in .svn/entri... | Ruby |
# Uninstall hook code here
| Ruby |
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the yml_dump plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the yml_dump plugin.'
Rak... | Ruby |
# Install hook code here
| Ruby |
namespace :backup do
namespace :db do
# Get the build number by parsing the svn info data.
# This function is inside the rake task so we can use it with sake
def get_build_number
begin
f = File.open "#{RAILS_ROOT}/.svn/entries"
# The revision information is on 4 lines in .svn/entri... | Ruby |
# Uninstall hook code here
| Ruby |
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the yml_dump plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the yml_dump plugin.'
Rak... | 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 |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | 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 |
#
# This file is only needed for Compass/Sass integration. If you are not using
# Compass, you may safely ignore or delete this file.
#
# If you'd like to learn more about Sass and Compass, see the sass/README.txt
# file for more information.
#
# Change this to :production when ready to deploy the CSS to the live ser... | Ruby |
description "Unit tests for the Zen Grids system."
stylesheet 'sass/function-zen-direction-flip.scss', :media => 'all', :to => 'function-zen-direction-flip.scss'
stylesheet 'sass/function-zen-grid-item-width.scss', :media => 'all', :to => 'function-zen-grid-item-width.scss'
stylesheet 'sass/function-zen-half-gutter.s... | Ruby |
description "The Zen Grids system."
stylesheet 'common.scss', :media => 'all'
stylesheet 'layout.scss', :media => 'all'
stylesheet 'styles.scss', :media => 'all'
html 'example.html'
help %Q{
Zen Grids is an intuitive, flexible grid system that leverages the natural source order of your content to make it easier to c... | Ruby |
require 'compass'
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
Compass::Frameworks.register('zen-grids', :path => extension_path)
| Ruby |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'zen-grids'
s.summary = %q{A Compass plugin for Zen Grids, a fluid responsive grid system}
s.description = %q{Zen Grids is an intuitive, flexible grid system that leverages the natural source order of your content to make it easier to c... | Ruby |
#
# This file is only needed for Compass/Sass integration. If you are not using
# Compass, you may safely ignore or delete this file.
#
# If you'd like to learn more about Sass and Compass, see the sass/README.txt
# file for more information.
#
# Change this to :production when ready to deploy the CSS to the live ser... | Ruby |
description "Unit tests for the Zen Grids system."
stylesheet 'sass/function-zen-direction-flip.scss', :media => 'all', :to => 'function-zen-direction-flip.scss'
stylesheet 'sass/function-zen-grid-item-width.scss', :media => 'all', :to => 'function-zen-grid-item-width.scss'
stylesheet 'sass/function-zen-half-gutter.s... | Ruby |
description "The Zen Grids system."
stylesheet 'common.scss', :media => 'all'
stylesheet 'layout.scss', :media => 'all'
stylesheet 'styles.scss', :media => 'all'
html 'example.html'
help %Q{
Zen Grids is an intuitive, flexible grid system that leverages the natural source order of your content to make it easier to c... | Ruby |
require 'compass'
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
Compass::Frameworks.register('zen-grids', :path => extension_path)
| Ruby |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'zen-grids'
s.summary = %q{A Compass plugin for Zen Grids, a fluid responsive grid system}
s.description = %q{Zen Grids is an intuitive, flexible grid system that leverages the natural source order of your content to make it easier to c... | 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 |
#!/usr/bin/env ruby
#==============================================================================
#
# iGoat Server
#
# Authors:
# Sean Eidemiller (sean@krvw.com)
#
# Ports:
# 8080/HTTP
# 8443/HTTPS (SSL)
#
# Endpoints:
# POST /igoat/user
# GET /igoat/token?username=<username>&password=<password>
#
# Exampl... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
class Publication
require 'state_library'
include StateLibrary
attr_reader :name, :channel_id, :subchannel, :marc_id, :some_path, :book_id_format, :issue_count, :max_page
def initialize(name, channel_id, subchannel, marc_id, some_path, book_id_format, issue_count, max_page = 9999)
@name = name
@chan... | Ruby |
module StateLibrary
require 'cgi'
require 'fileutils'
include FileUtils
def download_page(multi_issue, channel_id, subchannel, marc_id, some_path, issue_id, page_number, output_file)
base_url = "http://res4.nlc.gov.cn"
top_flag = multi_issue ? "" : "t"
filename_size = multi_issue ? "&filenameSize=3... | Ruby |
#!/usr/bin/env ruby
require 'getoptlong'
# The name of the collectd plugin, something like apache, memory, mysql, interface, ...
PLUGIN_NAME = 'arduinologger-temperature'
def usage
puts("#{$0} -h <host_id> [-i <sampling_interval>]")
exit
end
# Main
begin
# Sync stdout so that it will flush to collectd properly... | Ruby |
#!/usr/bin/env ruby
require 'getoptlong'
# The name of the collectd plugin, something like apache, memory, mysql, interface, ...
PLUGIN_NAME = 'arduinologger-distance'
def usage
puts("#{$0} -h <host_id> [-i <sampling_interval>]")
exit
end
# Main
begin
# Sync stdout so that it will flush to collectd properly.
... | Ruby |
#!/usr/bin/env ruby
require 'getoptlong'
# The name of the collectd plugin, something like apache, memory, mysql, interface, ...
PLUGIN_NAME = 'arduinologger-humidity'
def usage
puts("#{$0} -h <host_id> [-i <sampling_interval>]")
exit
end
# Main
begin
# Sync stdout so that it will flush to collectd properly.
... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
module CppUTestToUnityUtils
def convert_test_filename_to_unity_filename(testpath)
testpath.sub(/^tests\/(.*)\.cpp/, "unity/\\1.c")
end
def convert_test_filename_to_unity_testrunner_filename(testpath)
testpath.sub(/^tests\/(.*)\.cpp/, "unity/\\1_runner.c")
end
def convert_one_liners(line, grou... | Ruby |
#!/usr/bin/ruby
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
include CppUTestToUnityUtils
in_file = ARGV[0]
create_group_runner_file(in_file)
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(in_file)
puts "Creating test runner for :" + in_file + "\n"
puts " ... | Ruby |
#!/usr/bin/ruby
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
include CppUTestToUnityUtils
in_file = ARGV[0]
unity_filename = convert_test_filename_to_unity_filename(in_file)
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(in_file)
puts "Converting :" + in_file +... | Ruby |
#!/usr/bin/ruby
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
include CppUTestToUnityUtils
test_lines = Array.new
expected_lines = Array.new
#---------------------------------------------------
test_lines =
["\n",
"TEST_GROUP(mygroup)\n",
"{\n",
"}\n",
"\n"
]
group = get_test_group(... | Ruby |
#!/bin/ruby
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
include CppUTestToUnityUtils
in_file = ARGV[0]
test_lines = File.open(in_file).collect
out_file = File.open(File.basename(in_file, ".c") + "_runner.c", 'w')
group_runner = generate_group_runner_plainUnity("unity", test_lines)
wri... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class TestMethodNotFound < TestSandbox
def test_method
self.sandbox.run("foo(1,2,3)")
assert_equal :foo, service_provider.last_call[0]
end
def setup
super
sandbox.permit :foo
end
end
| Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class SingletonMethodTest < TestSandbox
def _test_obj( objstr )
assert_raise NoMethodError, RuntimeError do
self.sandbox.run( "a = #{objstr}
def a.foo
system('ls -l')
end
a.foo
"
)
end
end
def tes... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class MagicMethodTest < TestSandbox
def _test_obj( objstr )
assert_raise NoMethodError, RuntimeError do
self.sandbox.run( "a = #{objstr}
magic_method = a.public_methods.select{|x| x.size > 20 and x[0..0] == '_'}.first
a.send(magi... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class SingletonMethodTest < TestSandbox
def test_default
assert_raise NoMethodError, RuntimeError do
self.sandbox.run( "
def system(*args)
super(*args)
end
system('ls -l')
"
)
end
end
end
| Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class TestMethodNotFound < TestSandbox
def test_prohibited_method
assert_raise NoMethodError, RuntimeError do
self.sandbox.run("prohibited_method")
end
end
def test_prohibited_system_method
assert_raise NoMethodError, RuntimeError ... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class DisablePrivilegesTest < TestSandbox
def test_methods
assert_raise NoMethodError, TypeError, RuntimeError do
self.sandbox.run( "
begin
def @context_switcher.sandbox
@sandbox
end
rescue
end
... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class TestInstanceEval < TestSandbox
def _test_obj( objstr )
assert_raise RuntimeError, NoMethodError do
self.sandbox.run( "#{objstr}.instance_eval do
system('ls -l')
end
"
)
end
end
def test_methods
_test_ob... | Ruby |
require 'rubygems'
require 'test/unit'
require "sandbox_base_test"
class TestForeignInstanceEval < TestSandbox
def test_method
assert_raise RuntimeError, NoMethodError do
self.sandbox.run( "foo.instance_eval do
system('ls -l')
end
"
)
end
end
class X
end
def setup
super... | Ruby |
/a/.instance_eval{
system("ls -l")
}
| Ruby |
io = foo("oo").instance_variable_get(@inner_object)
| Ruby |
a = " 4"
#def a.singleton_method_added(m)ca
# system("ls -l")
#end
#system("ls -l")
begin
def @context_switcher.a
@sandbox
end
rescue Exception => e
print "Error #{e}\n"
rescue ArgumentError
print "ArgumentError\n"
end
sandbox = @context_switcher.a
sandbox.enable_privileges
sandbox.instance_eval do
system("ls ... | Ruby |
a = " 4"
#def a.singleton_method_added(m)ca
# system("ls -l")
#end
#system("ls -l")
begin
def @context_switcher.singleton_method_added(m)
end
rescue Exception => e
print "Error #{e}\n"
rescue ArgumentError
print "ArgumentError\n"
end
begin
def @context_switcher.a
@sandbox
end
rescue Exception => e
print "Error #{e... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.