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 | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_5.rb | Ruby | mit | 48 | master | 1,168 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
dir = make_fixture_transcripts_dir("tp_review3_project_temp")
write_testing_config_for_transcripts_dir(dir, self... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_filer.rb | Ruby | mit | 48 | master | 9,086 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'fileutils'
class TestFiler < Typingpool::Test
def test_filer_base
path = File.join(fixtures_dir, 'config-1')
assert(filer = Typin... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_project_local.rb | Ruby | mit | 48 | master | 2,186 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestProjectLocal < Typingpool::Test
def test_project_local_ours
assert(File.exist?(non_project_dir))
assert(File.directory?(non_proje... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_4.rb | Ruby | mit | 48 | master | 1,220 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name = 'tp-collect-3'
transcripts_dir = File.join(fixtures_dir, 'tp_collect_project_temp')
tp_collect_wi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_1.rb | Ruby | mit | 48 | master | 1,168 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
dir = make_fixture_transcripts_dir("tp_collect_project_temp")
write_testing_config_for_transcripts_dir(dir, self... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_4_tp_review.rb | Ruby | mit | 48 | master | 10,638 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestTpReview < Typingpool::Test::Script
def test_tp_review_with_project_specified
with_temp_readymade_project do |dir|
skip_if_no_... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_2_tp_make.rb | Ruby | mit | 48 | master | 8,757 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'open3'
class TestTpMake < Typingpool::Test::Script
def test_abort_with_no_files
assert_tp_make_abort_match(['--titl... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_3.rb | Ruby | mit | 48 | master | 1,393 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name = 'tp-collect-2'
transcripts_dir = File.join(fixtures_dir, 'tp_collect_project_temp')
tp_collect_wi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_test.rb | Ruby | mit | 48 | master | 2,322 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'set'
class TestTest < Typingpool::Test::Script
def test_readymade_project
with_temp_transcripts_dir do |dir|
tp_make(dir, confi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_2.rb | Ruby | mit | 48 | master | 1,381 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name = 'tp-collect-1'
transcripts_dir = File.join(fixtures_dir, 'tp_collect_project_temp')
tp_collect_wi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_amazon_question_fixture.rb | Ruby | mit | 48 | master | 1,095 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/test'
require 'fileutils'
class MakeAmazonQuestion < Typingpool::Test::Script
def test_make_amazon_question_fixture
with_temp_transcripts_dir do |dir|
tp_make(dir)
template = Typ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_6_tp_finish.rb | Ruby | mit | 48 | master | 10,353 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'typingpool/utility/test'
include Typingpool::Utility::Test
class TestTpFinish < Typingpool::Test::Script
def test_tp_finish_on_audio_files... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_template.rb | Ruby | mit | 48 | master | 4,899 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'fileutils'
class TestTemplate < Typingpool::Test
def test_template_base
assert(template1 = Typingpool::Template.new('template', [fixtu... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_config.rb | Ruby | mit | 48 | master | 3,541 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestConfig < Typingpool::Test
def test_config_regular_file
assert(config = Typingpool::Config.file(File.join(fixtures_dir, 'config-1')))... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_review_fixture_3.rb | Ruby | mit | 48 | master | 1,476 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
transcripts_dir = make_fixture_transcripts_dir('tp_review2_projects_temp')
write_testing_config_for_transcripts_... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_review_fixture_2.rb | Ruby | mit | 48 | master | 2,680 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
transcripts_dir = File.join(fixtures_dir, 'tp_review_project_temp')
fixture_name = 'tp-review-1'
fixture_path ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_8.rb | Ruby | mit | 48 | master | 1,306 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name='tp-review-9'
transcripts_dir = File.join(fixtures_dir, 'tp_review3_project_temp')
output = tp_revi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_5_tp_collect.rb | Ruby | mit | 48 | master | 2,256 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestTpCollect < Typingpool::Test::Script
def test_collection_in_tp_collect_and_tp_review
[{script: lambda{ |transcripts_dir, fixture| tp... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_3_tp_assign.rb | Ruby | mit | 48 | master | 10,351 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'typingpool/utility/test'
include Typingpool::Utility::Test
class TestTpAssign < Typingpool::Test::Script
#TODO: test that qualifications ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_review_fixture_1.rb | Ruby | mit | 48 | master | 1,015 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
dir = make_fixture_transcripts_dir('tp_review_project_temp')
write_testing_config_for_transcripts_dir(dir, self.... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_finish_fixture_2.rb | Ruby | mit | 48 | master | 1,327 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
transcripts_dir = File.join(fixtures_dir, 'tp_finish_project_temp')
fixture_name = 'tp_finish_9'
fixture_path ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_amazon.rb | Ruby | mit | 48 | master | 9,129 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'typingpool/utility/test'
require 'uri'
require 'cgi'
require 'rturk'
require 'ostruct'
require 'timecop'
include Typingpool::Utility::Test
c... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_project.rb | Ruby | mit | 48 | master | 7,510 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'erb'
class TestProject < Typingpool::Test
def test_project_base_new
assert(project = Typingpool::Project.new(project_default[:title], ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_integration_script_1_tp_config.rb | Ruby | mit | 48 | master | 4,403 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestTpConfig < Typingpool::Test::Script
def test_abort_with_invalid_file
exception = assert_raises(Typingpool::Error::Shell) do
call_scr... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_transcript.rb | Ruby | mit | 48 | master | 3,382 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
class TestTranscript < Typingpool::Test
def test_transcript_base
assert(transcript = Typingpool::Transcript.new(project_default[:title]))
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_finish_fixture_3.rb | Ruby | mit | 48 | master | 1,432 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
transcripts_dir = File.join(fixtures_dir, 'tp_finish_project_temp')
fixture_name = 'tp_finish_10'
fixture_path... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_review_fixture_4.rb | Ruby | mit | 48 | master | 3,773 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name = 'tp-review-3'
fixture_path = File.join(vcr_dir, fixture_name + '.yml')
transcripts_dir = File.jo... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_finish_fixture_1.rb | Ruby | mit | 48 | master | 1,116 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
transcripts_dir = make_fixture_transcripts_dir('tp_finish_project_temp')
write_testing_config_for_transcripts_di... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_transcript_chunks_fixture.rb | Ruby | mit | 48 | master | 1,479 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
lines_each = 2
if ARGV.last.to_s.match(/^\d+$/)
lines_each = ARGV.pop.to_i
end
if ARGV.empty?
abort "USAGE: #{File.basename($PROGRAM_NAME)} PROJECT_DIR [PROJECT_DIR...] [LINES_EACH=2]"
end
data_files = ARGV.map... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/test_unit_project_remote.rb | Ruby | mit | 48 | master | 8,275 | #!/usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
require 'minitest/autorun'
require 'typingpool'
require 'typingpool/test'
require 'typingpool/utility/test'
require 'stringio'
require 'aws-sdk'
include Typingpool::Utility::Test
class TestProjectRemote < Typingpool::Test
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool.rb | Ruby | mit | 48 | master | 20,438 | # -*- coding: utf-8 -*-
#= Typingpool
#
#Typingpool is an app for easily making transcripts of audio using
#Amazon's labor marketplace, Mechanical Turk.
#
#Typingpool is distributed as a Ruby gem. It is a made up of a handful
#of scripts for users and a collection of library files for
#developers.
#
#Typingpool also i... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/project.rb | Ruby | mit | 48 | master | 8,546 | module Typingpool
#Class representing a transcription job, a job typically associated
#with a single interview or other event and with one or more audio
#files containing recordings of that event. A project is
#associated, locally, with a filesystem directory. On Amazon
#Mechanical Turk, a Project is associ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon.rb | Ruby | mit | 48 | master | 2,236 | module Typingpool
class Amazon
require 'rturk'
require 'pstore'
require 'typingpool/amazon/hit'
require 'typingpool/amazon/question'
@@cache_file = '~/.typingpool.cache'
class << self
#You must call Amazon.setup before using any subclass methods
#that rely on Amazon servers.
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/error.rb | Ruby | mit | 48 | master | 546 | module Typingpool
class Error < StandardError
class Test < Error; end
class Shell < Error; end
class Argument < Error
class Format < Argument; end
end
class File < Error
class NotExists < File; end
class Remote < File
class SFTP < Remote; end
class S3 < Remote
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/config.rb | Ruby | mit | 48 | master | 8,783 | module Typingpool
#Hierarchical config object. Can be read from a YAML file and is
#often modified at runtime, for example in response to script flags.
#
#==Fields
# All listed defaults are populated when you run tp-config.
#===Required
# [transcripts] Unexpanded path to working directory for
# ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer.rb | Ruby | mit | 48 | master | 2,374 | module Typingpool
#Convenience wrapper for basic file operations. Base class for
#wrappers for specialized file types (audio, CSV) and for file
#collections.
class Filer
require 'fileutils'
include Utility::Castable
include Comparable
#Fully-expanded path to file
attr_reader :path
#Co... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/app.rb | Ruby | mit | 48 | master | 24,889 | module Typingpool
#Module encapsulating high-level Typingpool procedures and called
#from the various tp-* scripts. Control layer type code.
#
#This is the least mature Typingpool class. At present, all methods
#are class methods. This will likely change to a model in which
#different subclasses of App inst... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/template.rb | Ruby | mit | 48 | master | 3,118 | module Typingpool
#Model class that wraps ERB and adds a few Typingpool-specific
#capabilities: The ability to look in an array of search paths for a
#particular relative path, neccesary to support the Config#template
#dir on top of the built-in app template dir. Also makes it easy to
#pass in a hash and rend... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/utility.rb | Ruby | mit | 48 | master | 7,654 | module Typingpool
module Utility
require 'open3'
require 'uri'
require 'tmpdir'
require 'set'
require 'net/http'
require 'fcntl'
class << self
#Much like Kernel#system, except it doesn't spew STDERR and
#STDOUT all over your screen (when called with multiple args,
#w... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/test.rb | Ruby | mit | 48 | master | 1,846 | module Typingpool
require 'minitest'
require 'typingpool/utility/test'
class Test < Minitest::Test
include Utility::Test
class << self
attr_accessor :live
attr_accessor :record
end #class << self
self.record = ARGV.delete('--record')
self.live = ARGV.delete('--live')
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/transcript.rb | Ruby | mit | 48 | master | 1,905 | module Typingpool
#This is the model class for Typingpool's final and most important
#output, a transcript of the Project audio in HTML format, with
#embedded audio. A Transcript instance is actually an enumerable
#container for Transcript::Chunk instances. Each Transcript::Chunk
#corresponds to an Amazon::HI... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer/dir.rb | Ruby | mit | 48 | master | 2,378 | module Typingpool
class Filer
#Convenience wrapper for basic directory operations and for
#casting files to specific filer types (CSV, Audio).
class Dir < Files
#Full expanded path to the dir
attr_reader :path
#Constructor. Takes full expanded path to the dir. Does NOT
#create d... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer/files.rb | Ruby | mit | 48 | master | 1,584 | module Typingpool
class Filer
#Handler for collection of Filer instances. Makes them enumerable,
#Allows easy re-casting to Filer::Files subclasses,
#and provides various other convenience methods.
class Files
include Enumerable
include Utility::Castable
require 'fileutils'
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer/audio.rb | Ruby | mit | 48 | master | 3,670 | module Typingpool
class Filer
#Convenience wrapper for audio files.You can convert to mp3s,
#split into multiple files, and dynamically read the bitrate.
class Audio < Filer
require 'open3'
#Does the file have a '.mp3' extension?
def mp3?
File.extname(@path).downcase.eql?('.mp3... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer/csv.rb | Ruby | mit | 48 | master | 1,952 | module Typingpool
class Filer
#Convenience wrapper for CSV files. Makes them Enumerable, so you
#can iterate through rows with each, map, select, etc. You can
#also modify in place with each!. See Filer base class for other
#methods.
class CSV < Filer
include Enumerable
require 'csv'
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/filer/files/audio.rb | Ruby | mit | 48 | master | 2,354 | module Typingpool
class Filer
class Files
#Handler for collection of Filer::Audio instances. Does
#everything Filer::Files does, plus can batch convert to mp3 an
#can merge the Filer::Audio instances into a single audio file,
#provided they are in mp3 format.
class Audio < Files
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/config/root.rb | Ruby | mit | 48 | master | 3,346 | module Typingpool
class Config
#The root level of the config file and all full config
#objects. Kept distinct from Config because other subclasses need
#to inherit from Config, and we don't want them inheriting the
#root level fields.
class Root < Config
local_path_reader :transcripts, ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/app/friendlyexceptions.rb | Ruby | mit | 48 | master | 1,318 | module Typingpool
module App
module FriendlyExceptions
#Massages terse exceptions from our model layer into a
#human-friendly message suitable for an abort message from a
#command-line script.
# ==== Params
# [name] A string used to refer to the input. For example
# ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/app/cli.rb | Ruby | mit | 48 | master | 2,689 | module Typingpool
module App
module CLI
class << self
include App::FriendlyExceptions
#Optionally takes an ostensible path to a config file, as passed
#as a command-line option. Checks to make sure the file exists;
#returns nil if does not, returns a Config instance if it
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/app/cli/formatter.rb | Ruby | mit | 48 | master | 1,487 | module Typingpool
module App
module CLI
module Formatter
require 'highline/import'
def prompt_from_choices(choices, default_index)
prompt = choices.map do |choice|
cli_reverse('(') +
cli_reverse(cli_bold(choice.slice(0).upcase)) +
cli_rever... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/utility/test.rb | Ruby | mit | 48 | master | 5,851 | module Typingpool
module Utility
module Test
require 'vcr'
require 'uri'
def fixtures_dir
File.join(Utility.lib_dir, 'test', 'fixtures')
end
def audio_dir
File.join(fixtures_dir, 'audio')
end
def vcr_dir
File.join(fixtures_dir, 'vcr')
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/utility/castable.rb | Ruby | mit | 48 | master | 2,351 | module Typingpool
module Utility
module Castable
#Cast this object instance to a relative class. Call this from
#super in your own class if you want to pass args to the
#relative class constructor. All args after the first will be
#passed to new.
#
#A relative class can be a s... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/utility/test/script.rb | Ruby | mit | 48 | master | 15,464 | module Typingpool
module Utility
module Test
module Script
require 'yaml'
require 'fileutils'
require 'open3'
require 'tmpdir'
require 'typingpool/utility/test'
include Typingpool::Utility::Test
@@readymade_project_path = nil
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/template/env.rb | Ruby | mit | 48 | master | 2,595 | module Typingpool
class Template
#This subclass provides two utility methods to all templates:
#read, for including the text of another template, and render, for
#rendering another template. Read takes a relative path,
#documented below. Render is passed the same hash as the parent
#template, mer... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/template/assignment.rb | Ruby | mit | 48 | master | 655 | module Typingpool
class Template
#A Template::Assignment works just like a regular template, except
#that within each transcript dir (Config#transcript and the
#built-in app template dir) we search within a subdir called
#'assignment' first, then, after all the 'assignment' subdirs have
#been sea... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/hit.rb | Ruby | mit | 48 | master | 19,996 | module Typingpool
class Amazon
#Class representing an Amazon Mechanical Turk Human Intelligence
#Task (HIT).
#
#We go above and beyond RTurk::Hit for several practical reasons:
# * To allow easy serialization. Caching is a very useful way of
# reducing network calls to Amazon, and thus of s... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/question.rb | Ruby | mit | 48 | master | 1,342 | module Typingpool
class Amazon
#Class encapsulating the HTML form presented to Mechanical Turk workers
#transcribing a Typingpool audio chunk.
class Question
require 'nokogiri'
require 'uri'
require 'cgi'
attr_reader :url, :html
#Constructor. Takes the URL of where the ques... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/hit/full.rb | Ruby | mit | 48 | master | 4,756 | module Typingpool
class Amazon
class HIT
class Full
require 'uri'
require 'open-uri'
require 'nokogiri'
require 'typingpool/amazon/hit/full/fromsearchhits'
#See the RTurk documentation and Amazon Mechanical Turk API
#documentation for more on these fields.
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/hit/assignment.rb | Ruby | mit | 48 | master | 1,323 | module Typingpool
class Amazon
class HIT
class Assignment
require 'typingpool/amazon/hit/assignment/empty'
#See the RTurk documentation and Amazon Mechanical Turk API
#documentation for more on these fields.
attr_reader :id, :status, :worker_id, :submitted_at
#Const... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/hit/full/fromsearchhits.rb | Ruby | mit | 48 | master | 1,610 | module Typingpool
class Amazon
class HIT
class Full
#For more on why this subclass is neccesary, see the
#documentation for
#Typingpool::Amazon::HIT.cached_or_new_from_searchhits. In
#short, RTurk::HITParser objects returned by RTurk::SearchHITs
#are pointlessly and ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/amazon/hit/assignment/empty.rb | Ruby | mit | 48 | master | 477 | module Typingpool
class Amazon
class HIT
class Assignment
#Subclass used in cases where we know Amazon's servers have no
#assignments for us (because hit.full.assignments_completed ==
#0), so we don't want to bother doing an HTTP request to
#check.
class Empty < Assi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/project/local.rb | Ruby | mit | 48 | master | 4,370 | module Typingpool
class Project
#Representation of the Project instance in the local
#filesystem. Subclass of Filer::Dir; see Filer::Dir docs for
#additional details.
#
#This is basically a local dir with various subdirs and files
#containing the canonical representation of the project, includ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/project/remote.rb | Ruby | mit | 48 | master | 2,626 | module Typingpool
class Project
#Representation of the Project instance on remote servers. This is
#basically a collection of audio files to be transcribed and HTML
#files containing instructions and a form for the
#transcribers. The backend can be Amazon S3 (the default) or an
#SFTP server. Each ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/project/remote/s3.rb | Ruby | mit | 48 | master | 5,681 | module Typingpool
class Project
class Remote
#Subclass for storing remote files on Amazon Simple Storage
#Service (S3)
class S3 < Remote
require 'aws-sdk'
#Takes a Config#amazon, extracts the needed params, and
#returns a Project::Remote::S3 instance. Raises an exceptio... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/project/remote/sftp.rb | Ruby | mit | 48 | master | 3,811 | module Typingpool
class Project
class Remote
#Subclass for storing remote files on an SFTP server. Only
#public/private key authentication has been tested. There is not
#yet any provision for password-based authentication, though
#adding it should be trivial.
class SFTP < Remote
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/transcript/chunk.rb | Ruby | mit | 48 | master | 4,813 | module Typingpool
class Transcript
#Transcript::Chunk is the model class for one transcription by one
#Mechanical Turk worker of one "chunk" (a file) of audio, which in
#turn is a portion of a larger recording (for example, one minute
#of a 60 minute interview). It is basically parallel and similar
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | lib/typingpool/test/script.rb | Ruby | mit | 48 | master | 2,120 | module Typingpool
class Test
class Script < Test
require 'typingpool'
require 'open3'
require 'fileutils'
require 'nokogiri'
require 'typingpool/utility/test/script'
include Utility::Test::Script
#Overrides method in Utility::Test::Script
def do_later
Mi... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | Gemfile | Ruby | mit | 48 | main | 369 | # encoding: utf-8
source "https://rubygems.org"
group :development do
gem "ruby-prof", platforms: :mri
gem "rake"
end
group :benchmark do
gem "benchmark-ips", "~> 2.12"
gem "benchmark-memory", "~> 0.2"
end
group :test do
gem "rspec", ">= 3.8.0"
gem "rspec-its"
gem "simplecov"
gem 'bigdecimal'
end
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | generate.rb | Ruby | mit | 48 | main | 645 | #!/usr/bin/env ruby
# encoding: utf-8
# rabbitmq-codegen is Python 3 compatible and so is
# the code in this repo but Mako still fails with 3.6 as of May 2017 :( MK.
python = ENV.fetch("PYTHON", "python2")
def sh(*args)
system(*args)
end
extensions = []
spec = "codegen/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
u... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | Rakefile | Ruby | mit | 48 | main | 1,130 | require "bundler"
Bundler.setup
require "rake"
require "rspec/core/rake_task"
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "amq/protocol/version"
task :gem => :build
task :build do
system "gem build amq-protocol.gemspec"
end
task :install => :build do
system "gem install amq-protocol-#{AMQ::P... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | amq-protocol.gemspec | Ruby | mit | 48 | main | 846 | #!/usr/bin/env gem build
# encoding: utf-8
require File.expand_path("../lib/amq/protocol/version", __FILE__)
Gem::Specification.new do |s|
s.name = "amq-protocol"
s.version = AMQ::Protocol::VERSION
s.authors = ["Jakub Stastny", "Michael S. Klishin", "Theo Hultberg", "Mark Abramov"]
s.homepage = "https://githu... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/uri.rb | Ruby | mit | 48 | main | 3,354 | # encoding: utf-8
if RUBY_VERSION < "3.5"
require "cgi/util"
else
require "cgi/escape"
end
require "uri"
module AMQ
class URI
# @private
AMQP_DEFAULT_PORTS = {
"amqp" => 5672,
"amqps" => 5671
}.freeze
private_constant :AMQP_DEFAULT_PORTS
DEFAULTS = {
heartbeat: nil,
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/int_allocator.rb | Ruby | mit | 48 | main | 2,494 | # encoding: utf-8
# frozen_string_literal: true
require "amq/bit_set"
module AMQ
# Simple bitset-based integer allocator, heavily inspired by com.rabbitmq.utility.IntAllocator class
# in the RabbitMQ Java client.
#
# Unlike monotonically incrementing identifier, this allocator is suitable for very long runnin... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/bit_set.rb | Ruby | mit | 48 | main | 2,845 | # encoding: utf-8
# frozen_string_literal: true
module AMQ
# Very minimalistic, pure Ruby implementation of bit set. Inspired by java.util.BitSet,
# although significantly smaller in scope.
#
# Originally part of amqp gem. Extracted to make it possible for Bunny to use it.
class BitSet
attr_reader :word... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/pack.rb | Ruby | mit | 48 | main | 1,712 | # encoding: binary
# frozen_string_literal: true
module AMQ
# Implements pack to/unpack from 64bit string in network byte order.
# Uses native Ruby pack directives with explicit endianness (Ruby 1.9.3+).
module Pack
# Pack format strings - frozen for performance
UINT64_BE = 'Q>'.freeze # 64-bit unsigned... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/endianness.rb | Ruby | mit | 48 | main | 232 | # frozen_string_literal: true
module AMQ
module Endianness
BIG_ENDIAN = ([1].pack("s") == "\x00\x01")
def big_endian?
BIG_ENDIAN
end
def little_endian?
!BIG_ENDIAN
end
extend self
end
end |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/settings.rb | Ruby | mit | 48 | main | 5,980 | # encoding: utf-8
# frozen_string_literal: true
require "amq/protocol/client"
require "amq/uri"
module AMQ
module Settings
# @private
AMQPS = "amqps".freeze
# Default connection settings used by AMQ clients
#
# @see AMQ::Client::Settings.configure
def self.default
@de... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/exceptions.rb | Ruby | mit | 48 | main | 1,629 | # frozen_string_literal: true
module AMQ
module Protocol
class Error < StandardError
DEFAULT_MESSAGE = "AMQP error".freeze
def self.inherited(subclass)
@_subclasses ||= []
@_subclasses << subclass
end # self.inherited(subclazz)
def self.subclasses_with_values
@_s... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/type_constants.rb | Ruby | mit | 48 | main | 784 | # encoding: binary
# frozen_string_literal: true
module AMQ
module Protocol
module TypeConstants
TYPE_STRING = 'S'.freeze
TYPE_INTEGER = 'I'.freeze
TYPE_TIME = 'T'.freeze
TYPE_DECIMAL = 'D'.freeze
TYPE_HASH = 'F'.freeze
TYPE_ARRAY = 'A'.f... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/frame.rb | Ruby | mit | 48 | main | 6,200 | # encoding: binary
# frozen_string_literal: true
module AMQ
module Protocol
class Frame
TYPES = {:method => 1, :headers => 2, :body => 3, :heartbeat => 8}.freeze
TYPES_REVERSE = TYPES.invert.freeze
TYPES_OPTIONS = TYPES.keys.freeze
CHANNEL_RANGE = (0..65535).freeze
FINAL_OCTET = "... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/table_value_encoder.rb | Ruby | mit | 48 | main | 3,406 | # encoding: binary
# frozen_string_literal: true
require "amq/protocol/type_constants"
require "date"
require "amq/protocol/float_32bit"
module AMQ
module Protocol
class TableValueEncoder
#
# Behaviors
#
include TypeConstants
#
# API
#
def self.encode(value)... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/channel_close.rb | Ruby | mit | 48 | main | 848 | # frozen_string_literal: true
module AMQ
module Protocol
class Channel
class Close
# @return [Boolean] true if the channel was closed due to a consumer delivery acknowledgement timeout
def delivery_ack_timeout?
reply_code == 406 && reply_text.match?(/delivery acknowledgement on ch... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/constants.rb | Ruby | mit | 48 | main | 712 | # frozen_string_literal: true
module AMQ
module Protocol
TLS_PORT = 5671
SSL_PORT = 5671
# caching
EMPTY_STRING = "".freeze
PACK_INT8 = 'c'.freeze
PACK_CHAR = 'C'.freeze
PACK_UINT16 = 'n'.freeze
PACK_UINT16_X2 = 'n2'.f... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/float_32bit.rb | Ruby | mit | 48 | main | 339 | # frozen_string_literal: true
module AMQ
module Protocol
# Allows distinguishing between 32-bit and 64-bit floats in Ruby.
# Useful in cases when RabbitMQ plugins encode
# values as 32 bit numbers.
class Float32Bit
attr_reader :value
def initialize(value)
@value = value
end... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/table_value_decoder.rb | Ruby | mit | 48 | main | 5,274 | # encoding: binary
# frozen_string_literal: true
require "amq/protocol/type_constants"
require "amq/protocol/float_32bit"
module AMQ
module Protocol
class TableValueDecoder
#
# Behaviors
#
include TypeConstants
# Pack format strings use explicit endianness (available as of Ruby... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/table.rb | Ruby | mit | 48 | main | 4,602 | # encoding: binary
# frozen_string_literal: true
require "amq/protocol/type_constants"
require "amq/protocol/table_value_encoder"
require "amq/protocol/table_value_decoder"
module AMQ
module Protocol
class Table
#
# Behaviors
#
include TypeConstants
# Pack format string
PA... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | lib/amq/protocol/client.rb | Ruby | mit | 48 | main | 68,306 | # encoding: binary
# frozen_string_literal: true
# THIS IS AN AUTOGENERATED FILE, DO NOT MODIFY
# IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE FILES
# IN THE ./codegen DIRECTORY OF THE AMQ-PROTOCOL REPOSITORY.
require "amq/pack"
require "amq/protocol/table"
require "amq/protocol/frame"
require "amq/protocol/constants"
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | profiling/stackprof/body_framing_with_2k_payload.rb | Ruby | mit | 48 | main | 715 | #!/usr/bin/env ruby
# encoding: utf-8
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "amq/protocol/client"
FRAME_SIZE = 128 * 1024
puts
puts "-" * 80
puts "Profiling on #{RUBY_DESCRIPTION}"
n = 250_000
# warm up the JIT, etc
puts "Doing a warmup run..."
15_000.times {... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/pack_unpack.rb | Ruby | mit | 48 | main | 2,964 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require "amq/protocol/client"
require "benchmark/ips"
puts
puts "-" * 80
puts "Pack/Unpack Micro-benchmarks on #{RUBY_DESCRIPTION}"
puts "-" * 80
# Test data
UINT64_VALU... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/run_all.rb | Ruby | mit | 48 | main | 1,418 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
# Master benchmark runner
# Usage: ruby benchmarks/run_all.rb
require 'fileutils'
BENCHMARK_DIR = File.dirname(__FILE__)
RESULTS_DIR = File.join(BENCHMARK_DIR, "results")
FileUtils.mkdir_p(RESULTS_DIR)
benchmarks = %w[
pack_unpack.rb
frame_enc... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/compare_results.rb | Ruby | mit | 48 | main | 1,163 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
#
# Prints a before/after delta summary from two benchmark result files.
# Changes within ±5% are considered noise and hidden.
#
# Usage: ruby benchmarks/compare_results.rb <before.txt> <after.txt>
NOISE_THRESHOLD = 5.0
def parse_ips(file)
results ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/table_encoding.rb | Ruby | mit | 48 | main | 2,699 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require "amq/protocol/client"
require "benchmark/ips"
puts
puts "-" * 80
puts "Table Encoding/Decoding Benchmarks on #{RUBY_DESCRIPTION}"
puts "-" * 80
# Test data - var... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/int_allocator.rb | Ruby | mit | 48 | main | 698 | $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require 'amq/int_allocator'
require "benchmark"
allocator = AMQ::IntAllocator.new(1,65535)
mutex = Mutex.new
Benchmark.bm do |x|
x.report("allocate") do
allocator = AMQ::IntAllocator.new(1,65535)
1.upto(65534) do |i|
mut... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/frame_encoding.rb | Ruby | mit | 48 | main | 1,710 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require "amq/protocol/client"
require "benchmark/ips"
puts
puts "-" * 80
puts "Frame Encoding Benchmarks on #{RUBY_DESCRIPTION}"
puts "-" * 80
# Test data
SMALL_PAYLOAD ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/method_encoding.rb | Ruby | mit | 48 | main | 4,845 | #!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: true
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require "amq/protocol/client"
require "benchmark/ips"
puts
puts "-" * 80
puts "AMQP Method Encoding/Decoding Benchmarks on #{RUBY_DESCRIPTION}"
puts "-" * 80
FRAME_SIZE ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/pure/body_framing_with_2k_payload.rb | Ruby | mit | 48 | main | 632 | #!/usr/bin/env ruby
# encoding: utf-8
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "amq/protocol/client"
require "benchmark"
FRAME_SIZE = 128 * 1024
puts
puts "-" * 80
puts "Benchmarking on #{RUBY_DESCRIPTION}"
n = 250_000
# warm up the JIT, etc
puts "Doing a warmup... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | benchmarks/pure/body_framing_with_256k_payload.rb | Ruby | mit | 48 | main | 642 | #!/usr/bin/env ruby
# encoding: utf-8
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "amq/protocol/client"
require "benchmark"
FRAME_SIZE = 128 * 1024
puts
puts "-" * 80
puts "Benchmarking on #{RUBY_DESCRIPTION}"
n = 250_000
# warm up the JIT, etc
puts "Doing a warmup... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/spec_helper.rb | Ruby | mit | 48 | main | 442 | # encoding: binary
require 'bundler/setup'
Bundler.require(:test)
begin
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
rescue LoadError
end
$: << File.expand_path('../../lib', __FILE__)
require "amq/protocol"
puts "Running on #{RUBY_VERSION}"
RSpec.configure do |config|
config.include... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/settings_spec.rb | Ruby | mit | 48 | main | 1,782 | require "amq/settings"
RSpec.describe AMQ::Settings do
describe ".default" do
it "should provide some default values" do
expect(AMQ::Settings.default).to_not be_nil
expect(AMQ::Settings.default[:host]).to_not be_nil
end
it "includes default port" do
expect(AMQ::Settings.default[:port])... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/pack_spec.rb | Ruby | mit | 48 | main | 1,843 | # encoding: binary
RSpec.describe AMQ::Pack do
context "16-bit big-endian packing / unpacking" do
let(:examples_16bit) {
{
0x068D => "\x06\x8D", # 1677
0x0000 => "\x00\x00", # 0
0x7FFF => "\x7F\xFF" # 32767 (max positive signed 16-bit)
}
}
it "packs signed integer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.