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-core | https://github.com/fog/fog-core | lib/fog/core/time.rb | Ruby | mit | 46 | master | 587 | require "time"
module Fog
class Time < ::Time
DAYS = %w(Sun Mon Tue Wed Thu Fri Sat).freeze
MONTHS = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec).freeze
def self.now
at(::Time.now - offset)
end
def self.now=(new_now)
old_now = ::Time.now
@offset = old_now - new_now
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/services_mixin.rb | Ruby | mit | 46 | master | 4,144 | module Fog
module ServicesMixin
E_SERVICE_PROVIDER_CONSTANT = <<-EOS.gsub(/\s+/, " ").strip.freeze
Falling back to deprecated constant Fog::%<service>s::%<provider>s. The
preferred format of service provider constants has changed from
service::provider to provider::service. Please update this se... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/deprecation.rb | Ruby | mit | 46 | master | 647 | module Fog
module Deprecation
def deprecate(older, newer)
module_eval <<-EOS, __FILE__, __LINE__
def #{older}(*args)
Fog::Logger.deprecation("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
send(:#{newer}, *args)
end
EOS... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes.rb | Ruby | mit | 46 | master | 6,410 | module Fog
module Attributes
module ClassMethods
def _load(marshalled)
new(Marshal.load(marshalled))
end
def aliases
@aliases ||= {}
end
def associations
@associations ||= {}
end
def attributes
@attributes ||= []
end
def def... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/stringify_keys.rb | Ruby | mit | 46 | master | 487 | module Fog
module StringifyKeys
# Returns a new hash with all keys converted to strings.
def self.stringify(original_hash)
transform_hash(original_hash) do |hash, key, value|
hash[key.to_s] = value
end
end
# http://devblog.avdi.org/2009/11/20/hash-transforms-in-ruby/
def self.... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/deprecated_connection_accessors.rb | Ruby | mit | 46 | master | 1,526 | module Fog
module Core
# This module covers the shared code used by models and collections
# that deprecates the confusing usage of 'connection' which was
# actually intended to be an instance of Fog::Service
module DeprecatedConnectionAccessors
# Sets the Service but using the wrong name!
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/utils.rb | Ruby | mit | 46 | master | 961 | module Fog
module Core
module Utils
# This helper prepares a Hash of settings for passing into {Fog::Service.new}.
#
# The only special consideration is if +:header+ key is passed in the contents are unchanged. This
# allows the headers to be passed through to requests to customise HTTP he... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/hmac.rb | Ruby | mit | 46 | master | 593 | module Fog
class HMAC
def initialize(type, key)
@key = key
case type
when "sha1"
setup_sha1
when "sha256"
setup_sha256
end
end
def sign(data)
@signer.call(data)
end
private
def setup_sha1
@digest = OpenSSL::Digest.new("sha1")
@... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/association.rb | Ruby | mit | 46 | master | 311 | module Fog
class Association < Collection
def initialize(associations = [])
@loaded = true
load(associations)
end
def load(associations)
return unless associations.kind_of?(Array)
associations.each do |association|
self << association
end
end
end
end |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/current_machine.rb | Ruby | mit | 46 | master | 994 | require "thread"
module Fog
class CurrentMachine
@lock = Mutex.new
AMAZON_AWS_CHECK_IP = "http://checkip.amazonaws.com".freeze
def self.ip_address=(ip_address)
@lock.synchronize do
@ip_address = ip_address
end
end
# Get the ip address of the machine from which this command ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/wait_for.rb | Ruby | mit | 46 | master | 488 | module Fog
def self.wait_for(timeout = Fog.timeout, interval = Fog.interval, &_block)
duration = 0
start = Time.now
retries = 0
loop do
break if yield
if duration > timeout
raise Errors::TimeoutError, "The specified wait_for timeout (#{timeout} seconds) was exceeded"
end
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/errors.rb | Ruby | mit | 46 | master | 3,098 | module Fog
module Errors
class Error < StandardError
attr_accessor :verbose
def self.slurp(error, message = nil)
new_error = new(message || error.message)
new_error.set_backtrace(error.backtrace)
new_error.verbose = error.message
new_error
end
end
class ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/mock.rb | Ruby | mit | 46 | master | 2,590 | module Fog
@mocking = false
def self.mock!
@mocking = true
end
def self.unmock!
@mocking = false
end
class << self
attr_reader :mocking
alias_method :mock?, :mocking
alias_method :mocking?, :mocking
end
module Mock
@delay = 1
class << self
attr_reader :delay
e... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/ssh.rb | Ruby | mit | 46 | master | 4,655 | require "delegate"
module Fog
module SSH
def self.new(address, username, options = {})
if Fog.mocking?
Fog::SSH::Mock.new(address, username, options)
else
Fog::SSH::Real.new(address, username, options)
end
end
class Mock
def self.data
@data ||= Hash.new do... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/scp.rb | Ruby | mit | 46 | master | 3,174 | module Fog
module SCP
def self.new(address, username, options = {})
if Fog.mocking?
Fog::SCP::Mock.new(address, username, options)
else
Fog::SCP::Real.new(address, username, options)
end
end
class Mock
def self.data
@data ||= Hash.new do |hash, key|
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/collection.rb | Ruby | mit | 46 | master | 3,276 | require "fog/core/deprecated_connection_accessors"
module Fog
# Fog::Collection
class Collection < Array
extend Fog::Attributes::ClassMethods
include Fog::Attributes::InstanceMethods
include Fog::Core::DeprecatedConnectionAccessors
attr_reader :service
Array.public_instance_methods(false).eac... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/uuid.rb | Ruby | mit | 46 | master | 298 | require "securerandom"
module Fog
class UUID
class << self
def uuid
SecureRandom.uuid
end
# :nodoc: This method is used by other plugins, so preserve it for the compatibility
def supported?
SecureRandom.respond_to?(:uuid)
end
end
end
end |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/model.rb | Ruby | mit | 46 | master | 3,350 | require "fog/core/deprecated_connection_accessors"
require "fog/core/cache"
module Fog
class Model
extend Fog::Attributes::ClassMethods
include Fog::Attributes::InstanceMethods
include Fog::Core::DeprecatedConnectionAccessors
attr_accessor :collection
attr_reader :service
def initialize(new... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/credentials.rb | Ruby | mit | 46 | master | 2,716 | require "yaml"
module Fog
require "fog/core/deprecation"
# Sets the global configuration up from a Hash rather than using background loading from a file
#
# @example
# Fog.credentials = {
# :default => {
# :example_url => "https://example.com/"
# :example_username => "bob",
# ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/cache.rb | Ruby | mit | 46 | master | 11,561 | # coding: utf-8
require "fileutils"
require "yaml"
require "tmpdir"
module Fog
# A generic cache mechanism for fog resources. This can be for a server, security group, etc.
#
# Currently this is a on-disk cache using yml files per-model instance, however
# there is nothing in the way of extending this to use v... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/whitelist_keys.rb | Ruby | mit | 46 | master | 207 | module Fog
module WhitelistKeys
def self.whitelist(hash, valid_keys)
valid_hash = StringifyKeys.stringify(hash)
Hash[valid_hash.select { |k, _v| valid_keys.include?(k) }]
end
end
end |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/provider.rb | Ruby | mit | 46 | master | 1,811 | module Fog
class << self
attr_writer :providers
end
def self.providers
@providers ||= {}
end
module Provider
class << self
def extended(base)
provider = base.to_s.split("::").last
Fog.providers[provider.downcase.to_sym] = provider
Fog.providers[underscore_name(provi... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/array.rb | Ruby | mit | 46 | master | 589 | module Fog
module Attributes
# = Fog Array Attribute
#
# This class handles Array attributes from the providers,
# converting values to Array objects
class Array < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
at... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/default.rb | Ruby | mit | 46 | master | 2,587 | module Fog
module Attributes
# = Fog Default Attribute
#
# This class handles the attributes without a type force.
# The attributes returned from the provider will keep its original values.
class Default
attr_reader :model, :name, :squash, :aliases, :default, :as
# @param [Klass] mode... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/string.rb | Ruby | mit | 46 | master | 422 | module Fog
module Attributes
# = Fog String Attribute
#
# This class handles String attributes from the providers,
# converting values to String objects
class String < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/time.rb | Ruby | mit | 46 | master | 751 | module Fog
module Attributes
# = Fog Time Attribute
#
# This class handles Time attributes from the providers,
# converting values to Time objects
class Time < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
at... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/timestamp.rb | Ruby | mit | 46 | master | 634 | module Fog
module Attributes
# = Fog Timestamp Attribute
#
# This class handles Timestamp attributes from the providers,
# converting Integer and String values as a real Timestamp objects
class Timestamp < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/integer.rb | Ruby | mit | 46 | master | 426 | module Fog
module Attributes
# = Fog Integer Attribute
#
# This class handles Integer attributes from the providers,
# converting values to Integer objects
class Integer < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/float.rb | Ruby | mit | 46 | master | 418 | module Fog
module Attributes
# = Fog Float Attribute
#
# This class handles Float attributes from the providers,
# converting values to Float objects
class Float < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/attributes/boolean.rb | Ruby | mit | 46 | master | 551 | module Fog
module Attributes
# = Fog Boolean Attribute
#
# This class handles Boolean attributes from the providers,
# converting values to Boolean objects
class Boolean < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
def #{name}=(new_#{name})
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/associations/default.rb | Ruby | mit | 46 | master | 866 | module Fog
module Associations
# = Fog Default Association
#
# This class has the shared behavior between all association models.
class Default
attr_reader :model, :name, :aliases, :as, :association_class
def initialize(model, name, collection_name, options)
@model = model
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/associations/many_models.rb | Ruby | mit | 46 | master | 692 | module Fog
module Associations
# = Fog Multiple Association
#
# This class handles multiple association between the models.
# It expects the provider to map the attribute with a collection of objects.
class ManyModels < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __L... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/associations/one_model.rb | Ruby | mit | 46 | master | 627 | module Fog
module Associations
# = Fog Single Association
#
# This class handles single association between the models.
# It expects the provider to map the attribute with an initialized object.
class OneModel < Default
def create_setter
model.class_eval <<-EOS, __FILE__, __LINE__
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/associations/one_identity.rb | Ruby | mit | 46 | master | 862 | module Fog
module Associations
# = Fog Single Association
#
# This class handles single association between the models.
# It expects the provider to return only the id of the association.
# The association model will be loaded based on the id initialized.
class OneIdentity < Default
def ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/core/associations/many_identities.rb | Ruby | mit | 46 | master | 1,101 | module Fog
module Associations
# = Fog Multiple Association
#
# This class handles multiple association between the models.
# It expects the provider to return a collection of ids.
# The association models will be loaded based on the collection of ids.
class ManyIdentities < Default
def ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/types_helper.rb | Ruby | mit | 46 | master | 1,037 | # 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
module Integer; end
module String; end
module Time; end... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/collection_helper.rb | Ruby | mit | 46 | master | 2,230 | def collection_tests(collection, params = {}, mocks_implemented = true)
tests("success") do
tests("#new(#{params.inspect})").succeeds do
pending if Fog.mocking? && !mocks_implemented
collection.new(params)
end
tests("#create(#{params.inspect})").succeeds do
pending if Fog.mocking? && !m... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/model_helper.rb | Ruby | mit | 46 | master | 758 | def model_tests(collection, params = {}, mocks_implemented = true)
tests("success") do
@instance = collection.new(params)
tests("#save").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.save
end
yield if block_given?
tests("#destroy").succeeds do
pending if ... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/mock_helper.rb | Ruby | mit | 46 | master | 4,112 | require "fog/core"
# Use so you can run in mock mode from the command line
#
# FOG_MOCK=true fog
Fog.mock! if ENV["FOG_MOCK"] == "true"
# if in mocked mode, fill in some fake credentials for us
if Fog.mock?
Fog.credentials = {
aws_access_key_id: "aws_access_key_id",
aws_secret_access_key: "aws_secret_acces... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/helper.rb | Ruby | mit | 46 | master | 903 | require "excon"
ENV["FOG_RC"] = ENV["FOG_RC"] || File.expand_path(".fog", __dir__)
ENV["FOG_CREDENTIAL"] = ENV["FOG_CREDENTIAL"] || "default"
Excon.defaults.merge!(debug_request: true, debug_response: true)
LOREM = <<HERE.freeze
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/responds_to_helper.rb | Ruby | mit | 46 | master | 252 | module Shindo
class Tests
def responds_to(method_names)
method_names.each do |method_name|
tests("#respond_to?(:#{method_name})").returns(true) do
@instance.respond_to?(method_name)
end
end
end
end
end |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/formats_helper.rb | Ruby | mit | 46 | master | 2,586 | require "fog/schema/data_validator"
module Shindo
class Tests
# Generates a Shindo test that compares a hash schema to the result
# of the passed in block returning true if they match.
#
# The schema that is passed in is a Hash or Array of hashes that
# have Classes in place of values. When check... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/minitest/assertions.rb | Ruby | mit | 46 | master | 486 | require "fog/schema/data_validator"
module Minitest::Assertions
# Compares a hash's structure against a reference schema hash and returns true
# when they match. Fog::Schema::Datavalidator is used for the validation.
def assert_match_schema(actual, schema, message = nil, options = {})
validator = Fog::Schema... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/compute/flavors_helper.rb | Ruby | mit | 46 | master | 816 | def flavors_tests(connection, _params = {}, mocks_implemented = true)
tests("success") do
tests("#all").succeeds do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.all
end
if !Fog.mocking? || mocks_implemented
@identity = connection.flavors.first.identity
end
t... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/test_helpers/compute/server_helper.rb | Ruby | mit | 46 | master | 662 | def server_tests(connection, params = {}, mocks_implemented = true)
model_tests(connection.servers, params, mocks_implemented) do
tests("#reload").returns(true) do
pending if Fog.mocking? && !mocks_implemented
@instance.wait_for { ready? }
identity = @instance.identity
!identity.nil? && id... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/schema/data_validator.rb | Ruby | mit | 46 | master | 5,715 | module Fog
module Schema
# This validates a data object against a Ruby based schema to see
# if they match.
#
# * An object matches the schema if +==+ or +===+ returns +true+
# * Hashes match if all the key's values match the classes given
# in the schema as well. This can be configured in t... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/fog/compute/models/server.rb | Ruby | mit | 46 | master | 4,181 | require "fog/core/model"
module Fog
module Compute
class Server < Fog::Model
INITIAL_SSHABLE_TIMEOUT = 8
attr_writer :username, :private_key, :private_key_path, :public_key, :public_key_path, :ssh_port, :ssh_options
# Sets the proc used to determine the IP Address used for ssh/scp interactions... |
github | fog/fog-core | https://github.com/fog/fog-core | lib/tasks/test_task.rb | Ruby | mit | 46 | master | 1,102 | require "rake"
require "rake/tasklib"
module Fog
module Rake
class TestTask < ::Rake::TaskLib
def initialize
desc "Run the mocked tests"
task :test do
::Rake::Task[:mock_tests].invoke
end
task :mock_tests do
tests(true)
end
task :real_te... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | vagrant-dsc.gemspec | Ruby | mit | 45 | master | 1,311 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'vagrant-dsc/version'
Gem::Specification.new do |spec|
spec.name = "vagrant-dsc"
spec.version = Vagrant::Dsc::VERSION
spec.authors = ["Matt Fellows"]
spec.email ... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | Gemfile | Ruby | mit | 45 | master | 241 | source 'https://rubygems.org'
# Specify your gem's dependencies in vagrant-dsc.gemspec
gemspec
group :development do
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
end
group :plugins do
gem "vagrant-dsc", path: "."
end |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | Rakefile | Ruby | mit | 45 | master | 377 | require "bundler/gem_tasks"
require 'rspec/core/rake_task'
task :default => [:test, :quality]
# Remove 'install' task as the gem is installed to Vagrant, not to system
Rake::Task[:install].clear
namespace :test do
RSpec::Core::RakeTask.new('unit') do |task|
task.pattern = 'spec/**/*_spec.rb'
end
end
desc "Run a... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | lib/vagrant-dsc.rb | Ruby | mit | 45 | master | 458 | require "pathname"
require "vagrant-dsc/plugin"
module VagrantPlugins
module DSC
lib_path = Pathname.new(File.expand_path("../vagrant-dsc", __FILE__))
autoload :Action, lib_path.join("action")
autoload :Errors, lib_path.join("errors")
# This returns the path to the source of this plugin.
#
... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | lib/vagrant-dsc/provisioner.rb | Ruby | mit | 45 | master | 11,417 | require "log4r"
require 'erb'
module VagrantPlugins
module DSC
# DSC Errors namespace, including setup of locale-based error messages.
class DSCError < Vagrant::Errors::VagrantError
error_namespace("vagrant_dsc.errors")
I18n.load_path << File.expand_path("locales/en.yml", File.dirname(__FILE__))
... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | lib/vagrant-dsc/plugin.rb | Ruby | mit | 45 | master | 496 | require "vagrant"
module VagrantPlugins
module DSC
class Plugin < Vagrant.plugin("2")
name "DSC"
description <<-DESC
Provides support for provisioning your virtual machines with
DSC either using a local `DSC` Configuration or a DSC server.
DESC
config(:dsc, :provisioner) ... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | lib/vagrant-dsc/config.rb | Ruby | mit | 45 | master | 8,107 | require "vagrant/util/counter"
require "log4r"
module VagrantPlugins
module DSC
# The "Configuration" represents a configuration of how the DSC
# provisioner should behave: data directories, working directory,
# DSC Manifests etc.
class Config < Vagrant.plugin("2", :config)
extend Vagrant::Util... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | development/reboot/Vagrantfile | Ruby | mit | 45 | master | 998 | # -*- mode: ruby -*-
# vi: set ft=ruby :
$shell_script = <<SCRIPT
# config desired state
. C:\\vagrant\\manifests\\LCMConfig.ps1
LCMConfig
Set-DscLocalConfigurationManager -Path ".\\LCMConfig"
SCRIPT
VAGRANTFILE_API_VERSION = "2"
# linked clone feature requires 1.8
Vagrant.require_version ">= 1.8"
Vagrant.c... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | development/web/Vagrantfile | Ruby | mit | 45 | master | 3,397 | # -*- mode: ruby -*-
# vi: set ft=ruby :
$shell_script = <<SCRIPT
choco install seek-dsc -y
Install-WindowsFeature Web-Server
Get-DSCResource
SCRIPT
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |conf... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | spec/base.rb | Ruby | mit | 45 | master | 1,493 | shared_context "unit" do
before(:each) do
# State to store the list of registered plugins that we have to
# unregister later.
@_plugins = []
# Create a thing to store our temporary files so that they aren't
# unlinked right away.
@_temp_files = []
end
# This helper creates a temporary fi... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | spec/spec_helper.rb | Ruby | mit | 45 | master | 538 | require 'simplecov'
require 'coveralls'
require 'vagrant-dsc/version'
require 'vagrant-dsc/plugin'
require 'rspec/its'
require 'base'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
coverage_dir('tmp... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | spec/provisioner/provisioner_spec.rb | Ruby | mit | 45 | master | 34,423 | require 'spec_helper'
require 'vagrant-dsc/provisioner'
require 'vagrant-dsc/config'
require 'rspec/its'
describe VagrantPlugins::DSC::Provisioner do
include_context "unit"
let(:root_path) { (Pathname.new(Dir.mktmpdir)).to_s }
let(:ui) { Vagrant::UI::Silent.new }
let(:machin... |
github | mefellows/vagrant-dsc | https://github.com/mefellows/vagrant-dsc | spec/provisioner/config_spec.rb | Ruby | mit | 45 | master | 7,016 | require 'spec_helper'
require 'vagrant-dsc/provisioner'
require 'vagrant-dsc/config'
require 'base'
describe VagrantPlugins::DSC::Config do
include_context "unit"
let(:instance) { described_class.new }
let(:machine) { double("machine") }
def valid_defaults
# subject.prop = value
end
describe "default... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | metadata.rb | Ruby | apache-2.0 | 46 | main | 538 | # frozen_string_literal: true
name 'ossec'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
source_url 'https://github.com/sous-chefs/ossec'
issues_url 'https://github.com/sous-chefs/ossec/issues'
description 'Provides custom resources for ... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/helpers_spec.rb | Ruby | apache-2.0 | 46 | main | 1,844 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../libraries/helpers'
describe OssecCookbook::Helpers do
let(:helper_class) do
Class.new do
include OssecCookbook::Helpers
attr_reader :node
def initialize(node)
@node = node
end
def platform?(*platfor... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_config_spec.rb | Ruby | apache-2.0 | 46 | main | 1,304 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_config' do
step_into :ossec_config
platform 'ubuntu', '24.04'
before do
allow(File).to receive(:exist?).and_call_original
allow(File).to receive(:exist?).with('/var/ossec/etc/client.keys').and_return(true)
allow(File).to receive(:e... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_authd_spec.rb | Ruby | apache-2.0 | 46 | main | 777 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_authd' do
step_into :ossec_authd
platform 'ubuntu', '24.04'
before do
allow(File).to receive(:exist?).and_call_original
allow(File).to receive(:exist?).with('/var/ossec/etc/sslmanager.cert').and_return(true)
allow(File).to receive(... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_agent_auth_spec.rb | Ruby | apache-2.0 | 46 | main | 634 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_agent_auth' do
step_into :ossec_agent_auth
platform 'ubuntu', '24.04'
before do
allow(File).to receive(:size?).and_call_original
allow(File).to receive(:size?).with('/var/ossec/etc/client.keys').and_return(nil)
allow(File).to recei... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_client_spec.rb | Ruby | apache-2.0 | 46 | main | 1,320 | # frozen_string_literal: true
require 'spec_helper'
require 'json'
describe 'ossec_client' do
step_into :ossec_client
platform 'ubuntu', '24.04'
let(:data_bags_path) { File.expand_path('../../../test/fixtures/data_bags', __dir__) }
let(:data_bag_ossec_ssh) { JSON.parse(File.read("#{data_bags_path}/ossec/ssh.... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_repository_spec.rb | Ruby | apache-2.0 | 46 | main | 1,431 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_repository' do
step_into :ossec_repository
context 'on ubuntu-24.04' do
platform 'ubuntu', '24.04'
recipe do
ossec_repository 'default'
end
it 'creates the apt repository' do
expect(chef_run).to add_apt_repository('... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_server_spec.rb | Ruby | apache-2.0 | 46 | main | 1,426 | # frozen_string_literal: true
require 'spec_helper'
require 'json'
describe 'ossec_server' do
step_into :ossec_server
platform 'ubuntu', '24.04'
let(:data_bags_path) { File.expand_path('../../../test/fixtures/data_bags', __dir__) }
let(:data_bag_ossec_ssh) { JSON.parse(File.read("#{data_bags_path}/ossec/ssh.... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_install_spec.rb | Ruby | apache-2.0 | 46 | main | 417 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_install' do
step_into %i(ossec_install ossec_repository)
platform 'ubuntu', '24.04'
recipe do
ossec_install 'server'
end
it 'installs the server package' do
expect(chef_run).to install_package('ossec-hids-server')
end
it 'con... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | spec/unit/resources/ossec_local_spec.rb | Ruby | apache-2.0 | 46 | main | 741 | # frozen_string_literal: true
require 'spec_helper'
describe 'ossec_local' do
step_into %i(ossec_local ossec_install ossec_config ossec_repository)
platform 'ubuntu', '24.04'
before do
allow(File).to receive(:exist?).and_call_original
allow(File).to receive(:exist?).with('/var/ossec/etc/client.keys').a... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | test/integration/default/controls/default_spec.rb | Ruby | apache-2.0 | 46 | main | 691 | # frozen_string_literal: true
require_relative '../../spec_helper'
control 'ossec-default-package-01' do
impact 1.0
title 'The server package is installed'
describe package('ossec-hids-server') do
it { should be_installed }
end
end
control 'ossec-default-config-01' do
impact 0.7
title 'The main OSSE... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | test/integration/client/controls/client_spec.rb | Ruby | apache-2.0 | 46 | main | 740 | # frozen_string_literal: true
control 'ossec-client-package-01' do
impact 1.0
title 'The client package is installed'
describe package('ossec-hids-agent') do
it { should be_installed }
end
end
control 'ossec-client-ssh-01' do
impact 0.7
title 'The SSH authorization file exists for agent key distribut... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | test/integration/server/controls/server_spec.rb | Ruby | apache-2.0 | 46 | main | 698 | # frozen_string_literal: true
control 'ossec-server-package-01' do
impact 1.0
title 'The server package is installed'
describe package('ossec-hids-server') do
it { should be_installed }
end
end
control 'ossec-server-distribution-01' do
impact 0.7
title 'The server key distribution script is present'
... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_client.rb | Ruby | apache-2.0 | 46 | main | 2,060 | # frozen_string_literal: true
provides :ossec_client
unified_mode true
use '_partial/_base'
property :server_role, String, default: 'ossec_server'
property :server_env, [String, nil]
property :agent_server_ip, [String, nil]
property :client_keys_content, [String, nil]
action_class do
include OssecCookbook::Helper... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_agent_auth.rb | Ruby | apache-2.0 | 46 | main | 2,205 | # frozen_string_literal: true
provides :ossec_agent_auth
unified_mode true
use '_partial/_base'
property :agent_name, String, default: lazy { node['fqdn'] }
property :server_role, String, default: 'ossec_server'
property :server_env, [String, nil]
property :agent_server_ip, [String, nil]
property :port, Integer, def... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_authd.rb | Ruby | apache-2.0 | 46 | main | 2,175 | # frozen_string_literal: true
provides :ossec_authd
unified_mode true
use '_partial/_base'
property :ip_address, [true, false], default: false
property :port, Integer, default: 1515
property :ca, [String, nil]
property :certificate, String, default: lazy { "#{install_dir}/etc/sslmanager.cert" }
property :key, String... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_server.rb | Ruby | apache-2.0 | 46 | main | 3,763 | # frozen_string_literal: true
provides :ossec_server
unified_mode true
use '_partial/_base'
property :server_role, String, default: 'ossec_server'
property :server_env, [String, nil]
action_class do
include OssecCookbook::Helpers
def managed_agent_nodes
search_string = +'ossec:[* TO *]'
search_string <... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_local.rb | Ruby | apache-2.0 | 46 | main | 577 | # frozen_string_literal: true
provides :ossec_local
unified_mode true
use '_partial/_base'
action :create do
ossec_install 'server' do
manage_repository new_resource.manage_repository
end
ossec_config 'local' do
install_dir new_resource.install_dir
ossec_conf new_resource.ossec_conf
agent_conf... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_repository.rb | Ruby | apache-2.0 | 46 | main | 1,200 | # frozen_string_literal: true
provides :ossec_repository
unified_mode true
action_class do
include OssecCookbook::Helpers
end
action :create do
case node['platform_family']
when 'debian'
apt_repository 'ossec' do
uri "https://updates.atomicorp.com/channels/atomic/#{node['platform']}"
key 'https... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_config.rb | Ruby | apache-2.0 | 46 | main | 3,417 | # frozen_string_literal: true
provides :ossec_config
unified_mode true
use '_partial/_base'
property :install_type, String, equal_to: %w(local server agent), name_property: true
property :agent_server_ip, [String, nil]
action_class do
include OssecCookbook::Helpers
def default_all_conf
{
'syscheck' =... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/ossec_install.rb | Ruby | apache-2.0 | 46 | main | 1,259 | # frozen_string_literal: true
provides :ossec_install
unified_mode true
property :package_type, String, equal_to: %w(agent server), name_property: true
property :manage_repository, [true, false], default: true
action_class do
include OssecCookbook::Helpers
end
action :create do
ossec_repository 'default' if new... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | resources/_partial/_base.rb | Ruby | apache-2.0 | 46 | main | 385 | # frozen_string_literal: true
property :install_dir, String, default: '/var/ossec'
property :data_bag_name, String, default: 'ossec'
property :ssh_data_bag_item, String, default: 'ssh'
property :encrypted_data_bag, [true, false], default: false
property :ossec_conf, Hash, default: {}
property :agent_conf, Array, defau... |
github | sous-chefs/ossec | https://github.com/sous-chefs/ossec | libraries/helpers.rb | Ruby | apache-2.0 | 46 | main | 2,649 | # frozen_string_literal: true
require 'chef/mixin/deep_merge'
require 'chef/search/query'
module OssecCookbook
module Helpers
def ossec_apt_repo_dist
if node['os_release']
node['os_release']['version_codename']
elsif node['lsb']
node['lsb']['codename']
else
raise 'unabl... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | cocoapods-deploy.gemspec | Ruby | mit | 46 | master | 1,744 | # -*- encoding: utf-8 -*-
# stub: cocoapods-deploy 0.0.12 ruby lib
Gem::Specification.new do |s|
s.name = "cocoapods-deploy"
s.version = "0.0.12"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["James Campbell"]
... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | Gemfile | Ruby | mit | 46 | master | 222 | source 'https://rubygems.org'
# Specify your gem's dependencies in cocoapods-deployment.gemspec
gemspec
group :development do
gem 'cocoapods'
gem 'mocha'
gem 'bacon'
gem 'mocha-on-bacon'
gem 'prettybacon'
end |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | spec/deploy_transformer_spec.rb | Ruby | mit | 46 | master | 4,286 | require File.expand_path('../spec_helper', __FILE__)
def transform_podfile(lockfile, sandbox, podfile)
transformer = Pod::DeployTransformer.new(lockfile, sandbox)
transformer.transform_podfile(podfile)
end
module Pod
describe DeployTransformer do
describe "when transforming podfile" do
it "should pres... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | spec/deploy_downloader_spec.rb | Ruby | mit | 46 | master | 1,003 | require File.expand_path('../spec_helper', __FILE__)
class MockExternalSource
def initialize
end
def fetch
end
end
module Pod
describe DeployDownloader do
before do
@podfile = Podfile.new
Config.instance.stubs(:podfile).returns(@podfile)
@source = MockExternalSource.new
Extern... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | spec/deploy_analyzer_spec.rb | Ruby | mit | 46 | master | 237 | require File.expand_path('../spec_helper', __FILE__)
module Pod
describe DeployAnalyzer do
it "should have no sources" do
analyzer = DeployAnalyzer.new(nil, nil, nil)
analyzer.sources.should.equal []
end
end
end |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | spec/command/deploy_spec.rb | Ruby | mit | 46 | master | 3,506 | require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command::Deploy do
before do
@command = Command.parse(%w{ deploy })
@command.stubs(:verify_lockfile_exists!)
@command.stubs(:verify_podfile_exists!)
@podfile = Podfile.new
Config.instance.stubs(:podfile).r... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods_plugin.rb | Ruby | mit | 46 | master | 269 | require 'cocoapods-deploy/deploy_analyzer'
require 'cocoapods-deploy/deploy_downloader'
require 'cocoapods-deploy/deploy_installer'
require 'cocoapods-deploy/deploy_transformer'
require 'cocoapods-deploy/command'
require 'cocoapods-deploy/patches/write_lockfile_patch' |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods-deploy/deploy_transformer.rb | Ruby | mit | 46 | master | 2,984 | module Pod
class DeployTransformer
attr_accessor :lockfile
attr_accessor :sandbox
attr_accessor :metadata
def initialize(lockfile, sandbox)
@lockfile = lockfile
@sandbox = sandbox
@metadata = Source::Metadata.new({'prefix_lengths' => [1, 1, 1]})
end
def transform_podfile(p... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods-deploy/deploy_installer.rb | Ruby | mit | 46 | master | 438 | module Pod
class DeployInstaller < Installer
def create_analyzer
DeployAnalyzer.new(sandbox, podfile, lockfile).tap do |analyzer|
analyzer.allow_pre_downloads = false
end
end
def write_lockfiles
UI.message "- Writing Manifest in #{UI.path sandbox.manifest_path}" do
sandb... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods-deploy/deploy_downloader.rb | Ruby | mit | 46 | master | 1,796 | module Pod
class DeployDownloader
attr_accessor :dependency
def initialize(dependency)
@dependency = dependency
end
def download(config)
if @dependency.external_source.key?(:podspec)
download_podspec(config)
else
download_source(config)
end
end
def d... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods-deploy/command/deploy.rb | Ruby | mit | 46 | master | 4,990 | # - Patch Lockfile to store URLs
# - Use the data in deploy
module Pod
class Command
class Deploy < Command
include ProjectDirectory
self.summary = 'Install project dependencies to Podfile.lock versions without pulling down full podspec repo.'
self.description = <<-DESC
Install projec... |
github | jcampbell05/cocoapods-deploy | https://github.com/jcampbell05/cocoapods-deploy | lib/cocoapods-deploy/patches/write_lockfile_patch.rb | Ruby | mit | 46 | master | 3,444 | module Pod
# - Apply patch to sandbox
# - Both work together to record URI of ext pod
# - deploy transformer should use this data
# - Help people upgrade to 0.1 of cocoapods-deploy
Sandbox.class_eval do
def external_podspecs
@external_podspecs
end
def store_ex... |
github | joeyates/rake-builder | https://github.com/joeyates/rake-builder | Rakefile | Ruby | mit | 46 | master | 576 | require "bundler/gem_tasks"
require 'rcov/rcovtask' if RUBY_VERSION < '1.9'
require 'rspec/core/rake_task'
task :default => :spec
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
end
if RUBY_VERSION < '1.9'
RSpec::Core::RakeTask.new('spec:rcov') do |t|
t.pattern = 'spec/**/*_spec.rb'
t.... |
github | joeyates/rake-builder | https://github.com/joeyates/rake-builder | rake-builder.gemspec | Ruby | mit | 46 | master | 1,318 | require 'rake'
$:.unshift( File.dirname( __FILE__ ) + '/lib' )
require 'rake/builder/version'
Gem::Specification.new do |s|
s.name = 'rake-builder'
s.summary = 'Rake for C/C++ Projects'
s.description = 'Provides Rake:Builder, a specific rake TaskLib for building C, C++, Objective-C a... |
github | joeyates/rake-builder | https://github.com/joeyates/rake-builder | examples/04_zlib/Rakefile | Ruby | mit | 46 | master | 340 | require 'rubygems' if RUBY_VERSION < '1.9'
require 'rake/builder'
Rake::Builder.new do |builder|
builder.target = 'zlib'
builder.programming_language = 'c'
builder.source_search_paths = ['src']
builder.objects_path = '.'
builder.library_dependencies << 'z'
builder.generated_files ... |
github | joeyates/rake-builder | https://github.com/joeyates/rake-builder | examples/03_search_paths/Rakefile | Ruby | mit | 46 | master | 246 | require 'rubygems' if RUBY_VERSION < '1.9'
require 'rake'
require 'rake/builder'
Rake::Builder.new do |builder|
builder.target = 'search-paths'
builder.source_search_paths = [ 'src' ]
builder.objects_path = '.'
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.