source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/backend_services_factory.rb | Ruby | mit | 99 | master | 496 | require "integration/factories/collection_factory"
require "integration/factories/http_health_checks_factory"
class BackendServicesFactory < CollectionFactory
def initialize(example)
@http_health_checks = HttpHealthChecksFactory.new(example)
super(Fog::Compute[:google].backend_services, example)
end
def... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/sql_instances_factory.rb | Ruby | mit | 99 | master | 485 | require "integration/factories/collection_factory"
class SqlInstancesFactory < CollectionFactory
def initialize(example)
super(Fog::Google[:sql].instances, example)
end
def cleanup
super
end
def params
# Name has a time suffix due to SQL resources API objects having
# a _very_ long life on ... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/forwarding_rules_factory.rb | Ruby | mit | 99 | master | 573 | require "integration/factories/collection_factory"
require "integration/factories/target_pools_factory"
class ForwardingRulesFactory < CollectionFactory
def initialize(example)
@target_pools = TargetPoolsFactory.new(example)
super(Fog::Compute[:google].forwarding_rules, example)
end
def cleanup
supe... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/disks_factory.rb | Ruby | mit | 99 | master | 440 | require "integration/factories/collection_factory"
class DisksFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].disks, example)
end
def get(identity)
@subject.get(identity, TEST_ZONE)
end
def all
@subject.all(zone: TEST_ZONE)
end
def params
{ :name => reso... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/instance_group_manager_factory.rb | Ruby | mit | 99 | master | 707 | require "integration/factories/collection_factory"
require "integration/factories/instance_template_factory"
class InstanceGroupManagerFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].instance_group_managers, example)
@instance_template = InstanceTemplateFactory.new(example)
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/collection_factory.rb | Ruby | mit | 99 | master | 2,078 | class CollectionFactory
PREFIX = "fog-test".freeze
def initialize(subject, example)
@subject = subject
@example = example
@resource_counter = 0
end
# Cleans up all objects created by the factory in the current test suite.
#
# @param async [FalseClass or TrueClass] perform resource destruction ... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/ssl_certificates_factory.rb | Ruby | mit | 99 | master | 347 | require "integration/factories/collection_factory"
class SslCertificatesFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].ssl_certificates, example)
end
def params
{ :name => resource_name,
:certificate => TEST_PEM_CERTIFICATE,
:private_key => TEST_PEM_CERTIFICA... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/target_http_proxies_factory.rb | Ruby | mit | 99 | master | 444 | require "integration/factories/collection_factory"
require "integration/factories/url_maps_factory"
class TargetHttpProxiesFactory < CollectionFactory
def initialize(example)
@url_maps = UrlMapsFactory.new(example)
super(Fog::Compute[:google].target_http_proxies, example)
end
def cleanup
super
@... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/http_health_checks_factory.rb | Ruby | mit | 99 | master | 250 | require "integration/factories/collection_factory"
class HttpHealthChecksFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].http_health_checks, example)
end
def params
{ :name => resource_name }
end
end |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/images_factory.rb | Ruby | mit | 99 | master | 352 | require "integration/factories/collection_factory"
class ImagesFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].images, example)
end
def get(identity)
@subject.get(identity, TEST_PROJECT)
end
def params
{ :name => resource_name,
:raw_disk => { :source => TES... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/firewalls_factory.rb | Ruby | mit | 99 | master | 321 | require "integration/factories/collection_factory"
class FirewallsFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].firewalls, example)
end
def params
{ :name => resource_name,
:allowed => [{ :ip_protocol => "TCP",
:ports => ["201"] }] }
end
end |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/servers_factory.rb | Ruby | mit | 99 | master | 666 | require "integration/factories/collection_factory"
require "integration/factories/disks_factory"
class ServersFactory < CollectionFactory
def initialize(example)
@disks = DisksFactory.new(example)
super(Fog::Compute[:google].servers, example)
end
def cleanup
# Disk cleanup sometimes fails if server ... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/target_https_proxies_factory.rb | Ruby | mit | 99 | master | 811 | require "integration/factories/collection_factory"
require "integration/factories/url_maps_factory"
require "integration/factories/ssl_certificates_factory"
class TargetHttpsProxiesFactory < CollectionFactory
def initialize(example)
@ssl_certificates = SslCertificatesFactory.new(example)
@url_maps = UrlMapsF... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/target_pools_factory.rb | Ruby | mit | 99 | master | 761 | require "integration/factories/collection_factory"
require "integration/factories/servers_factory"
require "integration/factories/http_health_checks_factory"
class TargetPoolsFactory < CollectionFactory
def initialize(example)
@http_health_checks = HttpHealthChecksFactory.new(example)
@servers = ServersFacto... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/instance_groups_factory.rb | Ruby | mit | 99 | master | 387 | require "integration/factories/collection_factory"
class InstanceGroupsFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].instance_groups, example)
end
def get(identity)
@subject.get(identity, TEST_ZONE)
end
def all
@subject.all(zone: TEST_ZONE)
end
def params
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/url_maps_factory.rb | Ruby | mit | 99 | master | 471 | require "integration/factories/collection_factory"
require "integration/factories/backend_services_factory"
class UrlMapsFactory < CollectionFactory
def initialize(example)
@backend_services = BackendServicesFactory.new(example)
super(Fog::Compute[:google].url_maps, example)
end
def cleanup
super
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/sql_users_factory.rb | Ruby | mit | 99 | master | 685 | require "integration/factories/collection_factory"
require "integration/factories/sql_instances_factory"
class SqlUsersFactory < CollectionFactory
def initialize(example)
@instances = SqlInstancesFactory.new(example)
super(Fog::Google[:sql].users, example)
end
def cleanup
# Users will be cleaned up ... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/global_addresses_factory.rb | Ruby | mit | 99 | master | 301 | require "integration/factories/collection_factory"
class GlobalAddressesFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].global_addresses, example)
end
def get(identity)
@subject.get(identity)
end
def params
{ :name => resource_name }
end
end |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/instance_template_factory.rb | Ruby | mit | 99 | master | 784 | require "integration/factories/collection_factory"
class InstanceTemplateFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].instance_templates, example)
end
def params
{
:name => resource_name,
# TODO: Properties config is convoluted, needs to be refactored
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/sql_certs_factory.rb | Ruby | mit | 99 | master | 545 | require "integration/factories/collection_factory"
require "integration/factories/sql_instances_factory"
class SqlCertsFactory < CollectionFactory
def initialize(example)
@instances = SqlInstancesFactory.new(example)
super(Fog::Google[:sql].ssl_certs, example)
end
def cleanup
# Certs will be cleaned... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/target_instances_factory.rb | Ruby | mit | 99 | master | 513 | require "integration/factories/collection_factory"
require "integration/factories/servers_factory"
class TargetInstancesFactory < CollectionFactory
def initialize(example)
@servers = ServersFactory.new(example)
super(Fog::Compute[:google].target_instances, example)
end
def cleanup
super
@servers... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/factories/global_forwarding_rules_factory.rb | Ruby | mit | 99 | master | 499 | require "integration/factories/collection_factory"
require "integration/factories/target_http_proxies_factory"
class GlobalForwardingRulesFactory < CollectionFactory
def initialize(example)
@targets = TargetHttpProxiesFactory.new(example)
super(Fog::Compute[:google].global_forwarding_rules, example)
end
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/monitoring/test_monitored_resource_descriptors.rb | Ruby | mit | 99 | master | 997 | require "helpers/integration_test_helper"
class TestMetricDescriptors < FogIntegrationTest
def setup
@client = Fog::Google::Monitoring.new
end
def test_list_and_get
resp = @client.list_monitored_resource_descriptors
assert_operator(resp.resource_descriptors.size, :>, 0,
"resourc... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/monitoring/test_coverage.rb | Ruby | mit | 99 | master | 283 | require "helpers/integration_test_helper"
# This is a simple coverage helper that helps differentiate
# the tests when run in parallel so the final coverage report
# can be properly combined together from multiple runners
SimpleCov.command_name "test:monitoring" if ENV["COVERAGE"] |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/monitoring/test_timeseries.rb | Ruby | mit | 99 | master | 7,932 | require "helpers/integration_test_helper"
class TestMetricDescriptors < FogIntegrationTest
# This module has a decent amount of retry wrappers as the Stackdriver API
# can be quite slow with metric propagation (sometimes 80+ seconds) and client
# returning errors, e.g. Google::Apis::ClientError: badRequest if th... |
github | fog/fog-google | https://github.com/fog/fog-google | test/integration/monitoring/test_metric_descriptors.rb | Ruby | mit | 99 | master | 4,766 | require "helpers/integration_test_helper"
require "helpers/client_helper"
class TestMetricDescriptors < FogIntegrationTest
TEST_METRIC_TYPE_PREFIX = "custom.googleapis.com/fog-google-test/test-metric-descriptors".freeze
def setup
@client = Fog::Google::Monitoring.new
# Ensure any resources we create with ... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/test_shared.rb | Ruby | mit | 99 | master | 2,428 | require "helpers/test_helper"
class TestShared < Minitest::Test
# Test class that includes Fog::Google::Shared
class TestClient
include Fog::Google::Shared
end
# Simple stub service class
class ServiceStub
attr_reader :universe_domain_called_with
attr_accessor :client_options
def initialize... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/dns/test_common_collections.rb | Ruby | mit | 99 | master | 1,400 | require "helpers/test_helper"
class UnitTestDNSCollections < Minitest::Test
def setup
Fog.mock!
@client = Fog::DNS.new(provider: "google",
google_project: "foo")
# Exceptions that do not pass test_common_methods:
#
# DNS Projects API does not support 'list', so 'all' m... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/pubsub/test_common_collections.rb | Ruby | mit | 99 | master | 1,078 | require "helpers/test_helper"
class UnitTestPubsubCollections < Minitest::Test
def setup
Fog.mock!
@client = Fog::Google::Pubsub.new(google_project: "foo")
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
@collections = descen... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/monitoring/test_comon_collections.rb | Ruby | mit | 99 | master | 1,419 | require "helpers/test_helper"
class UnitTestMonitoringCollections < Minitest::Test
def setup
Fog.mock!
@client = Fog::Monitoring.new(provider: "google",
google_project: "foo")
# Exceptions that do not pass test_common_methods:
#
# TimeSeries API has no 'get' met... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/compute/test_operation.rb | Ruby | mit | 99 | master | 9,249 | require "helpers/test_helper"
class UnitTestOperation < Minitest::Test
OP_NAME = "operation-1765631023137-645d501f04210-ccccdddd-eeeeffff"
OP_REGION = "us-central1"
OP_CLIENT_OPERATION_ID = 3188330303322222222
OP_CREATION_TIMESTAMP = "2023-12-13T05:03:43.789-08:00"
O... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/compute/test_server.rb | Ruby | mit | 99 | master | 721 | require "helpers/test_helper"
class UnitTestServer < Minitest::Test
def setup
Fog.mock!
@client = Fog::Compute.new(provider: "google",
google_project: "foo")
end
def teardown
Fog.unmock!
end
def test_if_server_accepts_ssh_keys
key = "ssh-rsa IAMNOTAREALSSHKEYA... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/compute/test_common_collections.rb | Ruby | mit | 99 | master | 1,386 | require "helpers/test_helper"
class UnitTestCollections < Minitest::Test
def setup
Fog.mock!
@client = Fog::Compute.new(provider: "google",
google_project: "foo")
# Exceptions that do not pass test_common_methods:
#
# Projects do not have a "list" method in comput... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/compute/test_disk.rb | Ruby | mit | 99 | master | 981 | require "helpers/test_helper"
class UnitTestDisk < Minitest::Test
def setup
Fog.mock!
@client = Fog::Compute.new(provider: "google",
google_project: "foo")
end
def teardown
Fog.unmock!
end
def test_new_disk
disk = Fog::Google::Compute::Disk.new(
:name =>... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/compute/test_common_models.rb | Ruby | mit | 99 | master | 1,204 | require "helpers/test_helper"
class UnitTestModels < Minitest::Test
def setup
Fog.mock!
@client = Fog::Compute.new(provider: "google",
google_project: "foo")
# Do not test models that do not have a create method in API
exceptions = [Fog::Google::Compute::MachineType,
... |
github | fog/fog-google | https://github.com/fog/fog-google | test/unit/sql/test_common_collections.rb | Ruby | mit | 99 | master | 1,538 | require "helpers/test_helper"
class UnitTestSQLCollections < Minitest::Test
def setup
Fog.mock!
@client = Fog::Google::SQL.new(google_project: "foo")
# Exceptions that do not pass test_common_methods:
#
# SQL Users API doesn't have a 'get' method
# SQL Flags API has only one method - 'list'
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | Rakefile | Ruby | mit | 99 | master | 766 | #!/usr/bin/env rake
require "bundler/gem_tasks"
require "rake/testtask"
task :default => "test/unit"
Rake::TestTask.new("test/unit") do |t|
t.test_files = FileList["test/unit/**/test_*.rb"]
end
task("test/unit").clear_comments
task("test/unit").comment = "Run unit tests"
desc "Run motion tests (Usage: .rake)"
task... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | motion-bundler.gemspec | Ruby | mit | 99 | master | 978 | # -*- encoding: utf-8 -*-
require File.expand_path("../lib/motion-bundler/version", __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Paul Engel"]
gem.email = ["paul.engel@holder.nl"]
gem.summary = %q{Use Ruby gems and mock require statements within RubyMotion applications}
gem.desc... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/ios/Rakefile | Ruby | mit | 99 | master | 657 | # -*- coding: utf-8 -*-
$:.unshift "/Library/RubyMotion/lib"
require "motion/project/template/ios"
# Require and prepare Bundler
require "bundler"
Bundler.require
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = "MBundler"
end
require "/Users/paulengel/.rvm/rub... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/ios/app/app_delegate.rb | Ruby | mit | 99 | master | 271 | class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = AppController.alloc.init
@window.makeKeyAndVisible
true
end
end |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/ios/app/controllers/app_controller.rb | Ruby | mit | 99 | master | 3,322 | require "stringio"
require "strscan"
require "zlib"
require "httparty"
require "net/pop"
require "rexml/document"
require "socket"
require_relative "../../lib/foo"
class AppController < UIViewController
def viewDidLoad
# Testing SlotMachine
ts = TimeSlot.new 1015..1045
p ts.match 10
p ts.match 10,... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/osx/Rakefile | Ruby | mit | 99 | master | 728 | # -*- coding: utf-8 -*-
$:.unshift "/Library/RubyMotion/lib"
require "motion/project/template/osx"
# Require and prepare Bundler
require "bundler"
Bundler.require
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = "MBundler"
app.icon = "Icon"
app.info_plist["C... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/osx/app/window.rb | Ruby | mit | 99 | master | 422 | class AppDelegate
def buildWindow
@mainWindow = NSWindow.alloc.initWithContentRect(
[[240, 180], [480, 360]],
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,
backing: NSBackingStoreBuffered,
defer: false
)
@mainWindow.titl... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/osx/app/tests.rb | Ruby | mit | 99 | master | 3,275 | require "stringio"
require "strscan"
require "zlib"
require "httparty"
require "net/pop"
require "rexml/document"
require "socket"
require_relative "../lib/foo"
class AppDelegate
def runTests
# Testing SlotMachine
ts = TimeSlot.new 1015..1045
p ts.match 10
p ts.match 10, 5
# Testing StringIO... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | sample_apps/osx/app/menu.rb | Ruby | mit | 99 | master | 4,931 | class AppDelegate
def buildMenu
@mainMenu = NSMenu.new
appName = NSBundle.mainBundle.infoDictionary["CFBundleName"]
addMenu appName do
addItemWithTitle "About #{appName}", action: "orderFrontStandardAboutPanel:", keyEquivalent: ""
addItem NSMenuItem.separatorItem
addItemWithTitle "Pref... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler.rb | Ruby | mit | 99 | master | 4,327 | require "bundler"
require "motion-bundler/gem_ext"
require "motion-bundler/config"
require "motion-bundler/require"
require "motion-bundler/version"
module MotionBundler
extend self
PROJECT_PATH = File.expand_path "."
MOTION_BUNDLER_FILE = "#{PROJECT_PATH}/.motion-bundler.rb"
def app_require(file)
app_re... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/config.rb | Ruby | mit | 99 | master | 734 | module MotionBundler
class Config
def initialize
@requires = []
@files_dependencies = {}
register "app/app_delegate.rb" => ["boot.rb"] if boot_file?
end
def boot_file?
File.exists? "boot.rb"
end
def require(name)
@requires << name
end
def register(files_depend... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/cli.rb | Ruby | mit | 99 | master | 652 | require "yaml"
require "thor"
require "motion-bundler"
$CLI = true
module MotionBundler
class CLI < Thor
default_task :trace
desc "trace [FILE]", "Trace files and their mutual dependencies when requiring [FILE]"
def trace(file)
Require.mock_and_trace do
require file, "APP"
end
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/gem_ext.rb | Ruby | mit | 99 | master | 519 | module Motion
module Project
class Config
def files_dependencies(deps_hash)
res_path = lambda do |x|
path = /^\.?\//.match(x) ? x : File.join(".", x)
unless @files.flatten.include?(path)
App.fail "Can't resolve dependency `#{x}'"
end
path
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require.rb | Ruby | mit | 99 | master | 654 | require "motion-bundler/require/tracer"
require "motion-bundler/require/mocker"
require "motion-bundler/require/ripper"
require "motion-bundler/require/resolve"
module MotionBundler
module Require
include Resolve
extend self
def mock_and_trace
mock do
trace do
yield
end
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/resolve.rb | Ruby | mit | 99 | master | 1,528 | module MotionBundler
module Require
module Resolve
def resolve(path, only_mocks = true)
base_path = path.gsub(/\.rb$/, "")
load_paths(only_mocks).each do |load_path|
if (file = Dir["#{load_path}/#{base_path}.rb"].first)
return file
end
end
p... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/tracer.rb | Ruby | mit | 99 | master | 635 | require "motion-bundler/require/tracer/hooks"
require "motion-bundler/require/tracer/log"
module MotionBundler
module Require
module Tracer
include Hooks
extend self
def log
Thread.current[:motion_bundler_log] ||= Log.new
end
def yield
verbose = $VERBOSE
$V... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/ripper.rb | Ruby | mit | 99 | master | 1,767 | require "set"
require "motion-bundler/require/ripper/builder"
module MotionBundler
module Require
class Ripper
def initialize(sources, scope = MotionBundler::PROJECT_PATH)
@sources = sources
@scope = scope
@files = Set.new
@files_dependencies = {}
@requires = {}
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/mocker.rb | Ruby | mit | 99 | master | 398 | require "motion-bundler/require/mocker/hooks"
require "motion-bundler/require/mocker/dirs"
module MotionBundler
module Require
module Mocker
include Hooks
include Dirs
extend self
def yield
start
yield
ensure
stop
end
private
def start
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/tracer/hooks.rb | Ruby | mit | 99 | master | 4,160 | module MotionBundler
module Require
module Tracer
module Hooks
def hook
Kernel.instance_eval &require_hook unless Kernel.respond_to?(:require_with_mb_trace)
Object.class_eval &require_hook unless Object.respond_to?(:require_with_mb_trace)
Kernel.in... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/tracer/log.rb | Ruby | mit | 99 | master | 2,104 | require "yaml"
module MotionBundler
module Require
module Tracer
class Log
def initialize
@files = Set.new
@files_dependencies = {}
@requires = {}
end
def clear
@files.clear
@files_dependencies.clear
@requires.clear
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/mocker/dirs.rb | Ruby | mit | 99 | master | 374 | module MotionBundler
module Require
module Mocker
module Dirs
APP_MOCKS = File.expand_path("./mocks")
GEM_MOCKS = File.expand_path("../../../mocks", __FILE__)
def dirs
@dirs ||= [APP_MOCKS, GEM_MOCKS]
end
def add_dir(dir)
dirs.insert 1, File.exp... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/mocker/hooks.rb | Ruby | mit | 99 | master | 1,102 | module MotionBundler
module Require
module Mocker
module Hooks
def hook
Kernel.instance_eval &require_hook unless Kernel.respond_to?(:require_with_mb_mock)
Object.class_eval &require_hook unless Object.respond_to?(:require_with_mb_mock)
end
def unhook
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/require/ripper/builder.rb | Ruby | mit | 99 | master | 1,003 | require "ripper"
module MotionBundler
module Require
class Ripper
class Builder < ::Ripper::SexpBuilder
def initialize(file)
super File.read(file)
end
def requires
@requires || begin
@requires = []
parse
@requires
e... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/simulator/core_ext.rb | Ruby | mit | 99 | master | 1,322 | unless ENV["MB_SILENCE_CORE"] == "false"
module Kernel
def console
defined?(MotionBundler::Simulator) ? MotionBundler::Simulator::Console : Class.new{ def warn(*args); end }.new
end
end
class Object
def require(name)
console.warn { require name }
end
def require_relative(string)
console.warn { r... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/simulator/console.rb | Ruby | mit | 99 | master | 1,556 | module MotionBundler
module Simulator
module Console
class Warning
def print
if require_statement = [:require, :require_relative, :load, :autoload].include?(@method)
return if MotionBundler::REQUIRES.include? @args.last
end
warning = "Warning Called `#{[@o... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/device/core_ext.rb | Ruby | mit | 99 | master | 346 | unless ENV["MB_SILENCE_CORE"] == "false"
module Kernel
def require(name)
end
def require_relative(string)
end
def load(*args)
end
def autoload(mod, filename)
end
end
class Object
def require(name)
end
def require_relative(string)
end
def load(*args)
end
end
class Module
def autoload(mod... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/mocks/httparty.rb | Ruby | mit | 99 | master | 3,905 | module HTTParty
extend self
def included(base)
base.extend self
end
def format(f)
@format = f
end
def base_uri(u)
@base_uri = u.sub(/\/$/, "")
end
def basic_auth(user, password)
@basic_auth = [user, password]
end
def get(path, options = {}, &block)
send_request path, :get, o... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/mocks/mac_ruby-0.12/stringio.rb | Ruby | mit | 99 | master | 20,387 | # MacRuby implementation of stringio.
#
# This file is covered by the Ruby license. See COPYING for more details.
#
# Copyright (C) 2012, The MacRuby Team. All rights reserved.
# Copyright (C) 2009-2011, Apple Inc. All rights reserved.
class StringIO
attr_reader :string, :pos
# strio.lineno -> integer
#
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/mocks/mac_ruby-0.12/strscan.rb | Ruby | mit | 99 | master | 18,440 | # MacRuby implementation of strscan.
#
# This file is covered by the Ruby license. See COPYING for more details.
#
# Copyright (C) 2012, The MacRuby Team. All rights reserved.
# Copyright (C) 2009-2011, Apple Inc. All rights reserved.
class ScanError < StandardError; end
# StringScanner provides for lexical scanning ... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | lib/motion-bundler/mocks/zliby-0.0.5/zlib.rb | Ruby | mit | 99 | master | 18,378 | require "stringio"
module Zlib
ZLIBY_VERSION = "0.0.5"
ZLIB_VERSION = "1.2.3"
VERSION = "0.6.0" #For compatibility with Ruby-core Zlib
MAXBITS = 15
MAXLCODES = 286
MAXDCODES = 30
MAXCODES = (MAXLCODES+MAXDCODES)
FIXLCODES = 288
MAX_WBITS = 15
Z_DEFLATED = 8
def self.adler32 string="", adler=1
if adler > (2**128) - ... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/test_helper.rb | Ruby | mit | 99 | master | 2,970 | $:.unshift File.expand_path("../lib", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
require_relative "test_helper/coverage"
require_relative "test_helper/motion"
require "fileutils"
require "minitest/unit"
require "minitest/autorun"
require "mocha/setup"
require "motion-bundler"
class MiniTest::Unit::... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/motion/device/test_core_ext.rb | Ruby | mit | 99 | master | 1,041 | require File.expand_path("../../../test_helper", __FILE__)
module Motion
module Device
class TestCoreExt < MiniTest::Unit::TestCase
describe "lib/motion-bundler/device/core_ext.rb" do
before do
ENV["MB_SILENCE_CORE"] = "true"
end
it "should ignore require statements with... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/motion/simulator/test_core_ext.rb | Ruby | mit | 99 | master | 1,735 | require File.expand_path("../../../test_helper", __FILE__)
module Motion
module Simulator
class TestCoreExt < MiniTest::Unit::TestCase
class Foo; end
class Fu; end
describe "lib/motion-bundler/simulator/core_ext.rb" do
before do
ENV["MB_SILENCE_CORE"] = "true"
end
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/motion/simulator/test_setup.rb | Ruby | mit | 99 | master | 2,715 | require File.expand_path("../../../test_helper", __FILE__)
motion_gemfile <<-G
gem "motion-bundler", :path => "#{motion_bundler_file ".."}"
group :motion do
gem "slot_machine", :path => "#{gem_path "slot_machine"}"
end
G
module Motion
module Simulator
class TestSetup < MiniTest::Unit::TestCase
describe... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/test_helper/coverage.rb | Ruby | mit | 99 | master | 206 | if Dir.pwd == File.expand_path("../../..", __FILE__)
require "simplecov"
SimpleCov.coverage_dir "test/coverage"
SimpleCov.start do
# add_filter "lib/motion-bundler/simulator/core_ext.rb"
end
end |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/test_helper/motion.rb | Ruby | mit | 99 | master | 314 | module Motion
module Project
class App
def self.setup
yield new
end
def self.fail(msg)
raise msg
end
def files
@files ||= []
end
def files=(files)
@files = files
end
def files_dependencies(deps)
end
end
end
end |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/test_config.rb | Ruby | mit | 99 | master | 1,344 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestConfig < MiniTest::Unit::TestCase
describe MotionBundler::Config do
it "should include 'boot.rb' when existing" do
assert_equal({}, MotionBundler::Config.new.files_dependencies)
MotionBundler::Config.any_instance... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/test_motion-bundler.rb | Ruby | mit | 99 | master | 5,898 | require File.expand_path("../../test_helper", __FILE__)
require "bundler"
module Unit
class TestMotionBundler < MiniTest::Unit::TestCase
describe MotionBundler do
it "should distinguish whether compiling for simulator or device" do
assert_equal ARGV, MotionBundler.send(:argv)
MotionBundle... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/test_gem_ext.rb | Ruby | mit | 99 | master | 914 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestGemExt < MiniTest::Unit::TestCase
describe "lib/motion-bundler/gem_ext.rb" do
it "should required after having required MotionBundler" do
assert_equal true, $LOADED_FEATURES.include?(motion_bundler_file "motion-bundler/g... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/test_require.rb | Ruby | mit | 99 | master | 1,722 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestRequire < MiniTest::Unit::TestCase
describe MotionBundler::Require do
it "should be able to mock and trace requirements within a block" do
object = mock "object"
object.expects :do_something
MotionBundle... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/simulator/test_core_ext.rb | Ruby | mit | 99 | master | 2,072 | require File.expand_path("../../../test_helper", __FILE__)
require "motion-bundler/simulator/console"
module Unit
module Simulator
class TestCoreExt < MiniTest::Unit::TestCase
describe "lib/motion-bundler/simulator/core_ext.rb" do
before do
ENV["MB_SILENCE_CORE"] = "true"
end
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/simulator/test_console.rb | Ruby | mit | 99 | master | 2,032 | require File.expand_path("../../../test_helper", __FILE__)
require "motion-bundler/simulator/console"
module Unit
module Simulator
class TestConsole < MiniTest::Unit::TestCase
describe MotionBundler::Simulator::Console do
before do
MotionBundler.send :remove_const, :REQUIRES if defined?(... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/test_mocker.rb | Ruby | mit | 99 | master | 1,742 | require File.expand_path("../../../test_helper", __FILE__)
module Unit
module Require
class TestMocker < MiniTest::Unit::TestCase
describe MotionBundler::Require::Mocker do
describe "hooks" do
it "should have MotionBundler::Require::Mocker::Hooks included" do
assert_equal tr... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/test_ripper.rb | Ruby | mit | 99 | master | 3,715 | require File.expand_path("../../../test_helper", __FILE__)
module Unit
module Require
class TestRipper < MiniTest::Unit::TestCase
describe MotionBundler::Require::Ripper do
it "should be able to resolve require paths" do
app_builder = mock "object"
app_builder.expects(:requires... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/test_tracer.rb | Ruby | mit | 99 | master | 3,339 | require File.expand_path("../../../test_helper", __FILE__)
module Unit
module Require
class TestTracer < MiniTest::Unit::TestCase
describe MotionBundler::Require::Tracer do
describe "hooks" do
it "should have MotionBundler::Require::Tracer::Hooks included" do
assert_equal tr... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/test_resolve.rb | Ruby | mit | 99 | master | 1,404 | require File.expand_path("../../../test_helper", __FILE__)
module Unit
module Require
class TestResolve < MiniTest::Unit::TestCase
describe MotionBundler::Require::Resolve do
module Require
include MotionBundler::Require::Resolve
extend self
end
it "should be ... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/ripper/test_builder.rb | Ruby | mit | 99 | master | 935 | require File.expand_path("../../../../test_helper", __FILE__)
module Unit
module Require
module Ripper
class TestBuilder < MiniTest::Unit::TestCase
describe MotionBundler::Require::Ripper::Builder do
it "should scan for requires" do
File.expects(:read).with("./app/controllers... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/mocker/test_hooks.rb | Ruby | mit | 99 | master | 962 | require File.expand_path("../../../../test_helper", __FILE__)
module Unit
module Require
module Mocker
class TestHooks < MiniTest::Unit::TestCase
describe MotionBundler::Require::Mocker::Hooks do
it "should hook into core methods" do
assert_equal false, Kernel.respond_to?(:re... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/mocker/test_dirs.rb | Ruby | mit | 99 | master | 828 | require File.expand_path("../../../../test_helper", __FILE__)
module Unit
module Require
module Mocker
class TestDirs < MiniTest::Unit::TestCase
module Mocker
include MotionBundler::Require::Mocker::Dirs
extend self
end
describe MotionBundler::Require::Mocker::... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/tracer/test_log.rb | Ruby | mit | 99 | master | 4,696 | require File.expand_path("../../../../test_helper", __FILE__)
module Unit
module Require
module Tracer
class TestLog < MiniTest::Unit::TestCase
describe MotionBundler::Require::Tracer::Log do
before do
@log = MotionBundler::Require::Tracer::Log.new
end
it... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/unit/require/tracer/test_hooks.rb | Ruby | mit | 99 | master | 2,675 | require File.expand_path("../../../../test_helper", __FILE__)
module Unit
module Require
module Tracer
class TestHooks < MiniTest::Unit::TestCase
describe MotionBundler::Require::Tracer::Hooks do
it "should hook into core methods" do
assert_equal false, Kernel.respond_to?(:re... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/slot_machine.gemspec | Ruby | mit | 99 | master | 927 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |gem|
gem.authors = ["Paul Engel"]
gem.email = ["paul.engel@holder.nl"]
gem.summary = %q{Ruby gem for matching available slots (time slots are also supported)}
gem.description = %q{One of the classic programming problems is the determina... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/Gemfile | Ruby | mit | 99 | master | 379 | source "http://rubygems.org"
gemspec
group :gem_default do
gem "slot_machine", :path => "."
end
group :gem_development do
gem "pry"
end
group :gem_test do
gem "minitest"
gem "mocha", :git => "git://github.com/freerange/mocha.git", :ref => "f88a78050af1f1ad98c917cb26ed3539e59fe7e0" # see also: https://github... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/test/unit/test_time_slots.rb | Ruby | mit | 99 | master | 1,857 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestTimeSlots < MiniTest::Unit::TestCase
describe TimeSlots do
it "should merge slots on initialization" do
time_slots = TimeSlots.new 1015..1100, 1100..1115
assert_equal [TimeSlot.new(1015..1115)], time_slots.range_... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/test/unit/test_time_slot.rb | Ruby | mit | 99 | master | 2,653 | require File.expand_path("../../test_helper", __FILE__)
require "time"
module Unit
class TestTimeSlot < MiniTest::Unit::TestCase
describe TimeSlot do
it "should have the expected default interval" do
assert_equal 15, TimeSlot.default_interval
end
it "should validate the assigned valu... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/test/unit/test_slot.rb | Ruby | mit | 99 | master | 7,450 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestSlot < MiniTest::Unit::TestCase
describe Slot do
describe "class methods" do
it "should have the expected class methods" do
assert Slot.respond_to?(:interval)
assert Slot.respond_to?(:default_interval... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/test/unit/test_slots.rb | Ruby | mit | 99 | master | 3,795 | require File.expand_path("../../test_helper", __FILE__)
module Unit
class TestSlots < MiniTest::Unit::TestCase
describe Slots do
describe "instance methods" do
it "should have the expected instance methods" do
slots = Slots.new 1..10
assert slots.respond_to?(:range_slots)
... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/lib/time_slot.rb | Ruby | mit | 99 | master | 436 | class TimeSlot
include SlotMachine::Slot
def self.default_interval
@interval || 15
end
protected
def typecast(value)
value.is_a?(Time) ? value.strftime("%Y%m%d%H%M") : value.to_s
end
def valid?(value)
(value - (100 * (value / 100))) < 60
end
def to_array
super.delete_if{|i| !valid?(... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/lib/slot_machine/slot.rb | Ruby | mit | 99 | master | 3,867 | module SlotMachine
module Slot
def self.included(base)
base.class_eval do
attr_reader :start, :end, :length
def self.interval(value)
@interval = value
end
def self.default_interval
@interval || 10
end
def self.slots_class
@slo... |
github | archan937/motion-bundler | https://github.com/archan937/motion-bundler | test/gems/slot_machine/lib/slot_machine/slots.rb | Ruby | mit | 99 | master | 4,295 | module SlotMachine
module Slots
def self.included(base)
base.class_eval do
def self.slot_class
@slot_class ||= name.gsub(/s$/, "").split("::").inject(Object) do |mod, name|
mod.const_get name
end
end
end
end
def initialize(*ranges_or_range_slot... |
github | wireframe/bundler-updater | https://github.com/wireframe/bundler-updater | bundler-updater.gemspec | Ruby | mit | 99 | master | 1,010 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bundler/updater/version'
Gem::Specification.new do |spec|
spec.name = "bundler-updater"
spec.version = Bundler::Updater::VERSION
spec.authors = ["Ryan Sonnek"]
spec.e... |
github | wireframe/bundler-updater | https://github.com/wireframe/bundler-updater | lib/bundler/updater/cli.rb | Ruby | mit | 99 | master | 2,598 | require 'bundler'
require 'thor'
module Bundler
module Updater
class CLI < Thor::Group
desc "Update outdated gems interactively"
def update
if outdated_gems_to_update.empty?
say "No outdated gems to update"
else
say "Updating outdated gems:"
say outdated_... |
github | datafolklabs/ruby-parseconfig | https://github.com/datafolklabs/ruby-parseconfig | parseconfig.gemspec | Ruby | mit | 99 | master | 882 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'version'
Gem::Specification.new do |s|
s.name = 'parseconfig'
s.version = ParseConfig::VERSION
s.licenses = ["MIT"]
s.date = '2021-09-30'
s.authors = ['BJ Dierkes', 'Dmitry Shagin'... |
github | datafolklabs/ruby-parseconfig | https://github.com/datafolklabs/ruby-parseconfig | tests/test_parseconfig.rb | Ruby | mit | 99 | master | 966 | require 'rspec'
require '../lib/parseconfig.rb'
describe 'ruby-parseconfig' do
Dir['./files/*.conf'].each do |config_file|
it "should parse #{File.basename(config_file)} properly" do
require "./files/#{File.basename(config_file, '.conf')}.rb"
c = ParseConfig.new(config_file)
# Test overal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.