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
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/errors_helper_test.rb
Ruby
mit
48
main
1,463
require "test_helper" class ErrorsHelperTest < ActionView::TestCase setup do @object_with_no_errors = ErrorTestObject.new("title", Time.zone.today) @object_with_errors = ErrorTestObject.new(nil, nil) @object_with_unrelated_errors = ErrorTestObject.new("title", nil) @object_with_errors.validate @o...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/footer_helper_test.rb
Ruby
mit
48
main
1,792
require "test_helper" class FooterHelperTest < ActionView::TestCase context "FooterHelper" do should "show design system footer links when user is an editor" do assert_equal [ { title: "Reports, downtime and users", items: [ { text: "CSV reports", href: reports_path }, ...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/form_helper_test.rb
Ruby
mit
48
main
3,051
require "test_helper" class FormHelperTest < ActionView::TestCase context "form_errors" do should "return an unordered list with errors when there are errors present" do expected = '<div id="error-field-name"><ul class="help-block error-block"><li>One</li><li>Two</li><li>Three</li></ul></div>' asser...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/navigation_items_helper_test.rb
Ruby
mit
48
main
2,479
require "test_helper" class NavigationItemsHelperTest < ActionView::TestCase context "NavigationItemsHelper" do should "include editor-only links when user is an editor" do assert_equal [ { text: "My content", href: my_content_path, active: false }, { text: "Find content", href: find_conten...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/downtimes_helper_test.rb
Ruby
mit
48
main
2,687
require "test_helper" class DowntimesHelperTest < ActionView::TestCase include DowntimesHelper def setup @next_year = 1.year.from_now.year @edition_live = FactoryBot.create(:transaction_edition) @edition_downtime = FactoryBot.create(:transaction_edition) @downtime = FactoryBot.create( :downt...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/admin/publications_table_helper_test.rb
Ruby
mit
48
main
8,712
require "test_helper" class PublicationsTableHelperTest < ActionView::TestCase include PublicationsTableHelper context "#edition_number" do should "return the edition number for an edition that is not archived or published " do edition = FactoryBot.create( :edition, state: "draft", ...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/admin/action_helper_test.rb
Ruby
mit
48
main
4,832
require "test_helper" class ActionHelperTest < ActionView::TestCase test "it converts zendesk tickets to links" do expected_link = "https://govuk.zendesk.com/tickets/1234" texts = ["Zendesk ticket #1234", "zendesk 1234", "Zen 1234", "zen #1234", "zen#1234", "zen:1234", "zendesk: 1234"] texts.each do |te...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/admin/legacy_action_helper_test.rb
Ruby
mit
48
main
4,922
require "test_helper" class LegacyActionHelperTest < ActionView::TestCase test "it converts zendesk tickets to links" do expected_link = "https://govuk.zendesk.com/tickets/1234" texts = ["Zendesk ticket #1234", "zendesk 1234", "Zen 1234", "zen #1234", "zen#1234", "zen:1234", "zendesk: 1234"] texts.each ...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/helpers/admin/paths_helper_test.rb
Ruby
mit
48
main
2,682
require "test_helper" class PathsHelperTest < ActionView::TestCase JWT_AUTH_SECRET = "111".freeze context "#preview_edition_path" do setup do Rails.stubs(:application).returns( stub( config: stub(jwt_auth_secret: JWT_AUTH_SECRET), ), ) end context "when the editi...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/lib/sidekiq_gds_sso_middleware_test.rb
Ruby
mit
48
main
1,391
require "test_helper" class SidekiqGdsSsoMiddlewareTest < ActiveSupport::TestCase setup do @user = FactoryBot.create(:user, :govuk_editor, name: "Some Person") @warden = mock("warden") @warden.stubs({ authenticated?: true, user: @user }) end test "it will proxy a request to sidekiq web for an authen...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/lib/fact_check_email_handler_test.rb
Ruby
mit
48
main
2,062
require "test_helper" require "gmail_test_helper" class FactCheckEmailHandlerTest < ActiveSupport::TestCase setup do @gauge = stub end def handler(messages) handler = FactCheckEmailHandler.new(Publisher::Application.fact_check_config, @gauge) stub_gmail_requirements(handler, messages) handler.st...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/lib/local_service_cleaner_test.rb
Ruby
mit
48
main
1,981
require_relative "../../test_helper" class LocalServiceCleanerTest < ActiveSupport::TestCase context "removing services we don't need anymore" do setup do data = "LGSL,Description,Providing Tier\n" data += "1234,Finding Joy,all\n" data += "5678,Escaping Sadness,county/unitary\n" @input = ...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/lib/working_days_calculator_test.rb
Ruby
mit
48
main
4,211
require "test_helper" require "gds_api/test_helpers/calendars" class WorkingDaysCalculatorTest < ActiveSupport::TestCase include GdsApi::TestHelpers::Calendars test "cares about england-and-wales holidays by default" do calculator = WorkingDaysCalculator.new(Date.parse("2017-04-27")) english_and_welsh_hol...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/tagging/linkables_test.rb
Ruby
mit
48
main
1,071
require "test_helper" class LinkablesTest < ActiveSupport::TestCase setup do stub_linkables end test "returns sorted browse pages" do assert_equal( { "Benefits" => [ ["Benefits / Benefits and financial support for families (draft)", "CONTENT-ID-FAMILIES"], ["Benefits / Benefits...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/tasks/publish_missed_scheduled_editions_test.rb
Ruby
mit
48
main
1,051
require "test_helper" require "rake" class PublishMissedScheduledEditionsTaskTest < ActiveSupport::TestCase def setup Rake::Task["editions:publish_missed_scheduled_editions"].reenable end test "publishes editions that have missed their scheduled publish time" do missed_edition = FactoryBot.create(:editi...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/tasks/local_transactions_rake_test.rb
Ruby
mit
48
main
378
require "test_helper" require "rake" class LocalTransactionsRakeTest < ActiveSupport::TestCase context "local_transactions:update_services" do should "call LocalServiceImporter.run" do Rake::Task["local_transactions:update_services"].reenable LocalServiceImporter.expects(:run) Rake::Task["loca...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/tasks/access_and_permissions_test.rb
Ruby
mit
48
main
2,790
require "test_helper" require "rake" class AccessAndPermissionsTaskTest < ActiveSupport::TestCase setup do $stdout.stubs(puts: "") @add_organisation_access_task = Rake::Task["permissions:add_organisation_access"] @bulk_process_task = Rake::Task["permissions:bulk_process_access_flags"] @add_organisa...
github
alphagov/publisher
https://github.com/alphagov/publisher
test/unit/tasks/republish_content_test.rb
Ruby
mit
48
main
1,152
require "test_helper" require "rake" class RepublishContentTest < ActiveSupport::TestCase setup do @published_edition = FactoryBot.create(:answer_edition, state: "published") draft_artefact = FactoryBot.create(:draft_artefact, kind: "help_page", slug: "help/me") @draft_edition = FactoryBot.create(:help_p...
github
rbld/rebuild
https://github.com/rbld/rebuild
Rakefile
Ruby
apache-2.0
48
master
2,035
require 'rubygems' require 'rubygems/tasks' require 'rspec/core/rake_task' Gem::Tasks.new begin require 'cucumber' require 'cucumber/rake/task' def cucumber_opts(cfg) FileUtils.mkdir_p('tmp') %{ --format pretty --format rerun --out tmp/last_failed_list.txt --strict #{cfg.include?(:r...
github
rbld/rebuild
https://github.com/rbld/rebuild
rbld.gemspec
Ruby
apache-2.0
48
master
2,494
require_relative 'tools/version' Gem::Specification.new do |s| s.name = 'rbld' s.version = rbld_version s.author = 'Dmitry Fleytman' s.description = 'Zero-dependency, reproducible build environments' s.summary = "rbld-#{s.version}" s.email = 'rbld-devel@rbld.io' s.license = ...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/step_definitions/environment.rb
Ruby
apache-2.0
48
master
2,677
Given /^(?:existing )?(?:non\-modified )?(environment #{ENV_NAME_REGEX})$/ do |env| env.ensure_exists env.ensure_not_modified end Given /^(?:existing )?(?:non\-modified )?environments:$/ do |table| table.raw.each do |env_name| env = RebuildEnvironment.new(env_name[0]) env.ensure_exists env.ensure_not...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/step_definitions/utils.rb
Ruby
apache-2.0
48
master
1,232
Given(/^I successfully run `(.*)` for (\d+ times)$/) do |cmd, i| i.times do steps %Q{ Given I successfully run `#{cmd}` } end end Given(/^sample source code from "([^"]*)"$/) do |src_dir| FileUtils.cp_r(File.join(tests_root_dir, src_dir), tests_work_dir) end Given (/^I send signal "([^"]*)" to rbl...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/step_definitions/base.rb
Ruby
apache-2.0
48
master
671
Given /^existing base file (.*\.tar)$/ do |basefile| basedir = File.join( tests_work_dir, File.dirname( basefile ) ) FileUtils.mkdir_p( basedir ) cidfile = basefile + ".cid" steps %Q{ Given I successfully run `docker run --cidfile #{cidfile} #{test_env_base} echo -n` } cid = File.read(expand_path(ci...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/step_definitions/registry.rb
Ruby
apache-2.0
48
master
1,206
require 'colorize' After('@with-registry') do |scenario| if scenario.failed? STDERR.puts "== Failed with #{registry_type} registry ==".red end end Given /^remote registry is not configured$/ do rebuild_conf.fill("") end Given /^remote registry is not accessible$/ do registry_classes[:unaccessible].instan...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/step_definitions/help.rb
Ruby
apache-2.0
48
master
1,086
Given(/^I( successfully)? request help for rbld (.*)$/) do |check_status, rbld_cmd| @outputs = [] [ "help #{rbld_cmd}", "#{rbld_cmd} -h", "#{rbld_cmd} --help" ].each do |cmd| output = %x(rbld #{cmd}) @outputs << [output, $?] expect($?).to be == 0 if check_status end end def expect_hel...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/docker_registry.rb
Ruby
apache-2.0
48
master
3,888
require 'singleton' require 'docker_registry2' require 'em-proxy' class BaseDockerRegistry REGISTRY_BASE="rbld_populated_test_registry" REGISTRY_HOST="127.0.0.1" private_constant :REGISTRY_BASE, :REGISTRY_HOST private def registry_connect! DockerRegistry2.connect("http://#{REGISTRY_HOST}:#{@registry_po...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/fs_registry.rb
Ruby
apache-2.0
48
master
1,222
require 'singleton' class BaseFSRegistry private def recreate_registry FileUtils.rm_rf(@registry_path) FileUtils.mkdir_p(@registry_path) @rebuild_conf.set_registry(:rebuild, @registry_path) end public def initialize(dirname) @registry_path = File.join(fs_registry_location, dirname) @r...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/test_constants.rb
Ruby
apache-2.0
48
master
1,578
module RebuildTestConstants def test_env_base "alpine:3.4" end def registry_image_name "registry:2.5.1" end def fs_registry_location unless @fs_reg_location Aruba.configure do |c| @fs_reg_location = File.expand_path( File.join(c.root_directory, 'test_remotes') ) end end ...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/dockerhub.rb
Ruby
apache-2.0
48
master
1,104
require 'net/http' require 'uri' module Rebuild class DockerHub def kill_repos(list) list.each &method(:kill_repo) end def kill_repo(path) begin puts "Deleting DockerHub repository #{path}..." uri = "https://index.docker.io/v1/repositories/#{path}" response = issue_kill_repo_reques...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/world.rb
Ruby
apache-2.0
48
master
502
module KnowsRebuildConf def rebuild_conf @rebuild_conf ||= RebuildConfFile.new end end module KnowsRebuildVersion if ENV['TEST_WORKING_COPY'] == '1' require_relative '../../tools/version.rb' alias get_version rbld_version else def get_version file = %x(gem list -lq rbld).split("\n").first...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/rebuild_environment.rb
Ruby
apache-2.0
48
master
2,807
class RebuildEnvMgr def self.run_rbld_command(command) if ENV['TEST_WORKING_COPY'] == '1' rbld = File.expand_path('../../../cli/bin/rbld', __FILE__) else rbld = 'rbld' end cmdline = "#{rbld} #{command}" output = %x(#{cmdline} 2>&1) fail "Failed to run \"#{cmdline}\": #{output}" u...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/rebuild_conf.rb
Ruby
apache-2.0
48
master
674
class RebuildConfFile def initialize require 'ptools' require 'pathname' @conf_dir = File.join( Dir.home, '.rbld') @path_name = File.join( @conf_dir, 'rebuild.conf' ) end attr_reader :path_name def fill(content) FileUtils.mkdir_p( @conf_dir ) open(@path_name, 'w') { |f| f.write(conten...
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/platform_specific.rb
Ruby
apache-2.0
48
master
648
require 'os' require 'docker-api' def skip_this(scenario) if Cucumber::VERSION < '2' scenario.skip_invoke! else skip_this_scenario end end Before( '@skip-on-windows' ) do |scenario| skip_this( scenario ) if OS.windows? end def parse_version(v) Gem::Version.new( v ) end Docker.url = 'tcp://127.0.0....
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/dockerhub_registry.rb
Ruby
apache-2.0
48
master
1,645
require 'singleton' require 'securerandom' require_relative 'dockerhub' class BaseDockerHubRegistry private def cred(name) ENV["RBLD_CREDENTIAL_#{name.upcase}"] end def create_registry @registry_path = "#{@registry_base}-#{SecureRandom.uuid}" @dockerhub_repos << @registry_path @rebuild_conf....
github
rbld/rebuild
https://github.com/rbld/rebuild
features/support/hooks.rb
Ruby
apache-2.0
48
master
773
Before do cfg_file=rebuild_conf.path_name cfg_file_backup=cfg_file + ".backup" FileUtils.cp(cfg_file, cfg_file_backup) if File.exist?(cfg_file) if ENV['TEST_WORKING_COPY'] == '1' prepend_environment_variable('PATH', format("%s#{File::PATH_SEPARATOR}", File.expand_path('../../../cli/bin', __FILE__))) ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_fileops.rb
Ruby
apache-2.0
48
master
2,074
require 'docker' require_relative 'rbld_utils' require_relative 'rbld_print' module Rebuild::Engine extend Rebuild::Utils::Errors rebuild_errors \ EnvironmentLoadFailure: 'Failed to load environment from %s', EnvironmentSaveFailure: 'Failed to save environment %s to %s' class EnvironmentFile def init...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_reg_docker.rb
Ruby
apache-2.0
48
master
2,539
require 'docker_registry2' require_relative 'rbld_log' require_relative 'rbld_utils' require_relative 'rbld_dockerops' module Rebuild module Registry module Docker extend Rebuild::Utils::Errors rebuild_errors \ EntryNameParsingError: 'Internal registry name parsing failed: %s', APIConnectionEr...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_reg_dockerhub.rb
Ruby
apache-2.0
48
master
3,110
require 'docker_registry' require 'os' require_relative 'rbld_log' require_relative 'rbld_utils' require_relative 'rbld_dockerops' module Rebuild module Registry module DockerHub extend Rebuild::Utils::Errors rebuild_errors \ IndexConnectionError: 'Failed to access registry at %s', InternalNam...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_utils.rb
Ruby
apache-2.0
48
master
3,214
require 'delegate' require 'ruby-progressbar' require 'json' module Rebuild module Utils class Error < RuntimeError def initialize(fmt, msg) if not fmt.to_s.empty? if msg.kind_of?(Array) super( sprintf( fmt, *msg ) ) elsif super( sprintf( fmt, msg ) ) ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_verinfo.rb
Ruby
apache-2.0
48
master
431
module Rebuild module Version def self.retrieve_info git_ver_script = File.expand_path("../../../tools/version.rb", __FILE__) if File.exists?( git_ver_script ) require git_ver_script rbld_version else File.read(File.expand_path("../data/version", __FILE__)) end ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_config.rb
Ruby
apache-2.0
48
master
806
require 'parseconfig' module Rebuild class Remote def initialize(cfg) return unless cfg if @name = cfg['REMOTE_NAME'] @type = cfg["REMOTE_TYPE_#{@name}"] @path = cfg["REMOTE_#{@name}"] end end def validate! unless @valid raise 'Remote not defined' unless ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_dockerops.rb
Ruby
apache-2.0
48
master
3,255
require 'docker_registry2' require_relative 'rbld_log' require_relative 'rbld_utils' require 'highline' module Rebuild module Registry module Docker extend Rebuild::Utils::Errors rebuild_errors \ RegistryOperationError: nil, RegistryNotAuthenticatedError: nil class EnvironmentImage ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_engine.rb
Ruby
apache-2.0
48
master
20,340
require 'docker' require 'etc' require 'thread' require 'forwardable' require 'os' require_relative 'rbld_log' require_relative 'rbld_config' require_relative 'rbld_utils' require_relative 'rbld_print' require_relative 'rbld_reg_docker' require_relative 'rbld_reg_dockerhub' require_relative 'rbld_reg_fs' require_relati...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_plugins.rb
Ruby
apache-2.0
48
master
651
require 'singleton' require 'plugman' class Rebuild::PlugMgr include Singleton extend Forwardable def_delegator :@plugman, :notify private def initialize @plugman = Plugman.new( loader: loader ) @plugman.load_plugins end def loader ->(a) do plugins.each { |p| load( p ) } end ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_reg_fs.rb
Ruby
apache-2.0
48
master
2,004
require_relative 'rbld_log' require_relative 'rbld_utils' require_relative 'rbld_fileops' module Rebuild module Registry module FS extend Rebuild::Utils::Errors rebuild_error FSLookupError: 'Failed to access registry at %s' class API FILE_SFX = '.rbe' private_constant :FILE_SFX def...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_log.rb
Ruby
apache-2.0
48
master
584
require 'logger-better' require 'docker' module Rebuild module Logger def rbld_log if @rbld_logger.nil? if ENV['RBLD_LOG_LEVEL'].nil? @rbld_logger = NullLogger.new else @rbld_logger = ::Logger::Better.new ENV['RBLD_LOG_FILE'] || STDOUT @rbld_logger.level = ENV[...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_commands.rb
Ruby
apache-2.0
48
master
6,094
require_relative 'rbld_log' require_relative 'rbld_utils' require_relative 'rbld_verinfo' require_relative 'rbld_engine' require_relative 'rbld_plugins' module Rebuild::CLI extend Rebuild::Utils::Errors name_error = "Invalid %s, it may contain lowercase and uppercase letters, digits, underscores, periods and dash...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/rbld_print.rb
Ruby
apache-2.0
48
master
1,138
require 'colorize' require 'io/console' module Rebuild module Printer class RbldPrinter private def self.progress_print(msg) STDOUT.print msg.light_green STDOUT.flush end public def self.error(msg) puts puts " ERROR: #{msg}".light_red pu...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_deploy.rb
Ruby
apache-2.0
48
master
422
module Rebuild::CLI class RbldDeployCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT[:TAG]]" @description = "Deploy environment from remote registry" end def run(parameters) env = Environment.new( parameters[0] ) rbld_log.info("Going to deploy \"#{env}\"") e...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_create.rb
Ruby
apache-2.0
48
master
1,504
require 'getoptlong' module Rebuild::CLI class RbldCreateCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT]" @description = "Create a new environment" @options = [ ["-b NAME, --base NAME", "Base image from Docker Hub"], ["-f NAME, --basefile N...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_commit.rb
Ruby
apache-2.0
48
master
941
require 'getoptlong' module Rebuild::CLI class RbldCommitCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT[:TAG]]" @description = "Commit environment modifications" @options = [["-t TAG,--tag TAG", "New tag to be created"]] end def parse_opts(parameters) replace_a...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_checkout.rb
Ruby
apache-2.0
48
master
359
module Rebuild::CLI class RbldCheckoutCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT[:TAG]]" @description = "Discard environment modifications" end def run(parameters) env = Environment.new( parameters[0] ) rbld_log.info("Going to checkout #{env}") engine_...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_load.rb
Ruby
apache-2.0
48
master
613
module Rebuild::CLI class RbldLoadCommand < Command private def default_file(name, tag) "#{name}-#{tag}.rbld" end public def initialize @usage = "[OPTIONS] [FILE]" @description = "Load environment from file" end def run(parameters) file = parameters[0] rai...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_search.rb
Ruby
apache-2.0
48
master
354
module Rebuild::CLI class RbldSearchCommand < Command def initialize @usage = "[OPTIONS] [NAME[:TAG]|PREFIX]" @description = "Search remote registry for published environments" end def run(parameters) env = Environment.new(parameters[0], allow_empty: true) print_names( engine_api....
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_run.rb
Ruby
apache-2.0
48
master
973
module Rebuild::CLI class RbldRunCommand < Command include RunOptions def initialize @usage = [ { :syntax => "[OPTIONS] [ENVIRONMENT[:TAG]]", :description => "Interactive mode: opens shell in the " \ "specified enviroment" }, ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_rm.rb
Ruby
apache-2.0
48
master
1,105
module Rebuild::CLI class RbldRmCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT[:TAG]]... -- COMMANDS" @description = "Remove one or more local environments" @options = [ ["-f, --force", "force remove modified environments"] ] end def...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_status.rb
Ruby
apache-2.0
48
master
284
module Rebuild::CLI class RbldStatusCommand < Command def initialize @usage = "[OPTIONS]" @description = "List modified environments" end def run(parameters) print_names( engine_api.environments.select( &:modified? ), 'modified: ' ) end end end
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_save.rb
Ruby
apache-2.0
48
master
652
module Rebuild::CLI class RbldSaveCommand < Command private def default_file(env) "#{env.name}-#{env.tag}.rbld" end public def initialize @usage = "[OPTIONS] [ENVIRONMENT] [FILE]" @description = "Save local environment to file" end def run(parameters) env, file ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_list.rb
Ruby
apache-2.0
48
master
243
module Rebuild::CLI class RbldListCommand < Command def initialize @usage = "[OPTIONS]" @description = "List local environments" end def run(parameters) print_names( engine_api.environments ) end end end
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_modify.rb
Ruby
apache-2.0
48
master
935
module Rebuild::CLI class RbldModifyCommand < Command include RunOptions def initialize @usage = [ { :syntax => "[OPTIONS] [ENVIRONMENT[:TAG]]", :description => "Interactive mode: opens shell in the " \ "specified enviroment" }, ...
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_version.rb
Ruby
apache-2.0
48
master
272
module Rebuild::CLI class RbldVersionCommand < Command def initialize @usage = "[OPTIONS]" @description = "Show the Rebuild version information" end def run(parameters) puts "Rebuild CLI version #{Rebuild::Version.info}" end end end
github
rbld/rebuild
https://github.com/rbld/rebuild
cli/lib/commands/rbld_publish.rb
Ruby
apache-2.0
48
master
424
module Rebuild::CLI class RbldPublishCommand < Command def initialize @usage = "[OPTIONS] [ENVIRONMENT[:TAG]]" @description = "Publish environment on remote registry" end def run(parameters) env = Environment.new( parameters[0] ) rbld_log.info("Going to publish \"#{env}\"") ...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_remote_spec.rb
Ruby
apache-2.0
48
master
1,925
require_relative '../../cli/lib/rbld_config' module Rebuild describe Remote do before :each do @cfg = { 'REMOTE_NAME' => 'origin', 'REMOTE_TYPE_origin' => 'rebuild', 'REMOTE_origin' => 'origin_path' } @remote = Remote.new(@cfg) end it 'knows its name' do e...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_utils_shared.rb
Ruby
apache-2.0
48
master
304
shared_examples 'rebuild error class' do |prefix = nil| it 'derives from Rebuild::Utils::Error' do expect(described_class).to be < Rebuild::Utils::Error end it 'was defined by rebuild_error(s) function' do expect(described_class.send(:defined_by_rebuild_error_helper)).to be true end end
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_utils_spec.rb
Ruby
apache-2.0
48
master
9,642
require 'timecop' require_relative '../../cli/lib/rbld_utils' module Rebuild module Utils describe Error do context 'when format sequence is given' do it 'formats message accordingly' do expect { raise Error.new( 'test %s', 'msg' ) }.to raise_error('test msg') end end ...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_reg_docker_spec.rb
Ruby
apache-2.0
48
master
8,377
require_relative '../../cli/lib/rbld_reg_docker' require_relative 'rbld_utils_shared' module Rebuild module Registry module Docker [EntryNameParsingError, APIConnectionError].each do |c| describe c do include_examples 'rebuild error class' end end describe Entry do ...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_commands_spec.rb
Ruby
apache-2.0
48
master
6,075
require_relative '../../cli/lib/rbld_commands' require_relative 'rbld_utils_shared' module Rebuild module CLI [EnvironmentNameEmpty, EnvironmentNameWithoutTagExpected, EnvironmentNameError, HandlerClassNameError].each do |c| describe c do include_examples 'rebuild error class' ...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_engine_spec.rb
Ruby
apache-2.0
48
master
9,800
require_relative '../../cli/lib/rbld_engine' require_relative 'rbld_utils_shared' module Rebuild::Engine [UnsupportedDockerService, InaccessibleDockerService, EnvironmentIsModified, EnvironmentNotKnown, NoChangesToCommit, EnvironmentLoadFailure, EnvironmentSaveFailure, EnvironmentDeploymentFail...
github
rbld/rebuild
https://github.com/rbld/rebuild
spec/cli/rbld_reg_fs_spec.rb
Ruby
apache-2.0
48
master
267
require_relative '../../cli/lib/rbld_reg_fs' require_relative 'rbld_utils_shared' module Rebuild module Registry module FS [FSLookupError].each do |c| describe c do include_examples 'rebuild error class' end end end end end
github
rbld/rebuild
https://github.com/rbld/rebuild
tools/dockerhub-ci-clean.rb
Ruby
apache-2.0
48
master
478
#!/usr/bin/env ruby require_relative '../features/support/dockerhub' require_relative '../cli/lib/rbld_reg_dockerhub' require_relative '../features/support/test_constants' def cred(name) ENV["RBLD_CREDENTIAL_#{name.upcase}"] end path = Class.new.extend(RebuildTestConstants).dockerhub_namespace dh_registry = Rebui...
github
rbld/rebuild
https://github.com/rbld/rebuild
tools/version.rb
Ruby
apache-2.0
48
master
228
def rbld_version v = %x(git describe --tags --dirty) if m = v.match(/^v([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/) "#{m[1]}.#{m[2]}.#{m[3]}#{m[4].gsub('-', '.')}" else raise "Failed to parse version string #{v}" end end
github
rbld/rebuild
https://github.com/rbld/rebuild
tools/rebuild-conf/Rakefile
Ruby
apache-2.0
48
master
880
CONF_DIR = File.join( Dir.home, '.rbld' ) RBLD_CONF = File.expand_path( 'rebuild.conf', CONF_DIR ) CONF_CONTENTS = <<TEXT #This is a sample config file for Rebuild #Uncomment and adjust following lines #according to your registry configuration #For Docker registries #REMOTE_NAME=origin #REMOTE_TYPE_origin="docker" #R...
github
railslove/cmxl
https://github.com/railslove/cmxl
cmxl.gemspec
Ruby
mit
48
main
1,307
lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'cmxl/version' Gem::Specification.new do |spec| spec.name = 'cmxl' spec.version = Cmxl::VERSION spec.authors = ['Michael Bumann'] spec.email = ['michael@railslove.com'] spec.sum...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl.rb
Ruby
mit
48
main
1,611
require 'cmxl/version' require 'rchardet' require 'cmxl/field' require 'cmxl/statement' Dir[File.join(File.dirname(__FILE__), 'cmxl/fields', '*.rb')].each { |f| require f; } module Cmxl def self.config @config end @config = { # One or more newlines # followed by `-` at the beginning of a line. ...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/statement.rb
Ruby
mit
48
main
3,733
require 'digest/sha2' module Cmxl class Statement attr_accessor :source, :collection, :fields, :lines # Public: Initiate a new Statement and parse a provided single statement string # It directly parses the source and initiates file and transaction objects. # # Example: # # Cmxl::Statemen...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/field.rb
Ruby
mit
48
main
3,782
require 'date' module Cmxl class Field class LineFormatError < StandardError; end class Unknown < Field @parser = /(?<source>.*)/ def to_h { tag: tag, modifier: modifier, source: source } end end DATE = /(?<year>\d{0,2})(?<month>\d{2})(?<day>\d{2})/.freeze attr_accessor :...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/transaction_supplementary.rb
Ruby
mit
48
main
1,378
module Cmxl module Fields class TransactionSupplementary < Field attr_accessor :source, :initial, :charges class << self def parse(line) initial = Regexp.last_match(1) if line && line.match(initial_parser) charges = Regexp.last_match(1) if line && line.match(charges_parser...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/statement_details.rb
Ruby
mit
48
main
1,823
module Cmxl module Fields class StatementDetails < Field self.tag = 86 self.parser = /(?<transaction_code>\w{3})(?<details>(?<seperator>.).*)/ class << self def parse(line) # remove line breaks as they are allowed via documentation but not needed for data-parsing sup...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/reference.rb
Ruby
mit
48
main
381
module Cmxl module Fields class Reference < Field self.tag = 20 self.parser = /(?<statement_identifier>[a-zA-Z]{0,2})(?<date>\d{6})(?<additional_number>.*)/i def reference source end def date to_date(data['date']) end def to_h super.merge('date'...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/vmk_summary.rb
Ruby
mit
48
main
581
module Cmxl module Fields class VmkSummary < Field self.tag = 90 self.parser = /(?<entries>\d{,53})(?<currency>\w{3})(?<amount>[\d|,|\.]{1,15})/i def credit? modifier == 'C' end def debit? modifier == 'D' end def entries data['entries'].to_i ...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/account_identification.rb
Ruby
mit
48
main
297
module Cmxl module Fields class AccountIdentification < Field self.tag = 25 self.parser = /(?<bank_code>\w{8,11})\/(?<account_number>\d{0,23})(?<currency>[A-Z]{3})?|(?<country>[a-zA-Z]{2})(?<ban>\d{11,36})/i def iban "#{country}#{ban}" end end end end
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/transaction.rb
Ruby
mit
48
main
5,071
module Cmxl module Fields class Transaction < Field self.tag = 61 self.parser = %r{^(?<date>\d{6})(?<entry_date>\d{4})?(?<credit_debit_indicator>D|C|RD|RC|ED|EC)(?<currency_letter>[a-zA-Z])?(?<amount>\d{1,12},\d{0,2})(?<swift_code>(?:N|F|S).{3})(?<reference>NONREF|(.(?!\/\/)){,16}([^\/]){,1})((?:\/\/)...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/floor_limit_indicator.rb
Ruby
mit
48
main
463
module Cmxl module Fields class FloorLimitIndicator < Field self.tag = 34 self.parser = /(?<currency>[a-zA-Z]{3})(?<type_indicator>[DC]?)(?<amount>[\d|,|\.]{4,15})/i def credit? data['type_indicator'].empty? || data['type_indicator'] == 'C' end def debit? data['type...
github
railslove/cmxl
https://github.com/railslove/cmxl
lib/cmxl/fields/account_balance.rb
Ruby
mit
48
main
907
module Cmxl module Fields class AccountBalance < Field self.tag = 60 self.parser = /(?<funds_code>\A[a-zA-Z]{1})(?<date>\d{6})(?<currency>[a-zA-Z]{3})(?<amount>[\d|,|\.]{1,15})/i def date to_date(data['date']) end def credit? data['funds_code'].to_s.casecmp('C').zer...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/mt940_parsing_spec.rb
Ruby
mit
48
main
8,469
require 'spec_helper' describe 'parsing a statement' do context 'ISO 8859-1' do subject { Cmxl.parse(mt940_file('mt940-iso8859-1'))[0] } it { expect(subject.reference).to eql('1234567') } it { expect(subject.opening_balance.amount_in_cents).to eql(218_795) } it { expect(subject.closing_balance.amoun...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/field_spec.rb
Ruby
mit
48
main
1,204
require 'spec_helper' describe Cmxl::Field do subject { Cmxl::Field.new('D140829EUR000000000147,64', nil, 42) } it { expect(Cmxl::Field.parser).to eql(/(?<details>.*)/) } # default must be set it { expect(subject.to_h).to eql('tag' => 42, 'details' => 'D140829EUR000000000147,64') } it { expect(subject.to_has...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/spec_helper.rb
Ruby
mit
48
main
763
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'simplecov' SimpleCov.start require 'cmxl' puts File.join(File.dirname(__FILE__), 'support/**/*.rb').to_s Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f } RSpec.confi...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/statement_spec.rb
Ruby
mit
48
main
9,220
require 'spec_helper' describe Cmxl do context 'mt940' do context 'with details' do subject { Cmxl.parse(mt940_file('statement-details-mt940')).first.transactions.first } it { expect(subject.mt942?).to be_falsey } it { expect(subject).to be_debit } it { expect(subject).to_not be_credit }...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/support/fixtures.rb
Ruby
mit
48
main
223
def fixture_line(name) File.read(File.join(File.dirname(__FILE__), '../fixtures/lines', "#{name}.txt")) end def mt940_file(name = 'mt940') File.read(File.join(File.dirname(__FILE__), '../fixtures', "#{name}.txt")) end
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/statement_number_spec.rb
Ruby
mit
48
main
266
require 'spec_helper' describe Cmxl::Fields::StatementNumber do subject { Cmxl::Fields::StatementNumber.parse(fixture_line(:statement_number)) } it { expect(subject.statement_number).to eql('00035') } it { expect(subject.sequence_number).to eql('001') } end
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/entry_date_spec.rb
Ruby
mit
48
main
228
require 'spec_helper' describe Cmxl::Fields::EntryDate do context 'iban' do subject { Cmxl::Fields::EntryDate.parse(fixture_line(:entry_date)) } it { expect(subject.date).to eql(Date.parse('2017/12/29')) } end end
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/account_identification_spec.rb
Ruby
mit
48
main
776
require 'spec_helper' describe Cmxl::Fields::AccountIdentification do context 'legacy data' do subject { Cmxl::Fields::AccountBalance.parse(fixture_line(:account_identification_legacy)) } it { expect(subject.bank_code).to eql('70011110') } it { expect(subject.account_number).to eql('4005287001') } i...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/available_balance_spec.rb
Ruby
mit
48
main
482
require 'spec_helper' describe Cmxl::Fields::AvailableBalance do subject { Cmxl::Fields::AvailableBalance.parse(fixture_line(:available_balance)) } it { expect(subject.date).to eql(Date.new(2014, 9, 1)) } it { expect(subject).to_not be_credit } it { expect(subject).to be_debit } it { expect(subject.currency...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/transaction_supplementary_spec.rb
Ruby
mit
48
main
787
require 'spec_helper' describe Cmxl::Fields::TransactionSupplementary do let(:fixture) { 'Card Transaction/OCMT/CAD47,11/CHGS/EUR123,45' } subject(:supplementary) { described_class.parse(fixture) } it { expect(supplementary.initial_amount_in_cents).to eql(4711) } it { expect(supplementary.initial_currency).to...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/reference_spec.rb
Ruby
mit
48
main
592
require 'spec_helper' describe Cmxl::Fields::Reference do subject { Cmxl::Fields::Reference.parse(fixture_line(:reference)) } it { expect(subject.reference).to eql('D140902049') } it { expect(subject.date).to eql(Date.new(2014, 9, 2)) } it { expect(subject.statement_identifier).to eql('D') } it { expect(sub...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/account_balance_spec.rb
Ruby
mit
48
main
1,558
require 'spec_helper' require 'date' describe Cmxl::Fields::AccountBalance do context 'Credit' do subject { Cmxl::Fields::AccountBalance.parse(fixture_line(:account_balance_credit)) } it { expect(subject.date).to eql(Date.new(2014, 8, 29)) } it { expect(subject).to be_credit } it { expect(subject).to...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/closing_balance_spec.rb
Ruby
mit
48
main
431
require 'spec_helper' describe Cmxl::Fields::ClosingBalance do subject { Cmxl::Fields::ClosingBalance.parse(fixture_line(:closing_balance)) } it { expect(subject.date).to eql(Date.new(2014, 9, 1)) } it { expect(subject).to be_credit } it { expect(subject).to_not be_debit } it { expect(subject.amount).to eq...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/transaction_spec.rb
Ruby
mit
48
main
9,496
require 'spec_helper' describe Cmxl::Fields::Transaction do subject(:debit_transaction) { Cmxl::Fields::Transaction.parse(fixture[0]) } subject(:storno_credit_transaction) { Cmxl::Fields::Transaction.parse(fixture[1]) } subject(:ocmt_transaction) { Cmxl::Fields::Transaction.parse(fixture_line(:statement_ocmt)) }...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/vmk_summary_spec.rb
Ruby
mit
48
main
761
require 'spec_helper' describe Cmxl::Fields::VmkSummary do context 'credit' do subject { Cmxl::Fields::VmkSummary.parse(fixture_line(:vmk_summary_credit)) } it { expect(subject.amount).to eql(47.11) } it { expect(subject.entries).to eql(2) } it { expect(subject.currency).to eql('EUR') } it { exp...
github
railslove/cmxl
https://github.com/railslove/cmxl
spec/fields/floor_limit_indicator_spec.rb
Ruby
mit
48
main
1,038
require 'spec_helper' describe Cmxl::Fields::FloorLimitIndicator do context 'credit' do subject { Cmxl::Fields::FloorLimitIndicator.parse(fixture_line(:floor_limit_indicator_credit)) } it { expect(subject.amount).to eql(47.11) } it { expect(subject.currency).to eql('EUR') } it { expect(subject.credi...