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
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_table_spec.rb
Ruby
mit
228
master
630
require_relative '../spec_helper' describe ExtractTable do it "should create a hash: table_name => [sheet, range, number of total rows, column names]" do input = excel_fragment 'Table.xml' expected_output = { "FirstTable" => ["Sheet1", "B2:C5", "1", "ColA", "ColB"] } output = ExtractTable.extract("Sheet1", input) ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_worksheet_names_spec.rb
Ruby
mit
228
master
338
require_relative '../spec_helper' describe ExtractWorksheetNames do it "should output the worksheet names from the workbook, together with ids" do input = excel_fragment 'Workbook.xml' output = ExtractWorksheetNames.extract(input) output.should == {"Outputs" => "rId1" , "Calcs" => "rId2", "Inputs" => ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_data_from_worksheets_spec.rb
Ruby
mit
228
master
3,707
require_relative '../spec_helper' describe ExtractDataFromWorksheet do before do extractor = ExtractDataFromWorksheet.new input = excel_fragment 'FormulaeTypes.xml' extractor.extract(:SheetName, input) @extractor = extractor end it "should have a table_rids attribute with a hash keyed to the ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_named_references_spec.rb
Ruby
mit
228
master
406
require_relative '../spec_helper' describe ExtractNamedReferences do it "should output the named references in the workbook in the form <worksheet>\\t<name>\\t<reference>" do input = excel_fragment 'Workbook.xml' output = ExtractNamedReferences.extract(input) output.should == { :"in_result" => ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_cell_address_with_references.rb
Ruby
mit
228
master
1,207
require_relative '../spec_helper' describe ReplaceCellAddressesWithReferences do it "should replace CELL('address',A1) functions with the reference that they refer to" do input = <<END A1\t[:function, :CELL, [:string, "address"], [:cell, :A5]] A2\t[:function, :CELL, [:string, "ADDRESS"], [:cell, :"$A$5"]] A3\t[:fu...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_offsets_with_references_spec.rb
Ruby
mit
228
master
1,851
require_relative '../spec_helper' describe ReplaceOffsetsWithReferences do it "should replace OFFSET() functions with the reference that they refer to, if they have been passed values" do input = <<END A1\t[:function, :OFFSET, [:cell, :"$A$5"], [:number, 1], [:number, 1], [:number, 3], [:number, 3]] A2\t[:functio...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/wrap_formulae_that_return_arrays_and_are_not_in_arrays_spec.rb
Ruby
mit
228
master
983
require_relative '../spec_helper' describe WrapFormulaeThatReturnArraysAndAReNotInArrays do it "should wrap formulae (such as MMULT(A1:B1,C1:C2)) that return arrays but are not inside an array formula" do input = <<END A1\t[:function, "MMULT", [:array, [:row, [:number, "1"]]], [:array, [:row, [:number, "2"]]]] A...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_named_references_spec.rb
Ruby
mit
228
master
2,352
require_relative '../spec_helper' describe ReplaceNamedReferences do it "should replace named references with the references that they point to" do input = <<END A1\t[:named_reference, "Global"] A2\t[:named_reference, "Local"] A3\t[:sheet_reference,"otherSheet",[:named_reference, "Local"]] A4\t[:sheet_reference,...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/identify_repeated_formula_elements_spec.rb
Ruby
mit
228
master
1,395
require_relative '../spec_helper' describe IdentifyRepeatedFormulaElements do it "should be able to count the number of times a formula is referenced" do formulae = { ["sheet1", 'A1'] => [:function, "INDEX", [:array, [:row, [:cell, "A1"], [:cell, "A2"], [:cell, "A3"]]], [:number, 2]], ["sheet1", 'A2...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_shared_strings_spec.rb
Ruby
mit
228
master
538
require_relative '../spec_helper' describe ReplaceSharedStrings do it "should take the results of extract_worksheet_names.rb and extract_relationships.rb and return one line per worksheet: worksheet name then tab then worksheet filename" do shared_strings = [[:string, "One"], [:string, "Two"], [:string, "Thre...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_transpose_function_spec.rb
Ruby
mit
228
master
592
require_relative '../spec_helper' describe ReplaceTransposeFunction do it "should replace TRANSPOSE() functions with transposed arrays" do r = ReplaceTransposeFunction.new r.replace([:function, :TRANSPOSE, [:array, [:row, [:number, 1], [:number, 2]], [:row, [:number, 3], [:number, 4]]]]).should == [:array,...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_arrays_with_single_cells_spec.rb
Ruby
mit
228
master
5,710
require_relative '../spec_helper' describe ReplaceArraysWithSingleCellsAst do it "should replace array literals (e.g., {A1,B1;A2,B2}) with the appropriate cell (e.g., A1) where it is required" do r = ReplaceArraysWithSingleCellsAst.new ast = [:array, [:row, [:sheet_reference, :"sheet1", [:cell, :"B1"]], [:s...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/fix_subtotal_of_subtotals_spec.rb
Ruby
mit
228
master
4,676
require_relative '../spec_helper' describe FixSubtotalOfSubtotals do it "should be able to check if a bit of ast contains a SUBTOTAL function" do f = FixSubtotalOfSubtotals.new f.is_subtotal?([:number, 1]).should == false f.is_subtotal?([:array, [:row, [:function, :SUBTOTAL, [:number, 109], [:array, [:row, [:n...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/map_formulae_to_values_spec.rb
Ruby
mit
228
master
578
require_relative '../spec_helper' describe MapFormulaeToValues do before(:all) do @mapper = MapFormulaeToValues.new end checks = test_data('formulae_to_calculated_values.txt').each_line.map.with_index { |line,i| [i,line] }.find_all { |line| line[1].start_with?('[:') }.map { |line| [line[0],*line[1].s...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_indirects_with_references_spec.rb
Ruby
mit
228
master
1,129
require_relative '../spec_helper' describe ReplaceIndirectsWithReferences do it "should replace INDIRECT() functions with the reference that they refer to, if they have been passed a string value" do input = <<END A1\t[:function, :INDIRECT, [:string,"$A$5"]] A2\t[:function, :INDIRECT, [:cell, :"$A$5"]] A3\t[:funct...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_references_to_blanks_with_zeros_spec.rb
Ruby
mit
228
master
1,477
require_relative '../spec_helper' describe ReplaceReferencesToBlanksWithZeros do it "If a cell contains a reference, and only a reference, to a cell that is blank or doesn't exist, replace it with a zero" do references = { [:sheet1, :A1] => [:sheet_reference, :sheet1, [:cell, :A2]], [:sheet1, :B1] ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_column_with_column_number_spec.rb
Ruby
mit
228
master
1,822
require_relative '../spec_helper' describe ReplaceColumnAndRowFunctions do it "should replace COLUMN() and ROW() functions with the number of the column or row that they refer to" do input = <<END A1\t[:function, :COLUMN, [:cell, :"$A$5"]] A2\t[:function, :COLUMN, [:area, :"$A$5", "$C$5"]] A3\t[:function, :COLUMN,...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/remove_cells_spec.rb
Ruby
mit
228
master
836
require_relative '../spec_helper' describe RemoveCells do it "should remove any cells whose references are NOT in the given array" do input = { ['sheet1', 'A1'] => [:boolean_true], ['sheet1', 'A2'] => [:shared_string, "0"], ['sheet1', 'A3'] => [:number, "1"], ['sheet1', 'A4'] => [:number...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/simplify_arithmetic_spec.rb
Ruby
mit
228
master
13,058
require_relative '../spec_helper' describe SimplifyArithmetic do it "should turn [:arithmetic] ast with more than one operation into a series of nested arithmetic statements, following the excel precedence rules" do input = <<END A1\t[:arithmetic, [:number, 1], [:operator, :+], [:number, 2], [:operator, :+], [:numbe...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_ranges_with_array_literals_spec.rb
Ruby
mit
228
master
3,048
require_relative '../spec_helper' describe ReplaceRangesWithArrayLiterals do it "should replace ranges (e.g., A1:B2) with array literals (e.g., {A1,B1;A2,B2}) except if they only refer to a single cell, in which case replace with a single cell" do input = <<END A1\t[:sheet_reference, :sheet1, [:area, :A1, :B2]] ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_string_join_on_ranges_spec.rb
Ruby
mit
228
master
1,666
require_relative '../spec_helper' describe ReplaceStringJoinOnRangesAST do it "should replace string joins on ranges (e.g., A1:A2&B1:B2 = [A1&B1, A2&B2]). Note Excel only seems to do this if formulae are entered in array form?" do r = ReplaceStringJoinOnRangesAST.new r.map([:string_join, [:string, "A"], [:...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/inline_formulae_spec.rb
Ruby
mit
228
master
2,807
require_relative '../spec_helper' describe InlineFormulaeAst do it "should replace references to other cell with the contents of that cell" do references = { [:sheet1, :A2] => [:cell, :"A3"] } r = InlineFormulaeAst.new(references, :sheet1) r.map([:cell, :A2]).should == [:inlined_blank] r....
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/emergency_array_formula_replace_indirect_bodge_spec.rb
Ruby
mit
228
master
1,308
require_relative '../spec_helper' describe EmergencyArrayFormulaReplaceIndirectBodge do it "should replace INDIRECT() functions in array formulae with the reference that they refer to, even if they haven't been passed a string value. THIS IS A BODGE" do r = EmergencyArrayFormulaReplaceIndirectBodge.new r.c...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/count_formula_references_spec.rb
Ruby
mit
228
master
888
require_relative '../spec_helper' describe CountFormulaReferences do it "should be able to count the number of times a formula is referenced" do references = { [:sheet1, :A1] => [:cell, :"$A$2"], [:sheet1, :A2] => [:cell, :A3], [:sheet1, :A3] => [:number, 1], [:sheet2, :A1] => [:cell, :A...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_arithmetic_on_ranges_spec.rb
Ruby
mit
228
master
33,488
require_relative '../spec_helper' describe ReplaceArithmeticOnRangesAst do it "should replace arithmetic on ranges (e.g., 1/A1:B2) with individual calculations (i.e., [1/A1, 1/B1, 1/A2, 1/B2])" do r = ReplaceArithmeticOnRangesAst.new r.map([:arithmetic, [:number, 1], [:operator, :"/"], [:cell, :F198]])....
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/sort_into_calculation_order_spec.rb
Ruby
mit
228
master
884
require_relative '../spec_helper' describe SortIntoCalculationOrder do it "should be able to turn a set of references into a list sorted into the sequence they need to be calculated" do references = { [:sheet1, :A1] => [:cell, :"$A$2"], [:sheet1, :A2] => [:cell, :A3], [:sheet1, :A3] => [:numbe...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/identify_dependencies_spec.rb
Ruby
mit
228
master
4,466
require_relative '../spec_helper' describe IdentifyDependencies do it "should recursively work through formulae, identifying dependencies" do references = { [:sheet1, :A1] => [:cell, :"$A$2"], [:sheet1, :A2] => [:cell, :A3], [:sheet1, :A3] => [:number, 1], [:sheet2, :A1] => [:cell, :A2],...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_table_references_spec.rb
Ruby
mit
228
master
5,409
require_relative '../spec_helper' describe ReplaceTableReferences do it "should replace table references with cell and array references" do input = <<END A3\t[:table_reference, "FirstTable", "[#This Row],[ColA]:[ColB]"] A4\t[:string_join, [:table_reference, "FirstTable", "[#This Row],[ColA]"], [:table_reference, "Fi...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/simplify/replace_common_elements_in_formulae_spec.rb
Ruby
mit
228
master
804
require_relative '../spec_helper' describe ReplaceCommonElementsInFormulae do it "should work through formulae, replacing elements that are common to other formulae with a cell reference" do input = { ["sheet1", "A1"] => [:function, "INDEX", [:array, [:row, [:cell, "A1"], [:cell, "A2"], [:cell, "A3"]]], ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_c_spec.rb
Ruby
mit
228
master
843
require_relative '../spec_helper' describe ExcelToC do it "Should transform ExampleSpreadsheet.xlsx into the desired c code" do excel = File.join(File.dirname(__FILE__),'..','test_data','ExampleSpreadsheet.xlsx') expected = File.join(File.dirname(__FILE__),'excel_to_X_output_expected') actual = File.j...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_go_spec.rb
Ruby
mit
228
master
732
require_relative '../spec_helper' describe ExcelToGo do skip 'Should transform ExampleSpreadsheet.xlsx into the desired ruby code' do excel = File.join(File.dirname(__FILE__), '..', 'test_data', 'GoTestSpreadsheet.xlsx') actual = File.join(File.dirname(__FILE__), 'excel_to_X_output_actual') puts "Writing...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_ruby_spec.rb
Ruby
mit
228
master
817
require_relative '../spec_helper' describe ExcelToRuby do it "Should transform ExampleSpreadsheet.xlsx into the desired ruby code" do excel = File.join(File.dirname(__FILE__),'..','test_data','ExampleSpreadsheet.xlsx') expected = File.join(File.dirname(__FILE__),'excel_to_X_output_expected') actual = ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_x_spec.rb
Ruby
mit
228
master
1,455
require_relative '../spec_helper' describe ExcelToX do it "Should allow named_references_to_keep to be specified as a block" do c = ExcelToX.new c.named_references_to_keep = lambda { |named_reference| named_reference =~ /^keep/ } c.instance_variable_set("@named_references", { :keeper => :blah, :looser...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_X_output_actual/ruby/rubyexamplespreadsheet.rb
Ruby
mit
228
master
29,413
# coding: utf-8 # Compiled version of /Users/tamc/Documents/excel_to_code/spec/test_data/ExampleSpreadsheet.xlsx require '/Users/tamc/Documents/excel_to_code/src/excel/excel_functions' class RubyExampleSpreadsheet include ExcelFunctions def original_excel_filename; "/Users/tamc/Documents/excel_to_code/spec/test_da...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_X_output_actual/ruby/test_rubyexamplespreadsheet.rb
Ruby
mit
228
master
25,978
# coding: utf-8 # All tests for /Users/tamc/Documents/excel_to_code/spec/test_data/ExampleSpreadsheet.xlsx require 'minitest/autorun' require_relative 'rubyexamplespreadsheet' class TestRubyExampleSpreadsheet < Minitest::Unit::TestCase def worksheet; @worksheet ||= RubyExampleSpreadsheet.new; end def test_valuetyp...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_X_output_actual/c/examplespreadsheet.rb
Ruby
mit
228
master
32,995
require 'ffi' require 'singleton' class ExampleSpreadsheet # WARNING: this is not thread safe def initialize reset end def reset C.reset end def method_missing(name, *arguments) if arguments.size == 0 get(name) elsif arguments.size == 1 set(name, arguments.first) else ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_X_output_actual/c/Rakefile
Ruby
mit
228
master
867
require 'ffi' this_directory = File.dirname(__FILE__) COMPILER = 'gcc' COMPILE_FLAGS = '-fPIC' SHARED_LIBRARY_FLAGS = '-shared -fPIC' OUTPUT = FFI.map_library_name 'examplespreadsheet' OUTPUT_DIR = this_directory SOURCE = 'examplespreadsheet.c' OBJECT = 'examplespreadsheet.o' task :default => [:build] desc 'Build ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/commands/excel_to_X_output_actual/c/test_examplespreadsheet.rb
Ruby
mit
228
master
26,088
# coding: utf-8 # Test for examplespreadsheet require 'minitest/autorun' require_relative 'examplespreadsheet' class TestExampleSpreadsheet < Minitest::Unit::TestCase def self.runnable_methods puts 'Overriding minitest to run tests in a defined order' methods = methods_matching(/^test_/) end def workshee...
github
upserve/dockly
https://github.com/upserve/dockly
Rakefile
Ruby
mit
228
master
522
# Copyright Swipely, Inc. All rights reserved. $LOAD_PATH.unshift( File.join( File.dirname(__FILE__), 'lib' ) ) require 'rake' require 'dockly' require 'rspec/core/rake_task' require 'cane/rake_task' require 'pry' task :shell do Pry.start(Dockly) end task :default => [:spec, :quality] RSpec::Core::RakeTask.new ...
github
upserve/dockly
https://github.com/upserve/dockly
dockly.gemspec
Ruby
mit
228
master
1,465
# -*- encoding: utf-8 -*- require File.expand_path('../lib/dockly/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Swipely, Inc."] gem.email = %w{tomhulihan@swipely.com bright@swipely.com toddlunter@swipely.com} gem.description = %q{Packaging made easy} gem.summary = %q...
github
upserve/dockly
https://github.com/upserve/dockly
spec/spec_helper.rb
Ruby
mit
228
master
370
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'dockly' require 'pry' Dockly::Util::Logger.disable! unless ENV['ENABLE_LOGGER'] == 'true' RSpec.configure do |config| config.mock_with :rspec config.treat_symbols_as_metadata_key...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/docker_spec.rb
Ruby
mit
228
master
15,974
require 'spec_helper' describe Dockly::Docker do subject { described_class.new(:name => :test_docker) } describe '#registry' do context 'when there is no registry' do it 'returns nil' do expect(subject.registry).to eq(nil) end end context 'when there is only an ecr registry' do ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/tar_diff_spec.rb
Ruby
mit
228
master
2,349
require 'spec_helper' describe Dockly::TarDiff do let(:base) { StringIO.new } let(:input) { StringIO.new } let(:output) { StringIO.new } subject { described_class.new(base, input, output) } describe "#quick_write" do let(:input) { StringIO.new(message) } context "for a message under 4096 bytes" do ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/s3_writer_spec.rb
Ruby
mit
228
master
3,945
require 'spec_helper' describe Dockly::S3Writer do let(:connection) { double(:connection) } let(:bucket) { 'test_bucket' } let(:object) { 'object_name.tar' } let(:multipart_upload) { double(:multipart_upload, upload_id: upload_id) } let(:upload_id) { 'test_id' } before do allow(subject) .to rece...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/history_spec.rb
Ruby
mit
228
master
2,640
require 'spec_helper' describe Dockly::History do describe '#duplicate_build?' do before { allow(subject).to receive(:duplicate_build_sha).and_return(sha) } context 'when the duplicate build sha is not present' do let(:sha) { nil } it 'returns false' do expect(subject).to_not be_duplica...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/deb_spec.rb
Ruby
mit
228
master
9,693
require 'spec_helper' require 'tempfile' describe Dockly::Deb do describe '#create_package!' do subject do Dockly::Deb.new do package_name 'my-sweet-deb' version '77.0' release '8' pre_install "ls" post_install "rd /s /q C:\*" build_dir 'build' end ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/bash_builder_spec.rb
Ruby
mit
228
master
4,079
require 'spec_helper' describe Dockly::BashBuilder do describe "#normalize_for_dockly" do it "sets up log and fatal and makes /opt/dockly" do output = subject.normalize_for_dockly expect(output).to include("function log") expect(output).to include("function fatal") expect(output).to inclu...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/foreman_spec.rb
Ruby
mit
228
master
1,214
require 'spec_helper' describe Dockly::Foreman do describe '#create!' do subject do Dockly::Foreman.new do name :foreman init_dir '/etc/systemd/system' build_dir 'build/foreman' procfile File.join(File.dirname(__FILE__), '..', 'fixtures', 'Procfile') user 'root' ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/cli_spec.rb
Ruby
mit
228
master
222
require 'spec_helper' describe "Dockly CLI" do describe "running the most basic command" do let(:command) { "./bin/dockly" } it "should exit with 0" do expect(system(command)).to be_true end end end
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/rpm_spec.rb
Ruby
mit
228
master
8,548
require 'spec_helper' require 'tempfile' describe Dockly::Rpm do describe '#create_package!' do subject do Dockly::Rpm.new do package_name 'my-sweet-rpm' version '77.0' release '8' pre_install "ls" post_install "rd /s /q C:\*" build_dir 'build' s3_buc...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/build_cache/base_spec.rb
Ruby
mit
228
master
2,218
require 'spec_helper' describe Dockly::BuildCache::Base do subject { described_class.new(:name => :test_build_cache) } before do subject.s3_bucket 'lol' subject.s3_object_prefix 'swag' subject.hash_command 'md5sum /etc/vim/vimrc' subject.build_command 'touch lol' subject.output_dir '/' end ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/build_cache/local_spec.rb
Ruby
mit
228
master
3,570
require 'spec_helper' describe Dockly::BuildCache::Local do let(:build_cache) { described_class.new!(:name => :test_local_build_cache) } before do build_cache.s3_bucket 'fake' build_cache.s3_object_prefix 'object' build_cache.hash_command "md5sum #{File.join(Dir.pwd, 'Gemfile')} | awk '{ print $1 }'" ...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/build_cache/docker_spec.rb
Ruby
mit
228
master
4,785
require 'spec_helper' describe Dockly::BuildCache::Docker, :docker do let!(:build_cache) { described_class.new!(:name => :test_build_cache) } let!(:docker) do Dockly::Docker.new!(:name => :test_docker) do git_archive '/app' end end let(:image) { ::Docker::Image.build('from ubuntu:14.04') } bef...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/docker/ecr_spec.rb
Ruby
mit
228
master
2,054
require 'spec_helper' describe Dockly::Docker::ECR do subject do described_class.new(name: 'ecr', server_address: registry) end let(:username) { 'AWS' } let(:password) { 'password' } let(:registry) { 'accountid.dkr.ecr.region.amazonaws.com' } let(:endpoint) { "https://#{registry}" } let(:ecr_client)...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/docker/registry_spec.rb
Ruby
mit
228
master
1,716
require 'spec_helper' describe Dockly::Docker::Registry do subject { described_class.new(:name => :dockly_registry) } describe '#authenticate!' do context 'when authentication is not required' do before { subject.authentication_required false } it 'does nothing' do ::Docker.should_not_rec...
github
upserve/dockly
https://github.com/upserve/dockly
spec/dockly/util/git_spec.rb
Ruby
mit
228
master
1,308
require 'spec_helper' describe Dockly::Util::Git do describe '#repo' do it 'returns the repo for the current directory' do expect(subject.repo.git_work_tree).to eq(File.expand_path('.')) end end describe '#sha' do it 'returns a sha for the head object' do expect(subject.sha).to eq(`git r...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly.rb
Ruby
mit
228
master
2,349
require 'dockly/util' require 'dockly/util/tar' require 'dockly/util/git' require 'foreman/cli_fix' require 'foreman/export/base_fix' require 'minigit' require 'aws-sdk-core' require 'aws-sdk-s3' require 'aws-sdk-ecr' require 'open3' module Dockly LOAD_FILE = 'dockly.rb' class << self attr_writer :load_file ...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/foreman.rb
Ruby
mit
228
master
995
class Dockly::Foreman include Dockly::Util::DSL include Dockly::Util::Logger::Mixin logger_prefix '[dockly foreman]' dsl_attribute :name, :env, :procfile, :type, :user, :root_dir, :init_dir, :log_dir, :build_dir, :prefix default_value :build_dir, 'build/foreman' default_value :env, "" de...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/docker.rb
Ruby
mit
228
master
10,684
require 'docker' require 'excon' require 'tempfile' require 'zlib' require 'rubygems/package' require 'fileutils' class Dockly::Docker include Dockly::Util::DSL include Dockly::Util::Logger::Mixin autoload :Registry, 'dockly/docker/registry' autoload :ECR, 'dockly/docker/ecr' logger_prefix '[dockly docker]...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/history.rb
Ruby
mit
228
master
1,563
# This module contains logic to find matching content hash for a given commit. module Dockly::History module_function ASCII_FILE_SEP = 28.chr ASCII_RECORD_SEP = 30.chr TAG_PREFIX = 'dockly-' def push_content_tag! refs = ["refs/tags/#{content_tag}"] remotes = repo.capturing.remote(:v => true).split(...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/cli.rb
Ruby
mit
228
master
4,756
require 'rubygems' require 'dockly' require 'clamp' class Dockly::AbstractCommand < Clamp::Command option ['-F', '--file'], 'FILE', 'dockly file to read', :default => 'dockly.rb', :attribute_name => :file def execute if File.exist?(file) Dockly.load_file = file else raise 'Could not find a doc...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/rake_task.rb
Ruby
mit
228
master
4,743
require 'rake' require 'dockly' module Dockly::RakeHelper module_function def find_deb!(name) deb = Dockly.debs[name] raise "No deb named #{name}" if deb.nil? deb end def find_docker!(name) docker = Dockly.dockers[name] raise "No docker named #{name}" if docker.nil? docker end de...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/build_cache.rb
Ruby
mit
228
master
312
module Dockly::BuildCache end module Dockly::BuildCache autoload :Base, 'dockly/build_cache/base' autoload :Docker, 'dockly/build_cache/docker' autoload :Local, 'dockly/build_cache/local' class << self attr_writer :model def model @model ||= Dockly::BuildCache::Docker end end end
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/rpm.rb
Ruby
mit
228
master
987
require 'fpm' class Dockly::Rpm < Dockly::Deb logger_prefix '[dockly rpm]' dsl_attribute :os default_value :deb_build_dir, 'rpm' default_value :os, 'linux' def output_filename "#{package_name}_#{version}.#{release}_#{arch}.rpm" end def startup_script scripts = [] bb = Dockly::BashBuilder.ne...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/tar_diff.rb
Ruby
mit
228
master
4,459
class Dockly::TarDiff include Dockly::Util::Logger::Mixin # Tar header format for a ustar tar HEADER_UNPACK_FORMAT = "Z100A8A8A8A12A12A8aZ100A6A2Z32Z32A8A8Z155" PAX_FILE_FORMAT_REGEX = /\d+ path=(.*)/ logger_prefix '[dockly tar_diff]' attr_reader :base, :output, :target, :base_enum, :target_enum def ...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/s3_writer.rb
Ruby
mit
228
master
1,956
module Dockly class S3Writer include Dockly::Util::Logger::Mixin extend Forwardable MAX_BUFFER_SIZE = 5 * 1024 * 1024 attr_reader :connection, :s3_bucket, :s3_object, :parts, :closed, :buffer def_delegators :multipart_upload, :upload_id logger_prefix '[dockly s3writer]' def initialize(...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/deb.rb
Ruby
mit
228
master
7,801
require 'fpm' class Dockly::Deb include Dockly::Util::DSL include Dockly::Util::Logger::Mixin logger_prefix '[dockly deb]' dsl_attribute :package_name, :version, :release, :arch, :build_dir, :deb_build_dir, :pre_install, :post_install, :pre_uninstall, :post_uninstall, :s3_bucke...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/bash_builder.rb
Ruby
mit
228
master
1,219
require 'erb' require 'ostruct' module Dockly class BashBuilder SNIPPET_PATH = File.expand_path("../../../snippets", __FILE__) def self.generate_snippet_for(name, opts, defaults={}) define_method(name) do |*args| zipped_array = opts.zip(args).flatten snippet = File.read(File.join(SNIPP...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/build_cache/base.rb
Ruby
mit
228
master
3,325
require 'tempfile' class Dockly::BuildCache::Base include Dockly::Util::DSL include Dockly::Util::Logger::Mixin logger_prefix '[dockly build_cache]' dsl_attribute :s3_bucket, :s3_object_prefix, :use_latest, :hash_command, :build_command, :parameter_commands, :base_dir, :comman...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/build_cache/local.rb
Ruby
mit
228
master
1,763
class Dockly::BuildCache::Local < Dockly::BuildCache::Base def run_build puts "Build command: #{build_command}" status, body = run_command(build_command) raise "Build Cache `#{build_command}` failed to run.\nError: #{body}" unless status.success? FileUtils.mkdir_p(File.dirname(save_file)) tar_file...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/build_cache/docker.rb
Ruby
mit
228
master
3,908
class Dockly::BuildCache::Docker < Dockly::BuildCache::Base attr_accessor :image def execute! ensure_present! :image super image end def run_build status, _, container = run_command(build_command) raise "Build Cache `#{build_command}` failed to run." unless status.zero? cache = copy_ou...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/util/tar.rb
Ruby
mit
228
master
1,344
require 'fileutils' module Dockly::Util::Tar extend self def is_tar?(path) if File.size(path) < 262 return false end magic = nil File.open(path, "r") do |f| f.read(257) magic = f.read(5) end magic == "ustar" end def is_gzip?(path) if File.size(path) < 2 ret...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/util/git.rb
Ruby
mit
228
master
702
module Dockly::Util::Git module_function def repo @repo ||= MiniGit.new('.') end def sha return @sha if @sha @sha = repo.capturing.rev_parse('HEAD').chomp rescue @sha = 'unknown' end def archive(oid, prefix, output) prefix = prefix.dup unless prefix[-1] == '/'; prefix << '/'; en...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/docker/registry.rb
Ruby
mit
228
master
1,798
class Dockly::Docker::Registry include Dockly::Util::DSL include Dockly::Util::Logger::Mixin DEFAULT_SERVER_ADDRESS = 'https://index.docker.io/v1/' logger_prefix '[dockly docker registry]' dsl_attribute :name, :server_address, :email, :username, :password, :authentication_required, :auth_co...
github
upserve/dockly
https://github.com/upserve/dockly
lib/dockly/docker/ecr.rb
Ruby
mit
228
master
1,256
class Dockly::Docker::ECR include Dockly::Util::DSL include Dockly::Util::Logger::Mixin logger_prefix '[dockly docker ecr]' dsl_attribute :name, :server_address, :password, :username def authenticate! @username ||= login_from_aws[0] @password ||= login_from_aws[1] ensure_present! :password, :s...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
postmark.gemspec
Ruby
mit
228
main
1,561
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "postmark/version" Gem::Specification.new do |s| s.name = "postmark" s.version = Postmark::VERSION s.homepage = "https://postmarkapp.com" s.platform = Gem::Platform::RUBY s.license = '...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
Gemfile
Ruby
mit
228
main
532
source "http://rubygems.org" # Specify your gem's dependencies in postmark.gemspec gemspec group :test do gem 'rspec', '~> 3.7', "< 3.10" # until https://github.com/rspec/rspec-support/pull/537 gets merged gem 'rspec-its', '~> 1.2' gem 'fakeweb', :git => 'https://github.com/chrisk/fakeweb.git' gem 'fakeweb-ma...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark.rb
Ruby
mit
228
main
2,531
require 'net/http' require 'net/https' require 'thread' unless defined? Mutex # For Ruby 1.8.7 require 'postmark/version' require 'postmark/inflector' require 'postmark/helpers/hash_helper' require 'postmark/helpers/message_helper' require 'postmark/mail_message_converter' require 'postmark/bounce' require 'postmark/i...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/api_client.rb
Ruby
mit
228
main
12,247
module Postmark class ApiClient < Client attr_accessor :max_batch_size def initialize(api_token, options = {}) options = options.dup @max_batch_size = options.delete(:max_batch_size) || 500 super end def deliver(message_hash = {}) data = serialize(MessageHelper.to_postmark(me...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/http_client.rb
Ruby
mit
228
main
3,207
require 'thread' unless defined? Mutex # For Ruby 1.8.7 require 'cgi' module Postmark class HttpClient attr_accessor :api_token attr_reader :http, :secure, :proxy_host, :proxy_port, :proxy_user, :proxy_pass, :host, :port, :path_prefix, :http_open_timeout, :http_read_timeout, :...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/json.rb
Ruby
mit
228
main
323
module Postmark module Json class << self def encode(data) json_parser data.to_json end def decode(data) json_parser.decode(data) end private def json_parser ResponseParsers.const_get(Postmark.response_parser_class) end end end e...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/inbound.rb
Ruby
mit
228
main
702
module Postmark module Inbound extend self def to_ruby_hash(inbound) inbound = Json.decode(inbound) if inbound.is_a?(String) ret = HashHelper.to_ruby(inbound) ret[:from_full] ||= {} ret[:to_full] ||= [] ret[:cc_full] ||= [] ret[:headers] ||= [] ret[:attachments] ||= ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/inflector.rb
Ruby
mit
228
main
544
module Postmark module Inflector extend self def to_postmark(name) name.to_s.split('_').map { |part| capitalize_first_letter(part) }.join('') end def to_ruby(name) name.to_s.scan(camel_case_regexp).join('_').downcase.to_sym end def camel_case_regexp /(?:[A-Z](?:(?:[A-Z]+(...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/error.rb
Ruby
mit
228
main
3,349
require 'postmark/deprecations' module Postmark class Error < ::StandardError; end class HttpClientError < Error def retry? true end end class HttpServerError < Error attr_accessor :status_code, :parsed_body, :body alias_method :full_response, :parsed_body def self.build(status_co...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/client.rb
Ruby
mit
228
main
2,506
require 'enumerator' module Postmark class Client attr_reader :http_client, :max_retries def initialize(api_token, options = {}) options = options.dup @max_retries = options.delete(:max_retries) || 0 @http_client = HttpClient.new(api_token, options) end def api_token=(api_token) ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/account_api_client.rb
Ruby
mit
228
main
4,521
module Postmark class AccountApiClient < Client def initialize(api_token, options = {}) options = options.dup options[:auth_header_name] = 'X-Postmark-Account-Token' super end def senders(options = {}) find_each('senders', 'SenderSignatures', options) end alias_method :s...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/bounce.rb
Ruby
mit
228
main
1,530
require 'time' module Postmark class Bounce attr_reader :email, :bounced_at, :type, :description, :details, :name, :id, :server_id, :tag, :message_id, :subject, :message_stream, :content def initialize(values = {}) values = Postmark::HashHelper.to_ruby(values) @id = values[:id] @ema...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/mail_message_converter.rb
Ruby
mit
228
main
1,890
module Postmark class MailMessageConverter def initialize(message) @message = message end def run delete_blank_fields(pick_fields(convert, @message.templated?)) end private def convert headers_part.merge(content_part) end def delete_blank_fields(message_hash) ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/deprecations.rb
Ruby
mit
228
main
865
module Postmark def self.const_missing(const_name) replacement = Deprecations.deprecated_constants.fetch(const_name, nil) || super Deprecations.report("DEPRECATION WARNING: the class #{const_name} is deprecated. Use #{replacement} instead.") replacement end module Deprecations DEFAULT_BEHAVIORS =...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/helpers/message_helper.rb
Ruby
mit
228
main
1,520
module Postmark module MessageHelper extend self def to_postmark(message = {}) message = message.dup %w(to reply_to cc bcc).each do |field| message[field.to_sym] = Array[*message[field.to_sym]].join(", ") end if message[:headers] message[:headers] = headers_to_postm...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/helpers/hash_helper.rb
Ruby
mit
228
main
1,460
module Postmark module HashHelper extend self def to_postmark(object, options = {}) deep = options.fetch(:deep, false) case object when Hash object.reduce({}) do |m, (k, v)| m.tap do |h| h[Inflector.to_postmark(k)] = deep ? to_postmark(v, options) : v ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/message_extensions/mail.rb
Ruby
mit
228
main
4,832
module Mail class Message attr_accessor :delivered, :postmark_response def delivered? self.delivered end def tag(val = nil) default 'TAG', val end def tag=(val) header['TAG'] = val end def track_links(val = nil) self.track_links=(val) unless val.nil? ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/handlers/mail.rb
Ruby
mit
228
main
691
module Mail class Postmark attr_accessor :settings def initialize(values) self.settings = { :api_token => ENV['POSTMARK_API_TOKEN'] }.merge(values) end def deliver!(mail) response = if mail.templated? api_client.deliver_message_with_template(mail) els...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/response_parsers/yajl.rb
Ruby
mit
228
main
206
require 'yajl' Yajl::Encoder.enable_json_gem_compatability module Postmark module ResponseParsers module Yajl def self.decode(data) ::Yajl::Parser.parse(data) end end end end
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
lib/postmark/response_parsers/active_support.rb
Ruby
mit
228
main
206
# assume activesupport is already loaded module Postmark module ResponseParsers module ActiveSupport def self.decode(data) ::ActiveSupport::JSON.decode(data) end end end end
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/spec_helper.rb
Ruby
mit
228
main
1,781
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'bundler' Bundler.setup(:development) require 'mail' require 'postmark' require 'active_support' require 'json' require 'fakeweb' require 'fakeweb_matcher' require 'rspec' require 'rs...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark_spec.rb
Ruby
mit
228
main
5,213
require 'spec_helper' describe Postmark do let(:api_token) { double } let(:secure) { double } let(:proxy_host) { double } let(:proxy_port) { double } let(:proxy_user) { double } let(:proxy_pass) { double } let(:host) { double } let(:port) { double } let(:path_prefix) { double } let(:max_retries) { ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/json_spec.rb
Ruby
mit
228
main
856
require 'spec_helper' describe Postmark::Json do let(:data) { {"bar" => "foo", "foo" => "bar"} } shared_examples "json parser" do it 'encodes and decodes data correctly' do hash = Postmark::Json.decode(Postmark::Json.encode(data)) expect(hash).to have_key("bar") expect(hash).to have_key("foo...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/http_client_spec.rb
Ruby
mit
228
main
10,060
require 'spec_helper' describe Postmark::HttpClient do def response_body(status, message = "") {"ErrorCode" => status, "Message" => message}.to_json end let(:api_token) { "provided-postmark-api-token" } let(:http_client) { Postmark::HttpClient.new(api_token) } subject { http_client } context "attr w...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/bounce_spec.rb
Ruby
mit
228
main
5,019
require 'spec_helper' describe Postmark::Bounce do let(:bounce_data) { {:type => "HardBounce", :message_id => "d12c2f1c-60f3-4258-b163-d17052546ae4", :type_code => 1, :description => "The server was unable to deliver your message (ex: unknown user,...