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
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/prune_db.rake
Ruby
bsd-3-clause
49
master
16,117
namespace :prune_db do desc "Fixes a mis-match between a vote's prompt_id and its appearance's prompt_id. Sets the appearance prompt_id to match the vote's prompt_id" task :fix_promptid_mismatch => :environment do bad_records = Vote.connection.select_all " SELECT votes.prompt_id, appearances.id a...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/makecsvfromhash.rb
Ruby
bsd-3-clause
49
master
518
#require 'fastercsv' q = Question.find(109) the_prompts = q.prompts_hash_by_choice_ids #hash_of_choice_ids_from_left_to_right_to_votes the_hash = {} the_prompts.each do |key, p| left_id, right_id = key.split(", ") if not the_hash.has_key?(left_id) the_hash[left_id] = {} the_hash[left_id][left_id] = ...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/timezone.rake
Ruby
bsd-3-clause
49
master
8,054
namespace :timezone do # There is a very similar task in the AOI code base as well. # Any core changes to this task should probably be reflected there. desc "Converts all dates from PT to UTC" task :convert_dates_to_utc, [:workerid, :workers] => [:environment] do|t,args| args.with_defaults(:workerid => "0"...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/heroku.rake
Ruby
bsd-3-clause
49
master
2,190
require 'rake' namespace :heroku do def ask_yn(q) print "#{q} (y/n) " STDIN.gets.strip.downcase.slice(0, 1) == 'y' end def ask_value(q) print " #{q}: " STDIN.gets.strip end desc "Prompt for all the config vars and set them on the Heroku app" task :setup => :create do vars = {} i...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/testserver.rake
Ruby
bsd-3-clause
49
master
755
namespace :testserver do desc "Start a server for testing purposes on port 4000" task :start do system "export RAILS_ENV=test && #{Rails.root.to_s}/script/server -p 4000" end task :prepare => :test do Rake::Task["db:test:prepare"].invoke u = User.create!(:ema...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/cron.rake
Ruby
bsd-3-clause
49
master
204
# Enable with either: # heroku addons:add nightly_cron # heroku addons:add hourly_cron # Write a task like: # task :cron => :environment do # Tweet.get # end # See recent results: # heroku logs:cron
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/import_bt_test_data.rb
Ruby
bsd-3-clause
49
master
2,373
require 'faster_csv' BASEDIR = "/home/dhruv/CITP/bt_test/" q = Question.new(:name => "test for bt", :creator_id => 1, :site_id => 1) q.save() choice_offset = Choice.last.id inserts = [] timestring = Time.now.to_s(:db) #isn't rails awesome? totalchoices=0 CSVBridge.foreach(BASEDIR + "choices_7000.txt", {:headers =>...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/test_api.rake
Ruby
bsd-3-clause
49
master
32,772
namespace :test_api do desc "Run all API tests" task :all => [:question_ids_with_votes_before_2010_02_17, :question_vote_consistency] namespace :choice do @choice_tasks = { :verify_cached_prompt_counts => "Ensure that cached prompt counts are valid for a choice", :verify_choice_appearances_and_v...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/suspenders.rake
Ruby
bsd-3-clause
49
master
356
namespace :suspenders do desc "Pull the latest Heroku Suspenders" task :pull do remote = "heroku_suspenders" source = "git://github.com/dancroak/heroku_suspenders.git" remotes = `git remote show` unless remotes.split("\n").include?(remote) `git remote add #{remote} #{source}` end `gi...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/csv.rake
Ruby
bsd-3-clause
49
master
384
namespace :csv do desc "Export question data to csv" task :question_export, [:question_id, :type, :filename] => [:environment] do |t, args| q = Question.find(args[:question_id]) File.open(args[:filename], 'w', :external_encoding => Encoding::UTF_8) do |file| q.to_csv(args[:type]).each do |row| ...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/capistrano.rake
Ruby
bsd-3-clause
49
master
3,523
# ============================================================================= # A set of rake tasks for invoking the Capistrano automation utility. # ============================================================================= # Invoke the given actions via Capistrano def cap(*parameters) begin require 'rubyg...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/util.rake
Ruby
bsd-3-clause
49
master
776
namespace :util do desc "Add user to API" task :useradd, [:email, :password] => [:environment] do |t, args| u = User.create!( :email => args[:email], :password => args[:password], :password_confirmation => args[:password] ) u.email_confirmed = true u.save! puts "Added user #{...
github
allourideas/pairwise-api
https://github.com/allourideas/pairwise-api
lib/tasks/rspec.rake
Ruby
bsd-3-clause
49
master
7,109
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 rspec_gem_dir = nil Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir| rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb") end rspec_plugin_dir = File.expand_path(Fil...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
metadata.rb
Ruby
apache-2.0
49
main
523
name 'golang' maintainer 'Sous Chefs' maintainer_email 'help@sous-chefs.org' license 'Apache-2.0' description 'Installs go programming language' source_url 'https://github.com/sous-chefs/golang' issues_url 'https://github.com/sous-chefs/golang/issues' chef_version '>= 15....
github
sous-chefs/golang
https://github.com/sous-chefs/golang
spec/unit/recipes/default_spec.rb
Ruby
apache-2.0
49
main
984
# # Cookbook:: golang # Spec:: default # # Copyright:: 2020-2021, Jeff Byrnes # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
resources/package.rb
Ruby
apache-2.0
49
main
2,278
# # Cookbook:: golang # Resource:: default # # Copyright:: 2020-2021, Sous-chefs # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
resources/default.rb
Ruby
apache-2.0
49
main
6,263
# # Cookbook:: golang # Resource:: default # # Copyright:: 2020-2021, Sous-chefs # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
attributes/default.rb
Ruby
apache-2.0
49
main
289
# # Cookbook:: golang # Attribute:: default # default['golang']['scm'] = true default['golang']['scm_packages'] = %w(git) default['golang']['install_dir'] = '/usr/local' default['golang']['gopath'] = '/opt/go' default['golang']['gobin'] = '/opt/go/bin' default['golang']['packages'] = []
github
sous-chefs/golang
https://github.com/sous-chefs/golang
recipes/default.rb
Ruby
apache-2.0
49
main
1,282
# # Cookbook:: golang # Recipe:: default # # Copyright:: 2013-2021, Alexander Rozhnov # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
test/integration/source/default_test.rb
Ruby
apache-2.0
49
main
538
describe command '/usr/local/go/bin/go version' do its('stdout') { should include '1.13.12' } end describe command 'export GOPATH=/opt/go; cd /tmp/helloWorld && /usr/local/go/bin/go test' do its('exit_status') { should cmp 0 } end describe directory '/opt/go' do its('owner') { should eq 'golang' } its('group'...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
test/integration/install-dir/default_test.rb
Ruby
apache-2.0
49
main
526
describe command '/srv/go/bin/go version' do its('stdout') { should include '1.13.12' } end describe command 'export GOPATH=/opt/go; cd /tmp/helloWorld && /srv/go/bin/go test' do its('exit_status') { should cmp 0 } end describe directory '/opt/go' do its('owner') { should eq 'golang' } its('group') { should e...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
test/integration/default/default_test.rb
Ruby
apache-2.0
49
main
450
describe command '/usr/local/go/bin/go version' do its('stdout') { should include '1.14.4' } end describe command 'export GOPATH=/opt/go; cd /tmp/helloWorld && /usr/local/go/bin/go test' do its('exit_status') { should cmp 0 } end describe directory '/opt/go' do its('owner') { should eq 'golang' } its('group')...
github
sous-chefs/golang
https://github.com/sous-chefs/golang
test/integration/cookbooks/test/recipes/default.rb
Ruby
apache-2.0
49
main
917
# # Cookbook:: test # Recipe:: default # # Copyright:: 2020-2022, Sous Chefs # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
Rakefile
Ruby
apache-2.0
49
master
905
# Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ begin require 'voxpupuli/test/rake' rescue LoadError # only available if gem group test is installed end begin require 'voxpupuli/acceptance/rake' rescue LoadError # only available if gem group acceptanc...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/unit/facter/keepalived_version_spec.rb
Ruby
apache-2.0
49
master
1,763
# frozen_string_literal: true require 'spec_helper' describe Facter::Util::Fact do before do Facter.clear end describe 'keepalived_version' do context 'returns keepalived version when keepalived present' do it do keepalived_version_output = <<~EOS Keepalived v1.2.2 (10/03,2013) ...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/acceptance/keepalived_spec.rb
Ruby
apache-2.0
49
master
4,817
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'keepalived class' do context 'on master with vrrp instance' do it_behaves_like 'an idempotent resource' do let(:manifest) do <<-PUPPET class { 'keepalived': sysconf_options => '-D --vrrp', } ...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/classes/keepalived_spec.rb
Ruby
apache-2.0
49
master
4,979
# frozen_string_literal: true require 'spec_helper' describe 'keepalived', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end describe 'without parameters' do it { is_expected.to create_class('keepalived') } it { is_expec...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/classes/keepalived_global_defs_spec.rb
Ruby
apache-2.0
49
master
17,609
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::global_defs', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end let(:pre_condition) { 'include keepalived' } describe 'without parameters' do it { i...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_vrrp_track_file_spec.rb
Ruby
apache-2.0
49
master
2,388
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::vrrp::track_file', type: :define do let(:title) { '_FILE_NAME_' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end des...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_lvs_virtual_server_spec.rb
Ruby
apache-2.0
49
master
9,646
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::lvs::virtual_server', type: 'define' do let(:title) { '_TITLE_' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end con...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_vrrp_instance_spec.rb
Ruby
apache-2.0
49
master
45,294
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::vrrp::instance', type: :define do let(:title) { '_NAME_' } let(:mandatory_params) do { interface: '', priority: 10, state: '', virtual_ipaddress: [], virtual_router_id: 10, } end let(:pre_condition)...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_vrrp_script_spec.rb
Ruby
apache-2.0
49
master
4,968
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::vrrp::script', type: :define do let(:title) { '_TITLE_' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end describe 'w...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_lvs_real_server_spec.rb
Ruby
apache-2.0
49
master
4,067
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::lvs::real_server', type: 'define' do let(:title) { 'test' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end context '...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_vrrp_track_process_spec.rb
Ruby
apache-2.0
49
master
4,774
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::vrrp::track_process', type: :define do let(:title) { '_PROC_NAME_' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end ...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
spec/defines/keepalived_vrrp_sync_group_spec.rb
Ruby
apache-2.0
49
master
6,215
# frozen_string_literal: true require 'spec_helper' describe 'keepalived::vrrp::sync_group', type: :define do let(:title) { '_NAME_' } let(:pre_condition) do 'include keepalived' end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end describe...
github
voxpupuli/puppet-keepalived
https://github.com/voxpupuli/puppet-keepalived
lib/facter/keepalived_version.rb
Ruby
apache-2.0
49
master
544
# frozen_string_literal: true # Fact: keepalived_version # # Purpose: get keepalived version # # Resolution: # Tests for presence of keepalived # "keepalived --version" and matches on the tag after 'Keepalived v' # # Caveats: # none # # Notes: # None if defined?(Facter::Util::Resolution.which) && Facter::Util:...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
Gemfile
Ruby
mit
49
master
767
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT source 'https://rubygems.org' gemspec gem 'base64', '~>0.3', require: false gem 'bigdecimal', '~>4.0', require: false gem 'kramdown-parser-gfm', '~>1.1', require: false gem 'logger', '~>1.7'...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
jekyll-plantuml.gemspec
Ruby
mit
49
master
1,038
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'English' lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'version' Gem::Specification.new do |s| s.required_rubygems_version...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
Rakefile
Ruby
mit
49
master
1,101
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'rubygems' require 'rake' require 'rdoc' require 'rake/clean' def name @name ||= File.basename(Dir['*.gemspec'].first, '.*') end def version Gem::Specification.load(Dir['*.gemsp...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
lib/jekyll-plantuml.rb
Ruby
mit
49
master
1,571
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'jekyll' require 'liquid' require 'digest' require 'fileutils' require_relative 'jekyll-plantuml-file' # Jekyll main module. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyrig...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
lib/jekyll-plantuml-file.rb
Ruby
mit
49
master
1,686
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'jekyll' require 'liquid' require 'digest' require 'fileutils' # Jekyll main module. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2014-2026 Yegor Bugay...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
test/test__helper.rb
Ruby
mit
49
master
814
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT $stdout.sync = true require 'simplecov' require 'simplecov-cobertura' unless SimpleCov.running SimpleCov.command_name('test') SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.n...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
test/test_plantuml.rb
Ruby
mit
49
master
922
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'liquid' require 'tmpdir' require_relative 'test__helper' require_relative '../lib/jekyll-plantuml' # PlantumlBlock test. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
test/test_plantuml-file.rb
Ruby
mit
49
master
1,406
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT require 'liquid' require 'tmpdir' require_relative 'test__helper' require_relative '../lib/jekyll-plantuml-file' # PlantumlBlock test. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyr...
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
test-jekylls/jekyll-3/Gemfile
Ruby
mit
49
master
301
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT source 'https://rubygems.org' gem 'jekyll', '4.4.1' gem 'jekyll-plantuml', path: '../..' gem 'kramdown', '2.5.2' gem 'kramdown-parser-gfm', '1.1.0' gem 'liquid', '5.12.0'
github
yegor256/jekyll-plantuml
https://github.com/yegor256/jekyll-plantuml
test-jekylls/jekyll-4/Gemfile
Ruby
mit
49
master
266
# frozen_string_literal: true # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko # SPDX-License-Identifier: MIT source 'https://rubygems.org' gem 'jekyll', '4.4.1' gem 'jekyll-plantuml', path: '../..' gem 'kramdown', '2.5.2' gem 'liquid', '5.12.0'
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
Rakefile
Ruby
mit
49
master
1,434
require 'rubygems' require 'spec/rake/spectask' require 'cucumber/rake/task' Cucumber::Rake::Task.new do |t| t.cucumber_opts = "--format pretty" end desc "Run the specs under spec" Spec::Rake::SpecTask.new do |t| t.spec_opts = ['--options', "spec/spec.opts"] t.spec_files = FileList['spec/**/*_spec.rb'] end beg...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
rosetta_queue.gemspec
Ruby
mit
49
master
5,382
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{rosetta_queue} s.version = "0.5.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :requ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
examples/sample_amqp_consumer.rb
Ruby
mit
49
master
1,054
require 'rubygems' require File.dirname(__FILE__) + '/../init.rb' require File.expand_path(File.dirname(__FILE__) + '/../lib/rosetta_queue/consumer_managers/threaded') RosettaQueue.logger = Logger.new(File.expand_path(File.dirname(__FILE__) + '/../../log/rosetta_queue.log')) module RosettaQueue Adapter.define do |a...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
examples/sample_amqp_fanout_producer.rb
Ruby
mit
49
master
459
require 'rubygems' require File.dirname(__FILE__) + '/../init.rb' RosettaQueue.logger = Logger.new(File.expand_path(File.dirname(__FILE__) + '/../../log/rosetta_queue.log')) RosettaQueue::Adapter.define do |a| a.user = "rosetta" a.password = "password" a.host = "localhost" a.type = "amqp_synch"...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
examples/sample_amqp_fanout_consumer.rb
Ruby
mit
49
master
1,121
require 'rubygems' require File.dirname(__FILE__) + '/../init.rb' require File.expand_path(File.dirname(__FILE__) + '/../lib/rosetta_queue/consumer_managers/threaded.rb') RosettaQueue.logger = Logger.new(File.expand_path(File.dirname(__FILE__) + '/../../log/rosetta_queue.log')) module RosettaQueue Adapter.define do...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
examples/sample_amqp_producer.rb
Ruby
mit
49
master
456
require 'rubygems' require File.dirname(__FILE__) + '/../init.rb' RosettaQueue.logger = Logger.new(File.expand_path(File.dirname(__FILE__) + '/../../log/rosetta_queue.log')) RosettaQueue::Adapter.define do |a| a.user = "rosetta" a.password = "password" a.host = "localhost" a.type = "amqp_synch"...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/spec_helper.rb
Ruby
mit
49
master
1,241
ENV["MESSAGING_ENV"] = "test" require 'rubygems' require 'spec' require 'ruby-debug' $:.unshift(File.dirname(__FILE__) + '/../lib') require 'rosetta_queue' require 'rosetta_queue/adapters/null' require 'rosetta_queue/adapters/fake' require 'rosetta_queue/adapters/stomp' require 'rosetta_queue/adapters/amqp' require '...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/destinations_spec.rb
Ruby
mit
49
master
766
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue describe Destinations do before(:each) do Destinations.clear end after(:each) do Destinations.clear end it "should map destination to hash" do Destinations.define do |queue| queue.map :test_queue...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/filters_spec.rb
Ruby
mit
49
master
1,396
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue describe Filters do after(:each) do Filters.reset end describe "#process_receiving" do it "should process the passed in message with the defined receiving filter" do Filters.define do |f| f.receiving {...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapter_spec.rb
Ruby
mit
49
master
3,769
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue describe Adapter do before(:each) do @stomp_adapter = mock("Gateway::StompAdapter") Adapter.reset end describe ".reset" do it "should clear all definitions" do Adapter.define { |a| a.type = "null" } ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/producer_spec.rb
Ruby
mit
49
master
1,811
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue class TestProducer < Producer publishes_to :test_queue options :persistent => false end describe Producer do before(:each) do @adapter = mock("adapter", :send_message => nil, :disconnect => nil) RosettaQueue::Adap...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/exception_handler_spec.rb
Ruby
mit
49
master
3,864
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue describe ExceptionHandler do after(:each) do ExceptionHandler.reset_handlers end describe "::handle" do it "runs the given block returning the block's return value" do ExceptionHandler::handle do "foo...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/message_handler_spec.rb
Ruby
mit
49
master
1,358
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue class SimplerHandler include MessageHandler subscribes_to :test_queue options :my => 'options' def on_message(filtered_message) end end describe MessageHandler do before(:each) do Filters.stub!(:safe_process_r...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/consumer_spec.rb
Ruby
mit
49
master
2,632
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue describe Consumer do class TestConsumer include MessageHandler subscribes_to :test_queue options :persistent => false, :ack => "client" def on_message(msg) end end before(:each) do @message = ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/null_spec.rb
Ruby
mit
49
master
835
require File.dirname(__FILE__) + '/../../spec_helper' require 'rosetta_queue/adapters/null' module RosettaQueue module Gateway describe NullAdapter do def null_adapter NullAdapter.new({:user => 'user', :password => 'password', :host => 'host', :port => 'port'}) end %w[disconnect rec...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/stomp_spec.rb
Ruby
mit
49
master
3,792
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_adapter_behavior' require 'rosetta_queue/adapters/stomp' module RosettaQueue module Gateway describe StompAdapter do before(:each) do @msg = "Hello World!" @handler = mock('handler', :destinati...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/fake_spec.rb
Ruby
mit
49
master
2,361
require File.dirname(__FILE__) + '/../../spec_helper' require 'rosetta_queue/adapters/fake' module RosettaQueue module Gateway describe FakeAdapter do describe "#queues" do it "should return all the queues that messages were delivered to" do # given adapter = FakeAdapter.new ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/amqp_synchronous_spec.rb
Ruby
mit
49
master
8,335
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_adapter_behavior' require File.dirname(__FILE__) + '/shared_fanout_behavior' begin require 'rosetta_queue/adapters/amqp_synch' rescue LoadError => ex if ex.message =~ /bunny/i warn "--WARNING-- Skipping all of tha A...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/beanstalk_spec.rb
Ruby
mit
49
master
1,279
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_adapter_behavior' require 'rosetta_queue/adapters/beanstalk' module RosettaQueue module Gateway describe BeanstalkAdapter do before(:each) do @msg = "Hello World!" @handler = mock('handler', :h...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/shared_fanout_behavior.rb
Ruby
mit
49
master
503
module RosettaQueue module Gateway describe "a fanout exchange adapter", :shared => true do # it "should discover fanout name for destation" do # when_receiving_exchange { # @channel.should_receive(:fanout).with(@exchange).and_return(@bound_queue) # } # end it "shoul...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/adapters/shared_adapter_behavior.rb
Ruby
mit
49
master
1,003
module RosettaQueue module Gateway describe "an adapter", :shared => true do before(:each) do ::RosettaQueue::Destinations.stub!(:lookup).and_return("foo") end def do_publishing @adapter.send_message('queue', 'message', 'options') end def do_receiving_with_handler...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/core_ext/string_spec.rb
Ruby
mit
49
master
283
require File.dirname(__FILE__) + '/../../spec_helper' describe String do describe "#camelize" do it "should have code examples" end describe "#classify" do it "should have code examples" end describe "#underscore" do it "should have code examples" end end
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/consumer_managers/evented_spec.rb
Ruby
mit
49
master
1,395
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_manager_behavior' module RosettaQueue describe EventedManager do before(:each) do Stomp::Connection.stub!(:open).and_return(nil) @consumer = mock("test_consumer_1", :receive => true, ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/consumer_managers/threaded_spec.rb
Ruby
mit
49
master
1,714
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_manager_behavior' module RosettaQueue describe ThreadedManager do before(:each) do @mutex = mock("Mutex") @mutex.stub!(:synchronize).and_yield Mutex.stub!(:new).and_return(@mutex) Stomp::Conne...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/consumer_managers/base_spec.rb
Ruby
mit
49
master
1,067
require File.dirname(__FILE__) + '/../../spec_helper' module RosettaQueue describe BaseManager do describe "#add" do it "allows adding a handler" do BaseManager.new.add(Object.new) end it "wraps the handler with a consumer and stores it" do handler = Object.new ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
spec/rosetta_queue/consumer_managers/shared_manager_behavior.rb
Ruby
mit
49
master
492
module RosettaQueue describe "a consumer manager", :shared => true do def do_process @manager.start end describe ".add" do def do_process @manager.add(@message_handler) end it "should load message_handler into consumer" do during_process { Consumer.should_recei...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue.rb
Ruby
mit
49
master
736
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) require('rosetta_queue/core_ext/string') unless defined? ActiveSupport require('rosetta_queue/core_ext/time') unless defined? ActiveSupport require 'rosetta_queue/adapter' require 'rosetta...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/exception_handler.rb
Ruby
mit
49
master
2,771
# == ExceptionHandler # # RQ allows you to register exception handlers for different parts of messaging. # The handlers can be a class with a ::handle method or simply a block. # In both cases the handler needs to accept as arguments the exception and # an additional info hash which contains useful information about th...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/spec_helpers.rb
Ruby
mit
49
master
220
require 'rosetta_queue/adapters/null' require 'rosetta_queue/adapters/fake' require 'rosetta_queue/spec_helpers/hash' require 'rosetta_queue/spec_helpers/publishing_matchers' require 'rosetta_queue/spec_helpers/helpers'
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/message_handler.rb
Ruby
mit
49
master
1,079
module RosettaQueue module MessageHandler module ClassMethods attr_reader :destination, :options_hash def options(options = {}) @options_hash = options end def publishes_to(destination) @destination = destination end def subscribes_to(destination) @d...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/exceptions.rb
Ruby
mit
49
master
343
module RosettaQueue class RosettaQueueError < StandardError; end class DestinationNotFound < RosettaQueueError; end class RosettaQueueVariableNotFound < RosettaQueueError; end class CallbackNotImplemented < RosettaQueueError; end class AdapterException < RosettaQueueError; end class StopProcessingException...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/producer.rb
Ruby
mit
49
master
588
module RosettaQueue class Producer include MessageHandler def self.publish(destination, message, options = {}) ExceptionHandler::handle(:publishing, lambda { {:message => Filters.safe_process_sending(message), :action => :publishing, :destination => destination,...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapter.rb
Ruby
mit
49
master
1,373
require 'rosetta_queue/adapters/base' module RosettaQueue class Adapter class << self attr_writer :user, :password, :host, :port, :options def define yield self end def reset @user, @password, @host, @port, @options, @adapter_class = nil, nil, nil, nil, nil, nil e...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/consumer.rb
Ruby
mit
49
master
994
module RosettaQueue class Consumer def self.receive(destination, options = {}) RosettaQueue::Adapter.open { |a| return a.receive_once(Destinations.lookup(destination), options) } rescue Exception=>e RosettaQueue.logger.error("Caught exception in Consumer.receive: #{$!}\n" + e.backtrace.join("\...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/filters.rb
Ruby
mit
49
master
1,092
# Example: # RosettaQueue::Filters.define do |filter_for| # filter_for.receiving { |message| JSON.parse(message) } # filter_for.sending { |hash| hash.to_json } # end module RosettaQueue class Filters class << self def define yield self end def reset @receiving = nil ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/destinations.rb
Ruby
mit
49
master
501
module RosettaQueue class Destinations @dest = {} class << self def define yield self end def clear @dest.clear end def lookup(dest_name) mapping = @dest[dest_name.to_sym] raise "No destination mapping for '#{dest_name}' has been defined!" un...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/railtie.rb
Ruby
mit
49
master
256
class RosettaQueueRailtie < Rails::Railtie initialization "rosetta_queue" do RosettaQueue.logger = RosettaQueue::Logger.new(File.join(Rails.root, 'log', 'rosetta_queue.log')) require('rosetta_queue/spec_helpers') if Rails.env == "test" end end
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/logger.rb
Ruby
mit
49
master
517
require 'logger' module RosettaQueue class MissingLogger < ::StandardError; end def self.logger=(new_logger) @logger = new_logger end def self.logger return @logger if @logger raise MissingLogger, "No logger has been set for RosettaQueue. Please define one with RosettaQueue.logger=." end end ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/core_ext/string.rb
Ruby
mit
49
master
517
# Taken from ActiveSupport class String def camelize(first_letter_in_uppercase = true) if first_letter_in_uppercase self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else self.first.downcase + camelize(self)[1..-1] end end def classify camelize(self.sub(/.*\./,...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/core_ext/time.rb
Ruby
mit
49
master
638
require 'time' class Time DATE_FORMATS = { :db => "%Y-%m-%d %H:%M:%S", :number => "%Y%m%d%H%M%S", :time => "%H:%M", :short => "%d %b %H:%M", :long => "%B %d, %Y %H:%M", :long_ordinal => lambda { |time| time.strftime("%B #{time.day.ordinalize}, %Y %H:%M"...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/spec_helpers/hash.rb
Ruby
mit
49
master
761
class Hash # To be used in conjuction with rspec's predicate matcher. # # For example, in story/feature or a functional spec you could say: # # expected_message = {'name' => 'Advertiser'} # expected_message.should be_published_to(:advertiser_create) # def published_to?(destination) received_message...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/spec_helpers/helpers.rb
Ruby
mit
49
master
1,816
module RosettaQueue # Adds helpful methods when doing application level testing. # If you are using cucumber just include it in your World in the env.rb file: # World {|world| world.extend RosettaQueue::SpecHelpers } module SpecHelpers require 'open-uri' # *Currently* only works with ActiveMQ being use...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/spec_helpers/publishing_matchers.rb
Ruby
mit
49
master
4,403
module RosettaQueue module Matchers class PublishAMessageTo def initialize(expected_queue_name, options=nil) @options = options || {} @how_many_messages_expected = (@options[:exactly] || 1).to_i @expected_queue_name = expected_queue_name @expected_queue = expected_queue_nam...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/consumer_managers/base.rb
Ruby
mit
49
master
393
module RosettaQueue class BaseManager attr_reader :consumers class << self def create manager = self.new yield manager manager end end def initialize @consumers = {} end def add(message_handler, key = message_handler.class.to_s.underscore.to_sym) ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/consumer_managers/threaded.rb
Ruby
mit
49
master
2,712
require 'rosetta_queue/consumer_managers/base' module RosettaQueue class ThreadedManager < BaseManager def initialize @threads = {} @running = true @processing = true super end def start start_threads join_threads monitor_threads end def stop ...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/consumer_managers/evented.rb
Ruby
mit
49
master
955
require 'eventmachine' require 'rosetta_queue/consumer_managers/base' require 'mq' module RosettaQueue class EventedManager < BaseManager def start EM.run { trap_interruptions begin @consumers.each do |key, consumer| RosettaQueue.logger.info("Running consumer #{key}...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/base.rb
Ruby
mit
49
master
648
module RosettaQueue module Gateway class BaseAdapter protected def options_for(message_handler) (message_handler.options_hash) || {} end def destination_for(message_handler) raise DestinationNotFound.new("Missing destination on message handler #{message_handle...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/fake.rb
Ruby
mit
49
master
704
module RosettaQueue module Gateway class FakeAdapter def initialize(adapter_settings = {}) @messages = [] @open = true end def send_message(queue, message, headers) @messages << {'queue' => queue, 'message' => RosettaQueue::Filters::process_receiving(message), 'headers...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/null.rb
Ruby
mit
49
master
1,405
module RosettaQueue module Gateway # The null adapter lets all send messages enter into the ether and so is ideal for modes # when you do not want to incur the overhead of a real adapter. You can not consume with # this adapter however. # # In your RosettaQueue definition block, and your using r...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/amqp_evented.rb
Ruby
mit
49
master
4,294
require 'eventmachine' require 'mq' require File.expand_path(File.dirname(__FILE__) + "/amqp.rb") module RosettaQueue module Gateway module EventedExchange class BaseExchange def initialize(adapter_settings, options={}) @adapter_settings, @options = adapter_settings, options en...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/stomp.rb
Ruby
mit
49
master
2,232
require 'stomp' module RosettaQueue module Gateway class StompAdapter < BaseAdapter def ack(msg) raise AdapterException, "Unable to ack client because message-id is blank. Are your message handler options correct? (i.e., :ack => 'client')" if msg.headers["message-id"].nil? @conn.ack(msg....
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/amqp_synch.rb
Ruby
mit
49
master
3,206
require 'bunny' require File.expand_path(File.dirname(__FILE__) + "/amqp.rb") module RosettaQueue module Gateway module SynchExchange class BaseExchange def initialize(adapter_settings, options={}) @adapter_settings, @options = adapter_settings, options end def delete(...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/beanstalk.rb
Ruby
mit
49
master
1,373
require 'beanstalk-client' module RosettaQueue module Gateway class BeanstalkAdapter < BaseAdapter def ack(msg) @conn.ack(msg.headers["message-id"]) end def initialize(adapter_settings = {}) @host, @port = adapter_settings[:host], adapter_settings[:port] @conn = Beans...
github
bmabey/rosetta_queue
https://github.com/bmabey/rosetta_queue
lib/rosetta_queue/adapters/amqp.rb
Ruby
mit
49
master
2,761
module RosettaQueue module Gateway module Fanout def fanout_name_for(destination) fanout_name = destination.gsub(/(topic|fanout)\/(.*)/, '\2') raise AdapterException, "Unable to discover fanout exchange. Cannot bind queue to exchange!" unless fanout_name fanout_name end en...