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 | JunichiIto/osrb03-hotwire-sandbox | https://github.com/JunichiIto/osrb03-hotwire-sandbox | test/system/blogs_test.rb | Ruby | mit | 18 | main | 2,614 | require "application_system_test_case"
class BlogsTest < ApplicationSystemTestCase
def fill_in_blog_content(text)
find("trix-editor").set(text)
end
def assert_blogs(expected_blogs)
actual_blogs = all('#blogs > div')
assert_equal expected_blogs.size, actual_blogs.size
expected_blogs.each_with_ind... |
github | JunichiIto/osrb03-hotwire-sandbox | https://github.com/JunichiIto/osrb03-hotwire-sandbox | config/routes.rb | Ruby | mit | 18 | main | 225 | Rails.application.routes.draw do
resources :blogs, except: :show
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Defines the root path route ("/")
root "blogs#index"
end |
github | JunichiIto/osrb03-hotwire-sandbox | https://github.com/JunichiIto/osrb03-hotwire-sandbox | config/application.rb | Ruby | mit | 18 | main | 717 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Osrb03HotwireSandbox
class Application < Rails::Application
# Initialize configuration defaults for originally gene... |
github | JunichiIto/osrb03-hotwire-sandbox | https://github.com/JunichiIto/osrb03-hotwire-sandbox | config/environments/production.rb | Ruby | mit | 18 | main | 3,908 | require "active_support/core_ext/integer/time"
Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your applica... |
github | nickgeerts/next-on-rails | https://github.com/nickgeerts/next-on-rails | api/Gemfile | Ruby | mit | 18 | main | 812 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1'
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'sqlite3', '~> 1.4'
gem 'puma', '~> 4.1'
gem 'foreman'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_proc... |
github | nickgeerts/next-on-rails | https://github.com/nickgeerts/next-on-rails | api/config/application.rb | Ruby | mit | 18 | main | 1,311 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/en... |
github | nickgeerts/next-on-rails | https://github.com/nickgeerts/next-on-rails | api/config/environments/production.rb | Ruby | mit | 18 | main | 4,777 | Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | Rakefile | Ruby | mit | 18 | master | 2,832 | require 'bundler/setup'
require 'rake/testtask'
require 'rubygems'
require 'rubygems/package_task'
require 'yard'
require File.dirname(__FILE__) + '/lib/fog/libvirt'
#############################################################################
#
# Helper functions
#
####################################################... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | Gemfile | Ruby | mit | 18 | master | 205 | source "https://rubygems.org"
group :development, :test do
# This is here because gemspec doesn't support require: false
gem "netrc", :require => false
gem "octokit", :require => false
end
gemspec |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | fog-libvirt.gemspec | Ruby | mit | 18 | master | 1,706 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "fog/libvirt/version"
Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_r... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt.rb | Ruby | mit | 18 | master | 303 | require 'fog/core'
require 'fog/xml'
require 'fog/json'
require 'libvirt'
require File.expand_path('../libvirt/version', __FILE__)
module Fog
module Libvirt
extend Fog::Provider
autoload :Compute, File.expand_path('../libvirt/compute', __FILE__)
service(:compute, 'Compute')
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/bin/libvirt.rb | Ruby | mit | 18 | master | 1,555 | module Libvirt # deviates from other bin stuff to accommodate gem
class << self
def class_for(key)
case key
when :compute
Fog::Libvirt::Compute
else
raise ArgumentError, "Unrecognized service: #{key}"
end
end
def [](service)
@@connections ||= Hash.new do |has... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/compute.rb | Ruby | mit | 18 | master | 3,711 | require 'fog/libvirt/models/compute/util/util'
require 'fog/libvirt/models/compute/util/uri'
module Fog
module Libvirt
class Compute < Fog::Service
requires :libvirt_uri
recognizes :libvirt_username, :libvirt_password
model_path 'fog/libvirt/models/compute'
model :server
co... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/update_autostart.rb | Ruby | mit | 18 | master | 339 | module Fog
module Libvirt
class Compute
module Shared
def update_autostart(uuid, value)
domain = client.lookup_domain_by_uuid(uuid)
domain.autostart = value
end
end
class Real
include Shared
end
class Mock
include Shared
end... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/destroy_network.rb | Ruby | mit | 18 | master | 296 | module Fog
module Libvirt
class Compute
module Shared
def destroy_network(uuid)
client.lookup_network_by_uuid(uuid).destroy
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/upload_volume.rb | Ruby | mit | 18 | master | 810 | module Fog
module Libvirt
class Compute
module Shared
def upload_volume(pool_name, volume_name, file_path)
volume = client.lookup_storage_pool_by_name(pool_name).lookup_volume_by_name(volume_name)
stream = client.stream
image_file = File.open(file_path, "rb")
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/libversion.rb | Ruby | mit | 18 | master | 262 | module Fog
module Libvirt
class Compute
module Shared
def libversion()
client.libversion
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/create_domain.rb | Ruby | mit | 18 | master | 279 | module Fog
module Libvirt
class Compute
module Shared
def create_domain(xml)
client.create_domain_xml(xml)
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/volume_action.rb | Ruby | mit | 18 | master | 329 | module Fog
module Libvirt
class Compute
module Shared
def volume_action(key, action, options={})
get_volume({:key => key}, true).send(action)
true
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_interfaces.rb | Ruby | mit | 18 | master | 1,297 | module Fog
module Libvirt
class Compute
module Shared
def list_interfaces(filter = { })
data=[]
if filter.keys.empty?
active_networks = client.list_interfaces rescue []
defined_networks = client.list_defined_interfaces rescue []
(active_network... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_domains.rb | Ruby | mit | 18 | master | 4,257 | module Fog
module Libvirt
class Compute
module Shared
def list_domains(filter = { })
data=[]
if filter.key?(:uuid)
data << client.lookup_domain_by_uuid(filter[:uuid])
elsif filter.key?(:name)
data << client.lookup_domain_by_name(filter[:name])
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/define_domain.rb | Ruby | mit | 18 | master | 279 | module Fog
module Libvirt
class Compute
module Shared
def define_domain(xml)
client.define_domain_xml(xml)
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_networks.rb | Ruby | mit | 18 | master | 1,389 | module Fog
module Libvirt
class Compute
module Shared
def list_networks(filter = { })
data=[]
if filter.keys.empty?
(client.list_networks + client.list_defined_networks).each do |network_name|
data << network_to_attributes(client.lookup_network_by_name(n... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/create_volume.rb | Ruby | mit | 18 | master | 326 | module Fog
module Libvirt
class Compute
module Shared
def create_volume(pool_name, xml)
client.lookup_storage_pool_by_name(pool_name).create_vol_xml(xml)
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
en... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/get_node_info.rb | Ruby | mit | 18 | master | 1,069 | module Fog
module Libvirt
class Compute
module Shared
def get_node_info
node_hash = Hash.new
node_info = client.node_get_info
[:model, :memory, :cpus, :mhz, :nodes, :sockets, :cores, :threads].each do |param|
node_hash[param] = node_info.send(param) rescue n... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/define_pool.rb | Ruby | mit | 18 | master | 283 | module Fog
module Libvirt
class Compute
module Shared
def define_pool(xml)
client.define_storage_pool_xml(xml)
end
end
class Real
include Shared
end
class Mock
include Shared
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/destroy_interface.rb | Ruby | mit | 18 | master | 332 | module Fog
module Libvirt
class Compute
module Shared
#shutdown the interface
def destroy_interface(uuid)
client.lookup_interface_by_uuid(uuid).destroy
end
end
class Real
include Shared
end
class Mock
include Shared
end
en... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_pools.rb | Ruby | mit | 18 | master | 1,851 | module Fog
module Libvirt
class Compute
module Shared
def list_pools(filter = { })
data=[]
if filter.key?(:name)
data << find_pool_by_name(filter[:name], filter[:include_inactive])
elsif filter.key?(:uuid)
data << find_pool_by_uuid(filter[:uuid],... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/vm_action.rb | Ruby | mit | 18 | master | 361 | module Fog
module Libvirt
class Compute
module Shared
def vm_action(uuid, action, *params)
domain = client.lookup_domain_by_uuid(uuid)
domain.send(action, *params)
true
end
end
class Real
include Shared
end
class Mock
in... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/pool_action.rb | Ruby | mit | 18 | master | 346 | module Fog
module Libvirt
class Compute
module Shared
def pool_action(uuid, action)
pool = client.lookup_storage_pool_by_uuid uuid
pool.send(action)
true
end
end
class Real
include Shared
end
class Mock
include Shared
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/update_display.rb | Ruby | mit | 18 | master | 1,166 | module Fog
module Libvirt
class Compute
module Shared
def update_display(options = { })
raise ArgumentError, "uuid is a required parameter" unless options.key? :uuid
domain = client.lookup_domain_by_uuid(options[:uuid])
display = { }
display[:type] ... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/clone_volume.rb | Ruby | mit | 18 | master | 431 | module Fog
module Libvirt
class Compute
module Shared
def clone_volume(pool_name, xml, name)
vol = client.lookup_storage_pool_by_name(pool_name).lookup_volume_by_name(name)
client.lookup_storage_pool_by_name(pool_name).create_vol_xml_from(xml, vol)
end
end
cl... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_volumes.rb | Ruby | mit | 18 | master | 2,540 | module Fog
module Libvirt
class Compute
module Shared
def list_volumes(filter = { })
data = []
if filter.keys.empty?
raw_volumes do |pool|
pool.list_volumes.each do |volume_name|
begin
data << volume_to_attributes(pool.l... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/list_pool_volumes.rb | Ruby | mit | 18 | master | 438 | module Fog
module Libvirt
class Compute
module Shared
def list_pool_volumes(uuid)
pool = client.lookup_storage_pool_by_uuid uuid
pool.list_volumes.map do |volume_name|
volume_to_attributes(pool.lookup_volume_by_name(volume_name))
end
end
end
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/requests/compute/dhcp_leases.rb | Ruby | mit | 18 | master | 1,119 | require 'socket'
module Fog
module Libvirt
class Compute
class Real
def dhcp_leases(uuid, mac, flags = 0)
client.lookup_network_by_uuid(uuid).dhcp_leases(mac, flags)
end
end
class Mock
# Not implemented by the test driver
def dhcp_leases(uuid, mac, fla... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/server.rb | Ruby | mit | 18 | master | 20,594 | require 'fog/compute/models/server'
require 'fog/libvirt/models/compute/util/util'
require 'fileutils'
module Fog
module Libvirt
class Compute
class Server < Fog::Compute::Server
include Fog::Libvirt::Util
attr_reader :xml
identity :id, :aliases => 'uuid'
attribute :cpus
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/servers.rb | Ruby | mit | 18 | master | 437 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/server'
module Fog
module Libvirt
class Compute
class Servers < Fog::Collection
model Fog::Libvirt::Compute::Server
def all(filter={})
load(service.list_domains(filter))
end
def get(uuid)
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/nodes.rb | Ruby | mit | 18 | master | 353 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/node'
module Fog
module Libvirt
class Compute
class Nodes < Fog::Collection
model Fog::Libvirt::Compute::Node
def all(filter={ })
load(service.get_node_info)
end
def get
all.first
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/node.rb | Ruby | mit | 18 | master | 608 | require 'fog/core/model'
module Fog
module Libvirt
class Compute
class Node < Fog::Model
identity :uuid
attribute :model
attribute :memory
attribute :cpus
attribute :mhz
attribute :nodes
attribute :sockets
attribute :cores
attribute :... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/networks.rb | Ruby | mit | 18 | master | 395 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/network'
module Fog
module Libvirt
class Compute
class Networks < Fog::Collection
model Fog::Libvirt::Compute::Network
def all(filter={})
load(service.list_networks(filter))
end
def get(uuid)
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/pools.rb | Ruby | mit | 18 | master | 385 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/pool'
module Fog
module Libvirt
class Compute
class Pools < Fog::Collection
model Fog::Libvirt::Compute::Pool
def all(filter = {})
load(service.list_pools(filter))
end
def get(uuid)
self.... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/nics.rb | Ruby | mit | 18 | master | 222 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/nic'
module Fog
module Libvirt
class Compute
class Nics < Fog::Collection
model Fog::Libvirt::Compute::Nic
end
end
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/interfaces.rb | Ruby | mit | 18 | master | 403 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/interface'
module Fog
module Libvirt
class Compute
class Interfaces < Fog::Collection
model Fog::Libvirt::Compute::Interface
def all(filter={})
load(service.list_interfaces(filter))
end
def get(nam... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/network.rb | Ruby | mit | 18 | master | 979 | require 'fog/core/model'
require 'fog/libvirt/models/compute/util/util'
module Fog
module Libvirt
class Compute
class Network < Fog::Model
include Fog::Libvirt::Util
identity :uuid
attribute :name
attribute :bridge_name
attribute :xml
def initialize(attribu... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/volumes.rb | Ruby | mit | 18 | master | 390 | require 'fog/core/collection'
require 'fog/libvirt/models/compute/volume'
module Fog
module Libvirt
class Compute
class Volumes < Fog::Collection
model Fog::Libvirt::Compute::Volume
def all(filter = {})
load(service.list_volumes(filter))
end
def get(key)
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/interface.rb | Ruby | mit | 18 | master | 476 | require 'fog/core/model'
module Fog
module Libvirt
class Compute
class Interface < Fog::Model
identity :name
attribute :mac
attribute :active
def save
raise Fog::Errors::Error.new('Creating a new interface is not yet implemented. Contributions welcome!')
e... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/nic.rb | Ruby | mit | 18 | master | 1,195 | require 'fog/core/model'
module Fog
module Libvirt
class Compute
class Nic < Fog::Model
identity :mac
attribute :id
attribute :type
attribute :network
attribute :bridge
attribute :model
attr_accessor :server
TYPES = ["network", "bridge", "us... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/pool.rb | Ruby | mit | 18 | master | 2,305 | require 'fog/core/model'
module Fog
module Libvirt
class Compute
class Pool < Fog::Model
attr_reader :xml
identity :uuid
attribute :persistent
attribute :autostart
attribute :active
attribute :name
attribute :allocation
attribute :capacity
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/volume.rb | Ruby | mit | 18 | master | 4,581 | require 'fog/core/model'
require 'fog/libvirt/models/compute/util/util'
module Fog
module Libvirt
class Compute
class Volume < Fog::Model
attr_reader :xml
include Fog::Libvirt::Util
identity :id, :aliases => 'key'
attribute :pool_name
attribute :key
attribu... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/util/util.rb | Ruby | mit | 18 | master | 567 | require 'nokogiri'
require 'securerandom'
module Fog
module Libvirt
module Util
def xml_element(xml, path, attribute=nil)
xml = Nokogiri::XML(xml)
attribute.nil? ? (xml/path).first.text : (xml/path).first[attribute.to_sym]
end
def xml_elements(xml, path, attribute=nil)
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | lib/fog/libvirt/models/compute/util/uri.rb | Ruby | mit | 18 | master | 2,524 | require 'uri'
require 'cgi'
module Fog
module Libvirt
module Util
class URI
attr_reader :uri
def initialize(uri)
@parsed_uri=::URI.parse(uri)
@uri=uri
return self
end
# Transport will be part of the scheme
# The part after the plus sig... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/helper.rb | Ruby | mit | 18 | master | 608 | ENV['FOG_RC'] = ENV['FOG_RC'] || File.expand_path('../.fog', __FILE__)
ENV['FOG_CREDENTIAL'] = ENV['FOG_CREDENTIAL'] || 'default'
require 'fog/libvirt'
Excon.defaults.merge!(:debug_request => true, :debug_response => true)
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/helpers/formats_helper.rb | Ruby | mit | 18 | master | 3,592 | # frozen_string_literal: true
require 'fog/schema/data_validator'
# format related hackery
# allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean)
# allows both nil.is_a?(Fog::Nullable::String) and ''.is_a?(Fog::Nullable::String)
module Fog
module Boolean; end
module Nullable
module Boolean; end... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/helpers/formats_helper_tests.rb | Ruby | mit | 18 | master | 3,622 | Shindo.tests('test_helper', 'meta') do
tests('comparing welcome data against schema') do
data = { :welcome => 'Hello' }
data_matches_schema(:welcome => String) { data }
end
tests('#data_matches_schema') do
tests('when value matches schema expectation') do
data_matches_schema('key' => String) {... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/helpers/mock_helper.rb | Ruby | mit | 18 | master | 288 | # Use so you can run in mock mode from the command line
#
# FOG_MOCK=true fog
if ENV["FOG_MOCK"] == "true"
Fog.mock!
end
# if in mocked mode, fill in some fake credentials for us
if Fog.mock?
Fog.credentials = {
:libvirt_uri => 'test:///default',
}.merge(Fog.credentials)
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/compute_tests.rb | Ruby | mit | 18 | master | 739 | Shindo.tests('Fog::Compute[:libvirt]', ['libvirt']) do
compute = Fog::Compute[:libvirt]
tests("Compute collections") do
%w{ servers interfaces networks nics nodes pools volumes}.each do |collection|
test("it should respond to #{collection}") { compute.respond_to? collection }
end
end
tests("Com... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/define_domain_tests.rb | Ruby | mit | 18 | master | 318 | Shindo.tests("Fog::Compute[:libvirt] | define_domain request", 'libvirt') do
compute = Fog::Compute[:libvirt]
xml = compute.servers.new().to_xml
tests("Define Domain") do
response = compute.define_domain(xml)
test("should be a kind of Libvirt::Domain") { response.kind_of? Libvirt::Domain}
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/update_autostart_tests.rb | Ruby | mit | 18 | master | 356 | Shindo.tests('Fog::Compute[:libvirt] | update_autostart request', ['libvirt']) do
servers = Fog::Compute[:libvirt].servers
tests('The response should') do
test('should not be empty') { not servers.empty? }
server = servers.first
tests('should be false').succeeds { server.autostart == false }
serve... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/list_pools_tests.rb | Ruby | mit | 18 | master | 1,562 | class FakePool < Fog::Model
# Fake pool object to allow exercising the internal parsing of pools
# returned by the client queries
identity :uuid
attribute :persistent
attribute :autostart
attribute :active
attribute :name
attribute :num_of_volumes
attr_reader :info
class FakeInfo < Fog::Model
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/create_domain_tests.rb | Ruby | mit | 18 | master | 725 | Shindo.tests("Fog::Compute[:libvirt] | create_domain request", 'libvirt') do
compute = Fog::Compute[:libvirt]
xml = compute.servers.new( :nics => [{:bridge => "br180"}]).to_xml
tests("Create Domain") do
response = compute.create_domain(xml)
test("should be a kind of Libvirt::Domain") { response.kind_of?... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/dhcp_leases_tests.rb | Ruby | mit | 18 | master | 597 | Shindo.tests("Fog::Compute[:libvirt] | dhcp_leases request", 'libvirt') do
compute = Fog::Compute[:libvirt]
tests("DHCP leases response") do
response = compute.dhcp_leases("fbd4ac68-cbea-4f95-86ed-22953fd92384", "99:88:77:66:55:44", 0)
test("should be an array") { response.kind_of? Array }
test("shoul... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/requests/compute/update_display.rb | Ruby | mit | 18 | master | 395 | Shindo.tests('Fog::Compute[:libvirt] | update_display request', ['libvirt']) do
compute = Fog::Compute[:libvirt]
reconfig_target = 'f74d728a-5b62-7e2f-1f84-239aead298ca'
display_spec = {:password => 'ssaaa'}
tests('The response should') do
response = compute.update_display(:uuid => reconfig_target).merge... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/nics_tests.rb | Ruby | mit | 18 | master | 285 | Shindo.tests('Fog::Compute[:libvirt] | nics collection', ['libvirt']) do
nics = Fog::Compute[:libvirt].servers.first.nics
tests('The nics collection') do
test('should not be empty') { not nics.empty? }
test('should be a kind of Array') { nics.kind_of? Array }
end
end |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/nic_tests.rb | Ruby | mit | 18 | master | 984 | Shindo.tests('Fog::Compute[:libvirt] | nic model', ['libvirt']) do
server = Fog::Compute[:libvirt].servers.create(:name => Fog::Mock.random_letters(8))
nic = server.nics.first
tests('The nic model should') do
tests('have the action') do
test('reload') { nic.respond_to? 'reload' }
end
tests('ha... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/interface_tests.rb | Ruby | mit | 18 | master | 919 | Shindo.tests('Fog::Compute[:libvirt] | interface model', ['libvirt']) do
interfaces = Fog::Compute[:libvirt].interfaces
interface = interfaces.last
tests('The interface model should') do
tests('have the action') do
test('reload') { interface.respond_to? 'reload' }
end
tests('have attributes') ... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/network_tests.rb | Ruby | mit | 18 | master | 1,397 | Shindo.tests('Fog::Compute[:libvirt] | network model', ['libvirt']) do
networks = Fog::Compute[:libvirt].networks
network = networks.first
tests('The network model should') do
tests('have the action') do
test('reload') { network.respond_to? 'reload' }
test('dhcp_leases') { network.respond_to? 'd... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/server_tests.rb | Ruby | mit | 18 | master | 4,512 | Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
servers = Fog::Compute[:libvirt].servers
# Match the mac in dhcp_leases mock
nics = Fog.mock? ? [{ :type => 'network', :network => 'default', :mac => 'aa:bb:cc:dd:ee:ff' }] : nil
server = servers.create(:name => Fog::Mock.random_letters(8), ... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/interfaces_tests.rb | Ruby | mit | 18 | master | 575 | Shindo.tests('Fog::Compute[:libvirt] | interfaces collection', ['libvirt']) do
interfaces = Fog::Compute[:libvirt].interfaces
tests('The interfaces collection') do
test('should not be empty') { not interfaces.empty? }
test('should be a kind of Fog::Libvirt::Compute::Interfaces') { interfaces.kind_of? Fog:... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/networks_tests.rb | Ruby | mit | 18 | master | 495 | Shindo.tests('Fog::Compute[:libvirt] | networks collection', ['libvirt']) do
networks = Fog::Compute[:libvirt].networks
tests('The networks collection') do
test('should be a kind of Fog::Libvirt::Compute::Networks') { networks.kind_of? Fog::Libvirt::Compute::Networks }
tests('should be able to reload itse... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/volumes_tests.rb | Ruby | mit | 18 | master | 662 | Shindo.tests('Fog::Compute[:libvirt] | volumes collection', ['libvirt']) do
volumes = Fog::Compute[:libvirt].volumes
volumes.create(:name => 'test')
tests('The volumes collection') do
test('should not be empty') { not volumes.empty? }
test('should be a kind of Fog::Libvirt::Compute::Volumes') { volumes... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/pools_tests.rb | Ruby | mit | 18 | master | 514 | Shindo.tests('Fog::Compute[:libvirt] | pools request', ['libvirt']) do
pools = Fog::Compute[:libvirt].pools
tests('The pools collection') do
test('should not be empty') { not pools.empty? }
test('should be a kind of Fog::Libvirt::Compute::Pools') { pools.kind_of? Fog::Libvirt::Compute::Pools }
tests('... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/servers_tests.rb | Ruby | mit | 18 | master | 540 | Shindo.tests('Fog::Compute[:libvirt] | servers collection', ['libvirt']) do
servers = Fog::Compute[:libvirt].servers
tests('The servers collection') do
test('should not be empty') { not servers.empty? }
test('should be a kind of Fog::Libvirt::Compute::Servers') { servers.kind_of? Fog::Libvirt::Compute::Se... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/volume_tests.rb | Ruby | mit | 18 | master | 1,779 | Shindo.tests('Fog::Compute[:libvirt] | volume model', ['libvirt']) do
volume = Fog::Compute[:libvirt].volumes.create(:name => 'fog_test')
tests('The volume model should') do
tests('have attributes') do
model_attribute_hash = volume.attributes
attributes = [ :id,
:pool_name,
:key,
... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | tests/libvirt/models/compute/pool_tests.rb | Ruby | mit | 18 | master | 944 | Shindo.tests('Fog::Compute[:libvirt] | interface model', ['libvirt']) do
pools = Fog::Compute[:libvirt].pools
pool = pools.last
tests('The interface model should') do
tests('have the action') do
test('reload') { pool.respond_to? 'reload' }
end
tests('have attributes') do
model_attribute_... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | minitests/test_helper.rb | Ruby | mit | 18 | master | 424 | require 'minitest/autorun'
require 'mocha/minitest'
require 'fileutils'
$: << File.join(File.dirname(__FILE__), '..', 'lib')
logdir = File.join(File.dirname(__FILE__), '..', 'logs')
FileUtils.mkdir_p(logdir) unless File.exist?(logdir)
ENV['TMPDIR'] = 'test/tmp'
FileUtils.rm_f Dir.glob 'test/tmp/*.tmp'
require 'fog/... |
github | fog/fog-libvirt | https://github.com/fog/fog-libvirt | minitests/server/user_data_iso_test.rb | Ruby | mit | 18 | master | 2,583 | require 'test_helper'
class UserDataIsoTest < Minitest::Test
def setup
@compute = Fog::Compute[:libvirt]
@server = @compute.servers.new(:name => "test")
@test_data = "test data"
end
def test_contains_meta_data_file
@server.stubs(:system).returns(true)
in_a_temp_dir do |d|
@server.gener... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | Rakefile | Ruby | mit | 18 | master | 648 | require 'rubygems'
require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
task :default => [ :test, :spec ]
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.test_... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | Gemfile | Ruby | mit | 18 | master | 259 | source "http://rubygems.org"
# Runtime dependencies
gem "bio-logger"
gem "nokogiri"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rake"
gem "rspec"
gem "rdoc"
end |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | bio-blastxmlparser.gemspec | Ruby | mit | 18 | master | 2,269 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "bio-blastxmlparser"
s.version = "2.0.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Pjotr Prins"]
s.date = "2015-05-07"
s.description = "Fast big data BLAST XML parse... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | spec/spec_helper.rb | Ruby | mit | 18 | master | 368 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'bio-blastxmlparser'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f|... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | spec/bio-blastxmlparser_spec.rb | Ruby | mit | 18 | master | 3,468 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
TESTFILE = "./test/data/nt_example_blastn.m7"
include Bio::BlastXMLParser
describe "Bio::BlastXMLParser::NokogiriBlastXml" do
before(:all) do
n = NokogiriBlastXml.new(File.new(TESTFILE)).to_enum
@iter1 = n.next
@iter2 = n.next
end
it ... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/nokogiri_dom.rb | Ruby | mit | 18 | master | 352 | #! /usr/bin/ruby
require 'rubygems'
require 'nokogiri'
include Nokogiri
input = Nokogiri::XML(File.new("test/data/nt_example_blastn.m7"))
input.root.xpath("//Iteration").each do | e |
print "---- "
print e.xpath("Iteration_iter-num/text()"),"\n"
print e.xpath("Iteration_hits/Hit/Hit_hsps/Hsp/Hsp_score/text()"... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/bioruby.rb | Ruby | mit | 18 | master | 416 | #!/usr/bin/env ruby
require 'bio'
fn = 'test/data/nt_example_blastn.m7'
# Iterates over each XML result.
# The variable "report" is a Bio::Blast::Report object.
# Bio::Blast.reports(ARGF) do |report|
Bio::Blast.reports(File.new(fn)) do |report|
puts "Hits for " + report.query_def + " against " + report.db
repor... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/blastxmlparserdemo.rb | Ruby | mit | 18 | master | 408 | #! /usr/bin/ruby
rootpath = File.dirname(File.dirname(__FILE__))
$: << File.join(rootpath,'lib')
require 'bio-blastxmlparser'
fn = 'test/data/nt_example_blastn.m7'
n = Bio::BlastXMLParser::XmlIterator.new(fn).to_enum
n.each do | iter |
puts "Hits for " + iter.query_id
iter.each do | hit |
hit.each do | hsp |
... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/nokogiri_split_dom.rb | Ruby | mit | 18 | master | 672 | #! /usr/bin/ruby
require 'rubygems'
require 'nokogiri'
include Nokogiri
def each_iteration f
b = []
f.each_line do | line |
b << line
if line.strip == "</Iteration>"
yield b
b = []
end
end
end
f = File.open("test/data/nt_example_blastn.m7")
f.each_line do | line |
break if line... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/nokogiri_sax.rb | Ruby | mit | 18 | master | 617 | #! /usr/bin/ruby
require 'rubygems'
require 'nokogiri'
include Nokogiri
# print "---- "
# print e.xpath("Iteration_iter-num/text()"),"\n"
# print e.xpath("Iteration_hits/Hit/Hit_hsps/Hsp/Hsp_score/text()").map {|n| n.to_s}, "\n"
class PostCallbacks < XML::SAX::Document
def start_element(element, at... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | sample/libxml_sax.rb | Ruby | mit | 18 | master | 477 | #! /usr/bin/ruby
require 'rubygems'
require 'libxml'
include LibXML
class PostCallbacks
include XML::SaxParser::Callbacks
def on_start_element(element, attributes)
if element == 'Iteration_iter-num'
# Process row of data here
print "---- ",element
end
# if element == 'Hsp_score'
# ... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio-blastxmlparser.rb | Ruby | mit | 18 | master | 552 | # find local plugin installation, and use it when there
rootpath = File.dirname(File.dirname(__FILE__))
bio_logger_path = File.join(rootpath,'..','bioruby-logger','lib')
if File.directory? bio_logger_path
$: << bio_logger_path
$stderr.print "bio-logger loaded directly\n"
else
require "rubygems"
gem "bio-logger"... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio/writers/template.rb | Ruby | mit | 18 | master | 1,423 | require 'erb'
module Bio
class Template
def initialize fn
raise "Can not find template #{fn}!" if not File.exist?(fn)
parse(File.read(fn))
end
def parse buf
header = []
body = []
footer = []
where = :header
buf.split("\n").each do | line |
case whe... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio/writers/rdf.rb | Ruby | mit | 18 | master | 2,354 | # RDF support module. Original is part of bioruby-rdf by Pjotr Prins
#
module BioRdf
module RDF
def RDF::valid_uri? uri
uri =~ /^([!#$&-;=?_a-z~]|%[0-9a-f]{2})+$/i
end
def RDF::escape_string_literal(literal)
s = literal.to_s
# Put a slash before every double quote if there is no such ... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio/db/blast/xmliterator.rb | Ruby | mit | 18 | master | 398 | module Bio
module BlastXMLParser
# Iterate a BLAST file yielding (lazy) results
class XmlIterator
def initialize blastfilename
@fn = blastfilename
end
def to_enum
logger = Bio::Log::LoggerPlus['bio-blastxmlparser']
logger.info("parsing (:nosplit) #{@fn}")
... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio/db/blast/xmlsplitter.rb | Ruby | mit | 18 | master | 1,406 | require 'enumerator'
module Bio
module BlastXMLParser
# Reads a full XML result and splits it out into a buffer for each
# Iteration (query result).
class BlastXmlSplitter
def initialize fn
@fn = fn
end
def each
logger = Bio::Log::LoggerPlus['bio-blastxmlparser']
... |
github | pjotrp/blastxmlparser | https://github.com/pjotrp/blastxmlparser | lib/bio/db/blast/parser/nokogiri.rb | Ruby | mit | 18 | master | 5,426 | require 'nokogiri'
require 'enumerator'
module Bio
module BlastXMLParser
module XPath
def field name
res = if @prefix
@xml.xpath(@prefix+name+'/text()').to_s
else
@xml.xpath(name+'/text()').to_s
end
if res == nil
logger = Bio::Log::LoggerPlus['... |
github | rails-assets/angular-faye-rails | https://github.com/rails-assets/angular-faye-rails | angular-faye-rails.gemspec | Ruby | mit | 18 | master | 1,014 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'angular-faye-rails/version'
Gem::Specification.new do |spec|
spec.name = "angular-faye-rails"
spec.version = AngularFaye::Rails::VERSION
spec.authors = ["Tymon Tobolski... |
github | twoism/twitter-console | https://github.com/twoism/twitter-console | twitter-console.gemspec | Ruby | mit | 18 | master | 778 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/twitter-console/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Christopher Burnett"]
gem.email = ["signalstatic@gmail.com"]
gem.description = %q{Console for the Twitter Gem}
gem.summary = %q{Interactive consol... |
github | twoism/twitter-console | https://github.com/twoism/twitter-console | lib/twitter-console.rb | Ruby | mit | 18 | master | 1,122 | require "twitter-console/version"
module Twitter
module Console
class ClientProxy < Twitter::Client
[:get, :post, :put, :delete].each do |http_method|
class_eval %Q[
def #{http_method}(*args)
super(*args)[:body]
end]
end
end
BANNER = "Twitter Console-- Type... |
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | resque-exceptional.gemspec | Ruby | mit | 18 | master | 1,168 | spec = Gem::Specification.new do |s|
s.name = 'resque-exceptional'
s.version = '0.2.2'
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = 'A Resque failure backend for getexceptional.com'
s.license = 'MIT'
s.homepage = 'http://github.com/lanti... |
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | Rakefile | Ruby | mit | 18 | master | 581 | $LOAD_PATH.unshift 'lib'
require 'rake/testtask'
require 'fileutils'
require 'yard'
require 'yard/rake/yardoc_task'
task :default => :test
##
# Test task.
Rake::TestTask.new(:test) do |task|
task.libs << 'test'
task.test_files = FileList['test/*_test.rb']
task.verbose = true
end
##
# docs task.
YARD::Rake::Ya... |
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | test/resque_test.rb | Ruby | mit | 18 | master | 328 | require 'test_helper'
# make sure the worlds not fallen from beneith us.
class ResqueTest < Minitest::Test
def test_resque_version
major, minor, patch = Resque::Version.split('.')
assert_equal 1, major.to_i, 'major version does not match'
assert_operator minor.to_i, :>=, 8, 'minor version is too low'
e... |
github | lantins/resque-exceptional | https://github.com/lantins/resque-exceptional | test/test_helper.rb | Ruby | mit | 18 | master | 1,243 | # fix load path.
dir = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH.unshift dir + '/../lib'
$TESTING = true
# Run code coverage in MRI 1.9 only.
if RUBY_VERSION >= '1.9' && RUBY_ENGINE == 'ruby'
require 'simplecov'
SimpleCov.start do
add_filter '/test/'
end
end
# require gems for testing.
require 'mi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.