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
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
lib/spark/sql/context.rb
Ruby
mit
226
master
316
module Spark module SQL class Context attr_reader :spark_context, :jsql_context def initialize(spark_context) @spark_context = spark_context @jsql_context = JSQLContext.new(spark_context.sc) end def read DataFrameReader.new(self) end end end end
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/spec_helper.rb
Ruby
mit
226
master
694
require 'simplecov' SimpleCov.start $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'ruby-spark' require 'generator' # Loading Spark.load_lib Spark.jb.import_all_test Spark::Mllib.import # Keep it on method because its called from config test def spark_start Spark.logger.disable Spark.config do ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/generator.rb
Ruby
mit
226
master
758
class Generator def self.numbers(size=1000) Array.new(size){ rand(1..1000) } end def self.numbers_with_zero(size=1000) Array.new(size){ rand(0..1000) } end def self.words(size=1000) Array.new(size) { word } end def self.word(size=10) Array.new(rand(1..size)){(97+rand(26)).chr}.join en...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/key_spec.rb
Ruby
mit
226
master
1,393
require 'spec_helper' RSpec.shared_examples 'a keying by' do |workers| it "with #{workers || 'default'} worker" do rdd = rdd_numbers(workers) rdd = rdd.key_by(key_function1) result = numbers.map{|item| [key_function1.call(item), item]} expect(rdd.collect).to eql(result) rdd = rdd_words(workers)...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/reduce_spec.rb
Ruby
mit
226
master
3,346
require 'spec_helper' def longest_words(memo, word) memo.length > word.length ? memo : word end RSpec.shared_examples 'a reducing' do |workers| context "with #{workers || 'default'} worker" do it '.reduce' do rdd2 = rdd_numbers(workers) rdd2 = rdd2.map(to_i) rdd2 = rdd2.reduce(func1) r...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/context_spec.rb
Ruby
mit
226
master
4,617
require 'spec_helper' RSpec.describe Spark::Context do it '.run_job' do workers = 5 numbers = (0...100).to_a func = lambda{|part| part.size} ser = Spark::Serializer.build { __batched__(__marshal__, 1) } rdd = $sc.parallelize(numbers, workers, ser) rdd_result = $sc.run_job(rdd, func) r...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/sample_spec.rb
Ruby
mit
226
master
1,164
require 'spec_helper' # Sample method can not be tested because of random generator # Just test it for raising error RSpec.shared_examples 'a sampler' do |workers| context "with #{workers || 'default'} worker" do context '.sample' do it 'with replacement' do rdd2 = rdd(workers).sample(true, rand)...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/map_partitions_spec.rb
Ruby
mit
226
master
2,254
require 'spec_helper' def func3(x) x.map(&:to_i).reduce(:+) end def func4_with_index(data, index) [{ index => data.map(&:to_i).reduce(:*) }] end RSpec.shared_examples 'a map partitions' do |workers| context "with #{workers || 'default'} worker" do it 'without index' do rdd2 = rdd(workers).map_p...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/manipulation_spec.rb
Ruby
mit
226
master
3,261
require 'spec_helper' RSpec.describe 'Spark::RDD' do let(:numbers) { 1..100 } let(:rand_numbers) { Generator.numbers } it '.glom' do rdd = $sc.parallelize(numbers, 1).glom expect(rdd.collect).to eql([numbers.to_a]) ser = Spark::Serializer.build { __batched__(__marshal__, 1) } rdd = $sc.paralle...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/command_spec.rb
Ruby
mit
226
master
1,495
require 'spec_helper' def to_s_method(x) x.to_s end RSpec::describe Spark::CommandBuilder do let(:numbers) { Generator.numbers } let(:rdd) { $sc.parallelize(numbers, 1) } context '.serialize_function' do let(:result) { numbers.map(&:to_s) } it 'string' do expect(rdd.map('lambda{|x| x.to_s...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/statistic_spec.rb
Ruby
mit
226
master
5,828
require 'spec_helper' RSpec.shared_examples 'a stats' do |workers| let(:numbers) { [1.0, 1.0, 2.0, 3.0, 5.0, 8.0] } context "with #{workers || 'default'} worker" do it 'stats class' do stats = $sc.parallelize(numbers, workers).stats expect(stats.sum).to be_within(0.1).of(20) exp...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/flat_map_spec.rb
Ruby
mit
226
master
2,793
require 'spec_helper' RSpec.shared_examples 'a flat mapping' do |workers| it "with #{workers || 'default'} worker" do rdd2 = rdd(workers).map(func1) result = numbers.flat_map(&func1) expect(rdd2.collect).to eql(result) rdd3 = rdd(workers) rdd3 = rdd3.flat_map(func1) rdd3 = rdd3.flat_map(fun...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/group_spec.rb
Ruby
mit
226
master
2,769
require 'spec_helper' RSpec.shared_examples 'a groupping by key' do |workers| it "with #{workers || 'default'} worker" do expect(rdd_result(workers)).to eql(result) end end RSpec.shared_examples 'a cogroupping by key' do |workers| context "with #{workers || 'default'} worker" do it '.group_with' do ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/reduce_by_key_spec.rb
Ruby
mit
226
master
2,864
require 'spec_helper' def flat_map(line) line.split end def map(item) [item, 1] end def reduce(x,y) x+y end RSpec.shared_examples 'a words counting' do |workers| context "with #{workers || 'default'} worker" do let(:result) do keyyed = lines.flat_map{|x| x.split}.map{|x| [x,1]} result = keyy...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/filter_spec.rb
Ruby
mit
226
master
2,079
require 'spec_helper' def func4(item) item.start_with?('a') && item.size > 3 && item[1].to_s.ord > 106 end RSpec.shared_examples 'a filtering' do |workers| context "with #{workers || 'default'} worker" do it 'when numbers' do rdd2 = rdd_numbers(workers) rdd2 = rdd2.filter(func1) result = num...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/config_spec.rb
Ruby
mit
226
master
1,159
require 'spec_helper' RSpec.describe Spark::Config do before(:context) do Spark.stop end after(:context) do spark_start end it 'should be stopped' do expect(Spark.started?).to be_falsy end context 'new config' do let(:configuration) do { 'test.test1' => 'test1', ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/whole_text_files_spec.rb
Ruby
mit
226
master
904
require 'spec_helper' RSpec.shared_examples 'a whole_text_files' do |workers| it "with #{workers || 'default'} worker" do rdd2 = rdd(workers).map(get_numbers) result = files.size expect(rdd2.collect.size).to eql(result) rdd3 = rdd(workers) rdd3 = rdd3.flat_map(get_numbers) result = 0 f...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/serializer_spec.rb
Ruby
mit
226
master
4,027
require 'spec_helper' require 'zlib' RSpec.describe Spark::Serializer do let(:data) { [1, 'test', 2.0, [3], {key: 'value'}, :test, String] } it 'find' do expect(described_class.find('not_existed_class')).to eql(nil) expect(described_class.find('Marshal')).to eq(described_class::Marshal) expect(descri...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/map_spec.rb
Ruby
mit
226
master
2,468
require 'spec_helper' RSpec.shared_examples 'a mapping' do |workers| it "with #{workers || 'default'} worker" do rdd2 = rdd(workers).map(func1) result = numbers.map(&func1) expect(rdd2.collect).to eql(result) rdd3 = rdd(workers) rdd3 = rdd3.map(func1) rdd3 = rdd3.map(func2) rdd3 = rdd3....
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/sort_spec.rb
Ruby
mit
226
master
1,479
require 'spec_helper' RSpec.shared_examples 'a sorting' do |workers| it "with #{workers || 'default'} worker" do rdd2 = rdd(workers) rdd2 = rdd2.flat_map(split) result = lines.flat_map(&split) # Sort by self rdd3 = rdd2.map(map).sort_by_key result2 = result.map(&map).sort_by{|(key, _)| key}...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/external_apps_spec.rb
Ruby
mit
226
master
863
require 'spec_helper' RSpec.describe Spark::RDD do context '.pipe' do let(:words) { Generator.words } let(:numbers) { Generator.numbers } it 'single program' do skip if windows? rdd = $sc.parallelize(words, 1) rdd = rdd.pipe('tr a b') result = words.dup result.map! do ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/collect_spec.rb
Ruby
mit
226
master
859
require 'spec_helper' RSpec.describe Spark::RDD do let(:mapping) { lambda{|x| [x, 1]} } let(:numbers) { Generator.numbers } it '.collect_as_hash' do rdd = $sc.parallelize(numbers) rdd = rdd.map(mapping) expect(rdd.collect_as_hash).to eql(Hash[numbers.map(&mapping)]) end context '.take' do ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/ext_spec.rb
Ruby
mit
226
master
1,031
require 'spec_helper' RSpec.describe Array do it '.deep_copy' do data = ['a', 'b', 'c'] new_data = data.dup data[0] << 'a' expect(data).to eql(new_data) new_data = data.deep_copy data[1] << 'b' expect(data).to_not eql(new_data) end end RSpec.describe Hash do it '.stringify_ke...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/helper_spec.rb
Ruby
mit
226
master
2,616
require 'spec_helper' RSpec.configure do |c| c.include Spark::Helper::Parser c.include Spark::Helper::Statistic end RSpec.describe Spark::Helper do it 'memory size' do expect(to_memory_size('512mb')).to eql(524288.0) expect(to_memory_size('1586 mb')).to eql(1624064.0) expect(to_memory_size('3 MB'))...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/sql/data_frame_spec.rb
Ruby
mit
226
master
2,501
require 'spec_helper' RSpec.describe Spark::SQL::DataFrame do let(:file) { File.join('spec', 'inputs', 'people.json') } let(:df) { $sql.read.json(file) } context '[]' do it 'String' do value = df['age'] expect(value).to be_a(Spark::SQL::Column) expect(value.to_s).to eq('Column("age")') ...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/sql/column_spec.rb
Ruby
mit
226
master
3,459
require 'spec_helper' RSpec.shared_examples 'binary comparison' do |op| it "#{op}" do to_test = 20 result = df.select('age').where( df.age.__send__(op, to_test) ).values.flatten result.each do |item| if op == '!=' expect(item).to_not eq(to_test) else expect(item).to be.__send...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/mllib/vector_spec.rb
Ruby
mit
226
master
2,236
require 'spec_helper' RSpec.describe 'Spark::Mllib::Vector' do context 'parsing' do it 'dense vector' do dv = DenseVector.new([1.0, 2.0, 3.0, 4.0, 5.0]) dv2 = DenseVector.parse(dv.to_s) dv3 = Vectors.parse(dv.to_s) expect(dv.to_s).to eq("[1.0,2.0,3.0,4.0,5.0]") expect(dv2.values)...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/mllib/clustering_spec.rb
Ruby
mit
226
master
1,005
require 'spec_helper' RSpec.describe 'Spark::Mllib clustering' do context 'kmeans' do it 'test' do data = [ DenseVector.new([0, 1.1]), DenseVector.new([0, 1.2]), DenseVector.new([1.1, 0]), DenseVector.new([1.2, 0]) ] model = KMeans.train($sc.parallelize(data), 2,...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/mllib/matrix_spec.rb
Ruby
mit
226
master
854
require 'spec_helper' RSpec.describe 'Spark::Mllib::Matrix' do context 'dense' do it 'construct' do values = [[1.0, 0.0, 4.0], [0.0, 3.0, 5.0], [2.0, 0.0, 6.0]] matrix = DenseMatrix.new(3, 3, [[1.0, 0.0, 4.0], [0.0, 3.0, 5.0], [2.0, 0.0, 6.0]]) expect(matrix.shape).to eq([3, 3]) expect(m...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/mllib/regression_spec.rb
Ruby
mit
226
master
3,223
require 'spec_helper' # Mllib functions are tested on Spark # This just test if ruby call proper methods RSpec.describe 'Spark::Mllib regression' do let(:data1) do [ LabeledPoint.new(-1.0, [0, -1]), LabeledPoint.new(1.0, [0, 1]), LabeledPoint.new(-1.0, [0, -2]), LabeledPoint.new(1.0, [0...
github
ondra-m/ruby-spark
https://github.com/ondra-m/ruby-spark
spec/lib/mllib/classification_spec.rb
Ruby
mit
226
master
1,280
require 'spec_helper' RSpec.describe 'Spark::Mllib classification' do let(:data1) do [ LabeledPoint.new(0.0, [1, 0, 0]), LabeledPoint.new(1.0, [0, 1, 1]), LabeledPoint.new(0.0, [2, 0, 0]), LabeledPoint.new(1.0, [0, 2, 1]) ] end let(:values1) do data1.map do |lp| lp.fea...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
Rakefile
Ruby
mit
226
master
649
require 'rubygems' require 'rake' require 'rspec/core/rake_task' # Now using RSpec 2 desc "Run specs for current Rails version" RSpec::Core::RakeTask.new do |t| t.pattern = "spec/**/*_spec.rb" t.verbose = true # t.ruby_opts = lambda { # @rails_spec_version ? ["-c --format specdoc -- rails_spec_version=#{@ra...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
i18n_routing.gemspec
Ruby
mit
226
master
670
Gem::Specification.new do |s| s.name = "i18n_routing" s.version = "0.6.2" s.author = "Guillaume Luccisano" s.email = "guillaume.luccisano@gmail.com" s.homepage = "http://github.com/kwi/i18n_routing" s.summary = "I18n routing module for Rails 2.3.x and Rails 3. Translate your routes with ease !" s.descript...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
spec/spec_helper.rb
Ruby
mit
226
master
1,012
require "rubygems" require "bundler/setup" require 'rspec' $rails_version = ARGV.find { |e| e =~ /rails_spec_version=.*/ }.split('=').last.to_i rescue nil if !$rails_version begin require 'rails' rescue Exception $rails_version = 2 end end if !Module.constants.include?('Rails') and $rails_version mod...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
spec/i18n_routing/i18n_spec.rb
Ruby
mit
226
master
18,178
require 'spec_helper' describe :localized_routes do $r = nil # Global routes in order to speed up testing before(:all) do if !$r if !rails3? ActionController::Routing::Routes.clear! ActionController::Routing::Routes.draw do |map| map.not_about 'not_about', :controller => 'not...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
lib/i18n_routing_rails31.rb
Ruby
mit
226
master
15,515
# encoding: utf-8 require 'rack/mount' require 'action_dispatch' require 'active_support/core_ext/module' module I18nRouting module Mapper private # Just create a Mapper:Resource with given parameters def resource_from_params(type, *resources) res = resources.clone options = res.extract_op...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
lib/i18n_routing_rails32.rb
Ruby
mit
226
master
15,317
# encoding: utf-8 require 'journey' require 'action_dispatch' require 'active_support/core_ext/module' module I18nRouting module Mapper private # Just create a Mapper:Resource with given parameters def resource_from_params(type, *resources) res = resources.clone options = res.extract_optio...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
lib/i18n_routing_rails2.rb
Ruby
mit
226
master
7,960
# encoding: utf-8 # # WARNING : Old and dirty Rails 2.x code # Need clean up and intensive refactoring # module ActionController module Routing class Route #:nodoc: alias_method :mkd_initialize, :initialize def initialize(segments = [], requirements = {}, conditions = {}) @glang = requiremen...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
lib/i18n_routing_common.rb
Ruby
mit
226
master
1,600
# encoding: utf-8 # I18nRouting module for common usage methods module I18nRouting def self.locale_escaped(locale) locale.to_s.downcase.gsub('-', '_') end # Return the correct translation for given values def self.translation_for(name, type = :resources, option = nil) # First, if an option is given,...
github
kwi/i18n_routing
https://github.com/kwi/i18n_routing
lib/i18n_routing.rb
Ruby
mit
226
master
208
# encoding: utf-8 require 'i18n_routing_common' if Rails.version < '3' require 'i18n_routing_rails2' elsif Rails.version >= '3.2' require 'i18n_routing_rails32' else require 'i18n_routing_rails31' end
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
unix_utils.gemspec
Ruby
mit
226
master
1,065
# -*- encoding: utf-8 -*- require File.expand_path('../lib/unix_utils/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Seamus Abshere"] gem.email = ["seamus@abshere.net"] desc = %q{Like FileUtils, but provides zip, unzip, bzip2, bunzip2, tar, untar, sed, du, md5sum, shasum, cut, ...
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
Rakefile
Ruby
mit
226
master
285
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake' require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/test_*.rb' test.verbose = true end task :default => :test require 'yard' YARD::Rake::YardocTask.new
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
lib/unix_utils.rb
Ruby
mit
226
master
9,769
require 'fileutils' require 'tmpdir' require 'uri' require 'stringio' require 'open3' require 'securerandom' require "unix_utils/version" module UnixUtils BUFSIZE = 2**16 def self.curl(url, form_data = nil) outfile = tmp_path url if url.start_with?('file://') or not url.include?('://') # deal with ...
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
test/helper.rb
Ruby
mit
226
master
2,141
require 'rubygems' require 'bundler/setup' require 'pry' require 'minitest/spec' require 'minitest/autorun' if RUBY_VERSION >= '1.9' require 'minitest/reporters' MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new end require 'unix_utils' require 'stringio' require 'fileutils' require 'tmpdir' require...
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
test/test_unix_utils.rb
Ruby
mit
226
master
13,000
# encoding: UTF-8 require 'helper' describe UnixUtils do before do @old_pwd = Dir.pwd Dir.chdir File.expand_path('../target', __FILE__) end after do Dir.chdir @old_pwd end describe "errors" do it "gets printed to stderr" do begin old_stderr = $stderr capture = StringIO...
github
seamusabshere/unix_utils
https://github.com/seamusabshere/unix_utils
test/regression/test_sed_large_file.rb
Ruby
mit
226
master
1,148
# encoding: UTF-8 require 'helper' require 'tempfile' describe "handle large file with sed" do let(:normal_line_no) { 124000 } let(:invalid_line_no) { 10 } let(:input_file) { Tempfile.open('test', '/tmp') } before do begin (1..normal_line_no).each do |i| input_file.puts "\"psmith01\",\...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
sippy_cup.gemspec
Ruby
mit
227
develop
1,291
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "sippy_cup/version" Gem::Specification.new do |s| s.name = "sippy_cup" s.version = SippyCup::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Ben Klang", "Will Drexler"] s.email = ["bklang&mojolingo.c...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
Guardfile
Ruby
mit
227
develop
257
guard 'rspec', cmd: 'bundle exec rspec --format documentation', :all_on_start => true, :all_after_pass => true do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec/" } end
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
spec/spec_helper.rb
Ruby
mit
227
develop
1,151
# encoding: utf-8 %w{ sippy_cup fakefs/spec_helpers tempfile }.each { |f| require f } module SippyCup module SpecHelpers def capture(stream) stream = stream.to_s captured_stream = Tempfile.new(stream) stream_io = eval("$#{stream}") origin_stream = stream_io.dup stream_io.reop...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
spec/sippy_cup/scenario_spec.rb
Ruby
mit
227
develop
30,603
# encoding: utf-8 require 'spec_helper' describe SippyCup::Scenario do include FakeFS::SpecHelpers before do Dir.mkdir("/tmp") unless Dir.exist?("/tmp") Dir.chdir "/tmp" end let(:default_args) { {source: '127.0.0.1:5060', destination: '10.0.0.1:5080'} } let(:args) { {} } subject(:scenario) { des...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
spec/sippy_cup/media_spec.rb
Ruby
mit
227
develop
3,369
# encoding: utf-8 require 'spec_helper' describe SippyCup::Media do before :each do @from_ip = '192.168.5.1' @from_port = '13579' @to_ip = '192.168.10.2' @to_port = '24680' @media = SippyCup::Media.new @from_ip, @from_port, @to_ip, @to_port end it 'should start with an empty sequence...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
spec/sippy_cup/xml_scenario_spec.rb
Ruby
mit
227
develop
2,863
# encoding: utf-8 require 'spec_helper' describe SippyCup::XMLScenario do include FakeFS::SpecHelpers before do Dir.mkdir("/tmp") unless Dir.exist?("/tmp") Dir.chdir "/tmp" end let(:default_args) { {source: '127.0.0.1:5060', destination: '10.0.0.1:5080'} } let(:args) { {} } let(:xml) do <<-X...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
spec/sippy_cup/runner_spec.rb
Ruby
mit
227
develop
15,568
# encoding: utf-8 require 'spec_helper' describe SippyCup::Runner do before do Dir.chdir "/tmp" end let(:settings) { {} } let(:default_settings) { { logger: logger } } let(:command) { "sudo $(which sipp) -i 127.0.0.1" } let(:pid) { '1234' } let(:logger) { double } before { allow(logger).to recei...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/scenario.rb
Ruby
mit
227
develop
28,978
# encoding: utf-8 require 'nokogiri' require 'psych' require 'active_support/core_ext/hash' require 'active_support/core_ext/object/blank' require 'tempfile' require 'set' module SippyCup # # A representation of a SippyCup scenario from a manifest or created in code. Allows building a scenario from a set of basic ...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/xml_scenario.rb
Ruby
mit
227
develop
1,665
# encoding: utf-8 require 'tempfile' module SippyCup # # A representation of a SIPp XML scenario # class XMLScenario # @return [Hash] The options the scenario was created with, either from a manifest or passed as overrides attr_reader :scenario_options # # Create a scenario instance # ...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/media.rb
Ruby
mit
227
develop
4,289
# encoding: utf-8 require 'ipaddr' require 'sippy_cup/media/pcmu_payload' require 'sippy_cup/media/dtmf_payload' module SippyCup class Media VALID_STEPS = %w{silence dtmf}.freeze USEC = 1_000_000 MSEC = 1_000 attr_accessor :sequence def initialize(from_addr, from_port, to_addr, to_port, generato...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/tasks.rb
Ruby
mit
227
develop
444
# encoding: utf-8 require 'yaml' require 'sippy_cup/runner' namespace :sippy_cup do desc "Compile the given scenario" task :compile, :scenario do |t, args| require File.expand_path(args[:scenario]) end desc "Run the scenario described by the given manifest file" task :run, :options_file do |t, args| ...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/runner.rb
Ruby
mit
227
develop
7,272
# encoding: utf-8 require 'logger' require 'fileutils' # # Service object to oversee the execution of a Scenario # module SippyCup class Runner attr_accessor :sipp_pid # # Create a runner from a scenario # # @param [Scenario, XMLScenario] scenario The scenario to execute # @param [Hash] opts...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/media/pcmu_payload.rb
Ruby
mit
227
develop
562
# encoding: utf-8 require 'sippy_cup/media/rtp_payload' module SippyCup class Media class PCMUPayload < RTPPayload RTP_PAYLOAD_ID = 0x0 SILENT_BYTE = 0xff.chr PTIME = 20 # in milliseconds RATE = 8 # in KHz attr_accessor :ptime def initialize(opts = {}) super RTP_PAYLO...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/media/rtp_header.rb
Ruby
mit
227
develop
1,901
# encoding: utf-8 require 'packetfu' module SippyCup class Media class RTPHeader < Struct.new(:version, :padding, :extension, :marker, :payload_id, :sequence_num, :timestamp, :ssrc_id, :csrc_ids) VERSION = 2 include StructFu def initialize(args = {}) # TODO: Support Extension Heade...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/media/rtp_payload.rb
Ruby
mit
227
develop
550
# encoding: utf-8 require 'packetfu' require 'sippy_cup/media/rtp_header' module SippyCup class Media class RTPPayload attr_reader :header def initialize(payload_id = 0) @header = RTPHeader.new payload_id: payload_id end def to_bytes @header.to_s + media end ...
github
mojolingo/sippy_cup
https://github.com/mojolingo/sippy_cup
lib/sippy_cup/media/dtmf_payload.rb
Ruby
mit
227
develop
1,164
# encoding: utf-8 require 'sippy_cup/media/rtp_payload' module SippyCup class Media class DTMFPayload < RTPPayload RTP_PAYLOAD_ID = 101 PTIME = 20 # in milliseconds TIMESTAMP_INTERVAL = 160 END_OF_EVENT = 1 << 7 DTMF = %w{0 1 2 3 4 5 6 7 8 9 * # A B C D}.freeze attr_accessor :...
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
render_anywhere.gemspec
Ruby
mit
226
master
1,049
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "render_anywhere/version" Gem::Specification.new do |s| s.name = "render_anywhere" s.version = RenderAnywhere::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Luke Melia"] s.email = ["luke@lukemelia....
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
Rakefile
Ruby
mit
226
master
203
require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' task :default => [:spec] desc "Run the specs." RSpec::Core::RakeTask.new do |t| t.pattern = "spec/**/*_spec.rb" end
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
spec/spec_helper.rb
Ruby
mit
226
master
1,126
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration requ...
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
spec/lib/render_anywhere_spec.rb
Ruby
mit
226
master
1,607
require 'spec_helper' describe RenderAnywhere do class UserRenderer include RenderAnywhere def initialize(user) @user = user end def render_ivar set_instance_variable(:user, @user) render 'spec/views/user_ivar', :layout => false end def render_current_user renderin...
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
lib/render_anywhere.rb
Ruby
mit
226
master
709
require 'abstract_controller' require 'action_view' require 'render_anywhere/version' require 'render_anywhere/rendering_controller' module RenderAnywhere def render(*args) rendering_controller.render_to_string(*args) end def set_render_anywhere_helpers(*args) args.each do |helper_name| rendering...
github
yappbox/render_anywhere
https://github.com/yappbox/render_anywhere
lib/render_anywhere/rendering_controller.rb
Ruby
mit
226
master
2,029
require 'ostruct' module RenderAnywhere class RenderingController < ActionController::Metal # Include all the concerns we need to make this work include AbstractController::Logger include AbstractController::Rendering include ActionView::Layouts if defined?(ActionView::Layouts) # Rails 4.1.x incl...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
Dangerfile
Ruby
mit
226
master
1,020
# Ensure there is a summary for a PR fail "Please provide a summary in the Pull Request description" if github.pr_body.length < 5 # Only accept PRs to the `develop` branch fail "Please re-submit this PR to develop, we may have already fixed your issue." if github.branch_for_base != "master" # Warn when there is a big...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
fastlane-plugin-changelog.gemspec
Ruby
mit
226
master
986
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fastlane/plugin/changelog/version' Gem::Specification.new do |spec| spec.name = 'fastlane-plugin-changelog' spec.version = Fastlane::Changelog::VERSION spec.author = %(Pavel Prochazka...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/emojify_changelog_action_spec.rb
Ruby
mit
226
master
884
describe Fastlane::Actions::EmojifyChangelogAction do describe 'Emojify output of read_changelog action' do let (:changelog_mock_path) { "./../spec/fixtures/CHANGELOG_MOCK.md" } let (:existing_section_identifier) { '[0.0.6]' } it 'emojify the content of specific section' do result = Fastlane::FastF...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/update_changelog_action_with_placeholder_action_spec.rb
Ruby
mit
226
master
5,449
describe Fastlane::Actions::UpdateChangelogAction do describe 'Update CHANGELOG.md with placeholder line action' do let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' } let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' } # Path to mo...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/stamp_changelog_action_with_placeholder_action_spec.rb
Ruby
mit
226
master
6,733
describe Fastlane::Actions::StampChangelogAction do describe 'Stamp CHANGELOG.md with placeholder line action' do let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' } let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' } # Path to mock...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/update_changelog_action_spec.rb
Ruby
mit
226
master
5,403
describe Fastlane::Actions::UpdateChangelogAction do describe 'Update CHANGELOG.md action' do let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK.md' } let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK.md' } let (:updated_section_identifier) { '12.34.56' } let (:existing_se...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/stamp_changelog_action_with_bitbucket_spec.rb
Ruby
mit
226
master
2,069
describe Fastlane::Actions::StampChangelogAction do describe 'Stamp CHANGELOG.md action with Bitbucket repo' do let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK_BITBUCKET.md' } let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK_BITBUCKET.md' } let (:updated_section_identifier...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/stamp_changelog_action_spec.rb
Ruby
mit
226
master
3,437
describe Fastlane::Actions::StampChangelogAction do describe 'Stamp CHANGELOG.md action' do let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK.md' } let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK.md' } let (:updated_section_identifier) { '12.34.56' } before(:each) do ...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/spec_helper.rb
Ruby
mit
226
master
382
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) # This module is only used to check the environment is currently a testing env module SpecHelper end require 'fastlane' # to import the Action super class require 'fastlane/plugin/changelog' # import the actual plugin Fastlane.load_actions # load other actio...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
spec/read_changelog_action_spec.rb
Ruby
mit
226
master
2,164
describe Fastlane::Actions::ReadChangelogAction do describe 'Read CHANGELOG.md action' do let (:changelog_mock_path) { "./../spec/fixtures/CHANGELOG_MOCK.md" } let (:existing_section_identifier) { '[0.0.5 (rc1)]' } it 'reads content of [Unreleased] section' do result = Fastlane::FastFile.new.parse(...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog.rb
Ruby
mit
226
master
469
require 'fastlane/plugin/changelog/version' module Fastlane module Changelog # Return all .rb files inside the "actions" and "helper" directory def self.all_classes Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))] end end end # By default we want to import all available ...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog/actions/update_changelog.rb
Ruby
mit
226
master
7,518
module Fastlane module Actions class UpdateChangelogAction < Action def self.run(params) changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty? changelog_path = Helper::ChangelogHelper.ensure_changelog_exists(changelog_path) section_identifier = params[:...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog/actions/read_changelog.rb
Ruby
mit
226
master
5,170
module Fastlane module Actions module SharedValues READ_CHANGELOG_SECTION_CONTENT = :READ_CHANGELOG_SECTION_CONTENT READ_CHANGELOG_CHANGELOG_PATH = :READ_CHANGELOG_CHANGELOG_PATH end class ReadChangelogAction < Action def self.run(params) changelog_path = params[:changelog_path]...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog/actions/stamp_changelog.rb
Ruby
mit
226
master
7,972
module Fastlane module Actions class StampChangelogAction < Action UNRELEASED_IDENTIFIER = '[Unreleased]' def self.run(params) # 1. Ensure CHANGELOG.md exists changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty? changelog_path = Helper::Changelog...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog/actions/emojify_changelog.rb
Ruby
mit
226
master
3,193
module Fastlane module Actions module SharedValues EMOJIFY_CHANGELOG_CONTENT = :EMOJIFY_CHANGELOG_CONTENT end class EmojifyChangelogAction < Action SUBSECTION_IDENTIFIERS = ['Added', 'Changed', 'Fixed', 'Removed', 'Work In Progress', 'Security', 'Deprecated'] def self.run(params) ...
github
pajapro/fastlane-plugin-changelog
https://github.com/pajapro/fastlane-plugin-changelog
lib/fastlane/plugin/changelog/helper/changelog_helper.rb
Ruby
mit
226
master
3,322
module Fastlane module Helper CHANGELOG_PATH = './CHANGELOG.md' DEFAULT_CHANGELOG = '# Change Log All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
apollo-federation.gemspec
Ruby
mit
225
main
1,783
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'apollo-federation/version' Gem::Specification.new do |spec| spec.name = 'apollo-federation' spec.version = ApolloFederation::VERSION spec.authors = ['Noa El...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation.rb
Ruby
mit
225
main
594
# frozen_string_literal: true require 'apollo-federation/version' require 'apollo-federation/schema' require 'apollo-federation/object' require 'apollo-federation/interface' require 'apollo-federation/union' require 'apollo-federation/enum' require 'apollo-federation/enum_value' require 'apollo-federation/field' requi...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/service_field.rb
Ruby
mit
225
main
571
# frozen_string_literal: true require 'graphql' require 'apollo-federation/service' module ApolloFederation module ServiceField def self.included(base) base.extend(ClassMethods) end module ClassMethods extend GraphQL::Schema::Member::HasFields def define_service_field field(:...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/interface.rb
Ruby
mit
225
main
882
# frozen_string_literal: true require 'apollo-federation/field_set_serializer' require 'apollo-federation/has_directives' module ApolloFederation module Interface def self.included(klass) klass.definition_methods do include DefinitionMethods end end module DefinitionMethods in...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/argument.rb
Ruby
mit
225
main
828
# frozen_string_literal: true require 'apollo-federation/has_directives' module ApolloFederation module Argument include HasDirectives VERSION_2_DIRECTIVES = %i[tags inaccessible].freeze def initialize(*args, **kwargs, &block) add_v2_directives(**kwargs) # Remove the custom kwargs k...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/service.rb
Ruby
mit
225
main
421
# frozen_string_literal: true require 'graphql' module ApolloFederation class Service < GraphQL::Schema::Object graphql_name '_Service' description 'The sdl representing the federated service capabilities. Includes federation ' \ 'directives, removes federation types, and includes rest of full schema ...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/union.rb
Ruby
mit
225
main
441
# frozen_string_literal: true require 'apollo-federation/has_directives' module ApolloFederation module Union def self.included(klass) klass.extend(ClassMethods) end module ClassMethods include HasDirectives def tag(name:) add_directive(name: 'tag', arguments: [name: 'name', ...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/input_object.rb
Ruby
mit
225
main
447
# frozen_string_literal: true require 'apollo-federation/has_directives' module ApolloFederation module InputObject def self.included(klass) klass.extend(ClassMethods) end module ClassMethods include HasDirectives def tag(name:) add_directive(name: 'tag', arguments: [name: 'n...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/enum.rb
Ruby
mit
225
main
440
# frozen_string_literal: true require 'apollo-federation/has_directives' module ApolloFederation module Enum def self.included(klass) klass.extend(ClassMethods) end module ClassMethods include HasDirectives def tag(name:) add_directive(name: 'tag', arguments: [name: 'name', v...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/object.rb
Ruby
mit
225
main
1,444
# frozen_string_literal: true require 'apollo-federation/field_set_serializer' require 'apollo-federation/has_directives' module ApolloFederation module Object def self.included(klass) klass.extend(ClassMethods) end module ClassMethods include HasDirectives def extend_type ad...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/tracing.rb
Ruby
mit
225
main
697
# frozen_string_literal: true module ApolloFederation module Tracing HEADER_NAME = 'HTTP_APOLLO_FEDERATION_INCLUDE_TRACE' KEY = :ftv1 DEBUG_KEY = "#{KEY}_debug".to_sym module_function def use(schema) schema.tracer ApolloFederation::Tracing::Tracer end def should_add_traces(header...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/enum_value.rb
Ruby
mit
225
main
829
# frozen_string_literal: true require 'apollo-federation/has_directives' module ApolloFederation module EnumValue include HasDirectives VERSION_2_DIRECTIVES = %i[tags inaccessible].freeze def initialize(*args, **kwargs, &block) add_v2_directives(**kwargs) # Remove the custom kwargs ...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/entities_field.rb
Ruby
mit
225
main
3,383
# frozen_string_literal: true require 'graphql' require 'apollo-federation/any' module ApolloFederation module EntitiesField def self.included(base) base.extend(ClassMethods) end module ClassMethods extend GraphQL::Schema::Member::HasFields def define_entities_field(possible_entities...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/entity.rb
Ruby
mit
225
main
225
# frozen_string_literal: true require 'graphql' module ApolloFederation class Entity < GraphQL::Schema::Union graphql_name '_Entity' def self.resolve_type(object, context) context[object] end end end
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/has_directives.rb
Ruby
mit
225
main
497
# frozen_string_literal: true module ApolloFederation module HasDirectives def add_directive(name:, arguments: nil) own_federation_directives << { name: name, arguments: arguments } end def federation_directives if is_a?(Class) own_federation_directives + find_inherited_value(:federa...
github
Gusto/apollo-federation-ruby
https://github.com/Gusto/apollo-federation-ruby
lib/apollo-federation/any.rb
Ruby
mit
225
main
428
# frozen_string_literal: true require 'graphql' module ApolloFederation class Any < GraphQL::Schema::Scalar graphql_name '_Any' def self.coerce_input(value, _ctx) # TODO: Should we convert it to a Mash-like object? result = {} # `value` can be an ActionController::Parameters instance ...