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
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/devise.rb
Ruby
apache-2.0
99
main
17,361
Rails.application.reloader.to_prepare do # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/cache_store.rb
Ruby
apache-2.0
99
main
314
config = Rails.application.config redis_host = Settings.redis.host redis_port = Settings.redis.port || 6379 redis_db = Settings.redis.db || 0 redis_url = Settings.redis.url || "redis://#{redis_host}:#{redis_port}/#{redis_db}" config.cache_store = :redis_cache_store, { url: redis_url, namespace: 'avalon' }
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/ldp_solr_duration_logger.rb
Ruby
apache-2.0
99
main
2,969
# This module enables tracking the sum duration that LDP and solr requests take # and report it back alongside the view and DB times in the rails log for each request. module AvalonInstrumentation extend ActiveSupport::Concern module ClassMethods def log_process_action(payload) messages, ldp_runtime, s...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/about_page.rb
Ruby
apache-2.0
99
main
1,108
AboutPage.configure do |config| config.app = { :name => Avalon.name, :version => Avalon::VERSION } config.environment = AboutPage::Environment.new({ 'Ruby/Rails' => /^(RUBY|RAILS|RACK|GEM_|rvm)/ }) config.request = AboutPage::RequestEnvironment.new({ 'HTTP Server' => /^(SERVER_|POW_)/ }) c...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/avalon.rb
Ruby
apache-2.0
99
main
409
require 'string_additions' require 'avalon/errors' require 'day_hour_string' # Loads configuration information from the YAML file and then sets up the # dropbox # # This makes a Dropbox object accessible in the controllers to query and find # out what is available. See lib/avalon/dropbox.rb for details on the API requi...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/integer_to_hms.rb
Ruby
apache-2.0
99
main
406
int_class = if RUBY_VERSION < "2.4" Fixnum # rubocop:disable Lint/UnifiedInteger else Integer end int_class.class_eval do def to_hms h = 1.hour * 1000 m = 1.minute * 1000 s = 1000.0 v = self hour = v / h v -= hour * h min = v / m v ...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/blacklight.rb
Ruby
apache-2.0
99
main
221
require 'blacklight' Rails.application.config.to_prepare do Blacklight::SearchState.class_eval do def url_for_document doc, options = {} SpeedyAF::Base.for(doc.to_h.with_indifferent_access) end end end
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/config.rb
Ruby
apache-2.0
99
main
1,279
Config.setup do |config| # Name of the constant exposing loaded settings config.const_name = 'Settings' # Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'. # # config.knockout_prefix = nil # Overwrite arrays found in previously loaded settings file. When...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/aws.rb
Ruby
apache-2.0
99
main
326
if Settings.minio require "aws-sdk-s3" Aws.config.update( endpoint: Settings.minio.endpoint, access_key_id: Settings.minio.access, secret_access_key: Settings.minio.secret, region: ENV["AWS_REGION"] ) # Service specific global configuration Aws.config[:s3] = { force_path_style: true ...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/default_host.rb
Ruby
apache-2.0
99
main
1,018
server_options = Settings.domain server_options = case server_options when String uri = URI.parse(server_options) { host: uri.host, port: uri.port, protocol: uri.scheme } when Hash server_options else server_options.to_hash end if server_options server_options.symbolize_keys! server_options.slice!(:host, :...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/active_fedora_reindexing.rb
Ruby
apache-2.0
99
main
1,242
ActiveFedora::Fedora.class_eval do def header_options @config[:headers] end def authorized_connection options = {} options[:ssl] = ssl_options if ssl_options options[:request] = request_options if request_options options[:headers] = header_options if header_options Farad...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/dropbox_context.rb
Ruby
apache-2.0
99
main
500
Rails.application.config.to_prepare do BrowseEverythingController.before_action do if params[:context] collection = Admin::Collection.find(params[:context]) if browser.providers['file_system'].present? browser.providers['file_system'].config[:home] = collection.dropbox_absolute_path end ...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/active_encode.rb
Ruby
apache-2.0
99
main
1,264
Rails.application.config.to_prepare do ActiveEncode::Base.engine_adapter = Settings.encoding.engine_adapter.to_sym case Settings.encoding.engine_adapter.to_sym when :ffmpeg MasterFile.default_encoder_class = FfmpegEncode ActiveEncode::EngineAdapters::FfmpegAdapter.completeness_threshold = 95 when :matte...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/rsolr.rb
Ruby
apache-2.0
99
main
1,099
RSolr::Client.class_eval do def build_request path, opts raise "path must be a string or symbol, not #{path.inspect}" unless [String,Symbol].include?(path.class) path = path.to_s opts[:proxy] = proxy unless proxy.nil? # Avalon can produce requests that are too large for :get. # Override method to ...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/workflow_steps.rb
Ruby
apache-2.0
99
main
258
Rails.application.config.to_prepare do HYDRANT_STEPS = Workflow.new(FileUploadStep.new, ResourceDescriptionStep.new, StructureStep.new, AccessControlStep.new) end
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/noid-rails.rb
Ruby
apache-2.0
99
main
226
require 'noid-rails' Noid::Rails.configure do |config| config.minter_class = Noid::Rails::Minter::Db config.identifier_in_use = lambda do |id| ActiveFedora::Base.exists?(id) || ActiveFedora::Base.gone?(id) end end
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/sidekiq.rb
Ruby
apache-2.0
99
main
1,460
redis_url = Settings.redis.url || "redis://#{Settings.redis.host}:#{Settings.redis.port}/#{Settings.redis.db}" redis_conn = { url: redis_url } Sidekiq.configure_server do |s| s.redis = redis_conn end Sidekiq.configure_client do |s| s.redis = redis_conn end # Turn off Sinatra's sessions, which overwrite the main R...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/profiler.rb
Ruby
apache-2.0
99
main
293
# Having `rack-mini-profiler` in the Gemfile will automatically load it and use it in non-production environments. # This initializer will respect `AVALON_PROFILING`` in docker-compose.yml and turn on/off profiling accordingly. Rack::MiniProfiler.config.authorization_mode = :allow_authorized
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/browse_everything.rb
Ruby
apache-2.0
99
main
1,347
Rails.application.config.to_prepare do settings = {} if Settings.dropbox.google_drive settings['google_drive'] = { client_id: Settings.dropbox.google_drive.client_id, client_secret: Settings.dropbox.google_drive.client_secret } end if Settings....
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/avalon_lti.rb
Ruby
apache-2.0
99
main
321
# You also need to explicitly enable OAuth 1 support in the environment.rb or an initializer: AUTH_10_SUPPORT = true module Avalon module Lti begin Configuration = YAML.load(ERB.new(File.read(File.expand_path('../../lti.yml', __FILE__))).result) rescue Configuration = {} end end end
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/kaminari_active_fedora_extension.rb
Ruby
apache-2.0
99
main
3,782
module Kaminari # module ActiveFedoraExtension # extend ActiveSupport::Concern # # module ClassMethods # # Future subclasses will pick up the model extension # def inherited(kls) #:nodoc: # super # kls.send(:include, Kaminari::ActiveFedoraModelExtension) if kls.superclass == ::ActiveFedor...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/initializers/presenter_config.rb
Ruby
apache-2.0
99
main
4,164
Rails.application.config.to_prepare do SpeedyAF::Base.tap do |sp| sp.config MasterFile do self.defaults = { permalink: nil, title: nil, encoder_classname: nil, workflow_id: nil, comment: [...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/environments/test.rb
Ruby
apache-2.0
99
main
2,912
require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data the...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/environments/development.rb
Ruby
apache-2.0
99
main
3,573
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager load code on boot. config.eager...
github
avalonmediasystem/avalon
https://github.com/avalonmediasystem/avalon
config/environments/production.rb
Ruby
apache-2.0
99
main
5,928
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.enable_reloading = false # Eager load code on boot for better performance and memory savings (ignor...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
tty-exit.gemspec
Ruby
mit
99
master
1,321
require_relative "lib/tty/exit/version" Gem::Specification.new do |spec| spec.name = "tty-exit" spec.version = TTY::Exit::VERSION spec.authors = ["Piotr Murach"] spec.email = ["piotr@piotrmurach.com"] spec.summary = %q{Terminal exit codes for humans and machines} spec.des...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
Gemfile
Ruby
mit
99
master
461
source "https://rubygems.org" gemspec gem "rake", "~> 12.0" gem "rspec", "~> 3.0" gem "benchmark-ips", "~> 2.7.2" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5.0") gem "coveralls_reborn", "~> 0.21.0" gem "simplecov", "~> 0.21.0" end if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1.0...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
lib/tty/exit.rb
Ruby
mit
99
master
6,828
# frozen_string_literal: true require_relative "exit/code" require_relative "exit/registry" require_relative "exit/version" module TTY # Terminal exit codes for humans and machines module Exit extend self Error = Class.new(StandardError) # @api private def self.included(base) base.instance...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
lib/tty/exit/code.rb
Ruby
mit
99
master
5,104
# frozen_string_literal: true module TTY module Exit # All reserved exit codes as constants module Code # No errors SUCCESS = 0 # Catchall for general errors ERROR = 1 # Missing keyword or command, or permission problem # (and diff return code on a failed binary file com...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
lib/tty/exit/registry.rb
Ruby
mit
99
master
570
# frozen_string_literal: true module TTY module Exit module Registry # A storage for custom exit codes # # @api private def self.exits @exits ||= {} end # Register a custom exit code # # @param [String] name # @param [Integer] code # @param [St...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
tasks/spec.rake
Ruby
mit
99
master
816
begin require "rspec/core/rake_task" desc "Run all specs" RSpec::Core::RakeTask.new(:spec) do |task| task.pattern = "spec/{unit,integration}{,/*/**}/*_spec.rb" end namespace :spec do desc "Run unit specs" RSpec::Core::RakeTask.new(:unit) do |task| task.pattern = "spec/unit{,/*/**}/*_spec.r...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/spec_helper.rb
Ruby
mit
99
master
477
if ENV["COVERAGE"] == "true" require "simplecov" require "coveralls" SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ]) SimpleCov.start do command_name "spec" add_filter "spec" end end require "bundler/s...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/exit_reserved_spec.rb
Ruby
mit
99
master
428
# frozen_string_literal: true RSpec.describe TTY::Exit, "#exit_reserved?" do { 0 => true, 2 => true, 3 => false, 63 => false, 64 => true, 125 => false, 128 => true, 159 => true, 160 => false, }.each do |code, reserved| it "determines exit #{code.inspect} as #{reserved ? "res...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/register_exit_spec.rb
Ruby
mit
99
master
1,651
# frozen_string_literal: true RSpec.describe TTY::Exit, "#register_exit" do after { TTY::Exit::Registry.exits.clear } it "registers a custom exit code and invokes it by name" do output = StringIO.new stub_const("Command", Class.new do include TTY::Exit register_exit(:too_long, 7, "Argument ...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/exit_success_spec.rb
Ruby
mit
99
master
300
# frozen_string_literal: true RSpec.describe TTY::Exit, "#exit_success?" do it "verifies exit code 0 as successful" do expect(TTY::Exit.exit_success?(0)).to eq(true) end it "verifies exit code other than 0 as unsuccessful" do expect(TTY::Exit.exit_success?(1)).to eq(false) end end
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/exit_code_spec.rb
Ruby
mit
99
master
2,177
# frozen_string_literal: true RSpec.describe TTY::Exit, "#exit_code" do CODES = { ok: 0, success: 0, error: 1, shell_misuse: 2, usage_error: 64, data_err: 65, data_error: 65, no_input: 66, no_user: 67, no_host: 68, service_unavailable: 69, software_error: 70, syst...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/exit_message_spec.rb
Ruby
mit
99
master
1,902
# frozen_string_literal: true RSpec.describe TTY::Exit, "#exit_message" do MESSAGES = { success: "Successful termination", error: "An error occurred", shell_misuse: "Misuse of shell builtins", usage_error: "Command line usage error", data_error: "Data format error", no_input: "Cannot open in...
github
piotrmurach/tty-exit
https://github.com/piotrmurach/tty-exit
spec/unit/exit_with_spec.rb
Ruby
mit
99
master
1,378
# frozen_string_literal: true RSpec.describe TTY::Exit, "#exit_with" do it "exposes exit_with when including a module" do stub_const("Command", Class.new do include TTY::Exit def execute exit_with(:usage_error) end end) cmd = Command.new expect { cmd.execute }.t...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
cucumber-puppet.gemspec
Ruby
isc
99
master
1,201
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |gem| gem.version = "0.4.0" gem.author = "Nikolay Sturm" gem.description = "cucumber-puppet is a tool for behavioral testing of Puppet catalogs" ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
Rakefile
Ruby
isc
99
master
1,568
require 'rubygems' require 'appraisal' require 'cucumber/rake/task' require 'tmpdir' cucumber_opts = %w{--require features --format progress} Cucumber::Rake::Task.new do |t| t.cucumber_opts = [cucumber_opts, '--tags', '~@puppet_version'] end require 'rspec/core/rake_task' RSpec::Core::RakeTask.new do |t| t.rspe...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
Guardfile
Ruby
isc
99
master
1,822
# development testsuite group 'bdd' do guard 'cucumber', :cli => '--profile guard' do watch(%r{^features/.+\.feature$}) watch(%r{^features/support/.+$}) { 'features/' } watch(%r{^features/steps/(.+)\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features/' } end guard 'rspec', :version ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
Appraisals
Ruby
isc
99
master
531
appraise "2.6.18" do gem "puppet", "2.6.18" gem "cucumber-puppet", :path => "../" end appraise "2.7.23" do gem "puppet", "2.7.23" gem "cucumber-puppet", :path => "../" end appraise "3.0.2" do gem "puppet", "3.0.2" gem "facter", "~> 1.6.11" gem "cucumber-puppet", :path => "../" end appraise "3.1.1" do ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
spec/cucumber-puppet/puppet_spec.rb
Ruby
isc
99
master
4,898
require 'spec_helper' require 'cucumber-puppet/puppet' # ensure existence of different version's API module Puppet class Node class Catalog end end class Resource class Catalog end end end # to access some instance variables class TestCucumberPuppet < CucumberPuppet attr_accessor :catalog ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
spec/cucumber-puppet/helper_spec.rb
Ruby
isc
99
master
1,076
require 'cucumber-puppet/helper' include CucumberPuppet::Helper describe 'CucumberPuppet::Helper' do describe '.find_destdir' do paths = { 'puppet' => 'features/modules/foo', 'puppet/features' => 'modules/foo', 'puppet/features/modules' => 'foo', 'puppet/features/modules/foo' => '.', ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
features/steps/puppet_version.rb
Ruby
isc
99
master
250
Then /^cucumber\-puppet should successfully run "([^\"]*)"$/ do |feature| basedir = File.dirname(__FILE__) + '/../..' output = `ruby -I#{basedir}/lib #{basedir}/bin/cucumber-puppet #{feature}` if $?.to_i > 0 puts output fail end end
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
features/steps/cucumber-puppet.rb
Ruby
isc
99
master
575
When /^I run cucumber\-puppet with option "([^\"]*)"$/ do |option| basedir = File.dirname(__FILE__) + "/../.." @output = `ruby -I#{basedir}/lib #{basedir}/bin/cucumber-puppet #{option} 2>&1` end Then /^it should show a version number$/ do fail unless @output.match(/\d\.\d\.\d/) end Then /^it should show "([^\"]...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
features/steps/generate_feature.rb
Ruby
isc
99
master
487
Given /^a working directory of "([^\"]*)"$/ do |dir| dir.split('/').each do |d| Dir.mkdir(d) unless File.exists?(d) Dir.chdir(d) end end Then /^feature "([^\"]*)" should exist in "([^\"]*)"$/ do |feature, path| @featurefile = "#{path}/#{feature}.feature" fail unless File.exists?(@featurefile) end Then...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
features/steps/initialization.rb
Ruby
isc
99
master
1,509
Given /^an uninitialized directory tree$/ do @dir = Dir.mktmpdir @oldwd = Dir.getwd fail unless Dir.chdir(@dir) end Given /^an initialized directory tree$/ do steps %Q{ Given an uninitialized directory tree When I generate "world" } end Given /^an initialized directory tree for puppet version "([^\"...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
features/support/tmpdir.rb
Ruby
isc
99
master
768
require 'fileutils' def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil) case prefix_suffix when nil prefix = "d" suffix = "" when String prefix = prefix_suffix suffix = "" when Array prefix = prefix_suffix[0] suffix = prefix_suffix[1] else raise ArgumentError, "unexpected prefix_suffi...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/cucumber-puppet.rb
Ruby
isc
99
master
211
require 'yaml' class CucumberPuppet version = YAML.load_file(File.dirname(__FILE__) + '/../VERSION.yml') VERSION = [version[:major], version[:minor], version[:patch], version[:build]].compact.join('.') end
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/cucumber-puppet/helper.rb
Ruby
isc
99
master
1,996
require 'cucumber-puppet' # Private helper methods. module CucumberPuppet::Helper private # Finds the root of the puppet directory tree according to Puppet's # directory naming convention. Relevant sub-trees are: # # - <puppetdir>/features/modules/$module # - <puppetdir>/modules/$module/features # # I...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/cucumber-puppet/puppet.rb
Ruby
isc
99
master
2,870
require 'puppet' # A class for accessing Puppet's internal state regarding a certain node or # class. class CucumberPuppet def initialize # resources' alias metaparameter @aliases = {} # default puppet configuration @puppetcfg = { 'confdir' => "/etc/puppet", 'manifest' => "/etc/puppet/ma...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/cucumber-puppet/steps.rb
Ruby
isc
99
master
1,369
Given /^a node specified by "([^\"]*)"$/ do |file| # file: yaml node file fail("Cannot find node facts #{file}.") unless File.exist?(file) @node = YAML.load_file(file) fail("Invalid node file #{file}, this should come from " + "/var/lib/puppet/yaml/node.") unless @node.is_a?(Puppet::Node) end Given /^I use...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/cucumber-puppet/rake/task.rb
Ruby
isc
99
master
1,240
# Defines a Rake task for running cucumber-puppet features. # # To create the basic task, call: # # CucumberPuppetRakeTask.new # # This defines a task 'cucumber_puppet' that will run features in 'features' # and 'modules/*/features'. # # To further configure the task, you can pass a block: # # CucumberPuppetRakeTas...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/steps/user.rb
Ruby
isc
99
master
369
Then /^"([^\"]*)" should be in groups? "([^\"]*)"$/ do |user, groups| steps %Q{ Then there should be a resource "User[#{user}]" And the user should be in groups "#{groups}" } end Then /^the user should be in groups "([^\"]*)"$/ do |groups| g = @resource["groups"] g_s = g if g.is_a?(Array) g_s = g...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/steps/package.rb
Ruby
isc
99
master
389
Then /^following packages should be dealt with:$/ do |packages| packages.hashes.each do |package| steps %Q{ Then package "#{package['name']}" should be "#{package['state']}" } end end Then /^package "([^\"]*)" should be "([^\"]*)"$/ do |package, state| steps %Q{ Then there should be a resource ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/steps/file.rb
Ruby
isc
99
master
1,136
Then /^following directories should be created:$/ do |directories| directories.hashes.each do |dir| steps %Q{ Then there should be a resource "File[#{dir['name']}]" And the state should be "directory" And the directory should have standard permissions } end end Then /^the file should be a...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/steps/puppet.rb
Ruby
isc
99
master
4,093
Given /^a node of class "([^\"]*)"$/ do |klass| @klass = klass end # And Given /^of class "([^\"]*)"$/ do |klass| # we expect this to only be used in conjunction with other classes fail unless @klass if @klass.is_a? String # FIXME: Arrays currently unsupported @klass = {@klass => nil, klass => nil} ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/steps/service.rb
Ruby
isc
99
master
340
Then /^service "([^\"]*)" should be "([^\"]*)"$/ do |name, state| steps %Q{ Then there should be a resource "Service[#{name}]" } if state == "disabled" steps %Q{ Then the service should have "enable" set to "false" } elsif state == "running" steps %Q{ Then the state should be "#{stat...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/support/hooks.rb
Ruby
isc
99
master
357
Before do # adjust local configuration like this # @puppetcfg['confdir'] = File.join(File.dirname(__FILE__), '..', '..') # @puppetcfg['manifest'] = File.join(@puppetcfg['confdir'], 'manifests', 'site.pp') # @puppetcfg['modulepath'] = "/srv/puppet/modules:/srv/puppet/site-modules" # adjust facts like this ...
github
petems/cucumber-puppet
https://github.com/petems/cucumber-puppet
lib/generators/world/support/world.rb
Ruby
isc
99
master
220
<%= if version "begin gem 'puppet', '#{version}' rescue Gem::LoadError => e puts e exit 1 end" end %> require 'cucumber-puppet/puppet' require 'cucumber-puppet/steps' World do CucumberPuppet.new end
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
march_hare.gemspec
Ruby
mit
99
main
677
# encoding: utf-8 $: << File.expand_path('../lib', __FILE__) require 'march_hare/version' Gem::Specification.new do |s| s.name = 'march_hare' s.version = MarchHare::VERSION s.platform = 'java' s.authors = ['Theo Hultberg', 'Michael S. Klishin'] s.email = ['theo@burtcorp.com', 'mich...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
Gemfile
Ruby
mit
99
main
278
source "https://rubygems.org" gem 'rake', ">= 12.0.0" group :test do gem "rspec", "~> 3.11" gem "rabbitmq_http_api_client", ">= 2.2.0" end group :development do gem "yard" # JRuby-friendly Markdown renderer gem "kramdown", :platform => :jruby gem "faraday" end
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/blocked_connection_notifications.rb
Ruby
mit
99
main
389
#!/usr/bin/env ruby require 'march_hare' connection = MarchHare.connect connection.on_blocked do |reason| puts "I am blocked now. Reason: #{reason}" end connection.on_unblocked do puts "I am unblocked now." end ch = connection.create_channel x = ch.default_exchange 10.times do |i| x.publish("") end sleep 5....
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/non_blocking_subscription.rb
Ruby
mit
99
main
726
$: << 'lib' require 'march_hare' connection = MarchHare.connect(:host => 'localhost') channel = connection.create_channel channel.prefetch = 10 exchange = channel.exchange('test', :type => :direct) queue = channel.queue('hello.world') queue.bind(exchange, :routing_key => 'xyz') queue.purge consumer = queue.subscri...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/connection/publisher_recovery_with_begin_rescue_retry.rb
Ruby
mit
99
main
380
$: << 'lib' require 'march_hare' begin conn = MarchHare.connect(:host => 'localhost') ch = conn.create_channel x = ch.default_exchange loop do 10.times do print "." x.publish("") end sleep 3.0 end rescue MarchHare::Exception => e puts "RabbitMQ connection error: #{e.message...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/connection/recovering_merry_go_around.rb
Ruby
mit
99
main
971
#!/usr/bin/env ruby # encoding: utf-8 require "bundler" Bundler.setup $:.unshift(File.expand_path("../../../lib", __FILE__)) require 'march_hare' # This example passes messages between N queues: # # Q1 => Q2 => ... => Qn-1 => Qn # # and is used primarily to test (and demonstrate) connection # recovery with a lot of...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/connection/automatic_consumer_recovery.rb
Ruby
mit
99
main
2,801
#!/usr/bin/env ruby # encoding: utf-8 require "bundler" Bundler.setup $:.unshift(File.expand_path("../../../lib", __FILE__)) require 'march_hare' conn = MarchHare.connect(:heartbeat_interval => 8) ch0 = conn.create_channel ch1 = conn.create_channel ch2 = conn.create_channel ch3 = conn.create_channel x = ch1.top...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/exchanges/mandatory_messages.rb
Ruby
mit
99
main
724
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Publishing messages as mandatory" puts conn = MarchHare.connect ch = conn.create_channel x = ch.default_exchange ch.on_return do |reply_code, reply_text, exchange, routing_key, basic_properties, payload| puts "Got a retur...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/exchanges/fanout_exchange_routing.rb
Ruby
mit
99
main
475
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Fanout exchange routing" puts conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("examples.pings") 10.times do |i| q = ch.queue("", :auto_delete => true).bind(x) q.subscribe do |delivery_info, properties, p...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/exchanges/direct_exchange_routing.rb
Ruby
mit
99
main
796
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Direct exchange routing" puts conn = MarchHare.connect ch = conn.create_channel x = ch.direct("examples.imaging") q1 = ch.queue("", :auto_delete => true).bind(x, :routing_key => "resize") q1.subscribe do |delivery_info, pro...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/queues/redeliveries.rb
Ruby
mit
99
main
1,942
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Subscribing for messages using explicit acknowledgements model" puts connection1 = MarchHare.connect connection2 = MarchHare.connect connection3 = MarchHare.connect ch1 = connection1.create_channel ch1.prefetch = 1 ch2 = connect...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/basic_nack.rb
Ruby
mit
99
main
548
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating basic.nack" puts conn = MarchHare.connect ch = conn.create_channel q = ch.queue("", :exclusive => true) 20.times do q.publish("") end 20.times do metadata, _ = q.pop(:ack => true) if metadata.delivery_...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/publisher_confirms.rb
Ruby
mit
99
main
540
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating publisher confirms" puts conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("amq.fanout") q = ch.queue("", :exclusive => true).bind(x) ch.confirm_select 1000.times do x.publish("") end ch.wai...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/exchange_to_exchange_bindings.rb
Ruby
mit
99
main
608
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating exchange-to-exchange bindings" puts conn = MarchHare.connect ch = conn.create_channel x1 = ch.fanout("march_hare.examples.e2e.exchange1", :auto_delete => true, :durable => false) x2 = ch.fanout("march_hare.exa...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/queue_lease.rb
Ruby
mit
99
main
498
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating queue TTL (queue leases)" puts conn = MarchHare.connect ch = conn.create_channel q = ch.queue("", :exclusive => true, :arguments => {"x-expires" => 300}) sleep 0.4 begin # this will raise because the queue i...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/dead_letter_exchange.rb
Ruby
mit
99
main
731
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating dead letter exchange" puts conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("amq.fanout") dlx = ch.fanout("march_hare.examples.dlx.exchange") q = ch.queue("", :exclusive => true, :arguments =...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/per_queue_message_ttl.rb
Ruby
mit
99
main
629
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating per-queue message TTL" puts conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("amq.fanout") q = ch.queue("", :exclusive => true, :arguments => {"x-message-ttl" => 1000}).bind(x) 10.times do |i...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/alternate_exchange.rb
Ruby
mit
99
main
644
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating alternate exchanges" puts conn = MarchHare.connect ch = conn.create_channel x1 = ch.fanout("march_hare.examples.ae.exchange1", :auto_delete => true, :durable => false) x2 = ch.fanout("march_hare.examples.ae.ex...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/per_message_ttl.rb
Ruby
mit
99
main
620
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating per-message TTL" puts conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("amq.fanout") q = ch.queue("", :exclusive => true).bind(x) 10.times do |i| x.publish("Message #{i}", :properties => {:...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/sender_selected_distribution.rb
Ruby
mit
99
main
1,008
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating sender-selected distribution" puts conn = MarchHare.connect ch = conn.create_channel x = ch.direct("march_hare.examples.ssd.exchange") q1 = ch.queue("", :exclusive => true).bind(x, :routing_key => "one") q2 ...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/extensions/consumer_cancellation_notification.rb
Ruby
mit
99
main
629
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" puts "=> Demonstrating consumer cancellation notification" puts conn = MarchHare.connect ch = conn.create_channel q = ch.queue("", :exclusive => true) c = q.subscribe(:on_cancellation => Proc.new { |ch, consumer, consumer_tag| put...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/getting_started/weathr.rb
Ruby
mit
99
main
2,249
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" connection = MarchHare.connect ch = connection.create_channel # topic exchange name can be any string x = ch.topic("weathr", :auto_delete => true) # Subscribers. ch.queue("", :exclusive => true).bind(x, :routing_key => "americas.north....
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/getting_started/blabbr.rb
Ruby
mit
99
main
582
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" conn = MarchHare.connect ch = conn.create_channel x = ch.fanout("march_hare.nba.scores") ch.queue("joe", :auto_delete => true).bind(x).subscribe do |meta, payload| puts "#{payload} => joe" end ch.queue("aaron", :auto_delete => tru...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
examples/guides/getting_started/hello_world.rb
Ruby
mit
99
main
353
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "march_hare" conn = MarchHare.connect ch = conn.create_channel q = ch.queue("march_hare.examples.hello_world", :auto_delete => true) c = q.subscribe do |metadata, payload| puts "Received #{payload}" end q.publish("Hello!", :routing_key => q.name)...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare.rb
Ruby
mit
99
main
811
# encoding: utf-8 require 'java' unless defined?(TruffleRuby) # Java client logging depends on SLF4J require 'ext/slf4j-api' require 'ext/slf4j-simple' require 'ext/rabbitmq-client' require 'march_hare/version' require 'march_hare/exceptions' require 'march_hare/session' # MarchHare is a JRuby client for RabbitMQ ...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/session.rb
Ruby
mit
99
main
26,093
# encoding: utf-8 require "march_hare/shutdown_listener" require "set" require "march_hare/thread_pools" require "march_hare/exception_handler" require "java" require "logger" module MarchHare java_import com.rabbitmq.client.ConnectionFactory java_import com.rabbitmq.client.Connection java_import com.rabbitmq.cl...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/queue.rb
Ruby
mit
99
main
11,141
# encoding: utf-8 require "march_hare/juc" require "march_hare/metadata" require "march_hare/consumers" require "set" module MarchHare # Represents AMQP 0.9.1 queue. # # @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide # @see http://rubymarchhare.info/articles/extensions.html Rab...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/versioned_delivery_tag.rb
Ruby
mit
99
main
629
module MarchHare # Wraps a delivery tag (which is an integer) so that {Bunny::Channel} could # detect stale tags after connection recovery. # # @private class VersionedDeliveryTag attr_reader :tag attr_reader :version def initialize(tag, version) raise ArgumentError.new("tag cannot be nil")...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/channel.rb
Ruby
mit
99
main
42,039
# encoding: utf-8 require "march_hare/shutdown_listener" require "march_hare/juc" module MarchHare # ## Channels in RabbitMQ # # To quote {http://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification}: # # AMQP 0.9.1 is a multi-channelled protocol. Channels provide a way to multiplex # a ...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/juc.rb
Ruby
mit
99
main
265
module MarchHare module JavaConcurrent java_import 'java.lang.Thread' java_import 'java.lang.Runnable' java_import 'java.lang.InterruptedException' include_package 'java.util.concurrent' include_package 'java.util.concurrent.atomic' end end
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/metadata.rb
Ruby
mit
99
main
4,265
module MarchHare class Headers attr_reader :channel, :consumer_tag, :envelope, :properties def initialize(channel, consumer_tag, envelope, properties) @channel = channel @consumer_tag = consumer_tag @envelope = envelope @properties = properties # Prime the delivery t...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/exceptions.rb
Ruby
mit
99
main
4,711
module MarchHare class Exception < StandardError end class ShutdownSignal < Exception attr_reader :cause def initialize(cause) @cause = cause end end class NetworkException < Exception end class ConnectionRefused < NetworkException end class ConnectionClosedException < Exception...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/shutdown_listener.rb
Ruby
mit
99
main
297
module MarchHare class ShutdownListener include com.rabbitmq.client.ShutdownListener def initialize(entity, &block) # connection or channel @entity = entity @block = block end def shutdown_completed(cause) @block.call(@entity, cause) end end end
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/exception_handler.rb
Ruby
mit
99
main
297
module MarchHare class ExceptionHandler < com.rabbitmq.client.impl.ForgivingExceptionHandler def initialize(logger) super() @logger = logger end def log(msg, error) logger.error(msg) logger.error(error) end private attr_reader :logger end end
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/thread_pools.rb
Ruby
mit
99
main
2,275
require "march_hare/juc" module MarchHare # A slighly more Ruby developer-friendly way of instantiating various # JDK executors (thread pools). class ThreadPools # Returns a new thread pool (JDK executor) of a fixed size. # # @param [Integer] n Number of threads to use # # @option options [Bo...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/exchange.rb
Ruby
mit
99
main
8,178
# encoding: utf-8 module MarchHare import com.rabbitmq.client.AMQP # Represents AMQP 0.9.1 exchanges. # # @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide # @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide # @see Queue#bind class Exch...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/consumers/base.rb
Ruby
mit
99
main
2,697
require "march_hare/versioned_delivery_tag" module MarchHare import com.rabbitmq.client.DefaultConsumer class BaseConsumer < DefaultConsumer attr_accessor :consumer_tag attr_accessor :auto_ack def initialize(channel, queue, opts) super(channel) @channel = channel @queue = qu...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
lib/march_hare/consumers/blocking.rb
Ruby
mit
99
main
1,826
require "march_hare/consumers/base" module MarchHare class BlockingCallbackConsumer < CallbackConsumer POISON = :__poison__ def initialize(channel, queue, buffer_size, opts, callback) super(channel, queue, opts, callback) if buffer_size @internal_queue = JavaConcurrent::ArrayBlockingQueu...
github
ruby-amqp/march_hare
https://github.com/ruby-amqp/march_hare
spec/spec_helper.rb
Ruby
mit
99
main
3,773
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require 'bundler' Bundler.setup(:default, :test) require "march_hare" puts "Running on Ruby #{RUBY_VERSION}." RSpec.configure do |config| config.raise_errors_for_deprecations! config.expect_with :rspec do |expectations| # This option will default t...