hexsha
stringlengths
40
40
size
int64
2
1.01M
content
stringlengths
2
1.01M
avg_line_length
float64
1.5
100
max_line_length
int64
2
1k
alphanum_fraction
float64
0.25
1
d593099238bbdc0f4aeef04bb5732cda152a63a3
2,890
require 'test_helper' class InclineTest < ActiveSupport::TestCase test 'modules and classes loaded' do assert Object.const_defined? :Incline assert Incline.const_defined? :NotLoggedIn assert Incline.const_defined? :NotAuthorized assert Incline.const_defined? :InvalidApiCall assert Incline.const_defined? :VERSION assert Incline.const_defined? :Log assert Incline.const_defined? :Engine assert Incline.const_defined? :WorkPath assert Incline.const_defined? :JsonLogFormatter assert Incline.const_defined? :JsonLogger assert Incline.const_defined? :GlobalStatus assert Incline.const_defined? :DataTablesRequest assert Incline.const_defined? :DateTimeFormats assert Incline.const_defined? :NumberFormats assert Incline.const_defined? :AuthEngineBase assert Incline.const_defined? :UserManager assert Incline.const_defined? :Recaptcha assert Incline::Recaptcha.const_defined? :Tag assert Incline.const_defined? :Extensions assert Incline::Extensions.const_defined? :Object assert Incline::Extensions.const_defined? :Numeric assert Incline::Extensions.const_defined? :String assert Incline::Extensions.const_defined? :Application assert Incline::Extensions.const_defined? :ApplicationConfiguration assert Incline::Extensions.const_defined? :ActiveRecordBase assert Incline::Extensions.const_defined? :ConnectionAdapter assert Incline::Extensions.const_defined? :MainApp assert Incline::Extensions.const_defined? :ActionControllerBase assert Incline::Extensions.const_defined? :CurrentRequest assert Incline::Extensions.const_defined? :ActionMailerBase assert Incline::Extensions.const_defined? :ActionViewBase assert Incline::Extensions.const_defined? :Session assert Incline::Extensions::Session.const_defined? :Common assert Incline::Extensions::Session.const_defined? :Controller assert Incline::Extensions.const_defined? :ResourceRouteGenerator assert Incline::Extensions.const_defined? :ErbScaffoldGenerator assert Incline::Extensions.const_defined? :JbuilderGenerator assert Incline::Extensions.const_defined? :JbuilderTemplate assert Incline::Extensions.const_defined? :TestCase assert Incline::Extensions.const_defined? :IntegerValue assert Incline::Extensions.const_defined? :FloatValue assert Incline::Extensions.const_defined? :TimeZoneConverter assert Incline::Extensions.const_defined? :DateTimeValue assert Incline::Extensions.const_defined? :DateValue assert Incline::Extensions.const_defined? :DecimalValue assert Incline::Extensions.const_defined? :FormBuilder assert Incline.const_defined? :EmailValidator assert Incline.const_defined? :SafeNameValidator assert Incline.const_defined? :IpAddressValidator assert Incline.const_defined? :RecaptchaValidator end end
44.461538
71
0.794464
e8176c3cafdd2a0c0d0a4d007e209dfb18e5804f
1,255
class Bibliografia include Comparable attr_accessor :autor, :titulo, :fecha def initialize(autor, titulo, fecha) @autor = autor @titulo = titulo @fecha = fecha end def <=> (other) if @autor == other.autor @titulo <=> other.titulo else @autor <=> other.autor end end end class Libro < Bibliografia attr_accessor :serie, :editorial, :edicion, :isbn def initialize(autor, titulo, fecha, serie, editorial, edicion, isbn) super(autor, titulo, fecha) @serie = serie @editorial = editorial @edicion = edicion @isbn = isbn end end class Revista < Bibliografia attr_accessor :issn def initialize(autor, titulo, fecha, isnn) super(autor, titulo, fecha) @isnn = issn end end class Electronico < Bibliografia attr_accessor :url def initialize(autor, titulo, fecha, url) super(autor, titulo, fecha) @url = url end end class APA < Bibliografia attr_accessor :apellidos def initialize(autor,titulo,fecha,apellidos) super(autor, titulo, fecha) @apellidos = apellidos end end
19.307692
73
0.58247
7a45e8eed21375bba389e25a7f6b6eb5688ed0de
140
require 'test_helper' class MemoriesControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end end
17.5
62
0.742857
79dee93ab6192de35e09a8ba14d569ff38853eba
605
# frozen_string_literal: true module Cucumber class Runtime class AfterHooks def initialize(hooks, scenario) @hooks = hooks @scenario = scenario end def apply_to(test_case) test_case.with_steps( test_case.test_steps + after_hooks(test_case.source).reverse ) end private def after_hooks(source) @hooks.map do |hook| action = ->(result) { hook.invoke('After', @scenario.with_result(result)) } Hooks.after_hook(source, hook.location, &action) end end end end end
22.407407
85
0.598347
0807c8e5c2f11e7cf57fed41c19382b940d268f0
1,123
# -*- encoding: utf-8 -*- # stub: latex-decode 0.3.2 ruby lib Gem::Specification.new do |s| s.name = "latex-decode".freeze s.version = "0.3.2" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Sylvester Keil".freeze] s.date = "2020-10-14" s.description = "Decodes strings formatted in LaTeX to equivalent Unicode strings.".freeze s.email = ["http://sylvester.keil.or.at".freeze] s.extra_rdoc_files = ["README.md".freeze, "LICENSE".freeze] s.files = ["LICENSE".freeze, "README.md".freeze] s.homepage = "http://github.com/inukshuk/latex-decode".freeze s.licenses = ["GPL-3.0".freeze] s.rdoc_options = ["--line-numbers".freeze, "--inline-source".freeze, "--title".freeze, "\"LaTeX-Decode Documentation\"".freeze, "--main".freeze, "README.md".freeze, "--webcvs=http://github.com/inukshuk/latex-decode/tree/master/".freeze] s.rubygems_version = "3.2.15".freeze s.summary = "Decodes LaTeX to Unicode.".freeze s.installed_by_version = "3.2.15" if s.respond_to? :installed_by_version end
46.791667
238
0.69813
bb394f6faa811aad1210e2a6ec12b31ca4c85432
44
module DynamicLinks VERSION = '0.1.0' end
11
19
0.704545
3977db0520c9b05503ecb09ea4fc82000a21a547
209
class AddMaterialsTimestamps < ActiveRecord::Migration def change change_table :material_folders do |t| t.timestamps end change_table :materials do |t| t.timestamps end end end
19
54
0.698565
6ac7723e18e59ca93472426665ca6a5696d6d99b
3,945
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true config.assets.enabled = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = false # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [:request_id] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "chatwoot_#{Rails.env}" config.action_mailer.perform_caching = false config.action_mailer.default_url_options = { host: ENV['frontend_url'] } config.action_mailer.smtp_settings = { address: ENV['ses_address'], port: 587, user_name: ENV['ses_username'], # Your SMTP user password: ENV['ses_password'], # Your SMTP password authentication: :login, enable_starttls_auto: true } # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV['RAILS_LOG_TO_STDOUT'].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end
41.09375
102
0.754626
d5cb3fc9893c5289839662e4cf6a846cebf6c72f
365
class User class NotificationPresenter < BasePresenter presents :notification def link(options = {}) link_to notification.message, notification_path(notification), options end def created_at notification.created_at.strftime('%c') end def created_at_in_words time_ago_in_words notification.created_at end end end
20.277778
76
0.723288
5d605dd811b095f96a96a508972aec0956595350
3,808
# frozen_string_literal: true shared_context 'with storage' do |store, **stub_params| before do subject.object_store = store end end shared_examples "migrates" do |to_store:, from_store: nil| let(:to) { to_store } let(:from) { from_store || subject.object_store } def migrate(to) subject.migrate!(to) end def checksum Digest::SHA256.hexdigest(subject.read) end before do migrate(from) end it 'returns corresponding file type' do expect(subject).to be_an(CarrierWave::Uploader::Base) expect(subject).to be_a(ObjectStorage::Concern) if from == described_class::Store::REMOTE expect(subject.file).to be_a(CarrierWave::Storage::Fog::File) elsif from == described_class::Store::LOCAL expect(subject.file).to be_a(CarrierWave::SanitizedFile) else raise 'Unexpected file type' end end it 'does nothing when migrating to the current store' do expect { migrate(from) }.not_to change { subject.object_store }.from(from) end it 'migrate to the specified store' do from_checksum = checksum expect { migrate(to) }.to change { subject.object_store }.from(from).to(to) expect(checksum).to eq(from_checksum) end it 'removes the original file after the migration' do original_file = subject.file.path migrate(to) expect(File.exist?(original_file)).to be_falsey end it 'can access to the original file during migration' do file = subject.file allow(subject).to receive(:delete_migrated_file) { } # Remove as a callback of :migrate allow(subject).to receive(:record_upload) { } # Remove as a callback of :store (:record_upload) expect(file.exists?).to be_truthy expect { migrate(to) }.not_to change { file.exists? } end context 'when migrate! is not occupied by another process' do it 'executes migrate!' do expect(subject).to receive(:object_store=).at_least(1) migrate(to) end it 'executes use_file' do expect(subject).to receive(:unsafe_use_file).once subject.use_file end end context 'when migrate! is occupied by another process' do include ExclusiveLeaseHelpers before do stub_exclusive_lease_taken(subject.exclusive_lease_key, timeout: 1.hour.to_i) end it 'does not execute migrate!' do expect(subject).not_to receive(:unsafe_migrate!) expect { migrate(to) }.to raise_error(ObjectStorage::ExclusiveLeaseTaken) end it 'does not execute use_file' do expect(subject).not_to receive(:unsafe_use_file) expect { subject.use_file }.to raise_error(ObjectStorage::ExclusiveLeaseTaken) end end context 'migration is unsuccessful' do shared_examples "handles gracefully" do |error:| it 'does not update the object_store' do expect { migrate(to) }.to raise_error(error) expect(subject.object_store).to eq(from) end it 'does not delete the original file' do expect { migrate(to) }.to raise_error(error) expect(subject.exists?).to be_truthy end end context 'when the store is not supported' do let(:to) { -1 } # not a valid store include_examples "handles gracefully", error: ObjectStorage::UnknownStoreError end context 'upon a fog failure' do before do storage_class = subject.send(:storage_for, to).class expect_any_instance_of(storage_class).to receive(:store!).and_raise("Store failure.") end include_examples "handles gracefully", error: "Store failure." end context 'upon a database failure' do before do expect(uploader).to receive(:persist_object_store!).and_raise("ActiveRecord failure.") end include_examples "handles gracefully", error: "ActiveRecord failure." end end end
27.79562
99
0.693015
ff07cc5baacbb449b4a3fbb34357ce8c9cfd8a5f
1,019
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__) class Php54Swoole < AbstractPhp54Extension init homepage "http://pecl.php.net/package/swoole" url "http://pecl.php.net/get/swoole-1.7.17.tgz" sha256 "e4d3c2466aa1e1c99750ec5497445bde8ef775fd0b304d11016e6df363cc7ec0" head "https://github.com/swoole/swoole-src.git" bottle do sha256 "5b324d211a10e08f09d6a4ad13c9e044e8058b73ce6dfee75ec12367b31afa3f" => :yosemite sha256 "45ba76b0177896087d87b43bdeb92666e1c7cb1a9892533aaa7edaf85a259750" => :mavericks sha256 "732f01cb4417633270f3b809e721d449ec0fb0ba5b78efc058901496974e21a8" => :mountain_lion end def install Dir.chdir "swoole-#{version}" unless build.head? ENV.universal_binary if build.universal? safe_phpize system "./configure", "--prefix=#{prefix}", phpconfig system "make" prefix.install "modules/swoole.so" write_config_file if build.with? "config-file" end test do shell_output("php -m").include?("swoole") end end
31.84375
95
0.758587
bba3789a0cd34173ddd519f3ce3664468aaf6c25
3,460
class ApplicationController < ActionController::Base # require 'will_paginate/array' protect_from_forgery before_filter :set_locale # before_filter :is_browser_supported? before_filter :is_ie? before_filter :initialize_gon unless Rails.application.config.consider_all_requests_local rescue_from Exception, :with => :render_error rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found rescue_from ActionController::RoutingError, :with => :render_not_found rescue_from ActionController::UnknownController, :with => :render_not_found rescue_from ActionController::UnknownAction, :with => :render_not_found # rescue_from CanCan::AccessDenied do |exception| # redirect_to root_url, :alert => exception.message # end end Browser = Struct.new(:browser, :version) SUPPORTED_BROWSERS = [ Browser.new("Chrome", "15.0"), Browser.new("Safari", "4.0.2"), Browser.new("Firefox", "10.0.2"), Browser.new("Internet Explorer", "9.0"), Browser.new("Opera", "11.0") ] def is_browser_supported? user_agent = UserAgent.parse(request.user_agent) logger.debug "////////////////////////// BROWSER = #{user_agent}" if SUPPORTED_BROWSERS.any? { |browser| user_agent < browser } # browser not supported logger.debug "////////////////////////// BROWSER NOT SUPPORTED" render "layouts/unsupported_browser", :layout => false end end def is_ie? @is_ie = false user_agent = UserAgent.parse(request.user_agent) @is_ie = true if user_agent.browser == 'Internet Explorer' end def set_locale if params[:locale] and I18n.available_locales.include?(params[:locale].to_sym) I18n.locale = params[:locale] else I18n.locale = I18n.default_locale end end def default_url_options(options={}) { :locale => I18n.locale } end def initialize_gon gon.set = true gon.highlight_first_form_field = true x = "placeholder" gon.year_path = year_path(x).gsub(x, "") gon.first_name_path = first_name_path(x).gsub(x, "") gon.last_name_path = last_name_path(x).gsub(x, "") gon.no_data = I18n.t('app.common.no_data') @static_year = 2012 gon.static_year = @static_year # text for print and export buttons in highcharts gon.highcharts_downloadPNG = t('highcharts.downloadPNG') gon.highcharts_downloadJPEG = t('highcharts.downloadJPEG') gon.highcharts_downloadPDF = t('highcharts.downloadPDF') gon.highcharts_downloadSVG = t('highcharts.downloadSVG') gon.highcharts_exportButtonTitle = t('highcharts.exportButtonTitle') gon.highcharts_printButtonTitle = t('highcharts.printButtonTitle') if I18n.locale == :ka gon.datatable_i18n_url = "/datatable_ka.txt" else gon.datatable_i18n_url = "" end end # after user logs in, go to admin page def after_sign_in_path_for(resource) admin_path end def valid_role?(role) redirect_to root_path, :notice => t('app.msgs.not_authorized') if !current_user || !current_user.role?(role) end ####################### def render_not_found(exception) ExceptionNotifier::Notifier .exception_notification(request.env, exception) .deliver render :file => "#{Rails.root}/public/404.html", :status => 404 end def render_error(exception) ExceptionNotifier::Notifier .exception_notification(request.env, exception) .deliver render :file => "#{Rails.root}/public/500.html", :status => 500 end end
29.827586
112
0.701445
39525d7ac35ba43a3b985783b0052b363dfcb157
2,303
require 'spec_helper' describe 'is_ip_address' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { is_expected.to run.with_params([], []).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } it { is_expected.to run.with_params('1.2.3.4').and_return(true) } it { is_expected.to run.with_params('1.2.3.255').and_return(true) } it { is_expected.to run.with_params('1.2.3.256').and_return(false) } it { is_expected.to run.with_params('1.2.3').and_return(false) } it { is_expected.to run.with_params('1.2.3.4.5').and_return(false) } it { is_expected.to run.with_params('fe00::1').and_return(true) } it { is_expected.to run.with_params('fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74').and_return(true) } it { is_expected.to run.with_params('FE80:0000:CD12:D123:E2F8:47FF:FE09:DD74').and_return(true) } it { is_expected.to run.with_params('fe80:0000:cd12:d123:e2f8:47ff:fe09:zzzz').and_return(false) } it { is_expected.to run.with_params('fe80:0000:cd12:d123:e2f8:47ff:fe09').and_return(false) } it { is_expected.to run.with_params('fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74:dd74').and_return(false) } it { is_expected.to run.with_params('').and_return(false) } it { is_expected.to run.with_params('one').and_return(false) } it { is_expected.to run.with_params(1).and_return(false) } it { is_expected.to run.with_params({}).and_return(false) } it { is_expected.to run.with_params([]).and_return(false) } context 'Checking for deprecation warning', if: Puppet.version.to_f < 4.0 do # Checking for deprecation warning, which should only be provoked when the env variable for it is set. it 'should display a single deprecation' do ENV['STDLIB_LOG_DEPRECATIONS'] = "true" scope.expects(:warning).with(includes('This method is deprecated')) is_expected.to run.with_params('1.2.3.4').and_return(true) end it 'should display no warning for deprecation' do ENV['STDLIB_LOG_DEPRECATIONS'] = "false" scope.expects(:warning).with(includes('This method is deprecated')).never is_expected.to run.with_params('1.2.3.4').and_return(true) end after(:all) do ENV.delete('STDLIB_LOG_DEPRECATIONS') end end end
56.170732
113
0.719931
625af6da4206437e3242e103979e913659c7bd65
1,045
require 'rails_helper' describe SlackUtils::TextDecoder do describe '.decode' do subject do SlackUtils::TextDecoder.decode(text) end let :text do 'Hello!' end it 'decode' do expect(subject).to eq('Hello!') end context 'When include user' do let :text do 'Hoge<@U252525>Piyo' end it 'decode' do allow(SlackUtils::SingletonClient.instance).to receive(:find_user_name).and_return('Fuga') expect(subject).to eq('HogeFugaPiyo') end end context 'When include channel' do let :text do 'Hoge<#C252525>Piyo' end it 'decode' do allow(SlackUtils::SingletonClient.instance).to receive(:find_channel_name).and_return('Fuga') expect(subject).to eq('HogeFugaPiyo') end end context 'When include link' do let :text do 'Hoge<http://www.google.co.jp>Piyo' end it 'decode' do expect(subject).to eq('Hogehttp://www.google.co.jpPiyo') end end end end
20.9
101
0.606699
0136e5f5cfe85d054c950bac50fd20df23f7bca6
50
require "extpp" create_makefile("define_method")
12.5
32
0.8
793613ded61bd5d14b027338b1b28953d97ba6e8
5,361
# encoding: utf-8 require 'test_helper' class RemoteIridiumTest < Test::Unit::TestCase def setup @gateway = IridiumGateway.new(fixtures(:iridium)) @amount = 100 @credit_card = credit_card('4976000000003436', {:verification_value => '452'}) @declined_card = credit_card('4221690000004963') our_address = address(:address1 => "32 Edward Street", :address2 => "Camborne", :state => "Cornwall", :zip => "TR14 8PA", :country => "826") @options = { :order_id => generate_unique_id, :billing_address => our_address, :description => 'Store Purchase' } end def test_successful_purchase assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response.authorization, response.authorization assert response.message[/AuthCode/], response.message end def test_failed_purchase assert response = @gateway.purchase(@amount, @declined_card, @options) assert_failure response assert_equal 'Card declined', response.message end def test_authorize_and_capture amount = @amount assert auth = @gateway.authorize(amount, @credit_card, @options) assert_success auth assert auth.message[/AuthCode/], auth.message assert auth.authorization assert capture = @gateway.capture(amount, auth.authorization, @options) assert_success capture end def test_failed_capture assert response = @gateway.capture(@amount, '', @options) assert_failure response assert_match %r{Input Variable Errors}i, response.message end def test_successful_authorization assert response = @gateway.authorize(@amount, @credit_card, @options) assert response.message[/AuthCode/], response.message assert_success response assert response.test? assert !response.authorization.blank? end def test_failed_authorization assert response = @gateway.authorize(@amount, @declined_card, @options) assert response.test? assert_equal 'Card declined', response.message assert_equal false, response.success? end def test_successful_authorization_and_failed_capture assert auth = @gateway.authorize(@amount, @credit_card, @options) assert_success auth assert auth.message[/AuthCode/], auth.message assert capture = @gateway.capture(@amount + 10, auth.authorization, @options) assert_failure capture assert capture.message[/Amount exceeds that available for collection/] end def test_failed_capture_bad_auth_info assert auth = @gateway.authorize(@amount, @credit_card, @options) assert capture = @gateway.capture(@amount, "a;b;c", @options) assert_failure capture end def test_successful_purchase_by_reference assert response = @gateway.authorize(1, @credit_card, @options) assert_success response assert(reference = response.authorization) assert response = @gateway.purchase(@amount, reference, {:order_id => generate_unique_id}) assert_success response end def test_failed_purchase_by_reference assert response = @gateway.authorize(1, @credit_card, @options) assert_success response assert(reference = response.authorization) assert response = @gateway.purchase(@amount, 'bogusref', {:order_id => generate_unique_id}) assert_failure response end def test_successful_authorize_by_reference assert response = @gateway.authorize(1, @credit_card, @options) assert_success response assert(reference = response.authorization) assert response = @gateway.authorize(@amount, reference, {:order_id => generate_unique_id}) assert_success response end def test_successful_credit assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response = @gateway.credit(@amount, response.authorization) assert_success response end def test_failed_credit assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response = @gateway.credit(@amount*2, response.authorization) assert_failure response end def test_successful_void assert response = @gateway.authorize(@amount, @credit_card, @options) assert_success response assert response = @gateway.void(response.authorization) assert_success response end def test_failed_void assert response = @gateway.void("bogus") assert_failure response end def test_invalid_login gateway = IridiumGateway.new( :login => '', :password => '' ) assert response = gateway.purchase(@amount, @credit_card, @options) assert_failure response assert_match %r{Input Variable Errors}i, response.message end def test_successful_purchase_with_no_verification_value @credit_card.verification_value = nil assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response.authorization, response.authorization assert response.message[/AuthCode/], response.message end def test_successful_authorize_with_no_address @options.delete(:billing_address) assert response = @gateway.authorize(@amount, @credit_card, @options) assert_success response end end
32.295181
95
0.721694
1877e1c8dafa0f2cd4dec90c541f07886d180c84
603
maintainer "Gerhard Lazu" maintainer_email "[email protected]" license "Apache 2.0" description "Installs and maintains php and php modules" version "2.0.1" depends "build-essential" depends "xml" depends "mysql" supports "debian" supports "ubuntu" supports "centos" supports "redhat" supports "fedora" recipe "php", "Installs php" recipe "php::package", "Installs php using packages." recipe "php::source", "Installs php from source." # And many, many more PHP modules # These should be configurable. Just pass them to the providers and they will # deal with them
26.217391
77
0.716418
031e16af08338e357855235157001485194d2c21
55
require_relative "../lib/predictor" require 'ostruct'
13.75
35
0.763636
ab5d7d4fbcb3f1062fbfc6eccff014cb80d8b844
71
module Fastlane module DingtalkRobot VERSION = "0.1.4" end end
11.833333
22
0.690141
e9f8add20278d6bef957e782b96c14589c8c5e82
1,674
RSpec.describe Service, type: :model do before(:each) do create(:service) end it { is_expected.to validate_presence_of(:lgsl_code) } it { is_expected.to validate_presence_of(:label) } it { is_expected.to validate_presence_of(:slug) } it { is_expected.to validate_uniqueness_of(:lgsl_code) } it { is_expected.to validate_uniqueness_of(:label) } it { is_expected.to validate_uniqueness_of(:slug) } it { is_expected.to have_many(:service_interactions) } describe "#tiers" do subject { create(:service, :all_tiers) } let(:result) { subject.tiers } it "returns an array of tier names" do expect(result).to match_array(%w[unitary district county]) end end describe "#update_broken_link_count" do it "updates the broken_link_count" do link = create(:link, status: "broken") service = link.service expect { service.update_broken_link_count } .to change { service.broken_link_count } .from(0).to(1) end it "ignores unchecked links" do service = create(:service, broken_link_count: 1) create(:link, service: service, status: nil) expect { service.update_broken_link_count } .to change { service.broken_link_count } .from(1).to(0) end end describe "#delete_all_tiers" do it "deletes all tiers associated with a service" do service = create(:service, :all_tiers) service.delete_all_tiers expect(service.tiers).to be_empty end end describe "#required_tiers" do it "returns the correct tiers" do service = create(:service) expect(service.required_tiers("all")).to eq([2, 3, 1]) end end end
29.368421
64
0.680406
081751c0b51ded5ce581058f4a01cbcea24c9516
3,441
require 'spec_helper' require 'r10k/action/puppetfile/install' describe R10K::Action::Puppetfile::Install do let(:default_opts) { { root: "/some/nonexistent/path" } } let(:puppetfile) { R10K::Puppetfile.new('/some/nonexistent/path', {:moduledir => nil, :puppetfile_path => nil, :force => false}) } def installer(opts = {}, argv = [], settings = {}) opts = default_opts.merge(opts) return described_class.new(opts, argv, settings) end before(:each) do allow(puppetfile).to receive(:load!).and_return(nil) allow(R10K::Puppetfile).to receive(:new). with("/some/nonexistent/path", {:moduledir => nil, :puppetfile_path => nil, :force => false}). and_return(puppetfile) end it_behaves_like "a puppetfile install action" describe "installing modules" do let(:modules) do (1..4).map do |idx| R10K::Module::Base.new("author/modname#{idx}", "/some/nonexistent/path/modname#{idx}", {}) end end before do allow(puppetfile).to receive(:modules).and_return(modules) allow(puppetfile).to receive(:modules_by_vcs_cachedir).and_return({none: modules}) end it "syncs each module in the Puppetfile" do modules.each { |m| expect(m).to receive(:sync) } expect(installer.call).to eq true end it "returns false if a module failed to install" do modules[0..2].each { |m| expect(m).to receive(:sync) } expect(modules[3]).to receive(:sync).and_raise expect(installer.call).to eq false end end describe "purging" do before do allow(puppetfile).to receive(:modules).and_return([]) end it "purges the moduledir after installation" do mock_cleaner = double("cleaner") allow(puppetfile).to receive(:desired_contents).and_return(["root/foo"]) allow(puppetfile).to receive(:managed_directories).and_return(["root"]) allow(puppetfile).to receive(:purge_exclusions).and_return(["root/**/**.rb"]) expect(R10K::Util::Cleaner).to receive(:new). with(["root"], ["root/foo"], ["root/**/**.rb"]). and_return(mock_cleaner) expect(mock_cleaner).to receive(:purge!) installer.call end end describe "using custom paths" do it "can use a custom puppetfile path" do expect(R10K::Puppetfile).to receive(:new). with("/some/nonexistent/path", {:moduledir => nil, :force => false, puppetfile_path: "/some/other/path/Puppetfile"}). and_return(puppetfile) installer({puppetfile: "/some/other/path/Puppetfile"}).call end it "can use a custom moduledir path" do expect(R10K::Puppetfile).to receive(:new). with("/some/nonexistent/path", {:puppetfile_path => nil, :force => false, moduledir: "/some/other/path/site-modules"}). and_return(puppetfile) installer({moduledir: "/some/other/path/site-modules"}).call end end describe "forcing to overwrite local changes" do before do allow(puppetfile).to receive(:modules).and_return([]) end it "can use the force overwrite option" do subject = described_class.new({root: "/some/nonexistent/path", force: true}, [], {}) expect(R10K::Puppetfile).to receive(:new). with("/some/nonexistent/path", {:moduledir => nil, :puppetfile_path => nil, :force => true}). and_return(puppetfile) subject.call end end end
32.158879
101
0.642255
ab18cea08c35164209897c7ad7275f89f87767d6
160
class AddEmbargoTypeToStashEngineEmbargoes < ActiveRecord::Migration[4.2] def change add_column :stash_engine_embargoes, :embargo_type, :string end end
26.666667
73
0.80625
61814e26c0239d3ff43ecf88e520f3057c927ba0
2,168
describe Fastlane do describe Fastlane::FastFile do describe "App Store Connect API Key" do let(:fake_api_key_p8_path) { File.absolute_path("./spaceship/spec/connect_api/fixtures/asc_key.p8") } let(:fake_api_key_json_path) { "./spaceship/spec/connect_api/fixtures/asc_key.json" } let(:fake_api_key_in_house_json_path) { "./spaceship/spec/connect_api/fixtures/asc_key_in_house.json" } let(:key_id) { "D484D98393" } let(:issuer_id) { "32423-234234-234324-234" } it "with key_filepath" do result = Fastlane::FastFile.new.parse("lane :test do app_store_connect_api_key( key_id: '#{key_id}', issuer_id: '#{issuer_id}', key_filepath: '#{fake_api_key_p8_path}', ) end").runner.execute(:test) hash = { key_id: key_id, issuer_id: issuer_id, key: File.binread(fake_api_key_p8_path), duration: nil, in_house: nil } expect(result).to eq(hash) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY]).to eq(hash) end it "with key_content" do key_content = File.binread(fake_api_key_p8_path) result = Fastlane::FastFile.new.parse("lane :test do app_store_connect_api_key( key_id: '#{key_id}', issuer_id: '#{issuer_id}', key_content: '#{key_content}', duration: 200, in_house: true ) end").runner.execute(:test) hash = { key_id: key_id, issuer_id: issuer_id, key: key_content, duration: 200, in_house: true } expect(result).to eq(hash) end it "raise error when no key_filepath or key_content" do expect do Fastlane::FastFile.new.parse("lane :test do app_store_connect_api_key( key_id: '#{key_id}', issuer_id: '#{issuer_id}' ) end").runner.execute(:test) end.to raise_error(/:key_content or :key_filepath is required/) end end end end
31.42029
118
0.587638
d592379f497a4bce9b8be02599d837323240376c
1,735
# create module module RedshiftConnector module Importer end end require 'redshift_connector/importer/upsert' require 'redshift_connector/importer/insert_delta' require 'redshift_connector/importer/rebuild_rename' require 'redshift_connector/importer/rebuild_truncate' require 'redshift_connector/logger' module RedshiftConnector module Importer def Importer.for_delta_upsert(table:, columns:, delete_cond: nil, upsert_columns: nil, logger: RedshiftConnector.logger) if delete_cond and upsert_columns raise ArgumentError, "delete_cond and upsert_columns are exclusive" end importer = if delete_cond Importer::InsertDelta.new( dao: table.classify.constantize, columns: columns, delete_cond: delete_cond, logger: logger ) elsif upsert_columns Importer::Upsert.new( dao: table.classify.constantize, columns: columns, upsert_columns: upsert_columns, logger: logger ) else raise ArgumentError, "either of delete_cond or upsert_columns is required for delta import" end importer end def Importer.for_rebuild(strategy: 'rename', table:, columns:, logger: RedshiftConnector.logger) c = get_rebuild_class(strategy) c.new( dao: table.classify.constantize, columns: columns, logger: logger ) end def Importer.get_rebuild_class(strategy) case strategy.to_s when 'rename' then RebuildRename when 'truncate' then RebuildTruncate else raise ArgumentError, "unsupported rebuild strategy: #{strategy.inspect}" end end end end
29.40678
124
0.674928
ff44c8edefbf01295cac5a62639061feb5a91f25
624
Pod::Spec.new do |s| s.name = "MobileRTCSDK" s.version = "5.2.4" s.summary = "Mobile Real-Time Communication SDK" s.homepage = "https://github.com/ChaneyLau/MobileRTCSDK" s.license = 'MIT' s.author = { "Chaney Lau" => "[email protected]" } s.source = { :git => "https://github.com/ChaneyLau/MobileRTCSDK.git", :tag => s.version.to_s } s.platform = :ios, '9.0' s.requires_arc = true s.vendored_frameworks = "MobileRTCSDK/MobileRTC.framework" s.resource = "MobileRTCSDK/MobileRTCResources.bundle" end
32.842105
106
0.572115
4aab9166121d238c7e16e4e6dcfa225a34331b25
398
class ImageSweeper < ActionController::Caching::Sweeper include ::BaseSweeper observe Image def after_create(image) expire_cache_for(image) end def after_update(image) expire_cache_for(image) end def after_destroy(image) expire_cache_for(image) end private def expire_cache_for(image) image.posts.each do |post| expire_obj_cache post end end end
16.583333
55
0.728643
87235a271501aba50176984d58321cc3d37f5100
150
json.extract! purchase, :id, :item_id, :price, :shipping, :tax, :qty, :notes, :created_at, :updated_at json.url purchase_url(purchase, format: :json)
50
102
0.726667
01d02398f9a86f1c36dd64c8d44daa5e91b49c8f
8,426
require 'spec_helper' describe "exchanges:charge_unreturned_items" do include_context( 'rake', task_name: 'exchanges:charge_unreturned_items', task_path: Spree::Core::Engine.root.join('lib/tasks/exchanges.rake'), ) subject { task } describe '#prerequisites' do it { expect(subject.prerequisites).to include("environment") } end before do Spree::Config[:expedited_exchanges] = true Spree::StockItem.update_all(count_on_hand: 10) end context "there are no unreturned items" do it { expect { subject.invoke }.not_to change { Spree::Order.count } } end context "there are return items in an intermediate return status" do let!(:order) { create(:shipped_order, line_items_count: 2) } let(:return_item_1) { build(:exchange_return_item, inventory_unit: order.inventory_units.first) } let(:return_item_2) { build(:exchange_return_item, inventory_unit: order.inventory_units.last) } let!(:rma) { create(:return_authorization, order: order, return_items: [return_item_1, return_item_2]) } let!(:tax_rate) { create(:tax_rate, zone: order.tax_zone, tax_category: return_item_2.exchange_variant.tax_category) } before do rma.save! Spree::Shipment.last.ship! return_item_1.lost! return_item_2.give! Timecop.travel((Spree::Config[:expedited_exchanges_days_window] + 1).days) end after { Timecop.return } it { expect { subject.invoke }.not_to change { Spree::Order.count } } end context "there are unreturned items" do let!(:order) { create(:shipped_order, line_items_count: 2) } let(:return_item_1) { build(:exchange_return_item, inventory_unit: order.inventory_units.first) } let(:return_item_2) { build(:exchange_return_item, inventory_unit: order.inventory_units.last) } let!(:rma) { create(:return_authorization, order: order, return_items: [return_item_1, return_item_2]) } let!(:tax_rate) { create(:tax_rate, zone: order.tax_zone, tax_category: return_item_2.exchange_variant.tax_category) } before do rma.save! Spree::Shipment.last.ship! return_item_1.receive! Timecop.travel travel_time end after { Timecop.return } context "fewer than the config allowed days have passed" do let(:travel_time) { (Spree::Config[:expedited_exchanges_days_window] - 1).days } it "does not create a new order" do expect { subject.invoke }.not_to change { Spree::Order.count } end end context "more than the config allowed days have passed" do let(:travel_time) { (Spree::Config[:expedited_exchanges_days_window] + 1).days } it "creates a new completed order" do expect { subject.invoke }.to change { Spree::Order.count } expect(Spree::Order.last).to be_completed end it "sets frontend_viewable to false" do subject.invoke expect(Spree::Order.last).not_to be_frontend_viewable end it "moves the shipment for the unreturned items to the new order" do subject.invoke new_order = Spree::Order.last expect(new_order.shipments.count).to eq 1 expect(return_item_2.reload.exchange_shipment.order).to eq Spree::Order.last end it "creates line items on the order for the unreturned items" do subject.invoke expect(Spree::Order.last.line_items.map(&:variant)).to eq [return_item_2.exchange_variant] end it "associates the exchanges inventory units with the new line items" do subject.invoke expect(return_item_2.reload.exchange_inventory_unit.try(:line_item).try(:order)).to eq Spree::Order.last end it "uses the credit card from the previous order" do subject.invoke new_order = Spree::Order.last expect(new_order.credit_cards).to be_present expect(new_order.credit_cards.first).to eq order.valid_credit_cards.first end context "payments" do it "authorizes the order for the full amount of the unreturned items including taxes" do expect { subject.invoke }.to change { Spree::Payment.count }.by(1) new_order = Spree::Order.last expected_amount = return_item_2.reload.exchange_variant.price + new_order.additional_tax_total + new_order.included_tax_total + new_order.shipment_total expect(new_order.total).to eq expected_amount payment = new_order.payments.first expect(payment.amount).to eq expected_amount expect(new_order.item_total).to eq return_item_2.reload.exchange_variant.price end context "auto_capture_exchanges is true" do before do Spree::Config[:auto_capture_exchanges] = true end it 'creates a pending payment' do expect { subject.invoke }.to change { Spree::Payment.count }.by(1) payment = Spree::Payment.last expect(payment).to be_completed end end context "auto_capture_exchanges is false" do before do Spree::Config[:auto_capture_exchanges] = false end it 'captures payment' do expect { subject.invoke }.to change { Spree::Payment.count }.by(1) payment = Spree::Payment.last expect(payment).to be_pending end end end it "does not attempt to create a new order for the item more than once" do subject.invoke subject.reenable expect { subject.invoke }.not_to change { Spree::Order.count } end it "associates the store of the original order with the exchange order" do store = order.store expect(Spree::Order).to receive(:create!).once.with(hash_including({ store_id: store.id })).and_call_original subject.invoke end it 'approves the order' do subject.invoke new_order = Spree::Order.last expect(new_order).to be_approved expect(new_order.is_risky?).to eq false expect(new_order.approver_name).to eq "Spree::UnreturnedItemCharger" expect(new_order.approver).to be nil end context "there is no card from the previous order" do let!(:credit_card) { create(:credit_card, user: order.user, default: true, gateway_customer_profile_id: "BGS-123") } before { allow_any_instance_of(Spree::Order).to receive(:valid_credit_cards) { [] } } it "attempts to use the user's default card" do expect { subject.invoke }.to change { Spree::Payment.count }.by(1) new_order = Spree::Order.last expect(new_order.credit_cards).to be_present expect(new_order.credit_cards.first).to eq credit_card end end context "it is unable to authorize the credit card" do before { allow_any_instance_of(Spree::Payment).to receive(:authorize!).and_raise(RuntimeError) } it "raises an error with the order" do expect { subject.invoke }.to raise_error(Spree::ChargeUnreturnedItemsFailures) end end context "the exchange inventory unit is not shipped" do before { return_item_2.reload.exchange_inventory_unit.update_columns(state: "on hand") } it "does not create a new order" do expect { subject.invoke }.not_to change { Spree::Order.count } end end context "the exchange inventory unit has been returned" do before { return_item_2.reload.exchange_inventory_unit.update_columns(state: "returned") } it "does not create a new order" do expect { subject.invoke }.not_to change { Spree::Order.count } end end context 'rma for unreturned exchanges' do context 'config to not create' do before { Spree::Config[:create_rma_for_unreturned_exchange] = false } it 'does not create rma' do expect { subject.invoke }.not_to change { Spree::ReturnAuthorization.count } end end context 'config to create' do before do Spree::Config[:create_rma_for_unreturned_exchange] = true end it 'creates with return items' do expect { subject.invoke }.to change { Spree::ReturnAuthorization.count } rma = Spree::ReturnAuthorization.last expect(rma.return_items.all?(&:awaiting?)).to be true end end end end end end
38.474886
162
0.667695
bb2e1014abb100a8ad09c52c5dbc164e01a56878
3,721
## # Creates methods on object which delegate to an association proxy. # see delegate_belongs_to for two uses # # Todo - integrate with ActiveRecord::Dirty to make sure changes to delegate object are noticed # Should do # class User < Spree::Base; delegate_belongs_to :contact, :firstname; end # class Contact < Spree::Base; end # u = User.first # u.changed? # => false # u.firstname = 'Bobby' # u.changed? # => true # # Right now the second call to changed? would return false # # Todo - add has_one support. fairly straightforward addition ## module DelegateBelongsTo extend ActiveSupport::Concern module ClassMethods @@default_rejected_delegate_columns = ['created_at', 'created_on', 'updated_at', 'updated_on', 'lock_version', 'type', 'id', 'position', 'parent_id', 'lft', 'rgt'] mattr_accessor :default_rejected_delegate_columns ## # Creates methods for accessing and setting attributes on an association. Uses same # default list of attributes as delegates_to_association. # @todo Integrate this with ActiveRecord::Dirty, so if you set a property through one of these setters and then call save on this object, it will save the associated object automatically. # delegate_belongs_to :contact # delegate_belongs_to :contact, [:defaults] ## same as above, and useless # delegate_belongs_to :contact, [:defaults, :address, :fullname], :class_name => 'VCard' ## def delegate_belongs_to(association, *attrs) ActiveSupport::Deprecation.warn "delegate_belongs_to is deprecated. Instead use rails built in delegates.", caller opts = attrs.extract_options! initialize_association :belongs_to, association, opts attrs = get_association_column_names(association) if attrs.empty? attrs.concat get_association_column_names(association) if attrs.delete :defaults attrs.each do |attr| class_def attr do |*args| send(:delegator_for, association, attr, *args) end class_def "#{attr}=" do |val| send(:delegator_for_setter, association, attr, val) end end end protected def get_association_column_names(association, without_default_rejected_delegate_columns = true) association_klass = reflect_on_association(association).klass methods = association_klass.column_names methods.reject!{ |x| default_rejected_delegate_columns.include?(x.to_s) } if without_default_rejected_delegate_columns return methods rescue return [] end ## # initialize_association :belongs_to, :contact def initialize_association(type, association, opts = {}) raise 'Illegal or unimplemented association type.' unless [:belongs_to].include?(type.to_s.to_sym) send type, association, opts if reflect_on_association(association).nil? end private def class_def(name, method = nil, &blk) class_eval { method.nil? ? define_method(name, &blk) : define_method(name, method) } end end def delegator_for(association, attr, *args) return if self.class.column_names.include?(attr.to_s) send("#{association}=", self.class.reflect_on_association(association).klass.new) if send(association).nil? if args.empty? send(association).send(attr) else send(association).send(attr, *args) end end def delegator_for_setter(association, attr, val) return if self.class.column_names.include?(attr.to_s) send("#{association}=", self.class.reflect_on_association(association).klass.new) if send(association).nil? send(association).send("#{attr}=", val) end protected :delegator_for protected :delegator_for_setter end ActiveRecord::Base.send :include, DelegateBelongsTo
39.168421
191
0.723193
bbca18aafc53dfe8ce71badb9c85d846383822cf
941
# # Cookbook Name:: aws-proftpd # Recipe:: ec2 # # Author:: Kinesis Pty Ltd (<[email protected]>) # # Copyright (C) 2014, Kinesis Pty Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. Chef::Recipe.send(:include, Kinesis::Aws) ec2 = aws_client("EC2", node["ec2"]["placement_availability_zone"].chop) ec2.associate_address( instance_id: node["ec2"]["instance_id"], allocation_id: node["proftpd"]["eip_id"], allow_reassociation: true )
31.366667
74
0.737513
f70d2cb01385eb0ef5966c8b3d29bf95f5c251d1
1,247
# -*- encoding: utf-8 -*- require File.expand_path('../lib/arison/version', __FILE__) Gem::Specification.new do |gem| gem.name = "arison" gem.version = Arison::VERSION gem.summary = %q{activerecord-import by jsonl, command line interface} gem.description = %q{activerecord-import by jsonl, command line interface} gem.license = "MIT" gem.authors = ["Hiroshi Toyama"] gem.email = "[email protected]" gem.homepage = "https://github.com/toyama0919/arison" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] gem.add_dependency 'thor' gem.add_dependency 'activesupport' gem.add_dependency 'activerecord' gem.add_dependency 'activerecord-import' gem.add_development_dependency 'sqlite3' gem.add_development_dependency 'bundler' gem.add_development_dependency 'pry', '~> 0.10.1' gem.add_development_dependency 'rake', '~> 13.0' gem.add_development_dependency 'rspec', '~> 3.0' gem.add_development_dependency 'rubocop', '~> 0.49.0' gem.add_development_dependency 'rubygems-tasks', '~> 0.2' end
37.787879
78
0.681636
39c9782477b6be348114ca3f04919ff8d7590abc
900
def add(a, b) # return the result of adding a and b return a + b end def subtract(a, b) # return the result of subtracting b from a return a-b end def multiply(a, b) # return the result of multiplying a times b return a * b end def divide(a, b) # return the result of dividing a by b return a/b end def remainder(a, b) # return the remainder of dividing a by b using the modulo operator return a % b end def float_division(a, b) # return the result of dividing a by b as a float, rather than an integer return a.to_f/b end def string_to_number(string) # return the result of converting a string into an integer return string.to_i end def even?(number) # return true if the number is even (hint: use integer's even? method) return number.even? end def odd?(number) # return true if the number is odd (hint: use integer's odd? method) return number.odd? end
20
75
0.71
f7ef0cfd0d8c2eab51ebd547c0b3a611a38e8207
3,266
# frozen_string_literal: true module API class GroupBoards < Grape::API include BoardsResponses include PaginationParams prepend_if_ee('EE::API::BoardsResponses') # rubocop: disable Cop/InjectEnterpriseEditionModule before do authenticate! end helpers do def board_parent user_group end end params do requires :id, type: String, desc: 'The ID of a group' end resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do segment ':id/boards' do desc 'Find a group board' do detail 'This feature was introduced in 10.6' success ::API::Entities::Board end get '/:board_id' do present board, with: ::API::Entities::Board end desc 'Get all group boards' do detail 'This feature was introduced in 10.6' success Entities::Board end params do use :pagination end get '/' do present paginate(board_parent.boards.with_associations), with: Entities::Board end end params do requires :board_id, type: Integer, desc: 'The ID of a board' end segment ':id/boards/:board_id' do desc 'Get the lists of a group board' do detail 'Does not include backlog and closed lists. This feature was introduced in 10.6' success Entities::List end params do use :pagination end get '/lists' do present paginate(board_lists), with: Entities::List end desc 'Get a list of a group board' do detail 'This feature was introduced in 10.6' success Entities::List end params do requires :list_id, type: Integer, desc: 'The ID of a list' end get '/lists/:list_id' do present board_lists.find(params[:list_id]), with: Entities::List end desc 'Create a new board list' do detail 'This feature was introduced in 10.6' success Entities::List end params do use :list_creation_params end post '/lists' do authorize_list_type_resource! authorize!(:admin_list, user_group) create_list end desc 'Moves a board list to a new position' do detail 'This feature was introduced in 10.6' success Entities::List end params do requires :list_id, type: Integer, desc: 'The ID of a list' requires :position, type: Integer, desc: 'The position of the list' end put '/lists/:list_id' do list = board_lists.find(params[:list_id]) authorize!(:admin_list, user_group) move_list(list) end desc 'Delete a board list' do detail 'This feature was introduced in 10.6' success Entities::List end params do requires :list_id, type: Integer, desc: 'The ID of a board list' end delete "/lists/:list_id" do authorize!(:admin_list, user_group) list = board_lists.find(params[:list_id]) destroy_list(list) end end end end end
27.216667
98
0.585732
5daaf221ef2044122de49459ab1a7eb1127a86ff
2,073
module Spree module Core module ControllerHelpers module Locale extend ActiveSupport::Concern included do before_action :set_locale helper_method :supported_locales helper_method :supported_locales_for_all_stores helper_method :current_locale helper_method :supported_locale? helper_method :available_locales helper_method :locale_param end def set_locale I18n.locale = current_locale end def current_locale @current_locale ||= if params[:locale].present? && supported_locale?(params[:locale]) params[:locale] elsif respond_to?(:config_locale, true) && config_locale.present? config_locale else current_store&.default_locale || Rails.application.config.i18n.default_locale || I18n.default_locale end end def supported_locales @supported_locales ||= current_store&.supported_locales_list end def supported_locale?(locale_code) return false if supported_locales.nil? supported_locales.include?(locale_code&.to_s) end def supported_locales_for_all_stores @supported_locales_for_all_stores ||= (if defined?(SpreeI18n) (SpreeI18n::Locale.all << :en).map(&:to_s) else [Rails.application.config.i18n.default_locale, I18n.locale, :en] end).uniq.compact end def available_locales Spree::Store.available_locales end def locale_param return if I18n.locale.to_s == current_store.default_locale || current_store.default_locale.nil? I18n.locale.to_s end end end end end
32.904762
132
0.547033
5d93d0ab565ae41abe57498af48e98d09ddc515a
4,491
# frozen_string_literal: true require 'opal' require 'opal/builder' require 'opal/cli_runners' module Opal class CLI attr_reader :options, :file, :compiler_options, :evals, :load_paths, :argv, :output, :requires, :gems, :stubs, :verbose, :runner_options, :preload, :filename, :debug, :no_exit, :lib_only, :missing_require_severity class << self attr_accessor :stdout end def initialize(options = nil) options ||= {} # Runner @runner_type = options.delete(:runner) || :nodejs @runner_options = options.delete(:runner_options) || {} @options = options @sexp = options.delete(:sexp) @file = options.delete(:file) @no_exit = options.delete(:no_exit) @lib_only = options.delete(:lib_only) @argv = options.delete(:argv) { [] } @evals = options.delete(:evals) { [] } @load_paths = options.delete(:load_paths) { [] } @gems = options.delete(:gems) { [] } @stubs = options.delete(:stubs) { [] } @preload = options.delete(:preload) { [] } @output = options.delete(:output) { self.class.stdout || $stdout } @verbose = options.delete(:verbose) { false } @debug = options.delete(:debug) { false } @filename = options.delete(:filename) { @file && @file.path } @requires = options.delete(:requires) { [] } @missing_require_severity = options.delete(:missing_require_severity) { Opal::Config.missing_require_severity } @requires.unshift('opal') unless options.delete(:skip_opal_require) @compiler_options = Hash[ *compiler_option_names.map do |option| key = option.to_sym next unless options.key? key value = options.delete(key) [key, value] end.compact.flatten ] raise ArgumentError, 'no libraries to compile' if @lib_only && @requires.empty? raise ArgumentError, 'no runnable code provided (evals or file)' if @evals.empty? && @file.nil? && !@lib_only raise ArgumentError, "can't accept evals or file in `library only` mode" if (@evals.any? || @file) && @lib_only raise ArgumentError, "unknown options: #{options.inspect}" unless @options.empty? end def run return show_sexp if @sexp @exit_status = runner.call( options: runner_options, output: output, argv: argv, builder: builder, ) end def runner CliRunners[@runner_type] || raise(ArgumentError, "unknown runner: #{@runner_type.inspect}") end attr_reader :exit_status def builder @builder ||= create_builder end def create_builder builder = Opal::Builder.new( stubs: stubs, compiler_options: compiler_options, missing_require_severity: missing_require_severity, ) # --include builder.append_paths(*load_paths) # --gem gems.each { |gem_name| builder.use_gem gem_name } # --require requires.each { |required| builder.build(required) } # --preload preload.each { |path| builder.build_require(path) } # --verbose builder.build_str '$VERBOSE = true', '(flags)' if verbose # --debug builder.build_str '$DEBUG = true', '(flags)' if debug # --eval / stdin / file evals_or_file { |source, filename| builder.build_str(source, filename) } # --no-exit builder.build_str 'Kernel.exit', '(exit)' unless no_exit builder end def show_sexp evals_or_file do |contents, filename| buffer = ::Opal::Source::Buffer.new(filename) buffer.source = contents sexp = Opal::Parser.default_parser.parse(buffer) output.puts sexp.inspect end end def compiler_option_names %w[ method_missing arity_check dynamic_require_severity source_map_enabled irb_enabled inline_operators enable_source_location parse_comments ] end # Internal: Yields a string of source code and the proper filename for either # evals, stdin or a filepath. def evals_or_file # --library return if lib_only if evals.any? yield evals.join("\n"), '-e' elsif file && (filename != '-' || evals.empty?) yield file.read, filename end end end end
29.741722
117
0.599644
18085b4ef6578c3e77097495ef100d1fee95a4b6
4,660
class Mavsdk < Formula include Language::Python::Virtualenv desc "API and library for MAVLink compatible systems written in C++17" homepage "https://mavsdk.mavlink.io" url "https://github.com/mavlink/MAVSDK.git", tag: "v1.3.1", revision: "22168e71f1d0fd41dbe2e1c16fbf613f7e7851fe" license "BSD-3-Clause" revision 1 livecheck do url :stable regex(/^v?(\d+(?:\.\d+)+)$/i) end bottle do sha256 cellar: :any, arm64_monterey: "4bd9c69f46b688ea6e58604cbd03b949fbdf97fde57a48be53537fcec9053c0a" sha256 cellar: :any, arm64_big_sur: "56a86a6ec6e0dd883e83d11d655bed017bad79704efdfc2d43dff81ccb87c536" sha256 cellar: :any, monterey: "548c5f8fedf39c63a7fc5ced8b2c863de545377b8760c13e9b3894ddbcdf8222" sha256 cellar: :any, big_sur: "b135c2e4d2b80eeab90cd44c8e1ff9dcd5f3ae6617884710615d56f4bff2b083" sha256 cellar: :any, catalina: "55faea3ae3294c3396ec5e4756bc5304305edc41c3627067e35b80e6e4f85f3e" sha256 cellar: :any_skip_relocation, x86_64_linux: "24b769e71598261b775d63f7fd70f2316972cd33b0989aae4d7afb342bcbb913" end depends_on "cmake" => :build depends_on "[email protected]" => :build depends_on "six" => :build depends_on "abseil" depends_on "c-ares" depends_on "curl" depends_on "grpc" depends_on "jsoncpp" depends_on "[email protected]" depends_on "protobuf" depends_on "re2" depends_on "tinyxml2" uses_from_macos "zlib" on_macos do depends_on "llvm" if DevelopmentTools.clang_build_version <= 1100 end on_linux do depends_on "gcc" end fails_with :clang do build 1100 cause <<-EOS Undefined symbols for architecture x86_64: "std::__1::__fs::filesystem::__status(std::__1::__fs::filesystem::path const&, std::__1::error_code*)" EOS end fails_with gcc: "5" # To update the resources, use homebrew-pypi-poet on the PyPI package `protoc-gen-mavsdk`. # These resources are needed to install protoc-gen-mavsdk, which we use to regenerate protobuf headers. # This is needed when brewed protobuf is newer than upstream's vendored protobuf. resource "Jinja2" do url "https://files.pythonhosted.org/packages/89/e3/b36266381ae7a1310a653bb85f4f3658c462a69634fa9b2fef76252a50ed/Jinja2-3.1.1.tar.gz" sha256 "640bed4bb501cbd17194b3cace1dc2126f5b619cf068a726b98192a0fde74ae9" end resource "MarkupSafe" do url "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz" sha256 "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b" end def install # Fix version being reported as `v#{version}-dirty` inreplace "CMakeLists.txt", "OUTPUT_VARIABLE VERSION_STR", "OUTPUT_VARIABLE VERSION_STR_IGNORED" ENV.llvm_clang if OS.mac? && (DevelopmentTools.clang_build_version <= 1100) # Install protoc-gen-mavsdk deps venv_dir = buildpath/"bootstrap" venv = virtualenv_create(venv_dir, "python3") venv.pip_install resources # Install protoc-gen-mavsdk venv.pip_install "proto/pb_plugins" # Run generator script in an emulated virtual env. with_env( VIRTUAL_ENV: venv_dir, PATH: "#{venv_dir}/bin:#{ENV["PATH"]}", ) do system "tools/generate_from_protos.sh" end # Source build adapted from # https://mavsdk.mavlink.io/develop/en/contributing/build.html system "cmake", *std_cmake_args, "-Bbuild/default", "-DSUPERBUILD=OFF", "-DBUILD_SHARED_LIBS=ON", "-DBUILD_MAVSDK_SERVER=ON", "-DBUILD_TESTS=OFF", "-DVERSION_STR=v#{version}-#{tap.user}", "-DCMAKE_INSTALL_RPATH=#{rpath}", "-H." system "cmake", "--build", "build/default" system "cmake", "--build", "build/default", "--target", "install" end test do # Force use of Clang on Mojave ENV.clang if OS.mac? (testpath/"test.cpp").write <<~EOS #include <iostream> #include <mavsdk/mavsdk.h> int main() { mavsdk::Mavsdk mavsdk; std::cout << mavsdk.version() << std::endl; return 0; } EOS system ENV.cxx, "-std=c++17", testpath/"test.cpp", "-o", "test", "-I#{include}", "-L#{lib}", "-lmavsdk" assert_match "v#{version}-#{tap.user}", shell_output("./test").chomp assert_equal "Usage: #{bin}/mavsdk_server [Options] [Connection URL]", shell_output("#{bin}/mavsdk_server --help").split("\n").first end end
35.846154
140
0.668455
793b3440337ea1b832850f36d0750d7bbc5690be
80
# frozen_string_literal: true json.array! @ddcs, partial: 'ddcs/ddc', as: :ddc
20
48
0.7125
ff1b0b017c15c208dc1b507c81231c6a16fde1bb
1,844
# # Be sure to run `pod lib lint face-SDK.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'face-SDK' s.version = '1.0.0' s.summary = 'A short description of face-SDK.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! s.description = <<-DESC TODO: Add long description of the pod here. DESC s.homepage = 'https://github.com/huangmengfei/face-SDK' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'huangmengfei' => '[email protected]' } s.source = { :git => 'https://github.com/huangmengfei/face-SDK.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' s.ios.deployment_target = '9.0' # s.source_files = 'face-SDK/Classes/*' s.resources = ['face-SDK/Assets/MGFaceIDDetectResource.bundle', 'face-SDK/Assets/MGFaceIDZZIDCardResouce.bundle'] s.vendored_frameworks = 'MGFaceIDBaseKit.framework', 'MGFaceIDDetect.framework','MGFaceIDZZIDCardKit.framework' # s.resource_bundles = { # 'face-SDK' => ['face-SDK/Assets/*.png'] # } # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' s.dependency 'Masonry' end
38.416667
115
0.654555
ac5d9d7673d2a00dc8e92c24f367f06e3f7244f9
2,649
# frozen_string_literal: true module Stupidedi include Refinements module Values # # @see X222.pdf B.1.1.3.2 Repeating Data Elements # class RepeatedElementVal < AbstractElementVal # @return [CompositeElementDef, SimpleElementDef] def_delegators :@usage, :definition # @return [Array<AbstractElementVal>] attr_reader :children alias element_vals children # @return [Schema::SimpleElementUse, Schema::CompositeElementUse attr_reader :usage def_delegators :@children, :defined_at?, :length def initialize(children, usage) @children, @usage = children, usage end # @return [RepeatedElementVal] def copy(changes = {}) RepeatedElementVal.new \ changes.fetch(:children, @children), changes.fetch(:usage, @usage) end # @return false def leaf? false end # @return true def repeated? true end # @return [Boolean] def empty? @children.empty? or @children.all?(&:empty?) end def element(n, o = nil) unless n > 0 raise ArgumentError, "n must be positive" end unless o.nil? @children.at(n - 1).element(o) else @children.at(n - 1) end end # @return [void] def pretty_print(q) if @children.empty? id = definition.try do |d| ansi.bold("[#{d.id.to_s}: #{d.name.to_s}]") end q.text(ansi.repeated("RepeatedElementVal#{id}")) else q.text(ansi.repeated("RepeatedElementVal")) q.group(2, "(", ")") do q.breakable "" @children.each do |e| unless q.current_group.first? q.text ", " q.breakable end q.pp e end end end end # @return [Boolean] def ==(other) eql?(other) (other.definition == definition and other.children == @children) end end class << RepeatedElementVal ######################################################################### # @group Constructors # @return [RepeatedElementVal] def empty(element_use) RepeatedElementVal.new([], element_use) end # @return [RepeatedElementVal] def build(children, element_use) RepeatedElementVal.new(children, element_use) end # @endgroup ######################################################################### end end end
22.836207
79
0.510381
03ce633632c8f82677023c452b89d2963e6cd009
33,948
# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::ACM # @api private module ClientApi include Seahorse::Model AddTagsToCertificateRequest = Shapes::StructureShape.new(name: 'AddTagsToCertificateRequest') Arn = Shapes::StringShape.new(name: 'Arn') CertificateBody = Shapes::StringShape.new(name: 'CertificateBody') CertificateBodyBlob = Shapes::BlobShape.new(name: 'CertificateBodyBlob') CertificateChain = Shapes::StringShape.new(name: 'CertificateChain') CertificateChainBlob = Shapes::BlobShape.new(name: 'CertificateChainBlob') CertificateDetail = Shapes::StructureShape.new(name: 'CertificateDetail') CertificateOptions = Shapes::StructureShape.new(name: 'CertificateOptions') CertificateStatus = Shapes::StringShape.new(name: 'CertificateStatus') CertificateStatuses = Shapes::ListShape.new(name: 'CertificateStatuses') CertificateSummary = Shapes::StructureShape.new(name: 'CertificateSummary') CertificateSummaryList = Shapes::ListShape.new(name: 'CertificateSummaryList') CertificateTransparencyLoggingPreference = Shapes::StringShape.new(name: 'CertificateTransparencyLoggingPreference') CertificateType = Shapes::StringShape.new(name: 'CertificateType') DeleteCertificateRequest = Shapes::StructureShape.new(name: 'DeleteCertificateRequest') DescribeCertificateRequest = Shapes::StructureShape.new(name: 'DescribeCertificateRequest') DescribeCertificateResponse = Shapes::StructureShape.new(name: 'DescribeCertificateResponse') DomainList = Shapes::ListShape.new(name: 'DomainList') DomainNameString = Shapes::StringShape.new(name: 'DomainNameString') DomainStatus = Shapes::StringShape.new(name: 'DomainStatus') DomainValidation = Shapes::StructureShape.new(name: 'DomainValidation') DomainValidationList = Shapes::ListShape.new(name: 'DomainValidationList') DomainValidationOption = Shapes::StructureShape.new(name: 'DomainValidationOption') DomainValidationOptionList = Shapes::ListShape.new(name: 'DomainValidationOptionList') ExportCertificateRequest = Shapes::StructureShape.new(name: 'ExportCertificateRequest') ExportCertificateResponse = Shapes::StructureShape.new(name: 'ExportCertificateResponse') ExtendedKeyUsage = Shapes::StructureShape.new(name: 'ExtendedKeyUsage') ExtendedKeyUsageFilterList = Shapes::ListShape.new(name: 'ExtendedKeyUsageFilterList') ExtendedKeyUsageList = Shapes::ListShape.new(name: 'ExtendedKeyUsageList') ExtendedKeyUsageName = Shapes::StringShape.new(name: 'ExtendedKeyUsageName') FailureReason = Shapes::StringShape.new(name: 'FailureReason') Filters = Shapes::StructureShape.new(name: 'Filters') GetCertificateRequest = Shapes::StructureShape.new(name: 'GetCertificateRequest') GetCertificateResponse = Shapes::StructureShape.new(name: 'GetCertificateResponse') IdempotencyToken = Shapes::StringShape.new(name: 'IdempotencyToken') ImportCertificateRequest = Shapes::StructureShape.new(name: 'ImportCertificateRequest') ImportCertificateResponse = Shapes::StructureShape.new(name: 'ImportCertificateResponse') InUseList = Shapes::ListShape.new(name: 'InUseList') InvalidArgsException = Shapes::StructureShape.new(name: 'InvalidArgsException') InvalidArnException = Shapes::StructureShape.new(name: 'InvalidArnException') InvalidDomainValidationOptionsException = Shapes::StructureShape.new(name: 'InvalidDomainValidationOptionsException') InvalidParameterException = Shapes::StructureShape.new(name: 'InvalidParameterException') InvalidStateException = Shapes::StructureShape.new(name: 'InvalidStateException') InvalidTagException = Shapes::StructureShape.new(name: 'InvalidTagException') KeyAlgorithm = Shapes::StringShape.new(name: 'KeyAlgorithm') KeyAlgorithmList = Shapes::ListShape.new(name: 'KeyAlgorithmList') KeyUsage = Shapes::StructureShape.new(name: 'KeyUsage') KeyUsageFilterList = Shapes::ListShape.new(name: 'KeyUsageFilterList') KeyUsageList = Shapes::ListShape.new(name: 'KeyUsageList') KeyUsageName = Shapes::StringShape.new(name: 'KeyUsageName') LimitExceededException = Shapes::StructureShape.new(name: 'LimitExceededException') ListCertificatesRequest = Shapes::StructureShape.new(name: 'ListCertificatesRequest') ListCertificatesResponse = Shapes::StructureShape.new(name: 'ListCertificatesResponse') ListTagsForCertificateRequest = Shapes::StructureShape.new(name: 'ListTagsForCertificateRequest') ListTagsForCertificateResponse = Shapes::StructureShape.new(name: 'ListTagsForCertificateResponse') MaxItems = Shapes::IntegerShape.new(name: 'MaxItems') NextToken = Shapes::StringShape.new(name: 'NextToken') PassphraseBlob = Shapes::BlobShape.new(name: 'PassphraseBlob') PrivateKey = Shapes::StringShape.new(name: 'PrivateKey') PrivateKeyBlob = Shapes::BlobShape.new(name: 'PrivateKeyBlob') RecordType = Shapes::StringShape.new(name: 'RecordType') RemoveTagsFromCertificateRequest = Shapes::StructureShape.new(name: 'RemoveTagsFromCertificateRequest') RenewCertificateRequest = Shapes::StructureShape.new(name: 'RenewCertificateRequest') RenewalEligibility = Shapes::StringShape.new(name: 'RenewalEligibility') RenewalStatus = Shapes::StringShape.new(name: 'RenewalStatus') RenewalSummary = Shapes::StructureShape.new(name: 'RenewalSummary') RequestCertificateRequest = Shapes::StructureShape.new(name: 'RequestCertificateRequest') RequestCertificateResponse = Shapes::StructureShape.new(name: 'RequestCertificateResponse') RequestInProgressException = Shapes::StructureShape.new(name: 'RequestInProgressException') ResendValidationEmailRequest = Shapes::StructureShape.new(name: 'ResendValidationEmailRequest') ResourceInUseException = Shapes::StructureShape.new(name: 'ResourceInUseException') ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException') ResourceRecord = Shapes::StructureShape.new(name: 'ResourceRecord') RevocationReason = Shapes::StringShape.new(name: 'RevocationReason') String = Shapes::StringShape.new(name: 'String') TStamp = Shapes::TimestampShape.new(name: 'TStamp') Tag = Shapes::StructureShape.new(name: 'Tag') TagKey = Shapes::StringShape.new(name: 'TagKey') TagList = Shapes::ListShape.new(name: 'TagList') TagPolicyException = Shapes::StructureShape.new(name: 'TagPolicyException') TagValue = Shapes::StringShape.new(name: 'TagValue') TooManyTagsException = Shapes::StructureShape.new(name: 'TooManyTagsException') UpdateCertificateOptionsRequest = Shapes::StructureShape.new(name: 'UpdateCertificateOptionsRequest') ValidationEmailList = Shapes::ListShape.new(name: 'ValidationEmailList') ValidationMethod = Shapes::StringShape.new(name: 'ValidationMethod') AddTagsToCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) AddTagsToCertificateRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, required: true, location_name: "Tags")) AddTagsToCertificateRequest.struct_class = Types::AddTagsToCertificateRequest CertificateDetail.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateArn")) CertificateDetail.add_member(:domain_name, Shapes::ShapeRef.new(shape: DomainNameString, location_name: "DomainName")) CertificateDetail.add_member(:subject_alternative_names, Shapes::ShapeRef.new(shape: DomainList, location_name: "SubjectAlternativeNames")) CertificateDetail.add_member(:domain_validation_options, Shapes::ShapeRef.new(shape: DomainValidationList, location_name: "DomainValidationOptions")) CertificateDetail.add_member(:serial, Shapes::ShapeRef.new(shape: String, location_name: "Serial")) CertificateDetail.add_member(:subject, Shapes::ShapeRef.new(shape: String, location_name: "Subject")) CertificateDetail.add_member(:issuer, Shapes::ShapeRef.new(shape: String, location_name: "Issuer")) CertificateDetail.add_member(:created_at, Shapes::ShapeRef.new(shape: TStamp, location_name: "CreatedAt")) CertificateDetail.add_member(:issued_at, Shapes::ShapeRef.new(shape: TStamp, location_name: "IssuedAt")) CertificateDetail.add_member(:imported_at, Shapes::ShapeRef.new(shape: TStamp, location_name: "ImportedAt")) CertificateDetail.add_member(:status, Shapes::ShapeRef.new(shape: CertificateStatus, location_name: "Status")) CertificateDetail.add_member(:revoked_at, Shapes::ShapeRef.new(shape: TStamp, location_name: "RevokedAt")) CertificateDetail.add_member(:revocation_reason, Shapes::ShapeRef.new(shape: RevocationReason, location_name: "RevocationReason")) CertificateDetail.add_member(:not_before, Shapes::ShapeRef.new(shape: TStamp, location_name: "NotBefore")) CertificateDetail.add_member(:not_after, Shapes::ShapeRef.new(shape: TStamp, location_name: "NotAfter")) CertificateDetail.add_member(:key_algorithm, Shapes::ShapeRef.new(shape: KeyAlgorithm, location_name: "KeyAlgorithm")) CertificateDetail.add_member(:signature_algorithm, Shapes::ShapeRef.new(shape: String, location_name: "SignatureAlgorithm")) CertificateDetail.add_member(:in_use_by, Shapes::ShapeRef.new(shape: InUseList, location_name: "InUseBy")) CertificateDetail.add_member(:failure_reason, Shapes::ShapeRef.new(shape: FailureReason, location_name: "FailureReason")) CertificateDetail.add_member(:type, Shapes::ShapeRef.new(shape: CertificateType, location_name: "Type")) CertificateDetail.add_member(:renewal_summary, Shapes::ShapeRef.new(shape: RenewalSummary, location_name: "RenewalSummary")) CertificateDetail.add_member(:key_usages, Shapes::ShapeRef.new(shape: KeyUsageList, location_name: "KeyUsages")) CertificateDetail.add_member(:extended_key_usages, Shapes::ShapeRef.new(shape: ExtendedKeyUsageList, location_name: "ExtendedKeyUsages")) CertificateDetail.add_member(:certificate_authority_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateAuthorityArn")) CertificateDetail.add_member(:renewal_eligibility, Shapes::ShapeRef.new(shape: RenewalEligibility, location_name: "RenewalEligibility")) CertificateDetail.add_member(:options, Shapes::ShapeRef.new(shape: CertificateOptions, location_name: "Options")) CertificateDetail.struct_class = Types::CertificateDetail CertificateOptions.add_member(:certificate_transparency_logging_preference, Shapes::ShapeRef.new(shape: CertificateTransparencyLoggingPreference, location_name: "CertificateTransparencyLoggingPreference")) CertificateOptions.struct_class = Types::CertificateOptions CertificateStatuses.member = Shapes::ShapeRef.new(shape: CertificateStatus) CertificateSummary.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateArn")) CertificateSummary.add_member(:domain_name, Shapes::ShapeRef.new(shape: DomainNameString, location_name: "DomainName")) CertificateSummary.struct_class = Types::CertificateSummary CertificateSummaryList.member = Shapes::ShapeRef.new(shape: CertificateSummary) DeleteCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) DeleteCertificateRequest.struct_class = Types::DeleteCertificateRequest DescribeCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) DescribeCertificateRequest.struct_class = Types::DescribeCertificateRequest DescribeCertificateResponse.add_member(:certificate, Shapes::ShapeRef.new(shape: CertificateDetail, location_name: "Certificate")) DescribeCertificateResponse.struct_class = Types::DescribeCertificateResponse DomainList.member = Shapes::ShapeRef.new(shape: DomainNameString) DomainValidation.add_member(:domain_name, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "DomainName")) DomainValidation.add_member(:validation_emails, Shapes::ShapeRef.new(shape: ValidationEmailList, location_name: "ValidationEmails")) DomainValidation.add_member(:validation_domain, Shapes::ShapeRef.new(shape: DomainNameString, location_name: "ValidationDomain")) DomainValidation.add_member(:validation_status, Shapes::ShapeRef.new(shape: DomainStatus, location_name: "ValidationStatus")) DomainValidation.add_member(:resource_record, Shapes::ShapeRef.new(shape: ResourceRecord, location_name: "ResourceRecord")) DomainValidation.add_member(:validation_method, Shapes::ShapeRef.new(shape: ValidationMethod, location_name: "ValidationMethod")) DomainValidation.struct_class = Types::DomainValidation DomainValidationList.member = Shapes::ShapeRef.new(shape: DomainValidation) DomainValidationOption.add_member(:domain_name, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "DomainName")) DomainValidationOption.add_member(:validation_domain, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "ValidationDomain")) DomainValidationOption.struct_class = Types::DomainValidationOption DomainValidationOptionList.member = Shapes::ShapeRef.new(shape: DomainValidationOption) ExportCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) ExportCertificateRequest.add_member(:passphrase, Shapes::ShapeRef.new(shape: PassphraseBlob, required: true, location_name: "Passphrase")) ExportCertificateRequest.struct_class = Types::ExportCertificateRequest ExportCertificateResponse.add_member(:certificate, Shapes::ShapeRef.new(shape: CertificateBody, location_name: "Certificate")) ExportCertificateResponse.add_member(:certificate_chain, Shapes::ShapeRef.new(shape: CertificateChain, location_name: "CertificateChain")) ExportCertificateResponse.add_member(:private_key, Shapes::ShapeRef.new(shape: PrivateKey, location_name: "PrivateKey")) ExportCertificateResponse.struct_class = Types::ExportCertificateResponse ExtendedKeyUsage.add_member(:name, Shapes::ShapeRef.new(shape: ExtendedKeyUsageName, location_name: "Name")) ExtendedKeyUsage.add_member(:oid, Shapes::ShapeRef.new(shape: String, location_name: "OID")) ExtendedKeyUsage.struct_class = Types::ExtendedKeyUsage ExtendedKeyUsageFilterList.member = Shapes::ShapeRef.new(shape: ExtendedKeyUsageName) ExtendedKeyUsageList.member = Shapes::ShapeRef.new(shape: ExtendedKeyUsage) Filters.add_member(:extended_key_usage, Shapes::ShapeRef.new(shape: ExtendedKeyUsageFilterList, location_name: "extendedKeyUsage")) Filters.add_member(:key_usage, Shapes::ShapeRef.new(shape: KeyUsageFilterList, location_name: "keyUsage")) Filters.add_member(:key_types, Shapes::ShapeRef.new(shape: KeyAlgorithmList, location_name: "keyTypes")) Filters.struct_class = Types::Filters GetCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) GetCertificateRequest.struct_class = Types::GetCertificateRequest GetCertificateResponse.add_member(:certificate, Shapes::ShapeRef.new(shape: CertificateBody, location_name: "Certificate")) GetCertificateResponse.add_member(:certificate_chain, Shapes::ShapeRef.new(shape: CertificateChain, location_name: "CertificateChain")) GetCertificateResponse.struct_class = Types::GetCertificateResponse ImportCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateArn")) ImportCertificateRequest.add_member(:certificate, Shapes::ShapeRef.new(shape: CertificateBodyBlob, required: true, location_name: "Certificate")) ImportCertificateRequest.add_member(:private_key, Shapes::ShapeRef.new(shape: PrivateKeyBlob, required: true, location_name: "PrivateKey")) ImportCertificateRequest.add_member(:certificate_chain, Shapes::ShapeRef.new(shape: CertificateChainBlob, location_name: "CertificateChain")) ImportCertificateRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, location_name: "Tags")) ImportCertificateRequest.struct_class = Types::ImportCertificateRequest ImportCertificateResponse.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateArn")) ImportCertificateResponse.struct_class = Types::ImportCertificateResponse InUseList.member = Shapes::ShapeRef.new(shape: String) InvalidArgsException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidArgsException.struct_class = Types::InvalidArgsException InvalidArnException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidArnException.struct_class = Types::InvalidArnException InvalidDomainValidationOptionsException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidDomainValidationOptionsException.struct_class = Types::InvalidDomainValidationOptionsException InvalidParameterException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidParameterException.struct_class = Types::InvalidParameterException InvalidStateException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidStateException.struct_class = Types::InvalidStateException InvalidTagException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) InvalidTagException.struct_class = Types::InvalidTagException KeyAlgorithmList.member = Shapes::ShapeRef.new(shape: KeyAlgorithm) KeyUsage.add_member(:name, Shapes::ShapeRef.new(shape: KeyUsageName, location_name: "Name")) KeyUsage.struct_class = Types::KeyUsage KeyUsageFilterList.member = Shapes::ShapeRef.new(shape: KeyUsageName) KeyUsageList.member = Shapes::ShapeRef.new(shape: KeyUsage) LimitExceededException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) LimitExceededException.struct_class = Types::LimitExceededException ListCertificatesRequest.add_member(:certificate_statuses, Shapes::ShapeRef.new(shape: CertificateStatuses, location_name: "CertificateStatuses")) ListCertificatesRequest.add_member(:includes, Shapes::ShapeRef.new(shape: Filters, location_name: "Includes")) ListCertificatesRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextToken")) ListCertificatesRequest.add_member(:max_items, Shapes::ShapeRef.new(shape: MaxItems, location_name: "MaxItems")) ListCertificatesRequest.struct_class = Types::ListCertificatesRequest ListCertificatesResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextToken")) ListCertificatesResponse.add_member(:certificate_summary_list, Shapes::ShapeRef.new(shape: CertificateSummaryList, location_name: "CertificateSummaryList")) ListCertificatesResponse.struct_class = Types::ListCertificatesResponse ListTagsForCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) ListTagsForCertificateRequest.struct_class = Types::ListTagsForCertificateRequest ListTagsForCertificateResponse.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, location_name: "Tags")) ListTagsForCertificateResponse.struct_class = Types::ListTagsForCertificateResponse RemoveTagsFromCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) RemoveTagsFromCertificateRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, required: true, location_name: "Tags")) RemoveTagsFromCertificateRequest.struct_class = Types::RemoveTagsFromCertificateRequest RenewCertificateRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) RenewCertificateRequest.struct_class = Types::RenewCertificateRequest RenewalSummary.add_member(:renewal_status, Shapes::ShapeRef.new(shape: RenewalStatus, required: true, location_name: "RenewalStatus")) RenewalSummary.add_member(:domain_validation_options, Shapes::ShapeRef.new(shape: DomainValidationList, required: true, location_name: "DomainValidationOptions")) RenewalSummary.add_member(:renewal_status_reason, Shapes::ShapeRef.new(shape: FailureReason, location_name: "RenewalStatusReason")) RenewalSummary.add_member(:updated_at, Shapes::ShapeRef.new(shape: TStamp, required: true, location_name: "UpdatedAt")) RenewalSummary.struct_class = Types::RenewalSummary RequestCertificateRequest.add_member(:domain_name, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "DomainName")) RequestCertificateRequest.add_member(:validation_method, Shapes::ShapeRef.new(shape: ValidationMethod, location_name: "ValidationMethod")) RequestCertificateRequest.add_member(:subject_alternative_names, Shapes::ShapeRef.new(shape: DomainList, location_name: "SubjectAlternativeNames")) RequestCertificateRequest.add_member(:idempotency_token, Shapes::ShapeRef.new(shape: IdempotencyToken, location_name: "IdempotencyToken")) RequestCertificateRequest.add_member(:domain_validation_options, Shapes::ShapeRef.new(shape: DomainValidationOptionList, location_name: "DomainValidationOptions")) RequestCertificateRequest.add_member(:options, Shapes::ShapeRef.new(shape: CertificateOptions, location_name: "Options")) RequestCertificateRequest.add_member(:certificate_authority_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateAuthorityArn")) RequestCertificateRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, location_name: "Tags")) RequestCertificateRequest.struct_class = Types::RequestCertificateRequest RequestCertificateResponse.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, location_name: "CertificateArn")) RequestCertificateResponse.struct_class = Types::RequestCertificateResponse RequestInProgressException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) RequestInProgressException.struct_class = Types::RequestInProgressException ResendValidationEmailRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) ResendValidationEmailRequest.add_member(:domain, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "Domain")) ResendValidationEmailRequest.add_member(:validation_domain, Shapes::ShapeRef.new(shape: DomainNameString, required: true, location_name: "ValidationDomain")) ResendValidationEmailRequest.struct_class = Types::ResendValidationEmailRequest ResourceInUseException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) ResourceInUseException.struct_class = Types::ResourceInUseException ResourceNotFoundException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) ResourceNotFoundException.struct_class = Types::ResourceNotFoundException ResourceRecord.add_member(:name, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Name")) ResourceRecord.add_member(:type, Shapes::ShapeRef.new(shape: RecordType, required: true, location_name: "Type")) ResourceRecord.add_member(:value, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Value")) ResourceRecord.struct_class = Types::ResourceRecord Tag.add_member(:key, Shapes::ShapeRef.new(shape: TagKey, required: true, location_name: "Key")) Tag.add_member(:value, Shapes::ShapeRef.new(shape: TagValue, location_name: "Value")) Tag.struct_class = Types::Tag TagList.member = Shapes::ShapeRef.new(shape: Tag) TagPolicyException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) TagPolicyException.struct_class = Types::TagPolicyException TooManyTagsException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message")) TooManyTagsException.struct_class = Types::TooManyTagsException UpdateCertificateOptionsRequest.add_member(:certificate_arn, Shapes::ShapeRef.new(shape: Arn, required: true, location_name: "CertificateArn")) UpdateCertificateOptionsRequest.add_member(:options, Shapes::ShapeRef.new(shape: CertificateOptions, required: true, location_name: "Options")) UpdateCertificateOptionsRequest.struct_class = Types::UpdateCertificateOptionsRequest ValidationEmailList.member = Shapes::ShapeRef.new(shape: String) # @api private API = Seahorse::Model::Api.new.tap do |api| api.version = "2015-12-08" api.metadata = { "apiVersion" => "2015-12-08", "endpointPrefix" => "acm", "jsonVersion" => "1.1", "protocol" => "json", "serviceAbbreviation" => "ACM", "serviceFullName" => "AWS Certificate Manager", "serviceId" => "ACM", "signatureVersion" => "v4", "targetPrefix" => "CertificateManager", "uid" => "acm-2015-12-08", } api.add_operation(:add_tags_to_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "AddTagsToCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: AddTagsToCertificateRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) o.errors << Shapes::ShapeRef.new(shape: InvalidTagException) o.errors << Shapes::ShapeRef.new(shape: TooManyTagsException) o.errors << Shapes::ShapeRef.new(shape: TagPolicyException) o.errors << Shapes::ShapeRef.new(shape: InvalidParameterException) end) api.add_operation(:delete_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "DeleteCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: DeleteCertificateRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: ResourceInUseException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:describe_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "DescribeCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: DescribeCertificateRequest) o.output = Shapes::ShapeRef.new(shape: DescribeCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:export_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "ExportCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: ExportCertificateRequest) o.output = Shapes::ShapeRef.new(shape: ExportCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: RequestInProgressException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:get_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "GetCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: GetCertificateRequest) o.output = Shapes::ShapeRef.new(shape: GetCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: RequestInProgressException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:import_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "ImportCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: ImportCertificateRequest) o.output = Shapes::ShapeRef.new(shape: ImportCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: LimitExceededException) o.errors << Shapes::ShapeRef.new(shape: InvalidTagException) o.errors << Shapes::ShapeRef.new(shape: TooManyTagsException) o.errors << Shapes::ShapeRef.new(shape: TagPolicyException) o.errors << Shapes::ShapeRef.new(shape: InvalidParameterException) end) api.add_operation(:list_certificates, Seahorse::Model::Operation.new.tap do |o| o.name = "ListCertificates" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: ListCertificatesRequest) o.output = Shapes::ShapeRef.new(shape: ListCertificatesResponse) o.errors << Shapes::ShapeRef.new(shape: InvalidArgsException) o[:pager] = Aws::Pager.new( limit_key: "max_items", tokens: { "next_token" => "next_token" } ) end) api.add_operation(:list_tags_for_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "ListTagsForCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: ListTagsForCertificateRequest) o.output = Shapes::ShapeRef.new(shape: ListTagsForCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:remove_tags_from_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "RemoveTagsFromCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: RemoveTagsFromCertificateRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) o.errors << Shapes::ShapeRef.new(shape: InvalidTagException) o.errors << Shapes::ShapeRef.new(shape: TagPolicyException) o.errors << Shapes::ShapeRef.new(shape: InvalidParameterException) end) api.add_operation(:renew_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "RenewCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: RenewCertificateRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) api.add_operation(:request_certificate, Seahorse::Model::Operation.new.tap do |o| o.name = "RequestCertificate" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: RequestCertificateRequest) o.output = Shapes::ShapeRef.new(shape: RequestCertificateResponse) o.errors << Shapes::ShapeRef.new(shape: LimitExceededException) o.errors << Shapes::ShapeRef.new(shape: InvalidDomainValidationOptionsException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) o.errors << Shapes::ShapeRef.new(shape: InvalidTagException) o.errors << Shapes::ShapeRef.new(shape: TooManyTagsException) o.errors << Shapes::ShapeRef.new(shape: TagPolicyException) o.errors << Shapes::ShapeRef.new(shape: InvalidParameterException) end) api.add_operation(:resend_validation_email, Seahorse::Model::Operation.new.tap do |o| o.name = "ResendValidationEmail" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: ResendValidationEmailRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: InvalidStateException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) o.errors << Shapes::ShapeRef.new(shape: InvalidDomainValidationOptionsException) end) api.add_operation(:update_certificate_options, Seahorse::Model::Operation.new.tap do |o| o.name = "UpdateCertificateOptions" o.http_method = "POST" o.http_request_uri = "/" o.input = Shapes::ShapeRef.new(shape: UpdateCertificateOptionsRequest) o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure)) o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException) o.errors << Shapes::ShapeRef.new(shape: LimitExceededException) o.errors << Shapes::ShapeRef.new(shape: InvalidStateException) o.errors << Shapes::ShapeRef.new(shape: InvalidArnException) end) end end end
67.896
209
0.767262
abe812a6264e06323cdac47f067823bf8372c37d
5,356
# # Be sure to run `pod spec lint mvc-base.podspec' to ensure this is a # valid spec and to remove all comments including this before submitting the spec. # # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ # Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # These will help people to find your library, and whilst it # can feel like a chore to fill in it's definitely to your advantage. The # summary should be tweet-length, and the description more in depth. # s.name = "mvc-base" s.version = "0.2.9.1" s.summary = "自用代码库MVC框架" # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! s.description = <<-DESC 准确的说是MVP框架,带有侵入性的封装了UIViewController。将软件构架拆分为View(UIView和UIViewController),Presenter(业务角色),Middleware(中间件)和Model(模型),并自带一个简单的Router(路由),比VIPER要简单一点,重发代码少。 DESC s.homepage = "https://github.com/zsy78191/mvc-base" # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Licensing your code is important. See http://choosealicense.com for more info. # CocoaPods will detect a license file if there is a named LICENSE* # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. # s.license = "Apache License, Version 2.0" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the authors of the library, with email addresses. Email addresses # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also # accepts just a name if you'd rather not provide an email address. # # Specify a social_media_url where others can refer to, for example a twitter # profile URL. # s.author = { "zsy78191" => "[email protected]" } # Or just: s.author = "zsy78191" # s.authors = { "zsy78191" => "[email protected]" } # s.social_media_url = "http://twitter.com/zsy78191" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If this Pod runs only on iOS or OS X, then specify the platform and # the deployment target. You can optionally include the target after the platform. # # s.platform = :ios s.platform = :ios, "10.0" # When using multiple platforms # s.ios.deployment_target = "5.0" # s.osx.deployment_target = "10.7" # s.watchos.deployment_target = "2.0" # s.tvos.deployment_target = "9.0" # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the location from where the source should be retrieved. # Supports git, hg, bzr, svn and HTTP. # s.source = { :git => "https://github.com/zsy78191/mvc-base.git", :tag => "#{s.version}" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # CocoaPods is smart about how it includes source code. For source files # giving a folder will include any swift, h, m, mm, c & cpp files. # For header files it will include any header in the folder. # Not including the public_header_files will make all headers public. # s.source_files = "Classes", "Classes/**/*.{h,m}" s.exclude_files = "Classes/Exclude" # s.public_header_files = "Classes/**/*.h" # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # A list of resources included with the Pod. These are copied into the # target bundle with a build phase script. Anything else will be cleaned. # You can preserve files from being cleaned, please don't preserve # non-essential files like tests, examples and documentation. # # s.resource = "icon.png" # s.resources = "Resources/*.png" # s.preserve_paths = "FilesToSave", "MoreFilesToSave" # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Link your library with frameworks, or libraries. Libraries do not include # the lib prefix of their name. # # s.framework = "SomeFramework" # s.frameworks = "SomeFramework", "AnotherFramework" # s.library = "iconv" # s.libraries = "iconv", "xml2" # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If your library depends on compiler flags you can set them in the xcconfig hash # where they will only apply to your library. If you depend on other Podspecs # you can include multiple dependencies to ensure it works. # s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } s.dependency "oc-string" s.dependency "ui-base" s.dependency "ReactiveObjC" s.dependency "MagicalRecord" s.dependency "MGJRouter" s.dependency "DZNEmptyDataSet" s.dependency "Masonry" end
36.937931
156
0.603062
217eb5b13a53b4660edb7b20e79e8617f56fc911
277
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += [:session] if Rails.env.production?
39.571429
81
0.794224
01da43e9425e7a3a897cc30414ade12bbbcc8ccb
1,232
require 'polevault/migration' require 'erb' class NewMigration < Polevault::Migration def migrate # NOTE: Within this class you have access to the following variables: # # vault: Vault::Client instance configured with config # This which will have access to setup your # Vault node through the root token generated by init. See # https://github.com/hashicorp/vault-ruby for API docs # config: Figly::Settings hash that has config accessible via dot operator. # see http://github.com/onetwopunch/figly for details # kv: The kv store you specified in your config with methods read/write. # # i.e. # vault.logical.write('secret/test', value: config.custom.secret_value) vault.sys.enable_auth('github', 'github') vault.logical.write('auth/github/config', organization: 'hashicorp') vault.logical.write('auth/github/map/teams/ops', value: 'ops') # You can use ERB to inject values into policies @path = config.custom_path limited_template = File.read(File.join(Polevault.root, 'test/fixtures/policies/limited_policy.hcl.erb')) limited_policy = ERB.new(limited_template).result(binding) vault.sys.put_policy("limited", limited_policy) end end
41.066667
108
0.719156
03ace7e80573ebd3a595445ff3e21b93f4d7f2ff
379
# frozen_string_literal: true class ForkProjectsFinder < ProjectsFinder # rubocop: disable CodeReuse/ActiveRecord def initialize(project, params: {}, current_user: nil) project_ids = project.forks.includes(:creator).select(:id) super(params: params, current_user: current_user, project_ids_relation: project_ids) end # rubocop: enable CodeReuse/ActiveRecord end
34.454545
88
0.781003
4a0816c543ae59cd9cf7b2b071b6e9e6815185b4
112
class TripSerializer < ApplicationSerializer attributes :id, :headsign, :shape_id, :block_id, :remote_id end
22.4
61
0.785714
ed9c590102b58fc87a08932fe3a17de4e4e70913
4,189
#windows用 ::RBNACL_LIBSODIUM_GEM_LIB_PATH = "c:/msys64/mingw64/bin/libsodium-23.dll" require 'discordrb' require 'dotenv' #require 'rest-client' #require 'json' ### Google Cloud Platform APIs require 'googleauth' require 'googleauth/stores/file_token_store' require 'google/apis/compute_v1' require 'pp' Dotenv.load scope = ['https://www.googleapis.com/auth/compute'] client = Google::Apis::ComputeV1::ComputeService.new client.authorization = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open('gce-api.json'), scope: scope ) payload = { :project => ENV["PROJECT"], :zone => ENV["ZONE"], :resourceId => ENV["RESOURCE_ID"] }#.to_json bot = Discordrb::Commands::CommandBot.new( token: ENV["TOKEN"], client_id: ENV["CLIENT_ID"], prefix:'/', ) ### メモ # bot.send_message ( @channel, message ) => @channel にメッセージを送る # event.send_message (message) => event... コマンドを受け取ったならそのテキストサーバー,voice_state_updateならVoiceStateUpdateEvent,等になる bot.ready do bot.game = "Megaria" bot.servers.each_value do |srv| if srv.name == "test" @inform_channel = srv.channels.find{|s| s.type == 0} @in_voice_server_people = srv.channels.find{|s| s.type == 2}.users.size end end p @in_voice_server_people end start_proc = Proc.new do |event| begin bot.send_message(@inform_channel,"Order : Start server") res = client.start_instance( payload[:project], payload[:zone], payload[:resourceId] ) bot.send_message(@inform_channel,"Server starting ...") res_status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) while res_status.status != "RUNNING" sleep 1 res_status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) p res_status.status end status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) address = status.network_interfaces.first.access_configs.first.nat_ip message = "Server is running at #{address}" bot.send_message(@inform_channel,message) rescue => e p e end end stop_proc = Proc.new do |event| begin bot.send_message(@inform_channel,"Order : Stop server") res = client.stop_instance( payload[:project], payload[:zone], payload[:resourceId] ) bot.send_message(@inform_channel, "Server stopping ...") res_status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) while res_status.status != "TERMINATED" sleep 1 res_status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) p res_status.status end bot.send_message(@inform_channel,"Server is stopped.") rescue => e p e end end bot.command :hello do |event| event.send_message("Hello, #{event.user.name}") event.send_message("/Help でコマンド一覧を表示") end # voice_channnelへの入退室を検知して発火 bot.voice_state_update do |event| user = event.user.name if event.channel.nil? if event.old_channel.users.size < 1 p "left #{user} from #{event.old_channel.name}" bot.send_message(@inform_channel, "誰もおらんくなったのでサーバーを止めるマン") @in_voice_server_people -= 1 end # stop_proc.call(event) else if event.channel.users.size > @in_voice_server_people p "join #{user} to #{event.channel.name}" bot.send_message(@inform_channel,"#{user} is joined #{event.channel.name}") @in_voice_server_people += 1 end end end bot.command :start do |event| start_proc.call(event) end bot.command :stop do |event| stop_proc.call(event) end bot.command :status do |event| status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) event.send_message("Server is #{status.status}") end bot.command :addr do |event| status = client.get_instance( payload[:project], payload[:zone], payload[:resourceId]) event.send_message(status.network_interfaces.first.access_configs.first.nat_ip) end bot.command :help do |event| event.send_message("挨拶: /hello") event.send_message("サーバーの起動: /start") event.send_message("サーバーの停止: /stop") event.send_message("サーバーの状態: /status") event.send_message("サーバーアドレスの表示: /addr") end bot.run
27.559211
112
0.707806
b9e0e2078caaf4e30b5862657d0f010863d57873
38,627
##########################GO-LICENSE-START################################ # Copyright 2018 ThoughtWorks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ##########################GO-LICENSE-END################################## Rails.application.routes.draw do unless defined?(CONSTANTS) CONFIG_REPO_ID_FORMAT = ROLE_NAME_FORMAT = ELASTIC_AGENT_PROFILE_ID_FORMAT = USER_NAME_FORMAT = GROUP_NAME_FORMAT = TEMPLATE_NAME_FORMAT = PIPELINE_NAME_FORMAT = STAGE_NAME_FORMAT = ENVIRONMENT_NAME_FORMAT = /[\w\-][\w\-.]*/ JOB_NAME_FORMAT = /[\w\-.]+/ PIPELINE_COUNTER_FORMAT = STAGE_COUNTER_FORMAT = /-?\d+/ NON_NEGATIVE_INTEGER = /\d+/ PIPELINE_LOCATOR_CONSTRAINTS = {:pipeline_name => PIPELINE_NAME_FORMAT, :pipeline_counter => PIPELINE_COUNTER_FORMAT} STAGE_LOCATOR_CONSTRAINTS = {:stage_name => STAGE_NAME_FORMAT, :stage_counter => STAGE_COUNTER_FORMAT}.merge(PIPELINE_LOCATOR_CONSTRAINTS) ENVIRONMENT_NAME_CONSTRAINT = {:name => ENVIRONMENT_NAME_FORMAT} MERGED_ENVIRONMENT_NAME_CONSTRAINT = {:environment_name => ENVIRONMENT_NAME_FORMAT} PLUGIN_ID_FORMAT = /[\w\-.]+/ ALLOW_DOTS = /[^\/]+/ CONSTANTS = true end # This is used to generate _url and _path in application_helper#url_for_path get '/', to: redirect('/go/pipelines'), as: :root get "about", controller: :about, action: :show, as: :about get "admin/pipelines/snippet" => "admin/pipelines_snippet#index", as: :pipelines_snippet get "admin/pipelines/snippet/:group_name" => "admin/pipelines_snippet#show", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipelines_snippet_show get "admin/pipelines/snippet/:group_name/edit" => "admin/pipelines_snippet#edit", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipelines_snippet_edit put "admin/pipelines/snippet/:group_name" => "admin/pipelines_snippet#update", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipelines_snippet_update get 'admin/backup' => 'admin/backup#index', as: :backup_server post 'admin/backup' => 'admin/backup#perform_backup', as: :perform_backup ["svn", "git", "hg", "p4", "dependency", "tfs", "package"].each do |material_type| get "admin/pipelines/:pipeline_name/materials/#{material_type}/new" => "admin/materials/#{material_type}#new", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: "admin_#{material_type}_new" post "admin/pipelines/:pipeline_name/materials/#{material_type}" => "admin/materials/#{material_type}#create", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: "admin_#{material_type}_create" get "admin/pipelines/:pipeline_name/materials/#{material_type}/:finger_print/edit" => "admin/materials/#{material_type}#edit", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: "admin_#{material_type}_edit" put "admin/pipelines/:pipeline_name/materials/#{material_type}/:finger_print" => "admin/materials/#{material_type}#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: "admin_#{material_type}_update" end defaults :no_layout => true do get "admin/pipelines/:pipeline_name/materials/dependency/pipeline_name_search" => "admin/materials/dependency#pipeline_name_search", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_dependency_material_pipeline_name_search get "admin/pipelines/:pipeline_name/materials/dependency/load_stage_names_for" => "admin/materials/dependency#load_stage_names_for", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_dependency_material_load_stage_names_for end get "admin/:stage_parent/:pipeline_name/materials" => "admin/materials#index", constraints: {stage_parent: "pipelines", pipeline_name: PIPELINE_NAME_FORMAT}, defaults: {stage_parent: "pipelines"}, as: :admin_material_index delete "admin/:stage_parent/:pipeline_name/materials/:finger_print" => "admin/materials#destroy", constraints: {stage_parent: "pipelines", pipeline_name: PIPELINE_NAME_FORMAT}, defaults: {stage_parent: "pipelines"}, as: :admin_material_delete get "admin/pipeline/new" => "admin/pipelines#new", as: :pipeline_new post "admin/pipelines" => "admin/pipelines#create", as: :pipeline_create get "admin/pipeline/:pipeline_name/clone" => "admin/pipelines#clone", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :pipeline_clone post "admin/pipeline/save_clone" => "admin/pipelines#save_clone", as: :pipeline_save_clone get "admin/pipelines/:pipeline_name/pause_info.json" => "admin/pipelines#pause_info", :format => "json", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :pause_info_refresh get "admin/:stage_parent/:pipeline_name/:current_tab" => "admin/pipelines#edit", constraints: {stage_parent: "pipelines", pipeline_name: PIPELINE_NAME_FORMAT, current_tab: /#{["general", "project_management", "environment_variables", "permissions", "parameters"].join("|")}/}, defaults: {stage_parent: "pipelines"}, as: :pipeline_edit put "admin/:stage_parent/:pipeline_name/:current_tab" => "admin/pipelines#update", constraints: {stage_parent: "pipelines", pipeline_name: PIPELINE_NAME_FORMAT, current_tab: /#{["general", "project_management", "environment_variables", "permissions", "parameters"].join("|")}/}, defaults: {stage_parent: "pipelines"}, as: :pipeline_update get "admin/:stage_parent/:pipeline_name/stages" => "admin/stages#index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_stage_listing put "admin/:stage_parent/:pipeline_name/stages" => "admin/stages#use_template", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_stage_use_template get "admin/:stage_parent/:pipeline_name/stages/new" => "admin/stages#new", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_stage_new delete "admin/:stage_parent/:pipeline_name/stages/:stage_name" => "admin/stages#destroy", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, stage_name: STAGE_NAME_FORMAT}, as: :admin_stage_delete post "admin/:stage_parent/:pipeline_name/stages" => "admin/stages#create", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_stage_create post "admin/:stage_parent/:pipeline_name/stages/:stage_name/index/increment" => "admin/stages#increment_index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, stage_name: STAGE_NAME_FORMAT}, as: :admin_stage_increment_index post "admin/:stage_parent/:pipeline_name/stages/:stage_name/index/decrement" => "admin/stages#decrement_index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, stage_name: STAGE_NAME_FORMAT}, as: :admin_stage_decrement_index get "admin/:stage_parent/:pipeline_name/stages/:stage_name/:current_tab" => "admin/stages#edit", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, current_tab: /(settings|environment_variables|permissions)/, stage_name: STAGE_NAME_FORMAT}, as: :admin_stage_edit put "admin/:stage_parent/:pipeline_name/stages/:stage_name/:current_tab" => "admin/stages#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, current_tab: /(settings|environment_variables|permissions)/, stage_name: STAGE_NAME_FORMAT}, as: :admin_stage_update get "admin/:stage_parent/:pipeline_name/stages/:stage_name/jobs" => "admin/jobs#index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_job_listing get "admin/:stage_parent/:pipeline_name/stages/:stage_name/jobs/new" => "admin/jobs#new", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_job_new post "admin/:stage_parent/:pipeline_name/stages/:stage_name/jobs" => "admin/jobs#create", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, as: :admin_job_create put "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/:current_tab" => "admin/jobs#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, job_name: JOB_NAME_FORMAT}, as: :admin_job_update #TODO: use job name format, so part splitting doesn't mess us up -JJ delete "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name" => "admin/jobs#destroy", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, job_name: JOB_NAME_FORMAT}, as: :admin_job_delete get "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/:current_tab" => "admin/jobs#edit", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, current_tab: /#{["settings", "environment_variables", "artifacts", "resources", "tabs"].join("|")}/, job_name: JOB_NAME_FORMAT}, as: :admin_job_edit #put "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/:current_tab" => "admin/jobs#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_parent: /(pipelines|templates)/, current_tab: /#{["settings", "environment_variables", "artifacts", "resources", "tabs"].join("|")}/, job_name: JOB_NAME_FORMAT}, as: :admin_job_update get "admin/commands" => "admin/commands#index", as: :admin_commands get "admin/commands/show" => "admin/commands#show", as: :admin_command_definition get "admin/commands/lookup" => "admin/commands#lookup", :format => "text", as: :admin_command_lookup get "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks" => "admin/tasks#index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_tasks_listing get "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks/:type/new" => "admin/tasks#new", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_new post "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks/:type" => "admin/tasks#create", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_create post "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/task/:task_index/index/increment" => "admin/tasks#increment_index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_increment_index post "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/task/:task_index/index/decrement" => "admin/tasks#decrement_index", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_decrement_index get "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks/:type/:task_index/edit" => "admin/tasks#edit", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, task_index: NON_NEGATIVE_INTEGER, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_edit delete "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks/:task_index" => "admin/tasks#destroy", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, task_index: NON_NEGATIVE_INTEGER, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_delete put "admin/:stage_parent/:pipeline_name/stages/:stage_name/job/:job_name/tasks/:type/:task_index" => "admin/tasks#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT, task_index: NON_NEGATIVE_INTEGER, stage_parent: /(pipelines|templates)/}, :current_tab => "tasks", as: :admin_task_update get "admin/config_xml" => "admin/configuration#show", as: :config_view put "admin/config_xml" => "admin/configuration#update", as: :config_update get "admin/config_xml/edit" => "admin/configuration#edit", as: :config_edit get "admin/config/server" => "admin/server#index", as: :edit_server_config post "admin/config/server/update" => "admin/server#update", as: :update_server_config post "admin/config/server/validate" => "admin/server#validate", as: :validate_server_config_params, constraints: HeaderConstraint.new post "admin/config/server/test_email" => "admin/server#test_email", as: :send_test_email get "admin/pipelines" => "admin/pipeline_groups#index", as: :pipeline_groups get "admin/pipeline_group/new" => "admin/pipeline_groups#new", as: :pipeline_group_new post "admin/pipeline_group" => "admin/pipeline_groups#create", as: :pipeline_group_create put "admin/pipelines/move/:pipeline_name" => "admin/pipeline_groups#move", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :move_pipeline_to_group delete "admin/pipelines/:pipeline_name" => "admin/pipeline_groups#destroy", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :delete_pipeline get "admin/pipeline_group/:group_name/edit" => "admin/pipeline_groups#edit", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipeline_group_edit get "admin/pipeline_group/:group_name" => "admin/pipeline_groups#show", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipeline_group_show put "admin/pipeline_group/:group_name" => "admin/pipeline_groups#update", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipeline_group_update delete "admin/pipeline_group/:group_name" => "admin/pipeline_groups#destroy_group", constraints: {group_name: GROUP_NAME_FORMAT}, as: :pipeline_group_delete get "/admin/pipelines/possible_groups/:pipeline_name/:config_md5" => "admin/pipeline_groups#possible_groups", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :possible_groups get "admin/templates" => "admin/templates#index", as: :templates get "admin/templates/new" => "admin/templates#new", as: :template_new post "admin/templates/create" => "admin/templates#create", as: :template_create delete "admin/templates/:pipeline_name" => "admin/templates#destroy", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :delete_template get "admin/templates/:template_name/permissions" => "admin/templates#edit_permissions", constraints: {template_name: TEMPLATE_NAME_FORMAT}, as: :edit_template_permissions post "admin/templates/:template_name/permissions" => "admin/templates#update_permissions", constraints: {template_name: TEMPLATE_NAME_FORMAT}, as: :update_template_permissions get "admin/:stage_parent/:pipeline_name/:current_tab" => "admin/templates#edit", constraints: {stage_parent: "templates", pipeline_name: PIPELINE_NAME_FORMAT, current_tab: /#{["general"].join("|")}/}, defaults: {stage_parent: "templates"}, as: :template_edit put "admin/:stage_parent/:pipeline_name/:current_tab" => "admin/templates#update", constraints: {stage_parent: "templates", pipeline_name: PIPELINE_NAME_FORMAT, current_tab: /#{["general"].join("|")}/}, defaults: {stage_parent: "templates"}, as: :template_update get "admin/package_definitions/:repo_id/new" => "admin/package_definitions#new", as: :package_definitions_new get "admin/package_definitions/:repo_id/new_for_new_pipeline_wizard" => "admin/package_definitions#new_for_new_pipeline_wizard", as: :package_definitions_new_for_new_pipeline_wizard get "admin/package_definitions/:repo_id/:package_id/pipelines_used_in" => "admin/package_definitions#pipelines_used_in", as: :pipelines_used_in get "admin/package_definitions/:repo_id/:package_id" => "admin/package_definitions#show", as: :package_definitions_show get "admin/package_definitions/:repo_id/:package_id/for_new_pipeline_wizard" => "admin/package_definitions#show_for_new_pipeline_wizard", as: :package_definitions_show_for_new_pipeline_wizard get "admin/package_definitions/:repo_id/:package_id/with_repository_list" => "admin/package_definitions#show_with_repository_list", as: :package_definitions_show_with_repository_list delete "admin/package_definitions/:repo_id/:package_id" => "admin/package_definitions#destroy", as: :package_definition_delete post "admin/package_definitions/check_connection" => "admin/package_definitions#check_connection", as: :package_definition_check_connection, constraints: HeaderConstraint.new get "admin/package_repositories/new" => "admin/package_repositories#new", as: :package_repositories_new post "admin/package_repositories/check_connection" => "admin/package_repositories#check_connection", as: :package_repositories_check_connection, constraints: HeaderConstraint.new get "admin/package_repositories/list" => "admin/package_repositories#list", as: :package_repositories_list get "admin/package_repositories/:id/edit" => "admin/package_repositories#edit", as: :package_repositories_edit post "admin/package_repositories" => "admin/package_repositories#create", as: :package_repositories_create put "admin/package_repositories/:id" => "admin/package_repositories#update", as: :package_repositories_update delete "admin/package_repositories/:id" => "admin/package_repositories#destroy", as: :package_repositories_delete get "admin/package_repositories/:plugin/config/" => "admin/package_repositories#plugin_config", constraints: {:plugin => ALLOW_DOTS}, as: :package_repositories_plugin_config get "admin/package_repositories/:id/:plugin/config/" => "admin/package_repositories#plugin_config_for_repo", constraints: {:plugin => ALLOW_DOTS}, as: :package_repositories_plugin_config_for_repo get "admin/pipelines/:pipeline_name/materials/pluggable_scm/show_existing" => "admin/materials/pluggable_scm#show_existing", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_pluggable_scm_show_existing post "admin/pipelines/:pipeline_name/materials/pluggable_scm/choose_existing" => "admin/materials/pluggable_scm#choose_existing", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_pluggable_scm_choose_existing get "admin/pipelines/:pipeline_name/materials/pluggable_scm/new/:plugin_id" => "admin/materials/pluggable_scm#new", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, plugin_id: ALLOW_DOTS}, as: :admin_pluggable_scm_new post "admin/pipelines/:pipeline_name/materials/pluggable_scm/:plugin_id" => "admin/materials/pluggable_scm#create", constraints: {pipeline_name: PIPELINE_NAME_FORMAT, plugin_id: ALLOW_DOTS}, as: :admin_pluggable_scm_create get "admin/pipelines/:pipeline_name/materials/pluggable_scm/:finger_print/edit" => "admin/materials/pluggable_scm#edit", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_pluggable_scm_edit put "admin/pipelines/:pipeline_name/materials/pluggable_scm/:finger_print" => "admin/materials/pluggable_scm#update", constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :admin_pluggable_scm_update post "admin/materials/pluggable_scm/check_connection/:plugin_id" => "admin/materials/pluggable_scm#check_connection", constraints: {plugin_id: ALLOW_DOTS}, as: :admin_pluggable_scm_check_connection get "admin/materials/pluggable_scm/:scm_id/pipelines_used_in" => "admin/materials/pluggable_scm#pipelines_used_in", as: :scm_pipelines_used_in resources :analytics, only: [:index], controller: "analytics" get 'analytics/:plugin_id/:type/:id' => 'analytics#show', constraints: {plugin_id: PLUGIN_ID_FORMAT, id: PIPELINE_NAME_FORMAT}, as: :show_analytics scope 'pipelines' do defaults :no_layout => true do get ':pipeline_name/:pipeline_counter/build_cause' => 'pipelines#build_cause', constraints: PIPELINE_LOCATOR_CONSTRAINTS, as: :build_cause end match 'show', to: 'pipelines#show', via: %w(get post), as: :pipeline match 'select_pipelines', to: 'pipelines#select_pipelines', via: %w(get post), as: :pipeline_select_pipelines %w(index build_cause).each do |controller_action_method| get "#{controller_action_method}" => "pipelines##{controller_action_method}" end end get "pipelines(.:format)" => 'pipelines#index', defaults: {:format => "html"}, as: :pipeline_dashboard get 'home' => 'home#index' get "pipelines/value_stream_map/:pipeline_name/:pipeline_counter(.:format)" => "value_stream_map#show", constraints: {:pipeline_name => PIPELINE_NAME_FORMAT, :pipeline_counter => PIPELINE_COUNTER_FORMAT}, defaults: {:format => :html}, as: :vsm_show get "materials/value_stream_map/:material_fingerprint/:revision(.:format)" => "value_stream_map#show_material", defaults: {:format => :html}, constraints: {:revision => /[^\/]+(?=\.html\z|\.json\z)|[^\/]+/}, as: :vsm_show_material scope 'compare' do get ':pipeline_name/:from_counter/with/:to_counter' => 'comparison#show', constraints: {from_counter: PIPELINE_COUNTER_FORMAT, to_counter: PIPELINE_COUNTER_FORMAT, pipeline_name: PIPELINE_NAME_FORMAT}, as: :compare_pipelines get ':pipeline_name/list/compare_with/:other_pipeline_counter' => 'comparison#list', constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, format: 'json', as: :compare_pipelines_list get ':pipeline_name/timeline/:page' => 'comparison#timeline', constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :compare_pipelines_timeline end get 'failures/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter/:job_name' => 'failures#show', constraints: STAGE_LOCATOR_CONSTRAINTS, :no_layout => true, as: :failure_details_internal get 'server/messages.json' => 'server#messages', :format => "json", as: :global_message scope 'config_view' do get "templates/:name" => "config_view/templates#show", as: :config_view_templates_show, constraints: {name: TEMPLATE_NAME_FORMAT} end get 'environments', to: redirect('admin/environments'), as: :environment_redirect scope 'admin/environments' do defaults :no_layout => true do post "create" => 'environments#create', as: :environment_create get "new" => 'environments#new', as: :environment_new put ":name" => 'environments#update', constraints: ENVIRONMENT_NAME_CONSTRAINT, as: :environment_update get ":name/show" => 'environments#show', constraints: ENVIRONMENT_NAME_CONSTRAINT, as: :environment_show [:pipelines, :agents, :variables].each do |action| get ":name/edit/#{action}" => "environments#edit_#{action}", constraints: ENVIRONMENT_NAME_CONSTRAINT, as: "environment_edit_#{action}" end end end get "admin/environments(.:format)" => 'environments#index', defaults: {:format => :html}, as: :environments scope :api, as: :apiv1, format: false do api_version(:module => 'ApiV1', header: {name: 'Accept', value: 'application/vnd.go.cd.v1+json'}) do get 'current_user', controller: 'current_user', action: 'show' patch 'current_user', controller: 'current_user', action: 'update' resources :notification_filters, only: [:index, :create, :destroy] resources :users, param: :login_name, only: [:create, :index, :show, :destroy], constraints: {login_name: /(.*?)/} do patch :update, on: :member end namespace :elastic do resources :profiles, param: :profile_id, only: [:create, :index, :show, :destroy, :update], constraints: {profile_id: ELASTIC_AGENT_PROFILE_ID_FORMAT} end namespace :admin do namespace :security do resources :auth_configs, param: :auth_config_id, except: [:new, :edit,], constraints: {auth_config_id: ALLOW_DOTS} resources :roles, param: :role_name, except: [:new, :edit], constraints: {role_name: ROLE_NAME_FORMAT} end namespace :templates do get ':template_name/authorization' => 'authorization#show', constraints: {template_name: TEMPLATE_NAME_FORMAT} put ':template_name/authorization' => 'authorization#update', constraints: {template_name: TEMPLATE_NAME_FORMAT} end post 'internal/security/auth_configs/verify_connection' => 'security/auth_configs#verify_connection', as: :internal_verify_connection resources :config_repos, param: :id, only: [:create, :update, :show, :index, :destroy], constraints: {id: CONFIG_REPO_ID_FORMAT} resources :templates, param: :template_name, except: [:new, :edit], constraints: {template_name: TEMPLATE_NAME_FORMAT} get 'environments/:environment_name/merged' => 'merged_environments#show', constraints: MERGED_ENVIRONMENT_NAME_CONSTRAINT, as: :merged_environment_show get 'environments/merged' => 'merged_environments#index', as: :merged_environment_index resources :repositories, param: :repo_id, only: [:show, :index, :destroy, :create, :update], constraints: {repo_id: ALLOW_DOTS} resources :plugin_settings, param: :plugin_id, only: [:show, :create, :update], constraints: {plugin_id: ALLOW_DOTS} resources :packages, param: :package_id, only: [:show, :destroy, :index, :create, :update], constraints: {package_id: ALLOW_DOTS} namespace :internal do post :material_test, controller: :material_test, action: :test, as: :material_test controller :package_repository_check_connection do post :repository_check_connection, [action: :repository_check_connection] post :package_check_connection, [action: :package_check_connection] end resources :pipelines, only: [:index] resources :resources, only: [:index] resources :environments, only: [:index] resources :command_snippets, only: [:index] end resources :scms, param: :material_name, controller: :pluggable_scms, only: [:index, :show, :create, :update], constraints: {material_name: ALLOW_DOTS} end get 'stages/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter' => 'stages#show', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, pipeline_counter: PIPELINE_COUNTER_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_counter: STAGE_COUNTER_FORMAT}, as: :stage_instance_by_counter_api get 'stages/:pipeline_name/:stage_name' => 'stages#history', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT}, as: :stage_history_api get 'dashboard', controller: :dashboard, action: :dashboard, as: :show_dashboard match 'version', controller: :version, action: :show, as: :version, via: %w(get head) get 'version_infos/stale', controller: :version_infos, action: :stale, as: :stale_version_info get 'version_infos/latest_version', controller: :version_infos, action: :latest_version, as: :latest_version_info patch 'version_infos/go_server', controller: :version_infos, action: :update_server, as: :update_server_version_info match '*url', via: :all, to: 'errors#not_found' end end scope :api, as: :apiv2, format: false do api_version(:module => 'ApiV2', header: {name: 'Accept', value: 'application/vnd.go.cd.v2+json'}) do namespace :admin do resources :environments, param: :name, only: [:show, :destroy, :create, :index], constraints: {:name => ENVIRONMENT_NAME_FORMAT} patch 'environments/:name', to: 'environments#patch', constraints: {:name => ENVIRONMENT_NAME_FORMAT} put 'environments/:name', to: 'environments#put', constraints: {:name => ENVIRONMENT_NAME_FORMAT} end resources :users, param: :login_name, only: [:create, :index, :show, :destroy], constraints: {login_name: /(.*?)/} delete 'users', controller: 'users', action: 'bulk_delete' patch 'users/:login_name', to: 'users#update', constraints: {login_name: /(.*?)/} get 'dashboard', controller: :dashboard, action: :dashboard, as: :show_dashboard match '*url', via: :all, to: 'errors#not_found' end end scope :api, as: :apiv3, format: false do api_version(:module => 'ApiV3', header: {name: 'Accept', value: 'application/vnd.go.cd.v3+json'}) do namespace :admin do resources :templates, param: :template_name, except: [:new, :edit], constraints: {template_name: TEMPLATE_NAME_FORMAT} end match '*url', via: :all, to: 'errors#not_found' end end scope :api, as: :apiv4, format: false do api_version(:module => 'ApiV4', header: {name: 'Accept', value: 'application/vnd.go.cd.v4+json'}) do namespace :admin do resources :plugin_info, controller: :plugin_infos, param: :id, only: [:index, :show], constraints: {id: PLUGIN_ID_FORMAT} end resources :agents, param: :uuid, only: [:show, :destroy], constraints: {uuid: ALLOW_DOTS} do patch :update, on: :member end # for some reasons using the constraints breaks route specs for routes that don't use constraints, so an ugly hax get 'agents', action: :index, controller: 'agents' patch 'agents', action: :bulk_update, controller: 'agents' delete 'agents', action: :bulk_destroy, controller: 'agents' match '*url', via: :all, to: 'errors#not_found' end end scope :api, as: :apiv5, format: false do api_version(:module => 'ApiV5', header: {name: 'Accept', value: 'application/vnd.go.cd.v5+json'}) do namespace :admin do resources :pipelines, param: :pipeline_name, only: [:show, :update, :create, :destroy], constraints: {pipeline_name: PIPELINE_NAME_FORMAT} end match '*url', via: :all, to: 'errors#not_found' end end namespace :admin do resources :pipelines, only: [:edit], controller: :pipeline_configs, param: :pipeline_name, as: :pipeline_config, constraints: {pipeline_name: PIPELINE_NAME_FORMAT} get 'status_reports/:plugin_id' => 'status_reports#plugin_status', constraints: {plugin_id: PLUGIN_ID_FORMAT}, format: false, as: :status_report get 'status_reports/:plugin_id/:elastic_agent_id' => 'status_reports#agent_status', constraints: {plugin_id: PLUGIN_ID_FORMAT}, format: false, as: :agent_status_report namespace :security do resources :auth_configs, only: [:index], controller: :auth_configs, as: :auth_configs resources :roles, only: [:index], controller: :roles, as: :roles end end namespace :api, as: "" do defaults :no_layout => true do # state get 'state/status' => 'server_state#status' post 'state/active' => 'server_state#to_active', constraints: HeaderConstraint.new post 'state/passive' => 'server_state#to_passive', constraints: HeaderConstraint.new # history get 'pipelines/:pipeline_name/history/(:offset)' => 'pipelines#history', constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, defaults: {:offset => '0'}, as: :pipeline_history get 'stages/:pipeline_name/:stage_name/history/(:offset)' => 'stages#history', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT}, defaults: {:offset => '0'}, as: :stage_history_api get 'jobs/:pipeline_name/:stage_name/:job_name/history/(:offset)' => 'jobs#history', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT, job_name: JOB_NAME_FORMAT}, defaults: {:offset => '0'}, as: :job_history_api get "agents/:uuid/job_run_history/(:offset)" => 'agents#job_run_history', defaults: {:offset => '0'}, as: :agent_job_run_history_api, constraints: {uuid: ALLOW_DOTS} get "materials/:fingerprint/modifications/(:offset)" => 'materials#modifications', defaults: {:offset => '0'}, as: :material_modifications_api # instance get 'pipelines/:pipeline_name/instance/:pipeline_counter' => 'pipelines#instance_by_counter', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, pipeline_counter: PIPELINE_COUNTER_FORMAT}, as: :pipeline_instance_by_counter_api get 'stages/:pipeline_name/:stage_name/instance/:pipeline_counter/:stage_counter' => 'stages#instance_by_counter', constraints: {pipeline_name: PIPELINE_NAME_FORMAT, pipeline_counter: PIPELINE_COUNTER_FORMAT, stage_name: STAGE_NAME_FORMAT, stage_counter: STAGE_COUNTER_FORMAT}, as: :stage_instance_by_counter_api # status get 'pipelines/:pipeline_name/status' => 'pipelines#status', constraints: {pipeline_name: PIPELINE_NAME_FORMAT}, as: :pipeline_status_api # config get 'config/pipeline_groups' => 'pipeline_groups#list_configs', as: :pipeline_group_config_list_api get 'config/materials' => 'materials#list_configs', as: :material_config_list_api get 'config/revisions/(:offset)' => 'configuration#config_revisions', defaults: {:offset => '0'}, as: :config_revisions_list_api get 'config/diff/:from_revision/:to_revision' => 'configuration#config_diff', as: :config_diff_api # stage api's post 'stages/:id/cancel' => 'stages#cancel', constraints: HeaderConstraint.new, as: :cancel_stage constraints pipeline_name: PIPELINE_NAME_FORMAT, stage_name: STAGE_NAME_FORMAT do post 'stages/:pipeline_name/:stage_name/cancel' => 'stages#cancel_stage_using_pipeline_stage_name', constraints: HeaderConstraint.new, as: :cancel_stage_using_pipeline_stage_name end post 'material/notify/:post_commit_hook_material_type' => 'materials#notify', as: :material_notify, constraints: HeaderConstraint.new post 'admin/command-repo-cache/reload' => 'commands#reload_cache', as: :admin_command_cache_reload, constraints: HeaderConstraint.new # Vendor Webhooks post 'webhooks/github/notify' => 'web_hooks/git_hub#notify' post 'webhooks/gitlab/notify' => 'web_hooks/git_lab#notify' post 'webhooks/bitbucket/notify' => 'web_hooks/bit_bucket#notify' scope 'admin/feature_toggles' do defaults :no_layout => true, :format => :json do get "" => "feature_toggles#index", as: :api_admin_feature_toggles constraints HeaderConstraint.new do post "/:toggle_key" => "feature_toggles#update", constraints: {toggle_key: /[^\/]+/}, as: :api_admin_feature_toggle_update end end end defaults :format => 'text' do get 'fanin_trace/:name' => 'fanin_trace#fanin_trace', constraints: {name: PIPELINE_NAME_FORMAT} get 'fanin_debug/:name/(:index)' => 'fanin_trace#fanin_debug', constraints: {name: PIPELINE_NAME_FORMAT}, defaults: {:offset => '0'} get 'fanin/:name' => 'fanin_trace#fanin', constraints: {name: PIPELINE_NAME_FORMAT} end defaults :format => 'json' do get 'process_list' => 'process_list#process_list' get 'support' => 'server#capture_support_info' end defaults :format => 'xml' do # stage api's get 'stages/:id.xml' => 'stages#index', as: :stage # pipeline api's get 'pipelines/:name/stages.xml' => 'pipelines#stage_feed', constraints: {name: PIPELINE_NAME_FORMAT}, as: :api_pipeline_stage_feed get 'pipelines/:name/:id.xml' => 'pipelines#pipeline_instance', constraints: {name: PIPELINE_NAME_FORMAT}, as: :api_pipeline_instance get 'pipelines.xml' => 'pipelines#pipelines', as: :api_pipelines #job api's get 'jobs/scheduled.xml' => 'jobs#scheduled' get 'jobs/:id.xml' => 'jobs#index' end end end namespace :api do scope :config do namespace :internal do constraints HeaderConstraint.new do post 'pluggable_task/:plugin_id' => 'pluggable_task#validate', as: :pluggable_task_validation, constraints: {plugin_id: /[\w+\.\-]+/} end end end end post 'pipelines/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter/rerun-jobs' => 'stages#rerun_jobs', as: :rerun_jobs, constraints: STAGE_LOCATOR_CONSTRAINTS constraints HeaderConstraint.new do post 'pipelines/:pipeline_name/:pipeline_counter/comment' => 'pipelines#update_comment', as: :update_comment, constraints: PIPELINE_LOCATOR_CONSTRAINTS, format: :json end get "pipelines/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter" => "stages#overview", as: "stage_detail_tab_default", constraints: STAGE_LOCATOR_CONSTRAINTS %w(overview pipeline materials jobs tests stats stage_config).each do |controller_action_method| get "pipelines/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter/#{controller_action_method}" => "stages##{controller_action_method}", as: "stage_detail_tab_#{controller_action_method}", constraints: STAGE_LOCATOR_CONSTRAINTS end get "history/stage/:pipeline_name/:pipeline_counter/:stage_name/:stage_counter" => 'stages#history', as: :stage_history, constraints: STAGE_LOCATOR_CONSTRAINTS get "config_change/between/:later_md5/and/:earlier_md5" => 'stages#config_change', as: :config_change scope 'admin/users', module: 'admin' do defaults :no_layout => true do get 'new' => 'users#new', as: :users_new post 'create' => 'users#create', as: :users_create post 'search' => 'users#search', as: :users_search post 'roles' => 'users#roles', as: :user_roles end post 'operate' => 'users#operate', as: :user_operate get '' => 'users#users', as: :user_listing end scope 'internal' do # redirects to first-stage details page of the specific pipeline run get 'pipelines/:pipeline_name/:pipeline_counter' => 'stages#redirect_to_first_stage', as: :internal_stage_detail_tab, constraints: PIPELINE_LOCATOR_CONSTRAINTS end get 'preferences/notifications', controller: 'preferences', action: 'notifications' get "agents/:uuid" => 'agent_details#show', as: :agent_detail, constraints: {uuid: ALLOW_DOTS} get "agents/:uuid/job_run_history" => 'agent_details#job_run_history', as: :job_run_history_on_agent, constraints: {uuid: ALLOW_DOTS} get "errors/inactive" => 'go_errors#inactive' get "cctray.xml" => "cctray#index", :format => "xml", as: :cctray end
81.663848
386
0.749191
2138f649127e8c55e15fbf45d2a211b228c86e80
5,354
#------------------------------------------------------------------------- # # Copyright (c) Microsoft and contributors. All rights reserved. # # The MIT License(MIT) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files(the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions : # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #-------------------------------------------------------------------------- require "unit/test_helper" require "azure/storage/table" require "time" describe Azure::Storage::Table::Serialization do subject { Azure::Storage::Table::Serialization } describe "#hash_to_json" do let(:query_entities_response_json) { Fixtures["query_entities_response"] } let(:query_entities_response_hash) { { "odata.metadata" => "https://mytest.table.core.windows.net/$metadata#xyxnnunbmu/@Element", "odata.etag" => "W/\"datetime'2017-09-12T03%3A40%3A08.358891Z'\"", "PartitionKey" => "part2", "RowKey" => "entity-6", "Timestamp" => Time.parse("2017-09-12T03:40:08.358891Z"), "CustomStringProperty" => "CustomPropertyValue", "CustomIntegerProperty" => 37, "CustomBooleanProperty" => true, "[email protected]" => "Edm.DateTime", "CustomDateProperty" => Time.parse("2017-09-12T03:40:06.463953Z") } } it "serialize a hash to JSON string" do result = subject.hash_to_json(query_entities_response_hash) result.must_equal query_entities_response_json end end describe "#table_entries_from_json" do let(:query_tables_json) { Fixtures["query_tables"] } let(:table_entries) { [ { "TableName" => "aapilycmrr" }, { "TableName" => "bbfbbpbsmm" }, { "TableName" => "dfkvsheskq" }, { "TableName" => "ecxataxwrl" }, { "TableName" => "edhakjwlho" }, { "TableName" => "evsxufolvc" }, { "TableName" => "gjbcwdgevl" }, { "TableName" => "jwqiijvkcz" }, { "TableName" => "lhulazoqvz" }, { "TableName" => "lraeudqsxw" }, { "TableName" => "lrxqpcdbqb" }, { "TableName" => "ndiekmdvwh" }, { "TableName" => "soyvdmcffy" }, { "TableName" => "zridlgeizl" } ] } it "deserialize a table entries from json" do result = subject.table_entries_from_json(query_tables_json) result.must_equal table_entries end end describe "#entity_from_json" do let(:entity_json) { Fixtures["insert_entity_response_entry"] } it "create an entity from JSON" do result = subject.entity_from_json(entity_json) result.must_be_kind_of Azure::Storage::Table::Entity result.etag.must_equal "sampleetag" result.properties.must_equal("PartitionKey" => "abcd321", "RowKey" => "abcd123" , "CustomDoubleProperty" => "3.141592") end end describe "#entities_from_json" do let(:multiple_entities_json) { Fixtures["multiple_entities_payload"] } it "create entities array from JSON string" do result = subject.entities_from_json(multiple_entities_json) result.each do |e| e.properties["PartitionKey"].must_include "part" e.properties["RowKey"].must_include "entity-" e.properties["Timestamp"].must_include "2017-09-12" e.properties["CustomStringProperty"].must_equal "CustomPropertyValue" e.properties["CustomIntegerProperty"].must_equal 37 e.properties["CustomBooleanProperty"].must_equal true e.properties["CustomDateProperty"].to_i.must_equal Time.parse("2017-09-12 03:40:23 UTC").to_i end end end describe "#get_accept_string" do let(:expected_results) { { no_meta: Azure::Storage::Common::HeaderConstants::ODATA_NO_META, min_meta: Azure::Storage::Common::HeaderConstants::ODATA_MIN_META, full_meta: Azure::Storage::Common::HeaderConstants::ODATA_FULL_META, Azure::Storage::Common::HeaderConstants::ODATA_NO_META => Azure::Storage::Common::HeaderConstants::ODATA_NO_META, Azure::Storage::Common::HeaderConstants::ODATA_MIN_META => Azure::Storage::Common::HeaderConstants::ODATA_MIN_META, Azure::Storage::Common::HeaderConstants::ODATA_FULL_META => Azure::Storage::Common::HeaderConstants::ODATA_FULL_META, "nonsense" => "nonsense" } } it "create accept string with input" do expected_results.each do |k, v| subject.get_accept_string(k).must_equal v end end end end
41.503876
125
0.665671
398b6dbd3f734b87c3874b7ede76a0f57c4d2e88
321
require 'spec_helper' describe BinaryChecker do context "accepts a command" do it "knows that 'ls' _probably_ exists" do BinaryChecker.new("ls").should be_exist end it "knows that 'boooganone' _probably_ doesn't exists" do BinaryChecker.new("boooganone").should_not be_exist end end end
22.928571
61
0.713396
b90d0b527624caf1930f61cdec224544a0f2d802
7,075
# frozen_string_literal: true # # Uncomment this and change the path if necessary to include your own # components. # See https://github.com/plataformatec/simple_form#custom-components to know # more about custom components. # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } # # Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the # wrapper, change the order or even add your own to the # stack. The options given below are used to wrap the # whole input. config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b| ## Extensions enabled by default # Any of these extensions can be disabled for a # given input by passing: `f.input EXTENSION_NAME => false`. # You can make any of these extensions optional by # renaming `b.use` to `b.optional`. # Determines whether to use HTML5 (:email, :url, ...) # and required attributes b.use :html5 # Calculates placeholders automatically from I18n # You can also pass a string as f.input placeholder: "Placeholder" b.use :placeholder ## Optional extensions # They are disabled unless you pass `f.input EXTENSION_NAME => true` # to the input. If so, they will retrieve the values from the model # if any exists. If you want to enable any of those # extensions by default, you can change `b.optional` to `b.use`. # Calculates maxlength from length validations for string inputs # and/or database column lengths b.optional :maxlength # Calculate minlength from length validations for string inputs b.optional :minlength # Calculates pattern from format validations for string inputs b.optional :pattern # Calculates min and max from length validations for numeric inputs b.optional :min_max # Calculates readonly automatically from readonly attributes b.optional :readonly ## Inputs # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid' b.use :label_input b.use :hint, wrap_with: { tag: :span, class: :hint } b.use :error, wrap_with: { tag: :span, class: :error } ## full_messages_for # If you want to display the full error message for the attribute, you can # use the component :full_error, like: # # b.use :full_error, wrap_with: { tag: :span, class: :error } end # The default wrapper to be used by the FormBuilder. config.default_wrapper = :default # Define the way to render check boxes / radio buttons with labels. # Defaults to :nested for bootstrap config. # inline: input + label # nested: label > input config.boolean_style = :nested # Default class for buttons config.button_class = "btn" # Method used to tidy up errors. Specify any Rails Array method. # :first lists the first message for each field. # Use :to_sentence to list all errors for each field. # config.error_method = :first # Default tag used for error notification helper. config.error_notification_tag = :div # CSS class to add for error notification helper. config.error_notification_class = "error_notification" # Series of attempts to detect a default label method for collection. # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] # Series of attempts to detect a default value method for collection. # config.collection_value_methods = [ :id, :to_s ] # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. # config.collection_wrapper_tag = nil # You can define the class to use on all collection wrappers. Defaulting to none. # config.collection_wrapper_class = nil # You can wrap each item in a collection of radio/check boxes with a tag, # defaulting to :span. # config.item_wrapper_tag = :span # You can define a class to use in all item wrappers. Defaulting to none. # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil # You can define the default class to be used on forms. Can be overriden # with `html: { :class }`. Defaulting to none. # config.default_form_class = nil # You can define which elements should obtain additional classes # config.generate_additional_classes_for = [:wrapper, :label, :input] # Whether attributes are required by default (or not). Default is true. # config.required_by_default = true # Tell browsers whether to use the native HTML5 validations (novalidate form option). # These validations are enabled in SimpleForm's internal config but disabled by default # in this configuration, which is recommended due to some quirks from different browsers. # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, # change this configuration to true. config.browser_validations = false # Collection of methods to detect if a file type was given. # config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ] # Custom mappings for input types. This should be a hash containing a regexp # to match as key, and the input type that will be used when the field name # matches the regexp as value. # config.input_mappings = { /count/ => :integer } # Custom wrappers for input types. This should be a hash containing an input # type as key and the wrapper that will be used for all inputs with specified type. # config.wrapper_mappings = { string: :prepend } # Namespaces where SimpleForm should look for custom input classes that # override default inputs. # config.custom_inputs_namespaces << "CustomInputs" # Default priority for time_zone inputs. # config.time_zone_priority = nil # Default priority for country inputs. # config.country_priority = nil # When false, do not use translations for labels. # config.translate_labels = true # Automatically discover new inputs in Rails' autoload path. # config.inputs_discovery = true # Cache SimpleForm inputs discovery # config.cache_discovery = !Rails.env.development? # Default class for inputs # config.input_class = nil # Define the default class of the input wrapper of the boolean input. config.boolean_label_class = "checkbox" # Defines if the default input wrapper class should be included in radio # collection wrappers. # config.include_default_input_wrapper_class = true # Defines which i18n scope will be used in Simple Form. # config.i18n_scope = 'simple_form' # Defines validation classes to the input_field. By default it's nil. # config.input_field_valid_class = 'is-valid' # config.input_field_error_class = 'is-invalid' end
39.088398
132
0.727774
6ad09d7ca996b76e400aa0cf3451f2b6d587c802
790
require 'selenium-webdriver' driver = Selenium::WebDriver.for :remote, desired_capabilities: :chrome, url: "http://#{ENV['SELENIUM_HOST']}:4444/wd/hub" # スクレイピング driver.navigate.to(ENV['URL']) list_table = driver.find_element(:class => "list_table") dates = list_table.find_elements(:class => "date") urls = list_table.find_elements(:tag_name => "a") texts = list_table.find_elements(:tag_name => "a") count = dates.length - 1 newsItems = [] for i in 0..count do newsItem = { "date" => dates[i].text, "url" => urls[i].attribute("href"), "text" => texts[i].text } newsItems.push(newsItem) end news = { "newsItems" => newsItems } puts news # JSON出力 news_json = JSON.pretty_generate(news, {:indent => " "}) File.open("data/news.json", mode = "w") { |f| f.write(news_json) } exit
28.214286
122
0.678481
18e528b7256e58c8007976487141edfc3b9deab9
6,859
=begin #Xero Payroll NZ #This is the Xero Payroll API for orgs in the NZ region. The version of the OpenAPI document: 2.6.0 Contact: [email protected] Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'time' require 'date' module XeroRuby::PayrollNz require 'bigdecimal' class EarningsRates attr_accessor :pagination attr_accessor :problem attr_accessor :earnings_rates # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'pagination' => :'pagination', :'problem' => :'problem', :'earnings_rates' => :'earningsRates' } end # Attribute type mapping. def self.openapi_types { :'pagination' => :'Pagination', :'problem' => :'Problem', :'earnings_rates' => :'Array<EarningsRate>' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EarningsRates` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EarningsRates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'pagination') self.pagination = attributes[:'pagination'] end if attributes.key?(:'problem') self.problem = attributes[:'problem'] end if attributes.key?(:'earnings_rates') if (value = attributes[:'earnings_rates']).is_a?(Array) self.earnings_rates = value end end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && problem == o.problem && earnings_rates == o.earnings_rates end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [pagination, problem, earnings_rates].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(parse_date(value)) when :Date Date.parse(parse_date(value)) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BigDecimal BigDecimal(value.to_s) when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model XeroRuby::PayrollNz.const_get(type).build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end # customized data_parser def parse_date(datestring) seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0 return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s end end end
29.692641
212
0.623706
ffdccb5faa073c64d753019b8843c2b7a3705a0b
1,455
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require 'aws-sdk-core' require 'aws-sigv4' require_relative 'aws-sdk-appregistry/types' require_relative 'aws-sdk-appregistry/client_api' require_relative 'aws-sdk-appregistry/client' require_relative 'aws-sdk-appregistry/errors' require_relative 'aws-sdk-appregistry/resource' require_relative 'aws-sdk-appregistry/customizations' # This module provides support for AWS Service Catalog App Registry. This module is available in the # `aws-sdk-appregistry` gem. # # # Client # # The {Client} class provides one method for each API operation. Operation # methods each accept a hash of request parameters and return a response # structure. # # app_registry = Aws::AppRegistry::Client.new # resp = app_registry.associate_attribute_group(params) # # See {Client} for more information. # # # Errors # # Errors returned from AWS Service Catalog App Registry are defined in the # {Errors} module and all extend {Errors::ServiceError}. # # begin # # do stuff # rescue Aws::AppRegistry::Errors::ServiceError # # rescues all AWS Service Catalog App Registry API errors # end # # See {Errors} for more information. # # @!group service module Aws::AppRegistry GEM_VERSION = '1.7.0' end
26.944444
100
0.753265
1c08b801425dd90bc04649ef067195ea4e581de9
2,108
# frozen_string_literal: true module SoftDestroyable extend ActiveSupport::Concern included do scope :kept, -> { where(deleted_at: nil) } scope :only_deleted, -> { where.not(deleted_at: nil) } define_model_callbacks :soft_destroy define_model_callbacks :restore end module ClassMethods def default_scope(scope = nil) unless scope.nil? && !block_given? raise "Default scopes should not be used with soft destroyable - in class #{name}" end end def soft_destroy(timestamp = Time.zone.now) kept.each { |o| o.soft_destroy(timestamp) } end def restore(timestamp) only_deleted.each { |o| o.restore(timestamp) } end def cascade_soft_destroy(associations) Array.wrap(associations).each do |association_name| define_method("soft_destroy_#{association_name}") do send(association_name).soft_destroy(deleted_at) end after_soft_destroy("soft_destroy_#{association_name}".to_sym) define_method("restore_#{association_name}") do send(association_name).restore(deleted_at) end before_restore("restore_#{association_name}".to_sym) end end end def soft_destroyed? deleted_at.present? end def soft_destroy(timestamp = Time.zone.now) return if soft_destroyed? run_callbacks(:soft_destroy) do update(deleted_at: timestamp) end end def soft_destroy! soft_destroy || raise_validation_errors end def restore(timestamp = deleted_at) return unless deleted_at == timestamp run_callbacks(:restore) do update(deleted_at: nil) end end # This may have unintended consequences or issues with restoring records with associations in varying states # This will only raise an exception at the top level but does not guarantee nested objects were restored # and will not guarantee errors restoring nested objects are surfaced def restore! restore(deleted_at) || raise_validation_errors end private def raise_validation_errors raise ActiveModel::ValidationError, self end end
26.683544
110
0.711575
112406aab0c86dbf6945292777a198f3e8c39671
1,106
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'uri_scanner/version' Gem::Specification.new do |spec| spec.name = "uri_scanner" spec.version = URIScanner::VERSION spec.authors = ["Stas Kobzar"] spec.email = ["[email protected]"] spec.summary = %q{URI Parser with Ragel} spec.description = %q{Parsing URI and tokenize URI segments. Scan input text and extract URIs to array. Based on Ragel FSM compiler.} spec.homepage = "https://github.com/staskobzar/uri_scanner" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.5" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "simplecov" spec.add_development_dependency "codecov" end
39.5
137
0.676311
ab9c9d7f49aebc7ec1ab4563e520f4005be682cb
143
# frozen_string_literal: true require 'yaml' require 'yamlm/version' require 'yamlm/cli' module YAMLM class Error < StandardError; end end
14.3
34
0.769231
872d2fed6adce6bb5e8b190e088ecfd47ff04718
8,778
require 'spec_helper' module Pageflow describe EntryRoleQuery do describe EntryRoleQuery::Scope do describe '.with_role_at_least' do it 'includes entries with entry membership with required role' do user = create(:user) entry = create(:entry, with_editor: user) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).to include(entry) end it 'includes entries with entry membership with stronger role' do user = create(:user) entry = create(:entry, with_publisher: user) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).to include(entry) end it 'includes entries with account membership with required role' do user = create(:user) account = create(:account, with_editor: user) entry = create(:entry, account: account) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).to include(entry) end it 'does not include entries user is not member of' do user = create(:user) create(:entry, with_editor: user) other_entry = create(:entry) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).not_to include(other_entry) end it 'does not include entries with membership with wrong user and correct id' do user = create(:user) other_user = create(:user) entry = create(:entry, with_editor: other_user) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).not_to include(entry) end it 'does not include entries with membership with wrong account' do user = create(:user) account = create(:account) create(:account, with_editor: user) entry = create(:entry, account: account) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).not_to include(entry) end it 'does not include entries with memberships of insufficient role' do user = create(:user) entry = create(:entry, with_previewer: user) result = EntryRoleQuery::Scope.new(user, Entry).with_role_at_least(:editor) expect(result).not_to include(entry) end end describe '.with_account_role_at_least' do it 'includes entries with account membership with required role' do user = create(:user) account = create(:account, with_editor: user) entry = create(:entry, account: account) result = EntryRoleQuery::Scope.new(user, Entry).with_account_role_at_least(:editor) expect(result).to include(entry) end it 'includes entries with account membership with stronger role' do user = create(:user) account = create(:account, with_publisher: user) entry = create(:entry, account: account) result = EntryRoleQuery::Scope.new(user, Entry).with_account_role_at_least(:editor) expect(result).to include(entry) end it 'does not include entries of accounts with memberships of insufficient role' do user = create(:user) account = create(:account, with_previewer: user) entry = create(:entry, account: account) result = EntryRoleQuery::Scope.new(user, Entry).with_account_role_at_least(:editor) expect(result).not_to include(entry) end it 'does not include entries with entry membership with required role' do user = create(:user) entry = create(:entry, with_editor: user) result = EntryRoleQuery::Scope.new(user, Entry).with_account_role_at_least(:editor) expect(result).not_to include(entry) end it 'does not include entries of accounts user is not member of' do user = create(:user) create(:account, with_editor: user) other_entry = create(:entry) result = EntryRoleQuery::Scope.new(user, Entry).with_account_role_at_least(:editor) expect(result).not_to include(other_entry) end end it 'can be composed mutliple times in one query via table alias prefix' do common_account = create(:account) john = create(:user, :manager, on: common_account) johns_account = create(:account, with_manager: john) jack = create(:user, :member, on: common_account) jacks_account = create(:account, with_member: jack) entry_in_common_account = create(:entry, account: common_account) entry_in_johns_account = create(:entry, account: johns_account) entry_in_jacks_account = create(:entry, account: jacks_account) entries_managed_by_john = EntryRoleQuery::Scope .new(john, Entry, table_alias_prefix: 'manager') .with_role_at_least(:manager) entries_in_jacks_accounts_managed_by_john = EntryRoleQuery::Scope .new(jack, entries_managed_by_john) .with_role_at_least(:member) expect(entries_in_jacks_accounts_managed_by_john).to include(entry_in_common_account) expect(entries_in_jacks_accounts_managed_by_john).not_to include(entry_in_jacks_account) expect(entries_in_jacks_accounts_managed_by_john).not_to include(entry_in_johns_account) end end describe '.has_at_least_role?' do it 'returns true if user has membership with given role' do user = create(:user) entry = create(:entry, with_editor: user) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(true) end it 'returns true if user has membership with stronger role' do user = create(:user) entry = create(:entry, with_publisher: user) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(true) end it 'returns true if user has account membership with given role' do user = create(:user) account = create(:account, with_editor: user) entry = create(:entry, account: account) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(true) end it 'returns false if user has membership with weaker role' do user = create(:user) entry = create(:entry, with_previewer: user) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(false) end it 'returns false if user has membership with given role on other entry' do user = create(:user) create(:entry, with_editor: user) entry = create(:entry) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(false) end it 'returns false if user has account membership with given role on other account' do user = create(:user) create(:account, with_editor: user) entry = create(:entry) result = EntryRoleQuery.new(user, entry).has_at_least_role?(:editor) expect(result).to be(false) end end describe '.has_at_least_account_role?' do it 'returns true if user has account membership with given role' do user = create(:user) account = create(:account, with_editor: user) entry = create(:entry, account: account) result = EntryRoleQuery.new(user, entry).has_at_least_account_role?(:editor) expect(result).to be(true) end it 'returns false if user has membership with weaker role' do user = create(:user) account = create(:account, with_previewer: user) entry = create(:entry, account: account) result = EntryRoleQuery.new(user, entry).has_at_least_account_role?(:editor) expect(result).to be(false) end it 'returns false if user has entry membership with given role' do user = create(:user) entry = create(:entry, with_editor: user) result = EntryRoleQuery.new(user, entry).has_at_least_account_role?(:editor) expect(result).to be(false) end it 'returns false if user has account membership with given role on other account' do user = create(:user) create(:account, with_editor: user) entry = create(:entry) result = EntryRoleQuery.new(user, entry).has_at_least_account_role?(:editor) expect(result).to be(false) end end end end
34.559055
96
0.649465
61e0a08dbee8bee7a344fdce06f60d30056c473c
279
class Engine def results result = (1..100).map do |number| if (number % 35) == 0 'Nama Team' elsif (number % 7) == 0 'Team' elsif (number % 5) == 0 'Nama' else number end end result.join(', ') end end
17.4375
38
0.455197
5dd926ed9e373a72bbd038f88c3325d41f2b5167
3,565
# Copyright 2020 Google LLC # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. # frozen_string_literal: true require "test_helper" require "models/firm" require "models/account" require "models/transaction" require "models/department" require "models/customer" module ActiveRecord module Associations class HasManyTest < SpannerAdapter::TestCase include SpannerAdapter::Associations::TestHelper attr_accessor :customer def setup super @customer = Customer.create name: "Customer - 1" Account.create name: "Account - 1", customer: customer, credit_limit: 100 Account.create name: "Account - 2", customer: customer, credit_limit: 200 end def teardown Customer.destroy_all Account.destroy_all end def test_has_many assert_equal 2, customer.accounts.count assert_equal customer.accounts.pluck(:credit_limit).sort, [100, 200] end def test_finding_using_associated_fields assert_equal Account.where(customer_id: customer.id).to_a, customer.accounts.to_a end def test_successful_build_association account = customer.accounts.build(name: "Account - 3", credit_limit: 1000) assert account.save customer.reload assert_equal account, customer.accounts.find(account.id) end def test_create_and_destroy_associated_records customer2 = Customer.new name: "Customer - 2" customer2.accounts.build name: "Account - 11", credit_limit: 100 customer2.accounts.build name: "Account - 12", credit_limit: 200 customer2.save! customer2.reload assert_equal 2, customer2.accounts.count assert_equal 4, Account.count customer2.accounts.destroy_all customer2.reload assert_equal 0, customer2.accounts.count assert_equal 2, Account.count end def test_create_and_delete_associated_records customer2 = Customer.new name: "Customer - 2" customer2.accounts.build name: "Account - 11", credit_limit: 100 customer2.accounts.build name: "Account - 12", credit_limit: 200 customer2.save! customer2.reload assert_equal 2, customer2.accounts.count assert_equal 4, Account.count assert_equal 2, customer2.accounts.delete_all customer2.reload assert_equal 0, customer2.accounts.count assert_equal 2, Account.where(customer_id: nil).count end def test_update_associated_records count = customer.accounts.update_all(name: "Account - Update", credit_limit: 1000) assert_equal customer.accounts.count, count customer.reload customer.accounts.each do |account| assert_equal "Account - Update", account.name assert_equal 1000, account.credit_limit end end def test_fetch_associated_record_with_order accounts = customer.accounts.order(credit_limit: :desc) assert_equal [200, 100], accounts.pluck(:credit_limit) accounts = customer.accounts.order(credit_limit: :asc) assert_equal [100, 200], accounts.pluck(:credit_limit) end def test_set_counter_cache account = Account.first account.transactions.create!(amount: 10) account.transactions.create!(amount: 20) account.reload assert_equal 2, account.transactions_count end end end end
29.957983
90
0.686676
bf28b7d90b1be8b7a98dbe184aa970a7a9604f71
598
require './config/environment' require 'rack-flash' require 'date' class ApplicationController < Sinatra::Base use Rack::Flash register Sinatra::ActiveRecordExtension enable :sessions set :session_secret, "my_application_secret" configure do set :public_folder, 'public' set :views, 'app/views' end get '/' do if !(session[:user_id].blank?) puts "User id =" + session[:user_id].to_s @user = User.find_by(id: session[:user_id]) @username = @user.username @logged_in = true end erb :index end get '/error' do erb :error end end
19.933333
49
0.662207
287464e94cf4e85d84080f74de19610ebf5d5302
1,000
require 'azure_generic_resources' class AzureSQLManagedInstances < AzureGenericResources name 'azure_sql_managed_instances' desc 'Verifies settings for a collection of Azure SQL Managed Instances' example <<-EXAMPLE describe azure_sql_managed_instances(resource_group: 'migrated_vms') do it { should exist } end EXAMPLE def initialize(opts = {}) raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) opts[:resource_provider] = specific_resource_constraint('Microsoft.Sql/managedInstances', opts) super(opts, true) return if failed_resource? populate_filter_table_from_response end def to_s super(AzureSQLManagedInstances) end private def populate_table @resources.each do |resource| resource = resource.merge(resource[:properties]) skus = resource[:sku].each_with_object({}) { |(k, v), hash| hash["sku_#{k}".to_sym] = v } @table << resource.merge(skus) end end end
27.777778
99
0.726
1cc012fc403e79b67c43d49bef213fc6a61b0bed
2,281
# -*- encoding: utf-8 -*- # stub: omniauth 1.9.0 ruby lib Gem::Specification.new do |s| s.name = "omniauth" s.version = "1.9.0" s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Michael Bleigh", "Erik Michaels-Ober", "Tom Milewski"] s.date = "2020-01-17" s.description = "A generalized Rack framework for multiple-provider authentication." s.email = ["[email protected]", "[email protected]", "[email protected]"] s.files = [".github/ISSUE_TEMPLATE.md", ".gitignore", ".rspec", ".rubocop.yml", ".travis.yml", ".yardopts", "Gemfile", "LICENSE.md", "README.md", "Rakefile", "lib/omniauth.rb", "lib/omniauth/auth_hash.rb", "lib/omniauth/builder.rb", "lib/omniauth/failure_endpoint.rb", "lib/omniauth/form.css", "lib/omniauth/form.rb", "lib/omniauth/key_store.rb", "lib/omniauth/strategies/developer.rb", "lib/omniauth/strategy.rb", "lib/omniauth/test.rb", "lib/omniauth/test/phony_session.rb", "lib/omniauth/test/strategy_macros.rb", "lib/omniauth/test/strategy_test_case.rb", "lib/omniauth/version.rb", "omniauth.gemspec"] s.homepage = "https://github.com/omniauth/omniauth" s.licenses = ["MIT"] s.required_ruby_version = Gem::Requirement.new(">= 2.2") s.rubygems_version = "2.5.1" s.summary = "A generalized Rack framework for multiple-provider authentication." s.installed_by_version = "2.5.1" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<hashie>, [">= 3.4.6"]) s.add_runtime_dependency(%q<rack>, ["< 3", ">= 1.6.2"]) s.add_development_dependency(%q<bundler>, ["~> 1.14"]) s.add_development_dependency(%q<rake>, ["~> 12.0"]) else s.add_dependency(%q<hashie>, [">= 3.4.6"]) s.add_dependency(%q<rack>, ["< 3", ">= 1.6.2"]) s.add_dependency(%q<bundler>, ["~> 1.14"]) s.add_dependency(%q<rake>, ["~> 12.0"]) end else s.add_dependency(%q<hashie>, [">= 3.4.6"]) s.add_dependency(%q<rack>, ["< 3", ">= 1.6.2"]) s.add_dependency(%q<bundler>, ["~> 1.14"]) s.add_dependency(%q<rake>, ["~> 12.0"]) end end
51.840909
608
0.658922
7a316518b079d5ed32ac6bfefd11ca4844d2a881
320
object @user node(:url) { |user| username_url(user) } attributes :username child @background => :background do attributes :title, :body, :id node(:url) { |fact| username_fact_url(@user, fact) } end child @recent => :recent do attributes :title, :body, :id node(:url) { |fact| username_fact_url(@user, fact) } end
29.090909
54
0.690625
b92b4b9679aad4b8ecc8b79e01a4801ff4eb00f6
1,635
# frozen_string_literal: true # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. module Selenium module WebDriver module EdgeHtml # # Driver implementation for Microsoft Edge. # @api private # class Driver < WebDriver::Driver include DriverExtensions::HasWebStorage include DriverExtensions::TakesScreenshot def initialize(opts = {}) opts[:desired_capabilities] ||= Remote::Capabilities.edge opts[:url] ||= service_url(opts) listener = opts.delete(:listener) desired_capabilities = opts.delete(:desired_capabilities) @bridge = Remote::Bridge.new(opts) @bridge.create_session(desired_capabilities) super(@bridge, listener: listener) end def browser :edge end end # Driver end # Edge end # WebDriver end # Selenium
30.277778
67
0.69419
01f2a43c37ab3bd777d21008c01b970d8151e427
33,821
require_relative "test_helper" class ArraySingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Array)" def test_new assert_send_type "() -> ::Array[untyped]", Array, :new assert_send_type "(Array[Integer]) -> ::Array[Integer]", Array, :new, [1,2,3] assert_send_type "(Integer) -> Array[untyped]", Array, :new, 3 assert_send_type "(ToInt) -> Array[untyped]", Array, :new, ToInt.new(3) assert_send_type "(ToInt, String) -> Array[String]", Array, :new, ToInt.new(3), "" assert_send_type "(ToInt) { (Integer) -> :foo } -> Array[:foo]", Array, :new, ToInt.new(3) do :foo end end def test_square_bracket assert_send_type "() -> Array[untyped]", Array, :[] assert_send_type "(Integer, String) -> Array[Integer | String]", Array, :[], 1, "2" end def test_try_convert assert_send_type "(Integer) -> nil", Array, :try_convert, 3 assert_send_type "(ToArray) -> Array[Integer]", Array, :try_convert, ToArray.new(1,2,3) end end class ArrayInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::Array[::Integer]" def test_and assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :&, [2,3,4] assert_send_type "(ToArray) -> Array[Integer]", [1,2,3], :&, ToArray.new(:a, :b, :c) end def test_mul assert_send_type "(Integer) -> Array[Integer]", [1], :*, 3 assert_send_type "(ToInt) -> Array[Integer]", [1], :*, ToInt.new(3) assert_send_type "(String) -> String", [1], :*, "," assert_send_type "(ToStr) -> String", [1], :*, ToStr.new(",") end def test_plus assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :+, [4,5,6] assert_send_type "(Array[String]) -> Array[Integer | String]", [1,2,3], :+, ["4", "5", "6"] assert_send_type "(ToArray) -> Array[Integer | String]", [1,2,3], :+, ToArray.new("a") refute_send_type "(Enum) -> Array[Integer | String]", [1,2,3], :+, Enum.new("a") end def test_minus assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :-, [4,5,6] assert_send_type "(ToArray) -> Array[Integer | String]", [1,2,3], :-, ToArray.new("a") refute_send_type "(Enum) -> Array[Integer]", [1,2,3], :-, Enum.new("a") end def test_lshift assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :<<, 4 end def test_aref assert_send_type "(Integer) -> Integer", [1,2,3], :[], 0 assert_send_type "(Float) -> Integer", [1,2,3], :[], 0.1 assert_send_type "(ToInt) -> Integer", [1], :[], ToInt.new(0) assert_send_type "(Integer, ToInt) -> Array[Integer]", [1,2,3], :[], 0, ToInt.new(2) assert_send_type "(Integer, ToInt) -> nil", [1,2,3], :[], 4, ToInt.new(2) assert_send_type "(Range[Integer]) -> Array[Integer]", [1,2,3], :[], 0...1 assert_send_type "(Range[Integer]) -> nil", [1,2,3], :[], 5..8 end def test_aupdate assert_send_type "(Integer, Integer) -> Integer", [1,2,3], :[]=, 0, 0 assert_send_type "(Integer, ToInt, Integer) -> Integer", [1,2,3], :[]=, 0, ToInt.new(2), -1 assert_send_type "(Integer, ToInt, Array[Integer]) -> Array[Integer]", [1,2,3], :[]=, 0, ToInt.new(2), [-1] assert_send_type "(Integer, ToInt, nil) -> nil", [1,2,3], :[]=, 0, ToInt.new(2), nil assert_send_type "(Range[Integer], Integer) -> Integer", [1,2,3], :[]=, 0..2, -1 assert_send_type "(Range[Integer], Array[Integer]) -> Array[Integer]", [1,2,3], :[]=, 0...2, [-1] assert_send_type "(Range[Integer], nil) -> nil", [1,2,3], :[]=, 0...2, nil end def test_all? assert_send_type "() -> bool", [1,2,3], :all? assert_send_type "(singleton(Integer)) -> bool", [1,2,3], :all?, Integer assert_send_type "() { (Integer) -> bool } -> bool", [1,2,3], :all? do true end end def test_any? assert_send_type "() -> bool", [1,2,3], :any? assert_send_type "(singleton(Integer)) -> bool", [1,2,3], :any?, Integer assert_send_type "() { (Integer) -> bool } -> bool", [1,2,3], :any? do true end end def test_assoc assert_send_type "(Integer) -> nil", [1,2,3], :assoc, 0 end def test_at assert_send_type "(Integer) -> Integer", [1,2,3], :at, 0 assert_send_type "(ToInt) -> Integer", [1,2,3], :at, ToInt.new(0) assert_send_type "(ToInt) -> nil", [1,2,3], :at, ToInt.new(-5) end def test_bsearch assert_send_type "() { (Integer) -> (true | false) } -> Integer", [0,1,2,3,4], :bsearch do |x| x > 2 end assert_send_type "() { (Integer) -> (true | false) } -> nil", [0,1,2,3,4], :bsearch do |x| x > 8 end assert_send_type "() { (Integer) -> Integer } -> Integer", [0,1,2,3,4], :bsearch do |x| 3 <=> x end assert_send_type "() { (Integer) -> Integer } -> nil", [0,1,2,3,4], :bsearch do |x| 8 <=> x end end def test_bsearch_index assert_send_type "() { (Integer) -> (true | false) } -> Integer", [0,1,2,3,4], :bsearch_index do |x| x > 2 end assert_send_type "() { (Integer) -> (true | false) } -> nil", [0,1,2,3,4], :bsearch_index do |x| x > 8 end assert_send_type "() { (Integer) -> Integer } -> Integer", [0,1,2,3,4], :bsearch_index do |x| 3 <=> x end assert_send_type "() { (Integer) -> Integer } -> nil", [0,1,2,3,4], :bsearch_index do |x| 8 <=> x end end def test_llear assert_send_type "() -> Array[Integer]", [1,2,3], :clear end def test_collect assert_send_type "() { (Integer) -> String } -> Array[String]", [1,2,3], :collect do |x| x.to_s end end def test_collect! assert_send_type "() { (Integer) -> Integer } -> Array[Integer]", [1,2,3], :collect! do |x| x+1 end end def test_combination assert_send_type "(Integer) -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :combination, 3 assert_send_type "(ToInt) -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :combination, ToInt.new(3) assert_send_type "(Integer) { (Array[Integer]) -> void } -> Array[Integer]", [1,2,3], :combination, 3 do end assert_send_type "(ToInt) { (Array[Integer]) -> void } -> Array[Integer]", [1,2,3], :combination, ToInt.new(3) do end end def test_compact assert_send_type "() -> Array[Integer]", [1,2,3], :compact assert_send_type "() -> nil", [1,2,3], :compact! end def test_concat assert_send_type "(Array[Integer], Array[Integer]) -> Array[Integer]", [1,2,3], :concat, [4,5,6], [7,8,9] assert_send_type "(Array[Integer], Array[Integer]) -> self", Class.new(Array).new, :concat, [4,5,6], [7,8,9] end def test_count assert_send_type "() -> Integer", [1,2,3], :count assert_send_type "(Integer) -> Integer", [1,2,3], :count, 1 assert_send_type "() { (Integer) -> bool } -> Integer", [1,2,3], :count do |x| x.odd? end end def test_cycle assert_send_type "() { (Integer) -> void } -> nil", [1,2,3], :cycle do break end assert_send_type "(Integer) { (Integer) -> void } -> nil", [1,2,3], :cycle, 3 do end assert_send_type "(ToInt) { (Integer) -> void } -> nil", [1,2,3], :cycle, ToInt.new(2) do end end def test_deconstruct assert_send_type "() -> Array[Integer]", [1,2,3], :deconstruct end def test_delete assert_send_type "(Integer) -> Integer", [1,2,3], :delete, 2 assert_send_type "(String) -> nil", [1,2,3], :delete, "" assert_send_type "(Integer) { (Integer) -> String } -> Integer", [1,2,3], :delete, 2 do "" end assert_send_type "(Symbol) { (Symbol) -> String } -> String", [1,2,3], :delete, :foo do "" end end def test_delete_at assert_send_type "(Integer) -> Integer", [1,2,3], :delete_at, 2 assert_send_type "(Integer) -> nil", [1,2,3], :delete_at, 100 assert_send_type "(ToInt) -> nil", [1,2,3], :delete_at, ToInt.new(300) end def test_delete_if assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :delete_if do |x| x.odd? end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :delete_if end def test_difference assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :difference, [2] end def test_dig assert_send_type "(Integer) -> Integer", [1,2,3], :dig, 1 assert_send_type "(Integer) -> nil", [1,2,3], :dig, 10 assert_send_type "(ToInt) -> nil", [1,2,3], :dig, ToInt.new(10) end def test_drop assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :drop, 2 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :drop, ToInt.new(2) end def test_drop_while assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :drop_while do false end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :drop_while end def test_each assert_send_type "() { (Integer) -> void } -> Array[Integer]", [1,2,3], :each do end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :each end def test_each_index assert_send_type "() { (Integer) -> void } -> Array[Integer]", [1,2,3], :each_index do end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :each_index end def test_empty? assert_send_type "() -> bool", [1,2,3], :empty? end def test_fetch assert_send_type "(Integer) -> Integer", [1,2,3], :fetch, 1 assert_send_type "(ToInt) -> Integer", [1,2,3], :fetch, ToInt.new(1) assert_send_type "(ToInt, String) -> Integer", [1,2,3], :fetch, ToInt.new(1), "foo" assert_send_type "(ToInt, String) -> String", [1,2,3], :fetch, ToInt.new(10), "foo" assert_send_type "(Integer) { (Integer) -> Symbol } -> Integer", [1,2,3], :fetch, 1 do :hello end assert_send_type "(Integer) { (Integer) -> Symbol } -> Symbol", [1,2,3], :fetch, 10 do :hello end end def test_fill assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :fill, 0 assert_send_type "(Integer, nil) -> Array[Integer]", [1,2,3], :fill, 0, nil assert_send_type "(Integer, ToInt) -> Array[Integer]", [1,2,3], :fill, 0, ToInt.new(1) assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :fill, 0, 1 assert_send_type "(Integer, Integer, Integer) -> Array[Integer]", [1,2,3], :fill, 0, 1, 2 assert_send_type "(Integer, ToInt, ToInt) -> Array[Integer]", [1,2,3], :fill, 0, ToInt.new(1), ToInt.new(2) assert_send_type "(Integer, Integer, nil) -> Array[Integer]", [1,2,3], :fill, 0, 1, nil assert_send_type "(Integer, Range[Integer]) -> Array[Integer]", [1,2,3], :fill, 0, 1..2 assert_send_type "() { (Integer) -> Integer } -> Array[Integer]", [1,2,3], :fill do |i| i * 10 end assert_send_type "(ToInt, ToInt) { (Integer) -> Integer } -> Array[Integer]", [1,2,3], :fill, ToInt.new(0), ToInt.new(2) do |i| i * 10 end assert_send_type "(Range[Integer]) { (Integer) -> Integer } -> Array[Integer]", [1,2,3], :fill, 0..2 do |i| i * 10 end end def test_filter assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :filter do |i| i < 1 end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :filter end def test_filter! assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :filter! do |i| i < 0 end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :filter! do |i| i > 0 end assert_send_type "() -> Enumerator[Integer, Array[Integer]?]", [1,2,3], :filter! end def test_find_index assert_send_type "(Integer) -> Integer", [1,2,3], :find_index, 1 assert_send_type "(String) -> nil", [1,2,3], :find_index, "0" assert_send_type "() { (Integer) -> bool } -> Integer", [1,2,3], :find_index do |i| i.odd? end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :find_index do |i| i < 0 end assert_send_type "() -> Enumerator[Integer, Integer?]", [1,2,3], :find_index end def test_first assert_send_type "() -> Integer", [1,2,3], :first assert_send_type "() -> nil", [], :first assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :first, 2 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :first, ToInt.new(2) assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :first, 0 end def test_flatten assert_send_type "() -> Array[untyped]", [1,2,3], :flatten assert_send_type "(Integer) -> Array[untyped]", [1,2,3], :flatten, 3 assert_send_type "(ToInt) -> Array[untyped]", [1,2,3], :flatten, ToInt.new(3) end def test_flatten! assert_send_type "() -> Array[untyped]?", [1,2,3], :flatten! assert_send_type "(Integer) -> Array[untyped]?", [1,2,3], :flatten!, 3 assert_send_type "(ToInt) -> Array[untyped]?", [1,2,3], :flatten!, ToInt.new(3) end def test_include? assert_send_type "(Integer) -> bool", [1,2,3], :include?, 1 assert_send_type "(String) -> bool", [1,2,3], :include?, "" end def test_index assert_send_type "(Integer) -> Integer", [1,2,3], :index, 1 assert_send_type "(String) -> nil", [1,2,3], :index, "0" assert_send_type "() { (Integer) -> bool } -> Integer", [1,2,3], :index do |i| i.odd? end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :index do |i| i < 0 end assert_send_type "() -> Enumerator[Integer, Integer?]", [1,2,3], :index end def test_insert assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :insert, 0, 10 assert_send_type "(ToInt, Integer, Integer, Integer) -> Array[Integer]", [1,2,3], :insert, ToInt.new(0), 10, 20, 30 assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :insert, 0 end def test_intersection assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :intersection, [2,3,4] assert_send_type "(Array[Integer], Array[String], ToArray) -> Array[Integer]", [1,2,3], :intersection, [2,3,4], ["a"], ToArray.new(true, false) assert_send_type "() -> Array[Integer]", [1,2,3], :intersection end def test_join assert_send_type "() -> String", [1,2,3], :join assert_send_type "(String) -> String", [1,2,3], :join, "," assert_send_type "(ToStr) -> String", [1,2,3], :join, ToStr.new(",") end def test_keep_if assert_send_type "() { (Integer) -> false } -> Array[Integer]", [1,2,3], :keep_if do false end assert_send_type "() { (Integer) -> true } -> Array[Integer]", [1,2,3], :keep_if do true end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :keep_if end def test_last assert_send_type "() -> Integer", [1,2,3], :last assert_send_type "() -> nil", [], :last assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :last, 2 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :last, ToInt.new(0) end def test_length assert_send_type "() -> Integer", [1,2,3], :length end def test_map assert_send_type "() { (Integer) -> String } -> Array[String]", [1,2,3], :map do |x| x.to_s end assert_send_type "() -> Enumerator[Integer, Array[untyped]]", [1,2,3], :map end def test_map! assert_send_type "() { (Integer) -> Integer } -> Array[Integer]", [1,2,3], :map! do |x| x+1 end end def test_max assert_send_type "() -> Integer", [1,2,3], :max assert_send_type "() -> nil", [], :max assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :max, 1 assert_send_type "(ToInt) -> Array[Integer]", [], :max, ToInt.new(1) assert_send_type "() { (Integer, Integer) -> Integer } -> Integer", [1,2,3], :max do |_, _| 1 end assert_send_type "() { (Integer, Integer) -> Integer } -> nil", [], :max do |_, _| 0 end assert_send_type "(ToInt) { (Integer, Integer) -> Integer } -> Array[Integer]", [1,2,3], :max, ToInt.new(2) do |_, _| 0 end refute_send_type "(Integer) { (Integer, Integer) -> ToInt } -> Array[Integer]", [1,2,3], :max, 2 do |_, _| ToInt.new(0) end end def test_minmax assert_send_type "() -> [Integer, Integer]", [1,2,3], :minmax assert_send_type "() -> [Integer, Integer]", [1], :minmax assert_send_type "() -> [nil, nil]", [], :minmax assert_send_type "() { (Integer, Integer) -> Integer } -> [Integer, Integer]", [1, 2], :minmax do |_, _| 0 end end def test_none? assert_send_type "() -> bool", [1,2,3], :none? assert_send_type "(singleton(String)) -> bool", [1,2,3], :none?, String assert_send_type "() { (Integer) -> bool } -> bool", [1,2,3], :none? do |x| x.even? end end def test_one? assert_send_type "() -> bool", [1,2,3], :one? assert_send_type "(singleton(String)) -> bool", [1,2,3], :one?, String assert_send_type "() { (Integer) -> bool } -> bool", [1,2,3], :one? do |x| x.even? end end def test_pack assert_send_type "(String) -> String", [1,2,3], :pack, "ccc" assert_send_type "(ToStr) -> String", [1,2,3], :pack, ToStr.new("ccc") assert_send_type "(String, buffer: String) -> String", [1,2,3], :pack, "ccc", buffer: "" assert_send_type "(String, buffer: nil) -> String", [1,2,3], :pack, "ccc", buffer: nil refute_send_type "(ToStr, buffer: ToStr) -> String", [1,2,3], :pack, ToStr.new("ccc"), buffer: ToStr.new("") end def test_permutation assert_send_type "(Integer) -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :permutation, 2 assert_send_type "() -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :permutation assert_send_type "(Integer) { (Array[Integer]) -> void } -> Array[Integer]", [1,2,3], :permutation, 2 do end assert_send_type "() { (Array[Integer]) -> void } -> Array[Integer]", [1,2,3], :permutation do end end def test_pop assert_send_type "() -> Integer", [1,2,3], :pop assert_send_type "() -> nil", [], :pop assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :pop, 1 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :pop, ToInt.new(2) end def test_product assert_send_type "() -> Array[[Integer]]", [1,2,3], :product assert_send_type "(Array[String]) -> Array[[Integer, String]]", [1,2,3], :product, ["a", "b"] assert_send_type "(Array[String], Array[Symbol]) -> Array[[Integer, String, Symbol]]", [1,2,3], :product, ["a", "b"], [:a, :b] assert_send_type "(Array[String], Array[Symbol], Array[true | false]) -> Array[Array[Integer | String | Symbol | true | false]]", [1,2,3], :product, ["a", "b"], [:a, :b], [true, false] end def test_push assert_send_type "() -> Array[Integer]", [1,2,3], :push assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :push, 4, 5 end def test_rassoc assert_send_type "(String) -> nil", [1,2,3], :rassoc, "3" end def test_reject assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :reject do |x| x.odd? end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :reject end def test_reject! assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :reject! do |x| x.odd? end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :reject! do |x| x == "" end assert_send_type "() -> Enumerator[Integer, Array[Integer]?]", [1,2,3], :reject! end def test_repeated_combination assert_send_type "(ToInt) { (Array[Integer]) -> nil } -> Array[Integer]", [1,2,3], :repeated_combination, ToInt.new(2) do end assert_send_type "(ToInt) -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :repeated_combination, ToInt.new(2) end def test_repeated_permutation assert_send_type "(ToInt) { (Array[Integer]) -> nil } -> Array[Integer]", [1,2,3], :repeated_permutation, ToInt.new(2) do end assert_send_type "(ToInt) -> Enumerator[Array[Integer], Array[Integer]]", [1,2,3], :repeated_permutation, ToInt.new(2) end def test_replace assert_send_type "(Array[Integer]) -> Array[Integer]", [1,2,3], :replace, [2,3,4] end def test_reverse assert_send_type "() -> Array[Integer]", [1,2,3], :reverse end def test_reverse! assert_send_type "() -> Array[Integer]", [1,2,3], :reverse! end def test_reverse_each assert_send_type "() { (Integer) -> nil } -> Array[Integer]", [1,2,3], :reverse_each do end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [2,3,4], :reverse_each end def test_rindex assert_send_type "(Integer) -> Integer", [1,2,3], :rindex, 1 assert_send_type "(String) -> nil", [1,2,3], :rindex, "0" assert_send_type "() { (Integer) -> bool } -> Integer", [1,2,3], :rindex do |i| i.odd? end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :rindex do |i| i < 0 end assert_send_type "() -> Enumerator[Integer, Integer?]", [1,2,3], :rindex end def test_rotate assert_send_type "() -> Array[Integer]", [1,2,3], :rotate assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :rotate, 3 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :rotate, ToInt.new(2) end def test_rotate! assert_send_type "() -> Array[Integer]", [1,2,3], :rotate! assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :rotate!, 3 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :rotate!, ToInt.new(2) end def test_sample assert_send_type "() -> Integer", [1,2,3], :sample assert_send_type "() -> nil", [], :sample assert_send_type "(random: Random) -> Integer", [1,2,3], :sample, random: Random.new(1) assert_send_type "(random: Rand) -> Integer", [1,2,3], :sample, random: Rand.new assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :sample, 2 assert_send_type "(ToInt, random: Random) -> Array[Integer]", [1,2,3], :sample, ToInt.new(2), random: Random.new(2) assert_send_type "(ToInt, random: Rand) -> Array[Integer]", [1,2,3], :sample, ToInt.new(2), random: Rand.new end def test_select assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :select do |i| i < 1 end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :select end def test_select! assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :select! do |i| i < 1 end assert_send_type "() { (Integer) -> bool } -> nil", [1,2,3], :select! do true end assert_send_type "() -> Enumerator[Integer, Array[Integer]?]", [1,2,3], :select! end def test_shift assert_send_type "() -> Integer", [1,2,3], :shift assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :shift, ToInt.new(1) end def test_shuffle assert_send_type "() -> Array[Integer]", [1,2,3], :shuffle assert_send_type "(random: Random) -> Array[Integer]", [1,2,3], :shuffle, random: Random.new(2) assert_send_type "(random: Rand) -> Array[Integer]", [1,2,3], :shuffle, random: Rand.new end def test_shuffle! assert_send_type "() -> Array[Integer]", [1,2,3], :shuffle! assert_send_type "(random: Random) -> Array[Integer]", [1,2,3], :shuffle!, random: Random.new(2) assert_send_type "(random: Rand) -> Array[Integer]", [1,2,3], :shuffle!, random: Rand.new end def test_slice assert_send_type "(Integer) -> Integer", [1,2,3], :slice, 1 assert_send_type "(ToInt) -> nil", [1,2,3], :slice, ToInt.new(11) assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :slice, 1, 2 assert_send_type "(ToInt, ToInt) -> nil", [1,2,3], :slice, ToInt.new(10), ToInt.new(2) assert_send_type "(Range[Integer]) -> Array[Integer]", [1,2,3], :slice, 1...2 assert_send_type "(Range[Integer]) -> nil", [1,2,3], :slice, 11...21 end def test_slice! assert_send_type "(Integer) -> Integer", [1,2,3], :slice!, 1 assert_send_type "(ToInt) -> nil", [1,2,3], :slice!, ToInt.new(11) assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :slice!, 1, 2 assert_send_type "(ToInt, ToInt) -> nil", [1,2,3], :slice!, ToInt.new(10), ToInt.new(2) assert_send_type "(Range[Integer]) -> Array[Integer]", [1,2,3], :slice!, 1...2 assert_send_type "(Range[Integer]) -> nil", [1,2,3], :slice!, 11...21 end def test_sort assert_send_type "() -> Array[Integer]", [1,2,3], :sort assert_send_type "() { (Integer, Integer) -> Integer } -> Array[Integer]", [1,2,3], :sort do |a, b| b <=> a end refute_send_type "() { (Integer, Integer) -> nil } -> Array[Integer]", [1,2,3], :sort do end end def test_sort! assert_send_type "() -> Array[Integer]", [1,2,3], :sort! assert_send_type "() { (Integer, Integer) -> Integer } -> Array[Integer]", [1,2,3], :sort! do |a, b| b <=> a end refute_send_type "() { (Integer, Integer) -> nil } -> Array[Integer]", [1,2,3], :sort! do end end def test_sort_by! assert_send_type "() { (Integer) -> String } -> Array[Integer]", [1,2,3], :sort_by! do |x| x.to_s end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :sort_by! end def test_sum assert_send_type "() -> Integer", [1,2,3], :sum assert_send_type "(Integer) -> Integer", [1,2,3], :sum, 2 assert_send_type "(String) { (Integer) -> String } -> String", [1,2,3], :sum, "**" do |x| x.to_s end end def test_take assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :take, 2 assert_send_type "(ToInt) -> Array[Integer]", [1,2,3], :take, ToInt.new(2) end def test_take_while assert_send_type "() { (Integer) -> bool } -> Array[Integer]", [1,2,3], :take_while do |x| x < 2 end assert_send_type "() -> Enumerator[Integer, Array[Integer]]", [1,2,3], :take_while end def test_to_a assert_send_type "() -> Array[Integer]", [1,2,3], :to_a end def test_to_ary assert_send_type "() -> Array[Integer]", [1,2,3], :to_ary end def test_to_h testing "::Array[[::String, ::Integer]]" do assert_send_type "() -> Hash[String, Integer]", [["foo", 1], ["bar", 2]], :to_h end assert_send_type "() { (Integer) -> [Symbol, String] } -> Hash[Symbol, String]", [1,2,3], :to_h do |i| [:"s#{i}", i.to_s ] end end def test_transpose testing "::Array[[::String, ::Integer]]" do assert_send_type "() -> [Array[String], Array[Integer]]", [["foo", 1], ["bar", 2]], :transpose end end def test_union assert_send_type "() -> Array[Integer]", [1,2,3], :union assert_send_type "(Array[Symbol]) -> Array[Integer | Symbol]", [1,2,3], :union, [:x, :y, :z] end def test_uniq assert_send_type "() -> Array[Integer]", [1,2,3], :uniq assert_send_type "() { (Integer) -> String } -> Array[Integer]", [1,2,3], :uniq do |i| i.to_s end end def test_uniq! assert_send_type "() -> Array[Integer]", [1,2,3,1], :uniq! assert_send_type "() -> nil", [1,2,3], :uniq! assert_send_type "() { (Integer) -> String } -> Array[Integer]", [1,2,3, 1], :uniq! do |i| i.to_s end assert_send_type "() { (Integer) -> String } -> nil", [1,2,3], :uniq! do |i| i.to_s end end def test_unshift assert_send_type "() -> Array[Integer]", [1,2,3], :unshift assert_send_type "(Integer, Integer) -> Array[Integer]", [1,2,3], :unshift, 4, 5 end def test_values_at assert_send_type "() -> Array[Integer]", [1,2,3], :values_at assert_send_type "(Integer) -> Array[Integer]", [1,2,3], :values_at, 2 assert_send_type "(ToInt, Integer) -> Array[Integer?]", [1,2,3], :values_at, ToInt.new(2), 3 assert_send_type "(ToInt, Range[Integer]) -> Array[Integer?]", [1,2,3], :values_at, ToInt.new(2), 0..1 end def test_zip assert_send_type "(Array[String]) -> Array[[Integer, String?]]", [1,2,3], :zip, ["a", "b"] assert_send_type "(Array[String]) -> Array[[Integer, String]]", [1,2,3], :zip, ["a", "b", "c", "d"] assert_send_type "(Array[String], Array[Symbol]) -> Array[Array[untyped]]", [1,2,3], :zip, ["a", "b"], [:foo, :bar] assert_send_type "(Array[String]) { ([Integer, String?]) -> true } -> nil", [1,2,3], :zip, ["a", "b"] do true end end def test_vbar assert_send_type "(Array[String]) -> Array[Integer | String]", [1,2,3], :|, ["x", "y"] end end
35.41466
133
0.494013
d586af9c2c162ffa0b2b9b3a6359b0212ca634ec
2,356
class Libass < Formula desc "Subtitle renderer for the ASS/SSA subtitle format" homepage "https://github.com/libass/libass" url "https://github.com/libass/libass/releases/download/0.14.0/libass-0.14.0.tar.xz" sha256 "881f2382af48aead75b7a0e02e65d88c5ebd369fe46bc77d9270a94aa8fd38a2" revision 1 bottle do cellar :any sha256 "36b9be3be830f1e944eb7484c1a1f1495d1c5f454430bca9526660c416c50998" => :mojave sha256 "2d8f9ced8b8d4d7327a79e86ddf80d01bfbb96e040a8ac56798d4e2513a26e90" => :high_sierra sha256 "67f577f99f875a5f4998fb5d5cac85ba67dd39ef3b1b76037759fd64c86548bd" => :sierra sha256 "f48697b75e514bc69f390803b1d7c8f748c9796ad332c4fdceebbc57402592a3" => :el_capitan sha256 "d34b7773a45dec2765c48a504bd7cbd83b57301c488ca10053a7684b49532b3b" => :x86_64_linux end head do url "https://github.com/libass/libass.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end option "with-fontconfig", "Disable CoreText backend in favor of the more traditional fontconfig" if OS.mac? depends_on "pkg-config" => :build depends_on "nasm" => :build depends_on "freetype" depends_on "fribidi" depends_on "harfbuzz" => :recommended depends_on "fontconfig" => OS.mac? ? :optional : :recommended def install args = %W[--disable-dependency-tracking --prefix=#{prefix}] args << "--disable-harfbuzz" if build.without? "harfbuzz" if build.with? "fontconfig" args << "--disable-coretext" else args << "--disable-fontconfig" end system "autoreconf", "-i" if build.head? system "./configure", *args system "make", "install" end test do (testpath/"test.cpp").write <<~EOS #include "ass/ass.h" int main() { ASS_Library *library; ASS_Renderer *renderer; library = ass_library_init(); if (library) { renderer = ass_renderer_init(library); if (renderer) { ass_renderer_done(renderer); ass_library_done(library); return 0; } else { ass_library_done(library); return 1; } } else { return 1; } } EOS system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lass", "-o", "test" system "./test" end end
30.597403
109
0.657895
626ffa31b078aad19d798dfbc27ae742225c5b56
5,487
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ContainerInstance::Mgmt::V2017_08_01_preview # # A service client - single point of access to the REST API. # class ContainerInstanceManagementClient < MsRestAzure::AzureServiceClient include MsRestAzure include MsRestAzure::Serialization # @return [String] the base URI of the service. attr_accessor :base_url # @return Credentials needed for the client to connect to Azure. attr_reader :credentials # @return [String] Subscription credentials which uniquely identify # Microsoft Azure subscription. The subscription ID forms part of the URI # for every service call. attr_accessor :subscription_id # @return [String] Client API version attr_reader :api_version # @return [String] The preferred language for the response. attr_accessor :accept_language # @return [Integer] The retry timeout in seconds for Long Running # Operations. Default value is 30. attr_accessor :long_running_operation_retry_timeout # @return [Boolean] Whether a unique x-ms-client-request-id should be # generated. When set to true a unique x-ms-client-request-id value is # generated and included in each request. Default is true. attr_accessor :generate_client_request_id # @return [ContainerGroups] container_groups attr_reader :container_groups # @return [ContainerLogs] container_logs attr_reader :container_logs # # Creates initializes a new instance of the ContainerInstanceManagementClient class. # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. # @param base_url [String] the base URI of the service. # @param options [Array] filters to be applied to the HTTP requests. # def initialize(credentials = nil, base_url = nil, options = nil) super(credentials, options) @base_url = base_url || 'https://management.azure.com' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @container_groups = ContainerGroups.new(self) @container_logs = ContainerLogs.new(self) @api_version = '2017-08-01-preview' @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end # # Makes a request and returns the body of the response. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [Hash{String=>String}] containing the body of the response. # Example: # # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" # path = "/path" # options = { # body: request_content, # query_params: {'api-version' => '2016-02-01'} # } # result = @client.make_request(:put, path, options) # def make_request(method, path, options = {}) result = make_request_with_http_info(method, path, options) result.body unless result.nil? end # # Makes a request and returns the operation response. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. # def make_request_with_http_info(method, path, options = {}) result = make_request_async(method, path, options).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end # # Makes a request asynchronously. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [Concurrent::Promise] Promise object which holds the HTTP response. # def make_request_async(method, path, options = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = options[:base_url] || @base_url if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = options[:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? options.merge!({headers: request_headers.merge(options[:headers] || {})}) options.merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, options) end private # # Adds telemetry information. # def add_telemetry sdk_information = 'azure_mgmt_container_instance' sdk_information = "#{sdk_information}/0.17.6" add_user_agent_information(sdk_information) end end end
40.051095
154
0.698742
f76d645c16e0e04397efeef0fe3cfeac1fa00381
75,434
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'google/apis/core/base_service' require 'google/apis/core/json_representation' require 'google/apis/core/hashable' require 'google/apis/errors' module Google module Apis module BigquerydatatransferV1 # BigQuery Data Transfer API # # Transfers data from partner SaaS applications to Google BigQuery on a # scheduled, managed basis. # # @example # require 'google/apis/bigquerydatatransfer_v1' # # Bigquerydatatransfer = Google::Apis::BigquerydatatransferV1 # Alias the module # service = Bigquerydatatransfer::BigQueryDataTransferService.new # # @see https://cloud.google.com/bigquery/ class BigQueryDataTransferService < Google::Apis::Core::BaseService # @return [String] # API key. Your API key identifies your project and provides you with API access, # quota, and reports. Required unless you provide an OAuth 2.0 token. attr_accessor :key # @return [String] # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. attr_accessor :quota_user def initialize super('https://bigquerydatatransfer.googleapis.com/', '') @batch_path = 'batch' end # Returns true if valid credentials exist for the given data source and # requesting user. # Some data sources doesn't support service account, so we need to talk to # them on behalf of the end user. This API just checks whether we have OAuth # token for the particular user, which is a pre-requisite before user can # create a transfer config. # @param [String] name # The data source in the form: # `projects/`project_id`/dataSources/`data_source_id`` # @param [Google::Apis::BigquerydatatransferV1::CheckValidCredsRequest] check_valid_creds_request_object # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def check_project_data_source_valid_creds(name, check_valid_creds_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}:checkValidCreds', options) command.request_representation = Google::Apis::BigquerydatatransferV1::CheckValidCredsRequest::Representation command.request_object = check_valid_creds_request_object command.response_representation = Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Retrieves a supported data source and returns its settings, # which can be used for UI rendering. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/dataSources/`data_source_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::DataSource] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::DataSource] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_data_source(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::DataSource::Representation command.response_class = Google::Apis::BigquerydatatransferV1::DataSource command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Lists supported data sources and returns their settings, # which can be used for UI rendering. # @param [String] parent # The BigQuery project id for which data sources should be returned. # Must be in the form: `projects/`project_id`` # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListDataSourcesRequest` list results. For multiple-page # results, `ListDataSourcesResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_data_sources(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/dataSources', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse command.params['parent'] = parent unless parent.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Gets information about a location. # @param [String] name # Resource name for the location. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::Location] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::Location] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::Location::Representation command.response_class = Google::Apis::BigquerydatatransferV1::Location command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Lists information about the supported locations for this service. # @param [String] name # The resource that owns the locations collection, if applicable. # @param [String] filter # The standard list filter. # @param [Fixnum] page_size # The standard list page size. # @param [String] page_token # The standard list page token. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListLocationsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListLocationsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}/locations', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListLocationsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListLocationsResponse command.params['name'] = name unless name.nil? command.query['filter'] = filter unless filter.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns true if valid credentials exist for the given data source and # requesting user. # Some data sources doesn't support service account, so we need to talk to # them on behalf of the end user. This API just checks whether we have OAuth # token for the particular user, which is a pre-requisite before user can # create a transfer config. # @param [String] name # The data source in the form: # `projects/`project_id`/dataSources/`data_source_id`` # @param [Google::Apis::BigquerydatatransferV1::CheckValidCredsRequest] check_valid_creds_request_object # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def check_project_location_data_source_valid_creds(name, check_valid_creds_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}:checkValidCreds', options) command.request_representation = Google::Apis::BigquerydatatransferV1::CheckValidCredsRequest::Representation command.request_object = check_valid_creds_request_object command.response_representation = Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::CheckValidCredsResponse command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Retrieves a supported data source and returns its settings, # which can be used for UI rendering. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/dataSources/`data_source_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::DataSource] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::DataSource] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_location_data_source(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::DataSource::Representation command.response_class = Google::Apis::BigquerydatatransferV1::DataSource command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Lists supported data sources and returns their settings, # which can be used for UI rendering. # @param [String] parent # The BigQuery project id for which data sources should be returned. # Must be in the form: `projects/`project_id`` # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListDataSourcesRequest` list results. For multiple-page # results, `ListDataSourcesResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_location_data_sources(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/dataSources', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListDataSourcesResponse command.params['parent'] = parent unless parent.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Creates a new data transfer configuration. # @param [String] parent # The BigQuery project id where the transfer configuration should be created. # Must be in the format projects/`project_id`/locations/`location_id` # If specified location and location of the destination bigquery dataset # do not match - the request will fail. # @param [Google::Apis::BigquerydatatransferV1::TransferConfig] transfer_config_object # @param [String] authorization_code # Optional OAuth2 authorization code to use with this transfer configuration. # This is required if new credentials are needed, as indicated by # `CheckValidCreds`. # In order to obtain authorization_code, please make a # request to # https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=< # datatransferapiclientid>&scope=<data_source_scopes>&redirect_uri=<redirect_uri> # * client_id should be OAuth client_id of BigQuery DTS API for the given # data source returned by ListDataSources method. # * data_source_scopes are the scopes returned by ListDataSources method. # * redirect_uri is an optional parameter. If not specified, then # authorization code is posted to the opener of authorization flow window. # Otherwise it will be sent to the redirect uri. A special value of # urn:ietf:wg:oauth:2.0:oob means that authorization code should be # returned in the title bar of the browser, with the page text prompting # the user to copy the code and paste it in the application. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def create_project_location_transfer_config(parent, transfer_config_object = nil, authorization_code: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}/transferConfigs', options) command.request_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.request_object = transfer_config_object command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['parent'] = parent unless parent.nil? command.query['authorizationCode'] = authorization_code unless authorization_code.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Deletes a data transfer configuration, # including any associated transfer runs and logs. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::Empty] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::Empty] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def delete_project_location_transfer_config(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::Empty::Representation command.response_class = Google::Apis::BigquerydatatransferV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about a data transfer config. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_location_transfer_config(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about all data transfers in the project. # @param [String] parent # The BigQuery project id for which data sources # should be returned: `projects/`project_id``. # @param [Array<String>, String] data_source_ids # When specified, only configurations of requested data sources are returned. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransfersRequest` list results. For multiple-page # results, `ListTransfersResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_location_transfer_configs(parent, data_source_ids: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/transferConfigs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse command.params['parent'] = parent unless parent.nil? command.query['dataSourceIds'] = data_source_ids unless data_source_ids.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Updates a data transfer configuration. # All fields must be set, even if they are not updated. # @param [String] name # The resource name of the transfer config. # Transfer config names have the form of # `projects/`project_id`/location/`region`/transferConfigs/`config_id``. # The name is automatically generated based on the config_id specified in # CreateTransferConfigRequest along with project_id and region. If config_id # is not provided, usually a uuid, even though it is not guaranteed or # required, will be generated for config_id. # @param [Google::Apis::BigquerydatatransferV1::TransferConfig] transfer_config_object # @param [String] authorization_code # Optional OAuth2 authorization code to use with this transfer configuration. # If it is provided, the transfer configuration will be associated with the # authorizing user. # In order to obtain authorization_code, please make a # request to # https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=< # datatransferapiclientid>&scope=<data_source_scopes>&redirect_uri=<redirect_uri> # * client_id should be OAuth client_id of BigQuery DTS API for the given # data source returned by ListDataSources method. # * data_source_scopes are the scopes returned by ListDataSources method. # * redirect_uri is an optional parameter. If not specified, then # authorization code is posted to the opener of authorization flow window. # Otherwise it will be sent to the redirect uri. A special value of # urn:ietf:wg:oauth:2.0:oob means that authorization code should be # returned in the title bar of the browser, with the page text prompting # the user to copy the code and paste it in the application. # @param [String] update_mask # Required list of fields to be updated in this request. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def patch_project_location_transfer_config(name, transfer_config_object = nil, authorization_code: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:patch, 'v1/{+name}', options) command.request_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.request_object = transfer_config_object command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['name'] = name unless name.nil? command.query['authorizationCode'] = authorization_code unless authorization_code.nil? command.query['updateMask'] = update_mask unless update_mask.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Creates transfer runs for a time range [start_time, end_time]. # For each date - or whatever granularity the data source supports - in the # range, one transfer run is created. # Note that runs are created per UTC time in the time range. # @param [String] parent # Transfer configuration name in the form: # `projects/`project_id`/transferConfigs/`config_id``. # @param [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsRequest] schedule_transfer_runs_request_object # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def schedule_project_location_transfer_config_runs(parent, schedule_transfer_runs_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}:scheduleRuns', options) command.request_representation = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsRequest::Representation command.request_object = schedule_transfer_runs_request_object command.response_representation = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse command.params['parent'] = parent unless parent.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Deletes the specified transfer run. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`/runs/`run_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::Empty] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::Empty] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def delete_project_location_transfer_config_run(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::Empty::Representation command.response_class = Google::Apis::BigquerydatatransferV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about the particular transfer run. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`/runs/`run_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferRun] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferRun] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_location_transfer_config_run(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::TransferRun::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferRun command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about running and completed jobs. # @param [String] parent # Name of transfer configuration for which transfer runs should be retrieved. # Format of transfer configuration resource name is: # `projects/`project_id`/transferConfigs/`config_id``. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransferRunsRequest` list results. For multiple-page # results, `ListTransferRunsResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] run_attempt # Indicates how run attempts are to be pulled. # @param [Array<String>, String] states # When specified, only transfer runs with requested states are returned. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_location_transfer_config_runs(parent, page_size: nil, page_token: nil, run_attempt: nil, states: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/runs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse command.params['parent'] = parent unless parent.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['runAttempt'] = run_attempt unless run_attempt.nil? command.query['states'] = states unless states.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns user facing log messages for the data transfer run. # @param [String] parent # Transfer run name in the form: # `projects/`project_id`/transferConfigs/`config_Id`/runs/`run_id``. # @param [Array<String>, String] message_types # Message types to return. If not populated - INFO, WARNING and ERROR # messages are returned. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransferLogsRequest` list results. For multiple-page # results, `ListTransferLogsResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_location_transfer_config_run_transfer_logs(parent, message_types: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/transferLogs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse command.params['parent'] = parent unless parent.nil? command.query['messageTypes'] = message_types unless message_types.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Creates a new data transfer configuration. # @param [String] parent # The BigQuery project id where the transfer configuration should be created. # Must be in the format projects/`project_id`/locations/`location_id` # If specified location and location of the destination bigquery dataset # do not match - the request will fail. # @param [Google::Apis::BigquerydatatransferV1::TransferConfig] transfer_config_object # @param [String] authorization_code # Optional OAuth2 authorization code to use with this transfer configuration. # This is required if new credentials are needed, as indicated by # `CheckValidCreds`. # In order to obtain authorization_code, please make a # request to # https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=< # datatransferapiclientid>&scope=<data_source_scopes>&redirect_uri=<redirect_uri> # * client_id should be OAuth client_id of BigQuery DTS API for the given # data source returned by ListDataSources method. # * data_source_scopes are the scopes returned by ListDataSources method. # * redirect_uri is an optional parameter. If not specified, then # authorization code is posted to the opener of authorization flow window. # Otherwise it will be sent to the redirect uri. A special value of # urn:ietf:wg:oauth:2.0:oob means that authorization code should be # returned in the title bar of the browser, with the page text prompting # the user to copy the code and paste it in the application. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def create_project_transfer_config(parent, transfer_config_object = nil, authorization_code: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}/transferConfigs', options) command.request_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.request_object = transfer_config_object command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['parent'] = parent unless parent.nil? command.query['authorizationCode'] = authorization_code unless authorization_code.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Deletes a data transfer configuration, # including any associated transfer runs and logs. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::Empty] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::Empty] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def delete_project_transfer_config(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::Empty::Representation command.response_class = Google::Apis::BigquerydatatransferV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about a data transfer config. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_transfer_config(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about all data transfers in the project. # @param [String] parent # The BigQuery project id for which data sources # should be returned: `projects/`project_id``. # @param [Array<String>, String] data_source_ids # When specified, only configurations of requested data sources are returned. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransfersRequest` list results. For multiple-page # results, `ListTransfersResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_transfer_configs(parent, data_source_ids: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/transferConfigs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferConfigsResponse command.params['parent'] = parent unless parent.nil? command.query['dataSourceIds'] = data_source_ids unless data_source_ids.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Updates a data transfer configuration. # All fields must be set, even if they are not updated. # @param [String] name # The resource name of the transfer config. # Transfer config names have the form of # `projects/`project_id`/location/`region`/transferConfigs/`config_id``. # The name is automatically generated based on the config_id specified in # CreateTransferConfigRequest along with project_id and region. If config_id # is not provided, usually a uuid, even though it is not guaranteed or # required, will be generated for config_id. # @param [Google::Apis::BigquerydatatransferV1::TransferConfig] transfer_config_object # @param [String] authorization_code # Optional OAuth2 authorization code to use with this transfer configuration. # If it is provided, the transfer configuration will be associated with the # authorizing user. # In order to obtain authorization_code, please make a # request to # https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=< # datatransferapiclientid>&scope=<data_source_scopes>&redirect_uri=<redirect_uri> # * client_id should be OAuth client_id of BigQuery DTS API for the given # data source returned by ListDataSources method. # * data_source_scopes are the scopes returned by ListDataSources method. # * redirect_uri is an optional parameter. If not specified, then # authorization code is posted to the opener of authorization flow window. # Otherwise it will be sent to the redirect uri. A special value of # urn:ietf:wg:oauth:2.0:oob means that authorization code should be # returned in the title bar of the browser, with the page text prompting # the user to copy the code and paste it in the application. # @param [String] update_mask # Required list of fields to be updated in this request. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferConfig] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferConfig] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def patch_project_transfer_config(name, transfer_config_object = nil, authorization_code: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:patch, 'v1/{+name}', options) command.request_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.request_object = transfer_config_object command.response_representation = Google::Apis::BigquerydatatransferV1::TransferConfig::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferConfig command.params['name'] = name unless name.nil? command.query['authorizationCode'] = authorization_code unless authorization_code.nil? command.query['updateMask'] = update_mask unless update_mask.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Creates transfer runs for a time range [start_time, end_time]. # For each date - or whatever granularity the data source supports - in the # range, one transfer run is created. # Note that runs are created per UTC time in the time range. # @param [String] parent # Transfer configuration name in the form: # `projects/`project_id`/transferConfigs/`config_id``. # @param [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsRequest] schedule_transfer_runs_request_object # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def schedule_project_transfer_config_runs(parent, schedule_transfer_runs_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}:scheduleRuns', options) command.request_representation = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsRequest::Representation command.request_object = schedule_transfer_runs_request_object command.response_representation = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ScheduleTransferRunsResponse command.params['parent'] = parent unless parent.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Deletes the specified transfer run. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`/runs/`run_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::Empty] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::Empty] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def delete_project_transfer_config_run(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::Empty::Representation command.response_class = Google::Apis::BigquerydatatransferV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about the particular transfer run. # @param [String] name # The field will contain name of the resource requested, for example: # `projects/`project_id`/transferConfigs/`config_id`/runs/`run_id`` # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::TransferRun] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::TransferRun] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def get_project_transfer_config_run(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', options) command.response_representation = Google::Apis::BigquerydatatransferV1::TransferRun::Representation command.response_class = Google::Apis::BigquerydatatransferV1::TransferRun command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns information about running and completed jobs. # @param [String] parent # Name of transfer configuration for which transfer runs should be retrieved. # Format of transfer configuration resource name is: # `projects/`project_id`/transferConfigs/`config_id``. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransferRunsRequest` list results. For multiple-page # results, `ListTransferRunsResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] run_attempt # Indicates how run attempts are to be pulled. # @param [Array<String>, String] states # When specified, only transfer runs with requested states are returned. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_transfer_config_runs(parent, page_size: nil, page_token: nil, run_attempt: nil, states: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/runs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferRunsResponse command.params['parent'] = parent unless parent.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['runAttempt'] = run_attempt unless run_attempt.nil? command.query['states'] = states unless states.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end # Returns user facing log messages for the data transfer run. # @param [String] parent # Transfer run name in the form: # `projects/`project_id`/transferConfigs/`config_Id`/runs/`run_id``. # @param [Array<String>, String] message_types # Message types to return. If not populated - INFO, WARNING and ERROR # messages are returned. # @param [Fixnum] page_size # Page size. The default page size is the maximum value of 1000 results. # @param [String] page_token # Pagination token, which can be used to request a specific page # of `ListTransferLogsRequest` list results. For multiple-page # results, `ListTransferLogsResponse` outputs # a `next_page` token, which can be used as the # `page_token` value to request the next page of list results. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # Available to use for quota purposes for server-side applications. Can be any # arbitrary string assigned to a user, but should not exceed 40 characters. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def list_project_transfer_config_run_transfer_logs(parent, message_types: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+parent}/transferLogs', options) command.response_representation = Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse::Representation command.response_class = Google::Apis::BigquerydatatransferV1::ListTransferLogsResponse command.params['parent'] = parent unless parent.nil? command.query['messageTypes'] = message_types unless message_types.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end protected def apply_command_defaults(command) command.query['key'] = key unless key.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? end end end end end
63.711149
181
0.682424
edd93bc5bcd15c558694a0053d93d4172b1b20a7
964
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/google_ads/v2/enums/conversion_adjustment_type.proto require 'google/protobuf' require 'google/api/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_message "google.ads.googleads.v2.enums.ConversionAdjustmentTypeEnum" do end add_enum "google.ads.googleads.v2.enums.ConversionAdjustmentTypeEnum.ConversionAdjustmentType" do value :UNSPECIFIED, 0 value :UNKNOWN, 1 value :RETRACTION, 2 value :RESTATEMENT, 3 end end module Google::Ads::GoogleAds::V2::Enums ConversionAdjustmentTypeEnum = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v2.enums.ConversionAdjustmentTypeEnum").msgclass ConversionAdjustmentTypeEnum::ConversionAdjustmentType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v2.enums.ConversionAdjustmentTypeEnum.ConversionAdjustmentType").enummodule end
43.818182
211
0.820539
388c1daddebee178412bfaf1c5295ee66c5f6400
1,512
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__) class Php54Intl < AbstractPhp54Extension init homepage "http://php.net/manual/en/book.intl.php" url PHP_SRC_TARBALL sha256 PHP_CHECKSUM[:sha256] version PHP_VERSION bottle do root_url "https://homebrew.bintray.com/bottles-php" sha256 "5d0bbf10273205549a378e1ffc6e236241ecbde2eb025ac8f59ce8a1352604c3" => :yosemite sha256 "e0c4407f8166262af445640208f3d3c28f8f60526bf4e58fbf6b9405b3f6abcc" => :mavericks sha256 "7545b19e8c0ef7799cfcf0df261f14fa54fec1b6216dd67360670a667ae62e26" => :mountain_lion end depends_on "icu4c" def install Dir.chdir "ext/intl" ENV.universal_binary if build.universal? safe_phpize system "./configure", "--prefix=#{prefix}", phpconfig, "--disable-dependency-tracking", "--enable-intl", "--with-icu-dir=#{Formula['icu4c'].prefix}" system "make" prefix.install "modules/intl.so" write_config_file if build.with? "config-file" end def config_file super + <<-EOS.undent ;intl.default_locale = ; This directive allows you to produce PHP errors when some error ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. ;intl.error_level = E_WARNING EOS end test do shell_output("php -m").include?("intl") end end
30.24
95
0.672619
5d3d60e0d502737d59a3e36d2431145487090911
648
source 'https://rubygems.org' gemspec path: '../' gem 'activerecord', '~> 5.1.0' gem 'railties', '~> 5.1.0' # Database Configuration group :development, :test do platforms :jruby do gem 'activerecord-jdbcmysql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' gem 'activerecord-jdbcpostgresql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' gem 'kramdown' end platforms :ruby, :rbx do gem 'sqlite3' gem 'mysql2' gem 'pg' gem 'redcarpet' end platforms :rbx do gem 'rubysl', '~> 2.0' gem 'rubinius-developer_tools' end end
23.142857
122
0.66821
21419ce5de9b496bec1d957b8649bb4673a8d485
1,160
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads/v5/errors/ad_sharing_error.proto require 'google/protobuf' require 'google/api/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("google/ads/googleads/v5/errors/ad_sharing_error.proto", :syntax => :proto3) do add_message "google.ads.googleads.v5.errors.AdSharingErrorEnum" do end add_enum "google.ads.googleads.v5.errors.AdSharingErrorEnum.AdSharingError" do value :UNSPECIFIED, 0 value :UNKNOWN, 1 value :AD_GROUP_ALREADY_CONTAINS_AD, 2 value :INCOMPATIBLE_AD_UNDER_AD_GROUP, 3 value :CANNOT_SHARE_INACTIVE_AD, 4 end end end module Google module Ads module GoogleAds module V5 module Errors AdSharingErrorEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v5.errors.AdSharingErrorEnum").msgclass AdSharingErrorEnum::AdSharingError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v5.errors.AdSharingErrorEnum.AdSharingError").enummodule end end end end end
35.151515
182
0.750862
e23f1e12f4a7e9ad200f80b99b248620d9d8463e
310
class FixEmergColumn < ActiveRecord::Migration def up remove_column :reports, :emergency_arrival_id add_column :reports, :emergency_arrival_time_id, :integer end def down remove_column :reports, :emergency_arrival_time_id add_column :reports, :emergency_arrival_time, :integer end end
25.833333
61
0.777419
ab80662d03d3e47e681710746844601d6ce3a5ce
404
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::CostManagement::Mgmt::V2019_03_01_preview module Models # # Defines values for FunctionType # module FunctionType None = "None" All = "All" AHUB = "AHUB" Reservations = "Reservations" end end end
22.444444
70
0.678218
0387fa341334cd630b567e3cf47fc17283581b59
2,777
# # TestRail API binding for Ruby (API v2, available since TestRail 3.0) # # Learn more: # # http://docs.gurock.com/testrail-api2/start # http://docs.gurock.com/testrail-api2/accessing # # Copyright Gurock Software GmbH. See license.md for details. # require 'net/http' require 'net/https' require 'uri' require 'json' module TestRail class APIClient @url = '' @user = '' @password = '' attr_accessor :user attr_accessor :password def initialize(base_url) if !base_url.match(/\/$/) base_url += '/' end @url = base_url + 'index.php?/api/v2/' end # # Send Get # # Issues a GET request (read) against the API and returns the result # (as Ruby hash). # # Arguments: # # uri The API method to call including parameters # (e.g. get_case/1) # def send_get(uri) _send_request('GET', uri, nil) end # # Send POST # # Issues a POST request (write) against the API and returns the result # (as Ruby hash). # # Arguments: # # uri The API method to call including parameters # (e.g. add_case/1) # data The data to submit as part of the request (as # Ruby hash, strings must be UTF-8 encoded) # def send_post(uri, data) _send_request('POST', uri, data) end def create_test_run(uri, data) @add_test = true _send_request('POST', uri, data) end private def _send_request(method, uri, data) url = URI.parse(@url + uri) if method == 'POST' request = Net::HTTP::Post.new(url.path + '?' + url.query) request.body = JSON.dump(data) else request = Net::HTTP::Get.new(url.path + '?' + url.query) end request.basic_auth(@user, @password) request.add_field('Content-Type', 'application/json') conn = Net::HTTP.new(url.host, url.port) if url.scheme == 'https' conn.use_ssl = true conn.verify_mode = OpenSSL::SSL::VERIFY_NONE end response = conn.request(request) return if response.code == "400" if response.body && !response.body.empty? result = JSON.parse(response.body) return result['id'] if @add_test else result = {} end if response.code != '200' if result && result.key?('error') error = '"' + result['error'] + '"' else error = 'No additional error message received' end raise APIError.new('TestRail API returned HTTP %s (%s)' % [response.code, error]) end result end end class APIError < StandardError end end
24.359649
74
0.559957
f83c91082a369caea05c4087d130052d88cb11b4
15,323
require "helper" require "inspec/profile_context" require "inspec/runner_mock" require "inspec/resource" require "inspec/resources/command" require "inspec/profile" describe Inspec::Profile do let(:logger) { Minitest::Mock.new } let(:home) { MockLoader.home } describe "with an empty profile" do let(:profile) { MockLoader.load_profile("empty-metadata") } it "has a default name containing the original target" do _(profile.params[:name]).must_match(/tests from .*empty-metadata/) end it "has no controls" do _(profile.params[:controls]).must_equal({}) end end describe "with simple metadata in profile" do let(:profile_id) { "simple-metadata" } let(:profile) { MockLoader.load_profile(profile_id) } it "has metadata" do _(profile.params[:name]).must_equal "yumyum profile" end it "has no controls" do _(profile.params[:controls]).must_equal({}) end it "can overwrite the profile ID" do testid = rand.to_s res = MockLoader.load_profile(profile_id, id: testid) _(res.params[:name]).must_equal testid end end describe "SHA256 sums" do it "works on an empty profile" do _(MockLoader.load_profile("empty-metadata").sha256).must_match(/\h{64}/) end it "works on a complete profile" do _(MockLoader.load_profile("complete-profile").sha256).must_match(/\h{64}/) end end describe "code info" do let(:profile_id) { "complete-profile" } let(:code) { "control 'test01' do\n impact 0.5\n title 'Catchy title'\n desc 'example.com should always exist.'\n describe host('example.com') do\n it { should be_resolvable }\n end\nend\n" } let(:loc) { { ref: "controls/host_spec.rb", line: 5 } } it "gets code from an uncompressed profile" do info = MockLoader.load_profile(profile_id).info _(info[:controls][0][:code]).must_equal code loc[:ref] = File.join(MockLoader.profile_path(profile_id), loc[:ref]) _(info[:controls][0][:source_location]).must_equal loc end it "gets code on zip profiles" do path = MockLoader.profile_zip(profile_id) info = MockLoader.load_profile(path).info _(info[:controls][0][:code]).must_equal code _(info[:controls][0][:source_location]).must_equal loc end it "gets code on tgz profiles" do path = MockLoader.profile_tgz(profile_id) info = MockLoader.load_profile(path).info _(info[:controls][0][:code]).must_equal code _(info[:controls][0][:source_location]).must_equal loc end end describe "code info with supports override" do let(:profile_id) { "skippy-profile-os" } it "overrides os-name and os-family" do path = MockLoader.profile_zip(profile_id) info = MockLoader.load_profile(path).info _(info[:supports][0][:"platform-family"]).must_equal "definitely_not_supported" _(info[:supports][1][:"platform-name"]).must_equal "definitely_also_not_supported" end end describe "skips loading on unsupported platform" do let(:profile_id) { "windows-only" } it "loads our profile but skips loading controls" do skip "Mock loader always supports all platforms - bad test, ref #3750 " info = MockLoader.load_profile(profile_id).info _(info[:controls]).must_be_empty end end describe "when checking" do describe "an empty profile" do let(:profile_id) { "empty-metadata" } it "prints loads of warnings" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :error, nil, ["Missing profile version in inspec.yml"] logger.expect :warn, nil, ["Missing profile summary in inspec.yml"] logger.expect :warn, nil, ["Missing profile maintainer in inspec.yml"] logger.expect :warn, nil, ["Missing profile copyright in inspec.yml"] logger.expect :warn, nil, ["Missing profile license in inspec.yml"] logger.expect :warn, nil, ["No controls or tests were defined."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal false _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_match(/tests from .*empty-metadata/) _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 1 _(result[:warnings].length).must_equal 5 end end describe "a complete metadata profile" do let(:profile_id) { "complete-metadata" } let(:profile) { MockLoader.load_profile(profile_id, { logger: logger }) } it "prints ok messages" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :info, nil, ["Metadata OK."] logger.expect :warn, nil, ["No controls or tests were defined."] result = profile.check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "name" _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 1 end end describe "a complete metadata profile with controls" do let(:profile_id) { "complete-profile" } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :info, nil, ["Metadata OK."] logger.expect :info, nil, ["Found 1 controls."] logger.expect :info, nil, ["Control definitions OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "complete" _(result[:summary][:controls]).must_equal 1 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 0 end end describe "a complete metadata profile with controls in a tarball" do let(:profile_id) { "complete-profile" } let(:profile_path) { MockLoader.profile_tgz(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :info, nil, ["Metadata OK."] logger.expect :info, nil, ["Found 1 controls."] logger.expect :info, nil, ["Control definitions OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "complete" _(result[:summary][:controls]).must_equal 1 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 0 end end describe "a complete metadata profile with controls in zipfile" do let(:profile_id) { "complete-profile" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :info, nil, ["Metadata OK."] logger.expect :info, nil, ["Found 1 controls."] logger.expect :info, nil, ["Control definitions OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "complete" _(result[:summary][:controls]).must_equal 1 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 0 end end describe "a complete metadata profile with controls in zipfile" do let(:profile_id) { "complete-profile" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :info, nil, ["Metadata OK."] logger.expect :info, nil, ["Found 1 controls."] logger.expect :info, nil, ["Control definitions OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "complete" _(result[:summary][:controls]).must_equal 1 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 0 end end describe "shows error if version is invalid" do let(:profile_id) { "invalid-version" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :warn, nil, ["No controls or tests were defined."] logger.expect :error, nil, ["Version needs to be in SemVer format"] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal false _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "invalid-version" _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 1 _(result[:warnings].length).must_equal 1 end end describe "a profile with a slash in the name" do let(:profile_path) { "slash-in-name/not-allowed" } # Slashes allowed here let(:profile_name) { "slash-in-name/not-allowed" } # But not here it "issues an error" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_path}"] logger.expect :error, nil, ["The profile name (#{profile_name}) contains a slash which " \ "is not permitted. Please remove all slashes from `inspec.yml`."] logger.expect :info, nil, ["Found 1 controls."] logger.expect :info, nil, ["Control definitions OK."] result = MockLoader.load_profile(profile_path, { logger: logger }).check logger.verify _(result[:warnings].length).must_equal 0 _(result[:errors].length).must_equal 1 end end describe "shows warning if license is invalid" do let(:profile_id) { "license-invalid" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :warn, nil, ["License 'Invalid License Name' needs to be in SPDX format or marked as 'Proprietary'. See https://spdx.org/licenses/."] logger.expect :warn, nil, ["No controls or tests were defined."] logger.expect :info, nil, ["Metadata OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "license-invalid" _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 2 end describe "shows no warning if license is spdx" do let(:profile_id) { "license-spdx" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :warn, nil, ["No controls or tests were defined."] logger.expect :info, nil, ["Metadata OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "license-spdx" _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 1 end end describe "accepts proprietary license" do let(:profile_id) { "license-proprietary" } let(:profile_path) { MockLoader.profile_zip(profile_id) } let(:profile) { MockLoader.load_profile(profile_path, { logger: logger }) } it "prints ok messages and counts the controls" do logger.expect :info, nil, ["Checking profile in #{home}/test/fixtures/profiles/#{profile_id}"] logger.expect :warn, nil, ["No controls or tests were defined."] logger.expect :info, nil, ["Metadata OK."] result = MockLoader.load_profile(profile_id, { logger: logger }).check # verify logger output logger.verify # verify hash result _(result[:summary][:valid]).must_equal true _(result[:summary][:location]).must_equal "#{home}/test/fixtures/profiles/#{profile_id}" _(result[:summary][:profile]).must_equal "license-proprietary" _(result[:summary][:controls]).must_equal 0 _(result[:errors].length).must_equal 0 _(result[:warnings].length).must_equal 1 end end end end end
40.861333
203
0.651961
33552b6980019b627fe286ba203051d0595d0f84
2,208
module AsposeWordsCloud # class DocumentPropertyResponse < BaseObject attr_accessor :document_property, :status, :code # attribute mapping from ruby-style variable name to JSON key def self.attribute_map { # :'document_property' => :'DocumentProperty', # :'status' => :'Status', # :'code' => :'Code' } end # attribute type def self.swagger_types { :'document_property' => :'DocumentProperty', :'status' => :'String', :'code' => :'String' } end def initialize(attributes = {}) return if !attributes.is_a?(Hash) || attributes.empty? # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'DocumentProperty'] self.document_property = attributes[:'DocumentProperty'] end if attributes[:'Status'] self.status = attributes[:'Status'] end if attributes[:'Code'] self.code = attributes[:'Code'] end end def status=(status) allowed_values = ["Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", "HttpVersionNotSupported"] if status && !allowed_values.include?(status) fail "invalid value for 'status', must be one of #{allowed_values}" end @status = status end end end
35.612903
838
0.631793
5d0a85926982c1fd7213e37172d1aa59c9a89c9b
783
# # Author:: Adam Jacob (<[email protected]>) # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Ohai.plugin(:OhaiTime) do provides "ohai_time" collect_data do ohai_time Time.now.to_f end end
30.115385
74
0.742018
089a04d8df850af0d9f51e1250241664f498bef1
842
# -*- encoding: utf-8 -*- # stub: yell 2.0.7 ruby lib Gem::Specification.new do |s| s.name = "yell".freeze s.version = "2.0.7" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Rudolf Schmidt".freeze] s.date = "2016-10-23" s.description = "Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before".freeze s.homepage = "http://rudionrailspec.github.com/yell".freeze s.licenses = ["MIT".freeze] s.rubyforge_project = "yell".freeze s.rubygems_version = "2.5.2.3".freeze s.summary = "Yell - Your Extensible Logging Library".freeze s.installed_by_version = "2.5.2.3" if s.respond_to? :installed_by_version end
40.095238
183
0.71734
4a86a5805a2d9ba69bf49aa81a78c8e19bf37b2d
5,083
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "SPOTS_production" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false # Inserts middleware to perform automatic connection switching. # The `database_selector` hash is used to pass options to the DatabaseSelector # middleware. The `delay` is used to determine how long to wait after a write # to send a subsequent read to the primary. # # The `database_resolver` class is used by the middleware to determine which # database is appropriate to use based on the time delay. # # The `database_resolver_context` class is used by the middleware to set # timestamps for the last write to the primary. The resolver uses the context # class timestamps to determine how long to wait before reading from the # replica. # # By default Rails will store a last write timestamp in the session. The # DatabaseSelector middleware is designed as such you can define your own # strategy for connection switching and pass that into the middleware through # these configuration options. # config.active_record.database_selector = { delay: 2.seconds } # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end
44.2
114
0.763329
b9ef7f4616d7e3a08dc72254a54aea878b00887c
674
module Shorti RSpec.describe FindShortenUrlByUrlService do context 'Normal cases' do describe 'shorten url exist' do it 'should fetch record correctly' do shorten_url = FactoryBot.create(:shorten_url) fetched_shorten_url = described_class.run(url: shorten_url.url) expect(fetched_shorten_url).to eq(shorten_url) end end end context 'Exception' do describe 'shorten url not exist' do it 'should raise RecordNotFound' do expect { described_class.run(url: 'not-found') }.to raise_error(ActiveRecord::RecordNotFound) end end end end end
25.923077
73
0.642433
bb4c3c3449f2a34a190a54b85de70957fd48fdce
529
class TopupPriceCalculator attr_reader :pluie_fee, :fixed_prices def self.default_instance @default ||= TopupPriceCalculator.new end def initialize(prices= {}, pluie_fee= 1.1) @fixed_prices = (((10..50).step(5).map { |a| [ a, (a * pluie_fee).round(1)] }).to_h).merge(prices) @fixed_prices.freeze @pluie_fee = pluie_fee end def calculate_price(topup) calculate_price_by_amount(topup.amount) end def calculate_price_by_amount(amount) fixed_prices[amount] || amount * pluie_fee end end
24.045455
102
0.706994
bff14490d6babc520e34f5c13757510a6b8f8529
1,559
class GtkChtheme < Formula desc "GTK+ 2.0 theme changer GUI" homepage "http://plasmasturm.org/code/gtk-chtheme/" url "http://plasmasturm.org/code/gtk-chtheme/gtk-chtheme-0.3.1.tar.bz2" sha256 "26f4b6dd60c220d20d612ca840b6beb18b59d139078be72c7b1efefc447df844" revision 3 livecheck do url :homepage regex(/href=.*?gtk-chtheme[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do sha256 cellar: :any, arm64_big_sur: "8db79039412079abddb969b631131eb3a85f4e90edbcda84bffe4505e55f44b7" sha256 cellar: :any, big_sur: "b6255d461ea8c2ce6606170fdfc3d0564cc7d83ad5feeb7243c6dac01a7ba9e1" sha256 cellar: :any, catalina: "6294abe2d8ad07c52cc78c6fd156fba145340c163d4be7d103ce91ef84d2911b" sha256 cellar: :any, mojave: "54438d348c8534071e384f17ce9e9e5e784ec9732b64249a996372360edb5f9a" sha256 cellar: :any, high_sierra: "5e3ddc7b15e6d35d857815932e80b39f0abf804c8526cc798f0b3d3d66fe0338" sha256 cellar: :any, sierra: "5af49da12ab0e1799377eb160cff68283b7a24e0149135603d35810e6c0d7e55" end depends_on "pkg-config" => :build depends_on "gettext" depends_on "gtk+" def install # Unfortunately chtheme relies on some deprecated functionality # we need to disable errors for it to compile properly inreplace "Makefile", "-DGTK_DISABLE_DEPRECATED", "" system "make", "PREFIX=#{prefix}", "install" end test do # package contains just an executable and a man file # executable accepts no options and just spawns a GUI assert_predicate bin/"gtk-chtheme", :exist? end end
38.975
106
0.750481
ed2f2b6f101305c84758337ab1f68846e0f00917
1,656
# This example tries Nokogiri (used in Shoes 4), but falls back to # Hpricot for Shoes 3 compatibility begin require 'nokogiri' rescue Exception => e require 'hpricot' end class Comic attr_reader :rss, :title def initialize(body) @rss = defined?(Nokogiri) ? Nokogiri::XML(body) : Hpricot(body) @title = @rss.at("//channel/title").inner_text end def items @rss.search("//channel/item") end def latest_image @rss.search("//channel/item").first.inner_html.scan(/src="([^"]+\.\w+)"/).first end end Shoes.app width: 800, height: 600 do background "#555" @title = "Web Funnies" @feeds = [ "http://xkcd.com/rss.xml", # No longer contains images #"http://feedproxy.google.com/DilbertDailyStrip?format=xml", # debug #"http://www.smbc-comics.com/rss.php", #"http://www.daybydaycartoon.com/index.xml", #"http://www.questionablecontent.net/QCRSS.xml", #"http://indexed.blogspot.com/feeds/posts/default?alt=rss" ] stack margin: 10 do title strong(@title), align: "center", stroke: "#DFA", margin: 0 para "(loaded from RSS feeds)", align: "center", stroke: "#DFA", margin: 0 @feeds.each do |feed| download feed do |dl| stack width: "100%", margin: 10, border: 1 do # Fall back to Shoes 3 syntax if necessary body = dl.respond_to?(:read) ? dl.read : dl.response.body c = Comic.new body stack margin_right: gutter do background "#333", curve: 4 caption c.title, stroke: "#CD9", margin: 4 end image c.latest_image.first, margin: 8 end end end end end
26.709677
83
0.618961
626c4b8f5ee56a7d28edd8dec895114e353aae33
8,496
require 'concurrent/map' require 'active_support/core_ext/module/remove_method' require 'active_support/core_ext/module/attribute_accessors' require 'action_view/template/resolver' module ActionView # = Action View Lookup Context # # <tt>LookupContext</tt> is the object responsible for holding all information # required for looking up templates, i.e. view paths and details. # <tt>LookupContext</tt> is also responsible for generating a key, given to # view paths, used in the resolver cache lookup. Since this key is generated # only once during the request, it speeds up all cache accesses. class LookupContext #:nodoc: attr_accessor :prefixes, :rendered_format mattr_accessor :fallbacks @@fallbacks = FallbackFileSystemResolver.instances mattr_accessor :registered_details self.registered_details = [] def self.register_detail(name, &block) self.registered_details << name Accessors::DEFAULT_PROCS[name] = block Accessors.send :define_method, :"default_#{name}", &block Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{name} @details.fetch(:#{name}, []) end def #{name}=(value) value = value.present? ? Array(value) : default_#{name} _set_detail(:#{name}, value) if value != @details[:#{name}] end METHOD end # Holds accessors for the registered details. module Accessors #:nodoc: DEFAULT_PROCS = {} end register_detail(:locale) do locales = [I18n.locale] locales.concat(I18n.fallbacks[I18n.locale]) if I18n.respond_to? :fallbacks locales << I18n.default_locale locales.uniq! locales end register_detail(:formats) { ActionView::Base.default_formats || [:html, :text, :js, :css, :xml, :json] } register_detail(:variants) { [] } register_detail(:handlers) { Template::Handlers.extensions } class DetailsKey #:nodoc: alias :eql? :equal? @details_keys = Concurrent::Map.new def self.get(details) if details[:formats] details = details.dup details[:formats] &= Template::Types.symbols end @details_keys[details] ||= new end def self.clear @details_keys.clear end def self.digest_caches @details_keys.values.map(&:digest_cache) end attr_reader :digest_cache def initialize @digest_cache = Concurrent::Map.new end end # Add caching behavior on top of Details. module DetailsCache attr_accessor :cache # Calculate the details key. Remove the handlers from calculation to improve performance # since the user cannot modify it explicitly. def details_key #:nodoc: @details_key ||= DetailsKey.get(@details) if @cache end # Temporary skip passing the details_key forward. def disable_cache old_value, @cache = @cache, false yield ensure @cache = old_value end protected def _set_detail(key, value) @details = @details.dup if @details_key @details_key = nil @details[key] = value end end # Helpers related to template lookup using the lookup context information. module ViewPaths attr_reader :view_paths, :html_fallback_for_js # Whenever setting view paths, makes a copy so that we can manipulate them in # instance objects as we wish. def view_paths=(paths) @view_paths = ActionView::PathSet.new(Array(paths)) end def find(name, prefixes = [], partial = false, keys = [], options = {}) @view_paths.find(*args_for_lookup(name, prefixes, partial, keys, options)) end alias :find_template :find def find_file(name, prefixes = [], partial = false, keys = [], options = {}) @view_paths.find_file(*args_for_lookup(name, prefixes, partial, keys, options)) end def find_all(name, prefixes = [], partial = false, keys = [], options = {}) @view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options)) end def exists?(name, prefixes = [], partial = false, keys = [], **options) @view_paths.exists?(*args_for_lookup(name, prefixes, partial, keys, options)) end alias :template_exists? :exists? def any?(name, prefixes = [], partial = false) @view_paths.exists?(*args_for_any(name, prefixes, partial)) end alias :any_templates? :any? # Adds fallbacks to the view paths. Useful in cases when you are rendering # a :file. def with_fallbacks added_resolvers = 0 self.class.fallbacks.each do |resolver| next if view_paths.include?(resolver) view_paths.push(resolver) added_resolvers += 1 end yield ensure added_resolvers.times { view_paths.pop } end protected def args_for_lookup(name, prefixes, partial, keys, details_options) #:nodoc: name, prefixes = normalize_name(name, prefixes) details, details_key = detail_args_for(details_options) [name, prefixes, partial || false, details, details_key, keys] end # Compute details hash and key according to user options (e.g. passed from #render). def detail_args_for(options) return @details, details_key if options.empty? # most common path. user_details = @details.merge(options) if @cache details_key = DetailsKey.get(user_details) else details_key = nil end [user_details, details_key] end def args_for_any(name, prefixes, partial) # :nodoc: name, prefixes = normalize_name(name, prefixes) details, details_key = detail_args_for_any [name, prefixes, partial || false, details, details_key] end def detail_args_for_any # :nodoc: @detail_args_for_any ||= begin details = {} registered_details.each do |k| if k == :variants details[k] = :any else details[k] = Accessors::DEFAULT_PROCS[k].call end end if @cache [details, DetailsKey.get(details)] else [details, nil] end end end # Support legacy foo.erb names even though we now ignore .erb # as well as incorrectly putting part of the path in the template # name instead of the prefix. def normalize_name(name, prefixes) #:nodoc: prefixes = prefixes.presence parts = name.to_s.split('/'.freeze) parts.shift if parts.first.empty? name = parts.pop return name, prefixes || [""] if parts.empty? parts = parts.join('/'.freeze) prefixes = prefixes ? prefixes.map { |p| "#{p}/#{parts}" } : [parts] return name, prefixes end end include Accessors include DetailsCache include ViewPaths def initialize(view_paths, details = {}, prefixes = []) @details_key = nil @cache = true @prefixes = prefixes @rendered_format = nil @details = initialize_details({}, details) self.view_paths = view_paths end def digest_cache details_key.digest_cache end def initialize_details(target, details) registered_details.each do |k| target[k] = details[k] || Accessors::DEFAULT_PROCS[k].call end target end private :initialize_details # Override formats= to expand ["*/*"] values and automatically # add :html as fallback to :js. def formats=(values) if values values.concat(default_formats) if values.delete "*/*".freeze if values == [:js] values << :html @html_fallback_for_js = true end end super(values) end # Override locale to return a symbol instead of array. def locale @details[:locale].first end # Overload locale= to also set the I18n.locale. If the current I18n.config object responds # to original_config, it means that it has a copy of the original I18n configuration and it's # acting as proxy, which we need to skip. def locale=(value) if value config = I18n.config.respond_to?(:original_config) ? I18n.config.original_config : I18n.config config.locale = value end super(default_locale) end end end
30.234875
109
0.630885
d5fc29bfc0cde36ca62ad467b20d73bec1f72b51
1,263
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ApiManagement::Mgmt::V2018_01_01 module Models # # Tenant access information update parameters of the API Management # service. # class AccessInformationUpdateParameters include MsRestAzure # @return [Boolean] Tenant access information of the API Management # service. attr_accessor :enabled # # Mapper for AccessInformationUpdateParameters class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'AccessInformationUpdateParameters', type: { name: 'Composite', class_name: 'AccessInformationUpdateParameters', model_properties: { enabled: { client_side_validation: true, required: false, serialized_name: 'enabled', type: { name: 'Boolean' } } } } } end end end end
26.3125
73
0.584323
bffd2bed7636aeee389277b579171d85717e74c5
2,768
class EmailParser attr_reader :sender, :recipient, :email_text, :email def initialize(sender, recipient, email_text) @sender = sender @recipient = recipient @email_text = email_text.forcibly_convert_to_utf8 @email = nil begin Utils.silence_stream(STDERR) do @email = Mail.read_from_string(email_text) end rescue end @sending_user = nil @parent = nil @body = nil end def user_token @recipient.gsub(/^#{Rails.application.shortname}-/, "").gsub(/@.*/, "") end def been_here? !!@email_text.match(/^X-BeenThere: #{Rails.application.shortname}-/i) end def sending_user return @sending_user if @sending_user if (user = User.where("mailing_list_mode > 0 AND mailing_list_token = ?", user_token).first) && user.is_active? @sending_user = user return user end end def parent return @parent if @parent irt = self.email[:in_reply_to].to_s.gsub(/[^A-Za-z0-9@\.]/, "") if (m = irt.match(/^comment\.([^\.]+)\.\d+@/)) @parent = Comment.where(:short_id => m[1]).first elsif (m = irt.match(/^story\.([^\.]+)\.\d+@/)) @parent = Story.where(:short_id => m[1]).first end @parent end def body return @body if @body @possible_charset = nil if self.email.multipart? # parts[0] - multipart/alternative # parts[0].parts[0] - text/plain # parts[0].parts[1] - text/html if (found = self.email.parts.first.parts.select {|p| p.content_type.match(/text\/plain/i) } ).any? @body = found.first.body.to_s begin @possible_charset = parts.first.content_type_parameters["charset"] rescue end # parts[0] - text/plain elsif (found = self.email.parts.select {|p| p.content_type.match(/text\/plain/i) }).any? @body = found.first.body.to_s begin @possible_charset = p.first.content_type_parameters["charset"] rescue end end # simple one-part elsif self.email.content_type.to_s.match?(/text\/plain/i) @body = self.email.body.to_s begin @possible_charset = self.email.content_type_parameters["charset"] rescue end elsif !self.email.content_type.to_s.present? # no content-type header, assume it's text/plain @body = self.email.body.to_s end # TODO: use @possible_charset, but did previously forcing the entire # email_text to utf8 screw this up already? # try to remove sig lines @body.gsub!(/^-- \n.+\z/m, "") # try to strip out attribution line, followed by an optional blank line, # and then lines prefixed with > @body.gsub!(/^(On|on|at) .*\n\n?(>.*\n)+/, "") @body.strip! end end
25.163636
99
0.611272
e97c076cd0eeb2910d9b79078247c1a36c46c603
1,283
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'google/apis/securitycenter_v1/service.rb' require 'google/apis/securitycenter_v1/classes.rb' require 'google/apis/securitycenter_v1/representations.rb' module Google module Apis # Cloud Security Command Center API # # Cloud Security Command Center API provides access to temporal views of assets # and findings within an organization. # # @see https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview module SecuritycenterV1 VERSION = 'V1' REVISION = '20190529' # View and manage your data across Google Cloud Platform services AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform' end end end
35.638889
91
0.749026
62f0616f2f2402250d2bd241cdf5054b40ae8716
6,779
# frozen_string_literal: true require 'spec_helper' RSpec.describe SystemNotes::EpicsService do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, :repository, group: group) } let_it_be(:author) { create(:user) } let(:noteable) { create(:issue, project: project) } let(:issue) { noteable } let(:epic) { create(:epic, group: group) } describe '#epic_issue' do let(:noteable) { epic } context 'issue added to an epic' do subject { described_class.new(noteable: noteable, author: author).epic_issue(issue, :added) } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'epic_issue_added' } end it 'creates the note text correctly' do expect(subject.note).to eq("added issue #{issue.to_reference(epic.group)}") end end context 'issue removed from an epic' do subject { described_class.new(noteable: epic, author: author).epic_issue(issue, :removed) } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'epic_issue_removed' } end it 'creates the note text correctly' do expect(subject.note).to eq("removed issue #{issue.to_reference(epic.group)}") end end end describe '#issue_on_epic' do context 'issue added to an epic' do subject { described_class.new(noteable: epic, author: author).issue_on_epic(issue, :added) } it_behaves_like 'a system note' do let(:action) { 'issue_added_to_epic' } end it 'creates the note text correctly' do expect(subject.note).to eq("added to epic #{epic.to_reference(issue.project)}") end end context 'issue removed from an epic' do subject { described_class.new(noteable: epic, author: author).issue_on_epic(issue, :removed) } it_behaves_like 'a system note' do let(:action) { 'issue_removed_from_epic' } end it 'creates the note text correctly' do expect(subject.note).to eq("removed from epic #{epic.to_reference(issue.project)}") end end context 'invalid type' do it 'raises an error' do expect { described_class.new(noteable: epic, author: author).issue_on_epic(issue, :invalid) } .not_to change { Note.count } end end end describe '#change_epic_date_note' do let(:timestamp) { Time.current } context 'when start date was changed' do let(:noteable) { create(:epic) } subject { described_class.new(noteable: noteable, author: author).change_epic_date_note('start date', timestamp) } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'epic_date_changed' } end it 'sets the note text' do expect(subject.note).to eq "changed start date to #{timestamp.strftime('%b %-d, %Y')}" end end context 'when start date was removed' do let(:noteable) { create(:epic, start_date: timestamp) } subject { described_class.new(noteable: noteable, author: author).change_epic_date_note('start date', nil) } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'epic_date_changed' } end it 'sets the note text' do expect(subject.note).to eq 'removed the start date' end end end describe '#issue_promoted' do context 'note on the epic' do subject { described_class.new(noteable: epic, author: author).issue_promoted(issue, direction: :from) } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'moved' } let(:expected_noteable) { epic } end it 'sets the note text' do expect(subject.note).to eq("promoted from issue #{issue.to_reference(group)}") end end context 'note on the issue' do subject { described_class.new(noteable: issue, author: author).issue_promoted(epic, direction: :to) } it_behaves_like 'a system note' do let(:action) { 'moved' } end it 'sets the note text' do expect(subject.note).to eq("promoted to epic #{epic.to_reference(project)}") end end end describe '#change_epics_relation' do context 'relate epic' do let(:child_epic) { create(:epic, parent: epic, group: group) } let(:noteable) { child_epic } subject { described_class.new(noteable: epic, author: author).change_epics_relation(child_epic, 'relate_epic') } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'relate_epic' } end context 'when epic is added as child to a parent epic' do it 'sets the note text' do expect { subject }.to change { Note.system.count }.from(0).to(2) expect(Note.first.note).to eq("added epic &#{child_epic.iid} as child epic") expect(Note.last.note).to eq("added epic &#{epic.iid} as parent epic") end end context 'when added epic is from a subgroup' do let(:subgroup) {create(:group, parent: group)} before do child_epic.update!({ group: subgroup }) end it 'sets the note text' do expect { subject }.to change { Note.system.count }.from(0).to(2) expect(Note.first.note).to eq("added epic #{group.path}/#{subgroup.path}&#{child_epic.iid} as child epic") expect(Note.last.note).to eq("added epic #{group.path}&#{epic.iid} as parent epic") end end end context 'unrelate epic' do let(:child_epic) { create(:epic, parent: epic, group: group) } let(:noteable) { child_epic } subject { described_class.new(noteable: epic, author: author).change_epics_relation(child_epic, 'unrelate_epic') } it_behaves_like 'a system note', exclude_project: true do let(:action) { 'unrelate_epic' } end context 'when child epic is removed from a parent epic' do it 'sets the note text' do expect { subject }.to change { Note.system.count }.from(0).to(2) expect(Note.first.note).to eq("removed child epic &#{child_epic.iid}") expect(Note.last.note).to eq("removed parent epic &#{epic.iid}") end end context 'when removed epic is from a subgroup' do let(:subgroup) {create(:group, parent: group)} before do child_epic.update!({ group: subgroup }) end it 'sets the note text' do expect { subject }.to change { Note.system.count }.from(0).to(2) expect(Note.first.note).to eq("removed child epic #{group.path}/#{subgroup.path}&#{child_epic.iid}") expect(Note.last.note).to eq("removed parent epic #{group.path}&#{epic.iid}") end end end end end
33.559406
120
0.636525
e8f84ebbd9f0a5d4c509fe1ee390d57df3edf73b
3,744
# frozen_string_literal: true require "net/http" require "cmd/home" module Homebrew module_function def changelog_args Homebrew::CLI::Parser.new do description <<~EOS Open a <formula> or <cask>'s changelog in a browser, or open Homebrew's own release notes if no argument is provided. EOS switch "--formula", "--formulae", description: "Treat all named arguments as formulae." switch "--cask", "--casks", description: "Treat all named arguments as casks." switch "-l", "--list", description: "List changelog URLs only." switch "-f", "--fast", description: "Skip slower checks for changelogs on GitHub URls." conflicts "--formula", "--cask" named_args [:formula, :cask] end end def changelog args = changelog_args.parse return exec_browser "#{HOMEBREW_WWW}/blog" if args.no_named? type = if args.casks? then "casks" elsif args.formulae? then "formulae" else concat = `cat #{__dir__}/../{casks,formulae}.yml` changelogs = YAML.safe_load concat, [String], aliases: true end changelogs ||= YAML.load_file "#{__dir__}/../#{type}.yml" open = args.named.to_formulae_and_casks.map do |formula| yaml, = Dir["#{formula.tap.path}/{Casks,Formula}/changelogs.y*ml"] changelogs.merge! YAML.load_file yaml if yaml token = formula.try(:token) || formula.name if (changelog = changelogs[token]) changelog.prepend "https://" unless changelog.start_with? "http:" next args.list? ? puts(changelog) : changelog end if formula.livecheckable? livecheck = formula.livecheck.url changelog ||= URI.parse case livecheck when :stable, :head then formula.downloader.url when :homepage, :url then formula.send(livecheck).to_s else livecheck end end if (head = formula.try(:head)&.url) changelog ||= URI.parse head end changelog ||= formula.try(:appcast)&.uri skip = %w[rss xml] if changelog&.path&.end_with?(*skip) then changelog = nil elsif changelog&.query&.end_with? "atom" then changelog.query = nil end changelog ||= URI.parse formula.homepage path = Pathname changelog.path case path.extname when ".git" then changelog.path.delete_suffix! path.extname when *UnpackStrategy.from_extension(path.extname)&.extensions changelog.path = path.parent unless changelog.host == "github.com" end if changelog.host == "github.com" folders = changelog.path.split File::SEPARATOR changelog.path = File.join(*folders.first(3)) if path.extname.present? glob = "{CHANGELOG,ChangeLog}{.{md,{tx,rs}t},}" logs = `echo #{glob}`.split logs += logs.map(&:downcase) + logs.map(&:capitalize) server = "8.8.8.8" if !args.fast? && system_command("ping -c 1 -t 1 #{server}", print_stderr: false) http = Net::HTTP.new changelog.host, changelog.port http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER logs.find do |log| log.prepend "/blob/master/" request = Net::HTTP::Get.new changelog.request_uri + log response = http.request request changelog.path += log unless response.code.to_i.between? 400, 599 end end changelog.path += "/releases" if folders.compact_blank.count == 2 && !changelog.path.end_with?(*logs) changelog.fragment = nil if changelog.fragment == "readme" end next puts changelog if args.list? puts "Opening changelog for #{name_of formula}" next changelog end exec_browser(*open) if open.any? end end
33.132743
109
0.633013
b9805e4b99d620072f9d83ba70d8a1616f356762
142
require 'test_helper' class ShortLinksControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end end
17.75
64
0.746479
79a25ba84a272fd05b68a59e0d2e31728e53f191
2,724
require "logstash/codecs/edn_lines" require "logstash/event" require "logstash/json" require "insist" require "edn" describe LogStash::Codecs::EDNLines do subject do next LogStash::Codecs::EDNLines.new end context "#decode" do it "should return an event from edn data" do data = {"foo" => "bar", "baz" => {"bah" => ["a", "b", "c"]}, "@timestamp" => "2014-05-30T02:52:17.929Z"} subject.decode(data.to_edn + "\n") do |event| insist { event }.is_a?(LogStash::Event) insist { event["foo"] } == data["foo"] insist { event["baz"] } == data["baz"] insist { event["bah"] } == data["bah"] insist { event["@timestamp"].to_iso8601 } == data["@timestamp"] end end it "should return an event from edn data when a newline is recieved" do data = {"foo" => "bar", "baz" => {"bah" => ["a","b","c"]}, "@timestamp" => "2014-05-30T02:52:17.929Z"} subject.decode(data.to_edn) do |event| insist {false} end subject.decode("\n") do |event| insist { event.is_a? LogStash::Event } insist { event["foo"] } == data["foo"] insist { event["baz"] } == data["baz"] insist { event["bah"] } == data["bah"] insist { event["@timestamp"].to_iso8601 } == data["@timestamp"] end end end context "#encode" do it "should return edn data from pure ruby hash" do data = {"foo" => "bar", "baz" => {"bah" => ["a","b","c"]}, "@timestamp" => "2014-05-30T02:52:17.929Z"} event = LogStash::Event.new(data) got_event = false subject.on_event do |d| insist { EDN.read(d)["foo"] } == data["foo"] insist { EDN.read(d)["baz"] } == data["baz"] insist { EDN.read(d)["bah"] } == data["bah"] insist { EDN.read(d)["@timestamp"] } == "2014-05-30T02:52:17.929Z" insist { EDN.read(d)["@timestamp"] } == event["@timestamp"].to_iso8601 got_event = true end subject.encode(event) insist { got_event } end it "should return edn data rom deserialized json with normalization" do data = LogStash::Json.load('{"foo": "bar", "baz": {"bah": ["a","b","c"]}, "@timestamp": "2014-05-30T02:52:17.929Z"}') event = LogStash::Event.new(data) got_event = false subject.on_event do |d| insist { EDN.read(d)["foo"] } == data["foo"] insist { EDN.read(d)["baz"] } == data["baz"] insist { EDN.read(d)["bah"] } == data["bah"] insist { EDN.read(d)["@timestamp"] } == "2014-05-30T02:52:17.929Z" insist { EDN.read(d)["@timestamp"] } == event["@timestamp"].to_iso8601 got_event = true end subject.encode(event) insist { got_event } end end end
36.810811
123
0.555066
283099db7593389dc80dce2428375ddfa18d645e
42
module CodePoetry VERSION = "0.4.0" end
10.5
19
0.690476
6a1e5883de3ede8a213648b1b0962011bcedeb0c
8,502
require 'thor' require 'gogetit' require 'gogetit/util' module Gogetit class CLI < Thor include Gogetit::Util package_name 'Gogetit' @result = nil class << self attr_accessor :result end attr_reader :config, :logger, :lxd, :libvirt, :providers def initialize(*args) super @config = Gogetit.config @logger = Gogetit.logger @lxd = Gogetit.lxd @libvirt = Gogetit.libvirt @providers = { lxd: lxd, libvirt: libvirt } end desc 'list', 'List containers and instances, running currently.' method_option :out, :aliases => '-o', :type => :string, \ :default => '', :desc => 'to list from all remotes' def list case options[:out] when 'custom' Gogetit.list_all_types when 'all' config[:lxd][:nodes].each do |node| puts "Listing LXD containers on #{node[:url]}.." system("lxc list #{node[:name]}:") end puts "Listing KVM domains on #{config[:libvirt][:nodes][0][:url]}.." system("virsh -c #{config[:libvirt][:nodes][0][:url]} list --all") when '' puts "Listing LXD containers on #{config[:lxd][:nodes][0][:url]}.." system("lxc list #{config[:lxd][:nodes][0][:name]}:") puts '' puts "Listing KVM domains on #{config[:libvirt][:nodes][0][:url]}.." system("virsh -c #{config[:libvirt][:nodes][0][:url]} list --all") else puts "Invalid option or command" end end desc 'create NAME', 'Create either a container or KVM domain.' method_option :provider, :aliases => '-p', :type => :string, \ :default => 'lxd', :desc => 'A provider such as lxd and libvirt' method_option :spec, :aliases => '-s', :type => :string, \ :desc => 'A spec specified in gogetit.yml' method_option :alias, :aliases => '-a', :type => :string, \ :desc => 'An alias name for a lxd image' method_option :distro, :aliases => '-d', :type => :string, \ :desc => 'A distro name with its series for libvirt provider' method_option :chef, :aliases => '-c', :type => :boolean, \ :default => false, :desc => 'Chef awareness' method_option :zero, :aliases => '-z', :type => :boolean, \ :default => false, :desc => 'Chef Zero awareness' method_option :vlans, :aliases => '-v', :type => :array, \ :desc => 'A list of VLAN IDs to connect to' method_option :ipaddresses, :aliases => '-i', :type => :array, \ :desc => 'A list of static IPs to assign' method_option :"no-maas", :type => :boolean, \ :desc => 'Without MAAS awareness(only for LXD provider)' method_option :"maas-on-lxc", :type => :boolean, \ :desc => 'To install MAAS on a LXC enabling necessary user config'\ '(only for LXD provider with no-maas enabled)' method_option :"lxd-in-lxd", :type => :boolean, \ :desc => 'To run LXD inside of LXD enabling "security.nesting"' method_option :"kvm-in-lxd", :type => :boolean, \ :desc => 'To run KVM(Libvirt) inside of LXD' method_option :"file", :aliases => '-f', :type => :string, \ :desc => 'File location(only for LXD provider)' def create(name) abort(":vlans and :ipaddresses can not be set together.") \ if options[:vlans] and options[:ipaddresses] abort(":chef and :zero can not be set together.") \ if options[:chef] and options[:zero] abort("when :'no-maas', the network configuration have to be set by :file.") \ if options[:'no-maas'] and (options[:vlans] or options[:ipaddresses]) abort(":'no-maas' and :file have to be set together.") \ if options[:'no-maas'] ^ !!options[:file] abort(":distro has to be set only with libvirt provider.") \ if options[:distro] and options[:provider] == 'lxd' abort(":alias has to be set with lxd provider.") \ if options[:alias] and options[:provider] == 'libvirt' abort(":spec has to be set only with libvirt provider.") \ if options[:spec] and options[:provider] == 'lxd' case options[:provider] when 'lxd' Gogetit::CLI.result = lxd.create(name, options) when 'libvirt' Gogetit::CLI.result = libvirt.create(name, options) else abort('Invalid argument entered.') end # post-tasks if options[:chef] knife_bootstrap_chef(name, options[:provider], config) update_databags(config) elsif options[:zero] knife_bootstrap_zero(name, options[:provider], config) end end desc 'destroy NAME', 'Destroy either a container or KVM instance.' method_option :chef, :aliases => '-c', :type => :boolean, \ :default => false, :desc => 'Chef awareness' method_option :zero, :aliases => '-z', :type => :boolean, \ :default => false, :desc => 'Chef Zero awareness' def destroy(name) abort(":chef and :zero can not be set together.") \ if options[:chef] and options[:zero] provider = get_provider_of(name, providers) if provider case provider when 'lxd' Gogetit::CLI.result = lxd.destroy(name) when 'libvirt' Gogetit::CLI.result = libvirt.destroy(name) else abort('Invalid argument entered.') end end # post-tasks if options[:chef] knife_remove(name, options) update_databags(config) elsif options[:zero] knife_remove(name, options) end end desc 'deploy NAME', 'Deploy a node existing in MAAS.' method_option :distro, :aliases => '-d', :type => :string, \ :desc => 'A distro name with its series for libvirt provider' method_option :chef, :aliases => '-c', :type => :boolean, \ :default => false, :desc => 'Chef awareness' method_option :zero, :aliases => '-z', :type => :boolean, \ :default => false, :desc => 'Chef Zero awareness' def deploy(name) abort(":chef and :zero can not be set together.") \ if options[:chef] and options[:zero] Gogetit::CLI.result = libvirt.deploy(name, options) # post-tasks if options[:chef] knife_bootstrap(name, options[:provider], config) update_databags(config) elsif options[:zero] knife_bootstrap_zero(name, options[:provider], config) end end desc 'release NAME', 'Release a node in MAAS' method_option :chef, :type => :boolean, :desc => "Enable chef awareness." method_option :chef, :aliases => '-c', :type => :boolean, \ :default => false, :desc => 'Chef awareness' method_option :zero, :aliases => '-z', :type => :boolean, \ :default => false, :desc => 'Chef Zero awareness' def release(name) abort(":chef and :zero can not be set together.") \ if options[:chef] and options[:zero] Gogetit::CLI.result = libvirt.release(name) # post-tasks if options[:chef] knife_remove(name, options) update_databags(config) elsif options[:zero] knife_remove(name, options) end end desc 'rebuild NAME', 'Destroy(or release) and create(or deploy)'\ ' either a container or a node(machine) in MAAS again.' method_option :chef, :aliases => '-c', :type => :boolean, \ :default => false, :desc => 'Chef awareness' method_option :zero, :aliases => '-z', :type => :boolean, \ :default => false, :desc => 'Chef Zero awareness' def rebuild(name) abort(":chef and :zero can not be set together.") \ if options[:chef] and options[:zero] provider = get_provider_of(name, providers) if provider case provider when 'lxd' 1.upto(100) { print '_' }; puts puts "Destroying #{name}.." invoke :destroy, [name] alias_name = YAML.load( Gogetit::CLI.result[:info][:config][:"user.user-data"] )['source_image_alias'] 1.upto(100) { print '_' }; puts puts "Creating #{name}.." invoke :create, [name], :alias => alias_name when 'libvirt' invoke :release, [name] distro_name = Gogetit::CLI.result[:info][:machine]['distro_series'] invoke :deploy, [name], :distro => distro_name else abort('Invalid argument entered.') end end # post-tasks if options[:chef] knife_remove(name) if options[:chef] update_databags(config) end end end end
37.289474
84
0.589979
21bafe5383171003ab175c833ce4572c1a9e282b
243
class RenameChallengesSolveShares < ActiveRecord::Migration[5.2] def change rename_column :challenges, :solve_share_decrement, :solved_decrement_shares add_column :challenges, :solved_decrement_period, :integer, default: 1 end end
34.714286
79
0.802469
3890b8c4a28d06a3fcc340c2360a3d81afdd6233
917
# frozen_string_literal: true require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module App class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource( '*', headers: :any, methods: %i[get patch put delete post options] ) end end end end
27.787879
82
0.695747
1d49b6d1aca3c23907d3e5ece49b15e928818a7e
9,037
require 'erb' require 'fileutils' require 'optparse' require 'rollbar' require 'singleton' require 'yaml' require 'json' # CLI runner class PushmiPullyu::CLI include Singleton include PushmiPullyu::Logging COMMANDS = ['start', 'stop', 'restart', 'reload', 'run', 'zap', 'status'].freeze def initialize PushmiPullyu.server_running = true # set to false by interrupt signal trap PushmiPullyu.reset_logger = false # set to true by SIGHUP trap end def parse(argv = ARGV) opts = parse_options(argv) opts[:daemonize] = true if COMMANDS.include? argv[0] opts = parse_config(opts[:config_file]).merge(opts) if opts[:config_file] PushmiPullyu.options = opts end def run configure_rollbar begin if options[:daemonize] start_server_as_daemon else # If we're running in the foreground sync the output. $stdout.sync = $stderr.sync = true start_server end # rubocop:disable Lint/RescueException rescue Exception => e Rollbar.error(e) raise e end # rubocop:enable Lint/RescueException end def start_server setup_signal_traps setup_log print_banner run_tick_loop end private def configure_rollbar Rollbar.configure do |config| config.enabled = false unless options[:rollbar][:token].present? config.access_token = options[:rollbar][:token] config.use_exception_level_filters_default = true config.exception_level_filters['IOError'] = 'ignore' # add a filter after Rollbar has built the error payload but before it is delivered to the API, # in order to strip sensitive information out of certain error messages exception_message_transformer = proc do |payload| clean_message = payload[:exception][:message].sub(/http:\/\/.+:.+@(.+)\/aip\/v1\/(.*)/, "http://\1/aip/v1/\2") payload[:exception][:message] = clean_message payload[:message] = clean_message end config.transform << exception_message_transformer if options[:rollbar][:proxy_host].present? config.proxy = {} config.proxy[:host] = options[:rollbar][:proxy_host] config.proxy[:port] = options[:rollbar][:proxy_port] if options[:rollbar][:proxy_port].present? config.proxy[:user] = options[:rollbar][:proxy_user] if options[:rollbar][:proxy_user].present? config.proxy[:password] = options[:rollbar][:proxy_password] if options[:rollbar][:proxy_password].present? end end end def options PushmiPullyu.options end def parse_config(config_file) if File.exist?(config_file) YAML.safe_load(ERB.new(IO.read(config_file)).result).deep_symbolize_keys || {} else {} end end # Parse the options. def parse_options(argv) opts = {} @parsed_opts = OptionParser.new do |o| o.banner = 'Usage: pushmi_pullyu [options] [start|stop|restart|run]' o.separator '' o.separator 'Specific options:' o.on('-a', '--minimum-age AGE', Float, 'Minimum amount of time an item must spend in the queue, in seconds.') do |minimum_age| opts[:minimum_age] = minimum_age end o.on('-d', '--debug', 'Enable debug logging') do opts[:debug] = true end o.on('-r', '--rollbar-token TOKEN', 'Enable error reporting to Rollbar') do |token| if token.present? opts[:rollbar] = {} opts[:rollbar][:token] = token end end o.on '-C', '--config PATH', 'Path for YAML config file' do |config_file| opts[:config_file] = config_file end o.on('-L', '--logdir PATH', 'Path for directory to store log files') do |logdir| opts[:logdir] = logdir end o.on('-D', '--piddir PATH', 'Path for directory to store pid files') do |piddir| opts[:piddir] = piddir end o.on('-W', '--workdir PATH', 'Path for directory where AIP creation work takes place in') do |workdir| opts[:workdir] = workdir end o.on('-N', '--process_name NAME', 'Name of the application process') do |process_name| opts[:process_name] = process_name end o.on('-m', '--monitor', 'Start monitor process for a deamon') do opts[:monitor] = true end o.on('-q', '--queue NAME', 'Name of the queue to read from') do |queue| opts[:queue_name] = queue end o.separator '' o.separator 'Common options:' o.on_tail('-v', '--version', 'Show version') do puts "PushmiPullyu version: #{PushmiPullyu::VERSION}" exit end o.on_tail('-h', '--help', 'Show this message') do puts o exit end end.parse!(argv) ['config/pushmi_pullyu.yml', 'config/pushmi_pullyu.yml.erb'].each do |filename| opts[:config_file] ||= filename if File.exist?(filename) end opts end def print_banner logger.info "Loading PushmiPullyu #{PushmiPullyu::VERSION}" logger.info "Running in #{RUBY_DESCRIPTION}" logger.info 'Starting processing, hit Ctrl-C to stop' unless options[:daemonize] end def rotate_logs PushmiPullyu::Logging.reopen Daemonize.redirect_io(PushmiPullyu.application_log_file) if options[:daemonize] PushmiPullyu.reset_logger = false end def run_preservation_cycle entity_json = JSON.parse(queue.wait_next_item) entity = { type: entity_json['type'], uuid: entity_json['uuid'] } return unless entity[:type].present? && entity[:uuid].present? # add additional information about the error context to errors that occur while processing this item. Rollbar.scoped(entity_uuid: entity[:uuid]) do # Download AIP from Jupiter, bag and tar AIP directory and cleanup after # block code PushmiPullyu::AIP.create(entity) do |aip_filename, aip_directory| # Push tarred AIP to swift API deposited_file = swift.deposit_file(aip_filename, options[:swift][:container]) # Log successful preservation event to the log files PushmiPullyu::Logging.log_preservation_event(deposited_file, aip_directory) end # rubocop:disable Lint/RescueException rescue Exception => e Rollbar.error(e) logger.error(e) # TODO: we could re-raise here and let the daemon die on any preservation error, or just log the issue and # move on to the next item. # rubocop:enable Lint/RescueException end end def run_tick_loop while PushmiPullyu.server_running? run_preservation_cycle rotate_logs if PushmiPullyu.reset_logger? end end def setup_log if options[:daemonize] PushmiPullyu::Logging.initialize_logger(PushmiPullyu.application_log_file) else logger.formatter = PushmiPullyu::Logging::SimpleFormatter.new end logger.level = ::Logger::DEBUG if options[:debug] end def setup_signal_traps Signal.trap('INT') { shutdown } Signal.trap('TERM') { shutdown } Signal.trap('HUP') { PushmiPullyu.reset_logger = true } end def queue @queue ||= PushmiPullyu::PreservationQueue.new(redis_url: options[:redis][:url], queue_name: options[:queue_name], age_at_least: options[:minimum_age]) end def swift @swift ||= PushmiPullyu::SwiftDepositer.new(username: options[:swift][:username], password: options[:swift][:password], tenant: options[:swift][:tenant], project_name: options[:swift][:project_name], project_domain_name: options[:swift][:project_domain_name], auth_url: options[:swift][:auth_url]) end # On first call of shutdown, this will gracefully close the main run loop # which let's the program exit itself. Calling shutdown again will force shutdown the program def shutdown if !PushmiPullyu.server_running? exit!(1) else # using stderr instead of logger as it uses an underlying mutex which is not allowed inside trap contexts. warn 'Exiting... Interrupt again to force quit.' PushmiPullyu.server_running = false end end def start_server_as_daemon require 'daemons' pwd = Dir.pwd # Current directory is changed during daemonization, so store it opts = { ARGV: @parsed_opts, dir: options[:piddir], dir_mode: :normal, monitor: options[:monitor], log_output: true, log_dir: File.expand_path(options[:logdir]), logfilename: File.basename(PushmiPullyu.application_log_file), output_logfilename: File.basename(PushmiPullyu.application_log_file) } Daemons.run_proc(options[:process_name], opts) do |*_argv| Dir.chdir(pwd) start_server end end end
31.820423
115
0.636937
1ded1542d0f4c401c58a8f0062f284795f05f7a5
2,169
### # This Ruby source file was generated by test-to-ruby.xsl # and is a derived work from the source document. # The source document contained the following notice: =begin Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. =end # require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'helper')) ### # The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. # Retrieve the dir attribute of the DFN element and examine its value. # @author NIST # @author Mary Brady # see[http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740] ## DOMTestCase('HTMLElement103') do ### # Constructor. # @param factory document factory, may not be null # @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration ## def setup ## ## check if loaded documents are supported for content type ## contentType = getContentType() preload(contentType, "element", false) end ### # Runs the test case. # @throws Throwable Any uncaught exception causes test to fail # def test_HTMLElement103 nodeList = nil testNode = nil vdir = nil doc = nil doc = load_document("element", false) nodeList = doc.getElementsByTagName("dfn") assertSize("Asize", 1, nodeList) testNode = nodeList.item(0) vdir = testNode.dir() assert_equal("ltr", vdir, "dirLink") end ### # Gets URI that identifies the test. # @return uri identifier of test # def targetURI "http://www.w3.org/2001/DOM-Test-Suite/level1/html/HTMLElement103" end end
28.539474
117
0.710466
398a19c11eeccb7a1d342a35f2cc9ee8ce8b600e
2,246
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require File.expand_path('msg_bus_message', File.dirname(__FILE__)) module XYZ # This is the class that the MessageProcessors pass back they get marshalled to and from json class ProcessorMsg attr_reader :msg_type, :msg_content, :target_object_id def initialize(hash) unless (illegal_keys = hash.keys - [:msg_type, :msg_content, :target_object_id]).empty? fail Error.new("illegal key(s) (#{illegal_keys.join(', ')}) in ProcessorMsg.new") end @msg_type = hash[:msg_type] @msg_content = hash[:msg_content] || {} @target_object_id = hash[:target_object_id] end # TBD: factory in case we want to have subclasses for diffeernt msg types def self.create(hash) ProcessorMsg.new(hash) end def marshal_to_message_bus_msg hash = { msg_type: @msg_type, msg_content: @msg_content } hash.merge!({ target_object_id: @target_object_id }) if @target_object_id MessageBusMsgOut.new(hash) end def topic type = ret_obj_type_assoc_with_msg_type(@msg_type) MessageBusMsgOut.topic(type) end def key fail Error.new('missing target_object_id') if @target_object_id.nil? type = ret_obj_type_assoc_with_msg_type(@msg_type) MessageBusMsgOut.key(@target_object_id, type) end private def ret_obj_type_assoc_with_msg_type(msg_type) case msg_type when :propagate_asserted_value, :propagated_value, :asserted_value :attribute when :execute_on_node :node else fail Error.new("unexpected msg_type: #{msg_type}") end end end end
34.553846
95
0.710597
1c05145a6521949889ece4bcfdf11ac2c094b238
42
module Dissect VERSION = "0.2.1pre" end
10.5
22
0.690476