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
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/metadata_spec.rb
Ruby
bsd-3-clause
98
master
711
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do METRIC_NAME = 'my.met...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/service_level_objective_spec.rb
Ruby
bsd-3-clause
98
master
3,094
require_relative '../spec_helper' describe Dogapi::Client do SLO_ID = '42424242424242424242424242424242'.freeze SLO_TYPE = 'metric'.freeze SLO_NAME = 'test slo'.freeze SLO_DESCRIPTION = 'test slo description'.freeze SLO_QUERY_NUMERATOR = 'sum:test.metric.metric{type:good}.as_count()'.freeze SLO_QUERY_DENOM...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/gcp_integration_spec.rb
Ruby
bsd-3-clause
98
master
1,781
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do CONFIG = { projec...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/aws_logs_spec.rb
Ruby
bsd-3-clause
98
master
2,033
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do CONFIG = { accoun...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/service_check_spec.rb
Ruby
bsd-3-clause
98
master
582
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do SC_BODY = { check: 'a...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/search_spec.rb
Ruby
bsd-3-clause
98
master
508
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do SEARCH_QUERY = 'hosts...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/tag_spec.rb
Ruby
bsd-3-clause
98
master
2,454
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do HOST_NAME = 'test.exa...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/logs_pipeline_spec.rb
Ruby
bsd-3-clause
98
master
1,811
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do LOGS_PIPELINE_ID = '4...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/metric_spec.rb
Ruby
bsd-3-clause
98
master
3,205
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do METRIC_QUERY = 'avg(l...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/embed_spec.rb
Ruby
bsd-3-clause
98
master
1,455
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do EMBED_ID = 42_424_242...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/integration_spec.rb
Ruby
bsd-3-clause
98
master
1,604
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do SOURCE_TYPE_NAME = 'p...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/azure_integration_spec.rb
Ruby
bsd-3-clause
98
master
2,206
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do CONFIG = { tenant...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/dashboard_list_spec.rb
Ruby
bsd-3-clause
98
master
4,700
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do RESOURCE_NAME = 'dash...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/event_spec.rb
Ruby
bsd-3-clause
98
master
2,271
# encoding: utf-8 # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do EV...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/aws_integration_spec.rb
Ruby
bsd-3-clause
98
master
1,831
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do CONFIG = { accoun...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/synthetics_spec.rb
Ruby
bsd-3-clause
98
master
4,268
require_relative '../spec_helper' describe Dogapi::Client do SYNTHETICS_TEST_PUBLIC_ID = '84r-szk-xpt' SYNTHETICS_TESTS_PUBLIC_IDS = ['84r-szk-xpt', 'sti-s2m-ciz'] NEW_STATUS = 'paused' SYNTHETICS_RESULT_ID = 123_456 SYNTHETICS_TEST_TYPE = 'api'.freeze SYNTHETICS_TEST_CONFIG = { 'assertions' => [ ...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/integration/comment_spec.rb
Ruby
bsd-3-clause
98
master
1,148
# encoding: utf-8 # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe Dogapi::Client do CO...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/unit/common_spec.rb
Ruby
bsd-3-clause
98
master
7,880
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require_relative '../spec_helper' describe 'Common' do describe 'validate_tags' do...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/unit/capistrano_spec.rb
Ruby
bsd-3-clause
98
master
1,230
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require 'spec_helper' require 'capistrano/datadog' require 'benchmark' describe 'Cap...
github
DataDog/dogapi-rb
https://github.com/DataDog/dogapi-rb
spec/unit/facade_spec.rb
Ruby
bsd-3-clause
98
master
3,162
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2011-Present Datadog, Inc. require 'spec_helper' describe Dogapi::Client do before(:each) do @dogmock = D...
github
ews-im/hpr
https://github.com/ews-im/hpr
config.ru
Ruby
mit
98
master
656
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('./lib', __dir__) require 'bundler/setup' require 'hpr' puts <<-BANNER _ | |__ _ __ _ __ | '_ \\| '_ \\| '__| | | | | |_) | | |_| |_| .__/|_| |_| v#{Hpr::VERSION} BANNER if ENV['HPR_SIDEKIQ_UI'] require 'securerandom' r...
github
ews-im/hpr
https://github.com/ews-im/hpr
Rakefile
Ruby
mit
98
master
2,184
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('./lib', __dir__) # 初始化一些文件和目录,否则无法 docker 构建,构建的内容不会引入 docker FileUtils.cp('config/hpr.example.yml', 'config/hpr.yml') unless File.file?('config/hpr.yml') FileUtils.mkdir('logs') unless Dir.exist?('logs') require 'fileutils' require 'hpr' namespace :...
github
ews-im/hpr
https://github.com/ews-im/hpr
Guardfile
Ruby
mit
98
master
294
# frozen_string_literal: true guard 'sidekiq', concurrency: 10, require: './lib/hpr.rb', verbose: true do watch(%r{^lib/hpr/workers/(.+)\.rb$}) end ENV['HPR_SIDEKIQ_UI'] = 'true' guard 'puma', config: './config/puma.rb' do watch('Gemfile.lock') watch(%r{^config|lib/hpr/(.+)\.rb$}) end
github
ews-im/hpr
https://github.com/ews-im/hpr
Gemfile
Ruby
mit
98
master
783
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # Web Services gem 'puma', '~> 6.6.1' gem 'sinatra', '~> 4.2.1' gem 'sinatra-contrib', '~> 4.2.1' # Background Job Service gem 'sidekiq', '~> 7.1.4' gem 'sidekiq-failures', '~> 1.0.4' #...
github
ews-im/hpr
https://github.com/ews-im/hpr
spec/spec_helper.rb
Ruby
mit
98
master
4,280
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'hpr' require 'rack/test' require 'rspec' module SinatraTest include Rack::Test::Methods def app Hpr::WebApp end end RSpec.configure do |config| config.include SinatraTest # rspec-expectations config goes he...
github
ews-im/hpr
https://github.com/ews-im/hpr
spec/hpr/web_spec.rb
Ruby
mit
98
master
520
# frozen_string_literal: true require File.expand_path '../spec_helper.rb', __dir__ describe 'Hpr Web Application' do it 'should allow accessing the api layer' do get '/' expect(last_response).to be_ok expect(last_response.body).to eq JSON.dump(message: 'Welcome to hpr api layer') end it 'should al...
github
ews-im/hpr
https://github.com/ews-im/hpr
config/puma.rb
Ruby
mit
98
master
5,888
#!/usr/bin/env puma # The directory to operate out of. # # The default is the current directory. # # directory '/u/apps/lolcat' # Use an object or block as the rack application. This allows the # config file to be the application itself. # # app do |env| # puts env # # body = 'Hello, World!' # # [200, { 'Conten...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr.rb
Ruby
mit
98
master
3,900
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path(__dir__) require 'chronic_duration' require 'active_record' require 'settingslogic' require 'sentry-ruby' require 'fileutils' require 'sidekiq' require 'sidekiq/failures' module Hpr class << self def init init_sentry init_sidekiq ...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/error.rb
Ruby
mit
98
master
494
# frozen_string_literal: true module Hpr class Error < StandardError; end class ClientError < Error; end class NotFoundGitError < ClientError; end class NotRoleError < ClientError; end class UnkownURIError < ClientError; end class MissingSSHKeyError < ClientError; end class RepositoryExistsError < ...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/client.rb
Ruby
mit
98
master
4,694
# frozen_string_literal: true require 'gitlab' require 'fileutils' module Hpr # Hpr Client class Client def initialize determine_repository_path! determine_gitlab_configure! end def list_repositories(current_page = 1, per_page = 50) offset = (current_page - 1) * per_page Repos...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/web.rb
Ruby
mit
98
master
5,539
# frozen_string_literal: true require 'sinatra' require 'sinatra/json' require 'sinatra/required_params' require 'sinatra/streaming' require 'sidekiq/api' module Hpr # Web API Application class Web < Sinatra::Base helpers Sinatra::RequiredParams helpers Sinatra::Streaming configure do use Rack:...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/helper.rb
Ruby
mit
98
master
1,437
# frozen_string_literal: true module Hpr # Helper module Helper def self.git_url_parse(url) URLParser.parse(url) end # Git URL Parser class URLParser attr_accessor :namespace, :name def self.parse(url) instance = new(url) instance.parse instance end...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/worker.rb
Ruby
mit
98
master
1,549
# frozen_string_literal: true require 'sidekiq/api' module Hpr module Worker def schedule_update_job(name, repository) if scheduled?(name) # May be the current worker is still in schedule list. logger.debug "scheduled list exists job ... #{name}" return end start_time = Time.a...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/repository.rb
Ruby
mit
98
master
249
# frozen_string_literal: true module Hpr # Repository model class Repository < ActiveRecord::Base enum status: %i[idle cloning fetching pushing] validates :name, :url, :mirror_url, :gitlab_project_id, :status, presence: true end end
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/commands/create.rb
Ruby
mit
98
master
530
# frozen_string_literal: true command :create do |c| c.syntax = 'hpr create [option] url' c.summary = '创建 git 仓库镜像' c.option '-n NAME', '--name NAME', '自定义镜像名称' c.option '--no-create', '不创建 gitlab 的 repository' c.option '--no-clone', '不克隆 git 仓库' c.option '-P', '--progress', '显示操作进度条' c.action do |args...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/ext/git_mixin.rb
Ruby
mit
98
master
755
# frozen_string_literal: true require 'git' module Git class Base def config(name = nil, *values, append: false) if name && values.size.positive? lib.config_set(name, *values, append: append) elsif name lib.config_get(name) else lib.config_list end end end ...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/workers/clone.rb
Ruby
mit
98
master
2,412
# frozen_string_literal: true module Hpr # Clone git repository worker class CloneWorker include Sidekiq::Job include Hpr::Worker sidekiq_options retry: false def perform(name, url, mirror_url, gitlab_project_id) return unless ensure_git_repository_not_exist(name) sleep 10000000 ...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/workers/update.rb
Ruby
mit
98
master
1,074
# frozen_string_literal: true module Hpr # Update git repository worker class UpdateWorker include Sidekiq::Job include Hpr::Worker def perform(name) return unless ensure_git_repository_exist(name) repository = Repository.find_by(name: name) unless repository logger.error "...
github
ews-im/hpr
https://github.com/ews-im/hpr
lib/hpr/workers/destroy.rb
Ruby
mit
98
master
1,185
# frozen_string_literal: true module Hpr # Destroy git repository worker class DestroyWorker include Sidekiq::Job include Hpr::Worker def perform(name) @name = name delete_busy_jobs delete_retries_jobs delete_scheduled_jobs delete_git_files rescue => e Sentry.c...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
iostreams.gemspec
Ruby
apache-2.0
98
master
745
lib = File.expand_path("lib", __dir__) $:.unshift lib unless $:.include?(lib) # Maintain your gem's version: require "io_streams/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "iostreams" s.version = IOStreams::VERSION s.platform ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
Rakefile
Ruby
apache-2.0
98
master
549
require "rake/testtask" require_relative "lib/io_streams/version" task :gem do system "gem build iostreams.gemspec" end task publish: :gem do system "git tag -a v#{IOStreams::VERSION} -m 'Tagging #{IOStreams::VERSION}'" system "git push --tags" system "gem push iostreams-#{IOStreams::VERSION}.gem" system "r...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
Gemfile
Ruby
apache-2.0
98
master
361
source "https://rubygems.org" gemspec gem "amazing_print" gem "minitest", "< 6.0" gem "rake" # Required for Ruby 3.4+ compatibility gem "csv" gem "aws-sdk-s3" gem "bzip2-ffi" gem "creek" gem "nokogiri" # Rubyzip v2.2 blows up with some zip files gem "rubyzip", "~> 1.3" gem "symmetric-encryption" gem "zip_tricks" g...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/minimal_file_reader.rb
Ruby
apache-2.0
98
master
400
# The miminum methods that any IOStreams Reader must implement. class MinimalFileReader def self.open(file_name) io = new(file_name) yield(io) ensure io&.close end def initialize(file_name) @file = File.open(file_name) end def read(size = nil, outbuf = nil) @file.read(size, outbuf) e...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/pgp_test.rb
Ruby
apache-2.0
98
master
9,644
require_relative "test_helper" # Turn on logging if experiencing issues with new versions of gpg # require "logger" # IOStreams::Pgp.logger = Logger.new(STDOUT) class PgpTest < Minitest::Test describe IOStreams::Pgp do let :user_name do "Joe Bloggs" end let :email do "pgp_test@iostreams.net...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/bzip2_reader_test.rb
Ruby
apache-2.0
98
master
681
require_relative "test_helper" class Bzip2ReaderTest < Minitest::Test describe IOStreams::Bzip2::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "text.txt.bz2") end let :decompressed do File.read(File.join(File.dirname(__FILE__), "files", "text.txt")) end desc...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/xlsx_reader_test.rb
Ruby
apache-2.0
98
master
932
require_relative "test_helper" require "csv" class XlsxReaderTest describe IOStreams::Xlsx::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "spreadsheet.xlsx") end let :xlsx_contents do [ ["first column", "second column", "third column"], ["data 1", "da...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/encode_reader_test.rb
Ruby
apache-2.0
98
master
1,427
require_relative "test_helper" class EncodeReaderTest < Minitest::Test describe IOStreams::Encode::Reader do let :bad_data do [ "New M\xE9xico,NE".b, "good line", "New M\xE9xico,\x07SF".b ].join("\n").encode("BINARY") end let :cleansed_data do bad_data.gsub("\xE...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/line_writer_test.rb
Ruby
apache-2.0
98
master
1,446
require_relative "test_helper" class DelimitedWriterTest < Minitest::Test describe IOStreams::Line::Writer do let :file_name do File.join(File.dirname(__FILE__), "files", "text.txt") end let :raw do File.read(file_name) end let :lines do raw.lines.map(&:strip) end des...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/utils_test.rb
Ruby
apache-2.0
98
master
626
require_relative "test_helper" class UtilsTest < Minitest::Test describe IOStreams::Utils do describe ".temp_file_name" do it "returns value from block" do result = IOStreams::Utils.temp_file_name("base", ".ext") { |_name| 257 } assert_equal 257, result end it "supplies new tem...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/builder_test.rb
Ruby
apache-2.0
98
master
9,460
require_relative "test_helper" class BuilderTest < Minitest::Test describe IOStreams::Builder do let(:file_name) { "my/path/abc.bcd.xlsx.zip.gz.pgp" } let(:streams) { IOStreams::Builder.new(file_name) } describe "#option" do it "adds one option" do streams.option(:pgp, passphrase: "unlock-...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/test_helper.rb
Ruby
apache-2.0
98
master
1,484
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require "yaml" require "minitest/autorun" require "iostreams" require "amazing_print" require "symmetric-encryption" # Since PGP libraries use UTC for Dates ENV["TZ"] = "UTC" # Test cipher SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new( cipher_nam...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/gzip_reader_test.rb
Ruby
apache-2.0
98
master
651
require_relative "test_helper" class GzipReaderTest < Minitest::Test describe IOStreams::Gzip::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "text.txt.gz") end let :decompressed do Zlib::GzipReader.open(file_name, &:read) end describe ".open" do it "fi...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/pgp_reader_test.rb
Ruby
apache-2.0
98
master
1,370
require_relative "test_helper" class PgpReaderTest < Minitest::Test describe IOStreams::Pgp::Reader do let :temp_file do Tempfile.new("iostreams") end let :decrypted do file_name = File.join(File.dirname(__FILE__), "files", "text.txt") File.read(file_name) end after do t...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/gzip_writer_test.rb
Ruby
apache-2.0
98
master
1,168
require_relative "test_helper" class GzipWriterTest < Minitest::Test describe IOStreams::Gzip::Writer do let :temp_file do Tempfile.new("iostreams") end let :file_name do temp_file.path end let :decompressed do File.read(File.join(File.dirname(__FILE__), "files", "text.txt")) ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/pgp_writer_test.rb
Ruby
apache-2.0
98
master
4,782
require_relative "test_helper" class PgpWriterTest < Minitest::Test describe IOStreams::Pgp::Writer do let :temp_file do Tempfile.new("iostreams") end let :file_name do temp_file.path end let :decrypted do file_name = File.join(File.dirname(__FILE__), "files", "text.txt") ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/bzip2_writer_test.rb
Ruby
apache-2.0
98
master
1,349
require_relative "test_helper" class Bzip2WriterTest < Minitest::Test describe IOStreams::Bzip2::Writer do let :temp_file do Tempfile.new("iostreams") end let :file_name do temp_file.path end let :decompressed do File.read(File.join(File.dirname(__FILE__), "files", "text.txt")...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/path_test.rb
Ruby
apache-2.0
98
master
1,754
require_relative "test_helper" module IOStreams class PathTest < Minitest::Test describe IOStreams::Path do describe ".join" do let(:path) { IOStreams::Path.new("some_path") } it "returns self when no elements" do assert_equal path.object_id, path.join.object_id end ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/encode_writer_test.rb
Ruby
apache-2.0
98
master
2,616
require_relative "test_helper" class EncodeWriterTest < Minitest::Test describe IOStreams::Encode::Writer do let :bad_data do [ "New M\xE9xico,NE".b, "good line", "New M\xE9xico,\x07SF".b ].join("\n").encode("BINARY") end let :cleansed_data do bad_data.gsub("\xE...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/line_reader_test.rb
Ruby
apache-2.0
98
master
11,491
require_relative "test_helper" class LineReaderTest < Minitest::Test describe IOStreams::Line::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "text.txt") end let :csv_file do File.join(File.dirname(__FILE__), "files", "embedded_lines_test.csv") end let :unclo...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/record_reader_test.rb
Ruby
apache-2.0
98
master
1,614
require_relative "test_helper" class RecordReaderTest < Minitest::Test describe IOStreams::Record::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "test.csv") end let :json_file_name do File.join(File.dirname(__FILE__), "files", "test.json") end let :csv_rows ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/deprecated_test.rb
Ruby
apache-2.0
98
master
3,221
require_relative "test_helper" IOStreams.include(IOStreams::Deprecated) # Test deprecated api class DeprecatedTest < Minitest::Test describe IOStreams do let :source_file_name do File.join(__dir__, "files", "text.txt") end let :data do File.read(source_file_name) end let :temp_file...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/row_writer_test.rb
Ruby
apache-2.0
98
master
1,244
require_relative "test_helper" require "csv" class RowWriterTest < Minitest::Test describe IOStreams::Row::Writer do let :csv_file_name do File.join(File.dirname(__FILE__), "files", "test.csv") end let :raw_csv_data do File.read(csv_file_name) end let :csv_rows do CSV.read(csv...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/tabular_test.rb
Ruby
apache-2.0
98
master
12,994
require_relative "test_helper" class TabularTest < Minitest::Test describe IOStreams::Tabular do let :format do :csv end let :tabular do IOStreams::Tabular.new(columns: %w[first_field second third], format: format) end let :fixed do layout = [ {size: 23, key: :name}, ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/zip_reader_test.rb
Ruby
apache-2.0
98
master
1,587
require_relative "test_helper" require_relative "minimal_file_reader" require "zip" class ZipReaderTest < Minitest::Test describe IOStreams::Zip::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "text.zip") end let :multiple_zip_file_name do File.join(File.dirname(__FIL...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/zip_writer_test.rb
Ruby
apache-2.0
98
master
1,171
require_relative "test_helper" require "zip" class ZipWriterTest < Minitest::Test describe IOStreams::Zip::Writer do let :temp_file do Tempfile.new("iostreams") end let :file_name do temp_file.path end let :decompressed do ::File.read(File.join(File.dirname(__FILE__), "files",...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/io_streams_test.rb
Ruby
apache-2.0
98
master
4,179
require_relative "test_helper" require "json" module IOStreams class PathTest < Minitest::Test describe IOStreams do let :records do [ {"name" => "Jack Jones", "login" => "jjones"}, {"name" => "Jill Smith", "login" => "jsmith"} ] end let :expected_json do ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/stream_test.rb
Ruby
apache-2.0
98
master
17,943
require_relative "test_helper" class StreamTest < Minitest::Test describe IOStreams::Stream do let :source_file_name do File.join(__dir__, "files", "text.txt") end let :data do File.read(source_file_name) end let :bad_data do [ "New M\xE9xico,NE".b, "good line"...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/record_writer_test.rb
Ruby
apache-2.0
98
master
1,866
require_relative "test_helper" require "csv" class RecordWriterTest < Minitest::Test describe IOStreams::Record::Writer do let :csv_file_name do File.join(File.dirname(__FILE__), "files", "test.csv") end let :json_file_name do File.join(File.dirname(__FILE__), "files", "test.json") end ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/row_reader_test.rb
Ruby
apache-2.0
98
master
854
require_relative "test_helper" class RowReaderTest < Minitest::Test describe IOStreams::Row::Reader do let :file_name do File.join(File.dirname(__FILE__), "files", "test.csv") end let :expected do CSV.read(file_name) end describe "#each" do it "file" do rows = [] ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/paths/http_test.rb
Ruby
apache-2.0
98
master
765
require_relative "../test_helper" module Paths class HTTPTest < Minitest::Test describe IOStreams::Paths::HTTP do let :url do "http://google.com" end let :ssl_url do "https://google.com" end describe ".open" do it "reads http" do result = IOStream...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/paths/matcher_test.rb
Ruby
apache-2.0
98
master
5,306
require_relative "../test_helper" module Paths class MatcherTest < Minitest::Test describe IOStreams::Paths::Matcher do let :cases do [ { path: "/path/work", pattern: "a/b/c/**/*", expected_path: "/path/work/a/b/c", e...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/paths/sftp_test.rb
Ruby
apache-2.0
98
master
3,456
require_relative "../test_helper" module Paths class SFTPTest < Minitest::Test describe IOStreams::Paths::SFTP do before do unless ENV["SFTP_HOSTNAME"] skip "Supply environment variables to test SFTP paths: SFTP_HOSTNAME, SFTP_USERNAME, SFTP_PASSWORD, and optional SFTP_DIR, SFTP_IDENTITY_...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/paths/file_test.rb
Ruby
apache-2.0
98
master
7,012
require_relative "../test_helper" module Paths class FileTest < Minitest::Test describe IOStreams::Paths::File do let(:root) { IOStreams::Paths::File.new("/tmp/iostreams").delete_all } let(:directory) { root.join("/some_test_dir") } let(:data) { "Hello World\nHow are you doing?\nOn this fine da...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
test/paths/s3_test.rb
Ruby
apache-2.0
98
master
6,554
require_relative "../test_helper" module Paths class S3Test < Minitest::Test describe IOStreams::Paths::S3 do before do skip "Supply 'S3_BUCKET_NAME' environment variable with S3 bucket name to test S3 paths" unless ENV["S3_BUCKET_NAME"] end let :file_name do File.join(File.dir...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/iostreams.rb
Ruby
apache-2.0
98
master
1,807
require "io_streams/version" # @formatter:off module IOStreams autoload :Builder, "io_streams/builder" autoload :Errors, "io_streams/errors" autoload :Path, "io_streams/path" autoload :Pgp, "io_streams/pgp" autoload :Reader, "io_streams/reader" autoload :Stream, "io_streams/stream" autoloa...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/tabular.rb
Ruby
apache-2.0
98
master
7,694
module IOStreams # Common handling for efficiently processing tabular data such as CSV, spreadsheet or other tabular files # on a line by line basis. # # Tabular consists of a table of data where the first row is usually the header, and subsequent # rows are the data elements. # # Tabular applies the head...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/writer.rb
Ruby
apache-2.0
98
master
1,162
module IOStreams class Writer # When a Writer does not support streams, we copy the stream to a local temp file # and then pass that filename in for this reader. def self.stream(output_stream, original_file_name: nil, **args, &block) Utils.temp_file_name("iostreams_writer") do |file_name| co...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/stream.rb
Ruby
apache-2.0
98
master
13,630
module IOStreams class Stream attr_reader :io_stream attr_writer :builder def initialize(io_stream) raise(ArgumentError, "io_stream cannot be nil") if io_stream.nil? raise(ArgumentError, "io_stream must not be a string: #{io_stream.inspect}") if io_stream.is_a?(String) @io_stream = io_...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/path.rb
Ruby
apache-2.0
98
master
5,847
module IOStreams class Path < IOStreams::Stream attr_accessor :path def initialize(path) raise(ArgumentError, "Path cannot be nil") if path.nil? raise(ArgumentError, "Path must be a string: #{path.inspect}, class: #{path.class}") unless path.is_a?(String) @path = path.frozen? ? path :...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/io_streams.rb
Ruby
apache-2.0
98
master
12,808
require "uri" # Streaming library for Ruby # # Stream types / extensions supported: # .zip Zip File [ :zip ] # .gz, .gzip GZip File [ :gzip ] # .enc File Encrypted using symmetric encryption [ :enc ] # etc... # other All oth...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/pgp.rb
Ruby
apache-2.0
98
master
20,827
require "open3" module IOStreams # Read/Write PGP/GPG file or stream. # # Limitations # - Designed for processing larger files since a process is spawned for each file processed. # - For small in memory files or individual emails, use the 'opengpgme' library. module Pgp autoload :Reader, "io_streams/pgp...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/builder.rb
Ruby
apache-2.0
98
master
5,126
module IOStreams # Build the streams that need to be applied to a path during reading or writing. class Builder attr_accessor :file_name, :format_options attr_reader :streams, :options def initialize(file_name = nil) @file_name = file_name @streams = nil @options = nil...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/reader.rb
Ruby
apache-2.0
98
master
1,069
module IOStreams class Reader # When a Reader does not support streams, we copy the stream to a local temp file # and then pass that filename in for this reader. def self.stream(input_stream, **args, &block) Utils.temp_file_name("iostreams_reader") do |file_name| ::File.open(file_name, "wb")...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/errors.rb
Ruby
apache-2.0
98
master
814
module IOStreams module Errors class Error < StandardError end class InvalidHeader < Error end class MissingHeader < Error end class UnknownFormat < Error end class TypeMismatch < Error end class CommunicationsFailure < Error end # When the specified delimiter...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/utils.rb
Ruby
apache-2.0
98
master
1,653
require "uri" require "tmpdir" module IOStreams module Utils MAX_TEMP_FILE_NAME_ATTEMPTS = 5 # Lazy load dependent gem so that it remains a soft dependency. def self.load_soft_dependency(gem_name, stream_type, require_name = gem_name) require require_name rescue LoadError => e raise(LoadE...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/deprecated.rb
Ruby
apache-2.0
98
master
9,896
module IOStreams UTF8_ENCODING = Encoding.find("UTF-8").freeze BINARY_ENCODING = Encoding.find("BINARY").freeze # Deprecated IOStreams from v0.x. Do not use, will be removed soon. module Deprecated def self.included(base) base.extend ClassMethods end module ClassMethods # DEPRECATED....
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/encode/reader.rb
Ruby
apache-2.0
98
master
3,556
module IOStreams module Encode class Reader < IOStreams::Reader attr_reader :encoding, :cleaner NOT_PRINTABLE = Regexp.compile(/[^[:print:]|\r|\n]/).freeze # Builtin strip options to apply after encoding the read data. CLEANSE_RULES = { # Strips all non printable characters ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/encode/writer.rb
Ruby
apache-2.0
98
master
2,763
module IOStreams module Encode class Writer < IOStreams::Writer attr_reader :encoding, :cleaner # Write a line at a time to a file or stream def self.stream(input_stream, original_file_name: nil, **args) yield new(input_stream, **args) end # A delimited stream writer that w...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/symmetric_encryption/reader.rb
Ruby
apache-2.0
98
master
410
module IOStreams module SymmetricEncryption class Reader < IOStreams::Reader # read from a file/stream using Symmetric Encryption def self.stream(input_stream, **args, &block) Utils.load_soft_dependency("symmetric-encryption", ".enc streaming") unless defined?(SymmetricEncryption) ::S...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/symmetric_encryption/writer.rb
Ruby
apache-2.0
98
master
1,027
module IOStreams module SymmetricEncryption class Writer < IOStreams::Writer # Write to stream using Symmetric Encryption # By default the output stream is compressed. # If the input_stream is already compressed consider setting compress: false. def self.stream(input_stream, compress: true...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/pgp/reader.rb
Ruby
apache-2.0
98
master
2,153
require "open3" module IOStreams module Pgp class Reader < IOStreams::Reader # Passphrase to use to open the private key to decrypt the received file class << self attr_writer :default_passphrase private attr_reader :default_passphrase @default_passphrase = nil ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/pgp/writer.rb
Ruby
apache-2.0
98
master
4,472
require "open3" module IOStreams module Pgp class Writer < IOStreams::Writer class << self # Sign all encrypted files with this users key. # Default: Do not sign encrypted files. attr_writer :default_signer # Passphrase to use to open the private key when signing the file. ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/bzip2/reader.rb
Ruby
apache-2.0
98
master
457
module IOStreams module Bzip2 class Reader < IOStreams::Reader # Read from a Bzip2 stream, decompressing the contents as it is read def self.stream(input_stream, **args) Utils.load_soft_dependency("bzip2-ffi", "Bzip2", "bzip2/ffi") unless defined?(::Bzip2::FFI) begin io = ::...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/bzip2/writer.rb
Ruby
apache-2.0
98
master
457
module IOStreams module Bzip2 class Writer < IOStreams::Writer # Write to a stream, compressing with Bzip2 def self.stream(input_stream, original_file_name: nil, **args) Utils.load_soft_dependency("bzip2-ffi", "Bzip2", "bzip2/ffi") unless defined?(::Bzip2::FFI) begin io = ::...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/paths/http.rb
Ruby
apache-2.0
98
master
4,046
require "net/http" require "uri" require "cgi" module IOStreams module Paths class HTTP < IOStreams::Path attr_reader :username, :password, :http_redirect_count, :url # Stream to/from a remote file over http(s). # # Parameters: # url: [String] # URI of the file to downl...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/paths/sftp.rb
Ruby
apache-2.0
98
master
12,481
require "open3" module IOStreams module Paths # Read a file from a remote sftp server. # # Example: # IOStreams. # path("sftp://example.org/path/file.txt", username: "jbloggs", password: "secret"). # reader do |input| # puts input.read # end # # Note: #...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/paths/matcher.rb
Ruby
apache-2.0
98
master
2,193
module IOStreams module Paths # Implement fnmatch logic for any path iterator class Matcher # Characters indicating that pattern matching is required MATCH_START_CHARS = /[*?\[{]/.freeze attr_reader :path, :pattern, :flags # If the supplied pattern contains sub-directories without wi...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/paths/file.rb
Ruby
apache-2.0
98
master
7,009
require "fileutils" module IOStreams module Paths class File < IOStreams::Path attr_accessor :create_path def initialize(file_name, create_path: true) @create_path = create_path super(file_name) end # Yields Paths within the current path. # # Examples: ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/paths/s3.rb
Ruby
apache-2.0
98
master
13,701
require "uri" module IOStreams module Paths class S3 < IOStreams::Path attr_reader :bucket_name, :options # Largest file size supported by the S3 copy object api. S3_COPY_OBJECT_SIZE_LIMIT = 5 * 1024 * 1024 * 1024 # When an upload file exceeds this size, use a multipart file upload. ...
github
reidmorrison/iostreams
https://github.com/reidmorrison/iostreams
lib/io_streams/gzip/writer.rb
Ruby
apache-2.0
98
master
318
module IOStreams module Gzip class Writer < IOStreams::Writer # Write to a stream, compressing with GZip def self.stream(input_stream, original_file_name: nil, &block) io = ::Zlib::GzipWriter.new(input_stream) block.call(io) ensure io&.close end end end end