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
|
---|---|---|---|---|---|
21b1578f168f5df6a6d8a3a6c5779de63ef94a55 | 5,043 | # frozen_string_literal: true
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 = "omniauth_demo_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')
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
| 43.852174 | 114 | 0.763038 |
f8705f37e977ae0fb3eca49c8b6260f98f5e4b7f | 210 | json.array!(@accommodation_charges) do |accommodation_charge|
json.extract! accommodation_charge, :id, :company_id, :name, :amount
json.url accommodation_charge_url(accommodation_charge, format: :json)
end
| 42 | 72 | 0.804762 |
e86b2235278a0a8eb69dc74f1dbd35dee59776f3 | 1,561 | class Tcpflow < Formula
desc "TCP/IP packet demultiplexer"
homepage "https://github.com/simsong/tcpflow"
url "https://downloads.digitalcorpora.org/downloads/tcpflow/tcpflow-1.6.1.tar.gz"
sha256 "436f93b1141be0abe593710947307d8f91129a5353c3a8c3c29e2ba0355e171e"
license "GPL-3.0"
livecheck do
url "https://downloads.digitalcorpora.org/downloads/tcpflow/"
regex(/href=.*?tcpflow[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "45666c536a212cbc2b76a6663e051f432e4b82910a440d5fa6cebad4562e70f9"
sha256 cellar: :any, big_sur: "ec65cbfeff09cd48c9accca03cf14a733034b96f0d01d47cbcf43ef9e0e859de"
sha256 cellar: :any, catalina: "78b9e40f778060e2a0a277dfa1ff2d3ee720be679f8ade7b98e274ace2a05e7c"
sha256 cellar: :any, mojave: "752820d85c73654edd4b2eef81a36d6d3be542e8cb6f7f62af7906b0740ba98f"
end
head do
url "https://github.com/simsong/tcpflow.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "boost" => :build
depends_on "[email protected]"
uses_from_macos "bzip2"
uses_from_macos "libpcap"
on_linux do
depends_on "gcc" # For C++17
end
fails_with gcc: 5
def install
system "bash", "./bootstrap.sh" if build.head?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
end
| 33.212766 | 122 | 0.66688 |
e962b2025c6b6afda42e2ac1634df211db0c469d | 1,417 | class Hugo < Formula
desc "Configurable static site generator"
homepage "https://gohugo.io/"
url "https://github.com/gohugoio/hugo/archive/v0.57.2.tar.gz"
sha256 "435267c639ce58daea14c1f7d1f64bdd9176d20bd5719457e11051b88a6fffe6"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "ac8d2f6052b11f18090e819c119e5d5ef53cb5833986482e36ff0ad7a6984c61" => :mojave
sha256 "7ab991f43bec1c3f9112e94961fb4dc9eb23fd1e5cfca032f5a56ed0e1fd4a77" => :high_sierra
sha256 "123467686a3b9f82a5619208641583a76713411ab684bc073193f2fded174ea6" => :sierra
end
depends_on "go" => :build
def install
ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
(buildpath/"src/github.com/gohugoio/hugo").install buildpath.children
cd "src/github.com/gohugoio/hugo" do
system "go", "build", "-o", bin/"hugo", "-tags", "extended", "main.go"
# Build bash completion
system bin/"hugo", "gen", "autocomplete", "--completionfile=hugo.sh"
bash_completion.install "hugo.sh"
# Build man pages; target dir man/ is hardcoded :(
(Pathname.pwd/"man").mkpath
system bin/"hugo", "gen", "man"
man1.install Dir["man/*.1"]
prefix.install_metafiles
end
end
test do
site = testpath/"hops-yeast-malt-water"
system "#{bin}/hugo", "new", "site", site
assert_predicate testpath/"#{site}/config.toml", :exist?
end
end
| 32.953488 | 93 | 0.704305 |
397a068bafe971c4274b0767df1e5fe916248f00 | 168 | class AddCoordinatorIdToEvent < ActiveRecord::Migration
def change
add_column :events, :coordinator_id, :integer
add_index :events, :coordinator_id
end
end
| 24 | 55 | 0.77381 |
012e31b907adc6b794b2f39af5b8c20a50c174af | 1,329 | #
# Cookbook:: net_snmp
# Resource:: package
#
# Copyright:: Ben Hughes <[email protected]>
#
# 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.
unified_mode true
include NetSnmp::Cookbook::PackageHelpers
property :packages, [String, Array],
default: lazy { default_net_snmp_packages },
description: 'A list of packages to install'
action_class do
def do_action(package_action)
if platform?('debian')
apt_repository 'non-free' do
uri 'http://deb.debian.org/debian'
components ['non-free']
action :add
end
end
new_resource.packages.each do |pkg|
package pkg do
action package_action
end
end
end
end
action :install do
do_action(action)
end
action :upgrade do
do_action(action)
end
action :remove do
do_action(action)
end
| 23.732143 | 74 | 0.708804 |
26e734fb5b7775e75d40b5639e37fcc44a3068f4 | 1,409 | require 'rails_helper'
require 'cancan/matchers'
describe Ability do
let(:ability) { Ability.new(user) }
subject { ability }
let(:admin_set) { create(:admin_set) }
context 'for a user who is not logged in' do
let(:user) { User.new }
it 'has general ability' do
expect(subject).to be_able_to(:read, :resque)
end
end
context 'for a regular logged-in user' do
let(:user) { User.create(username: 'ability-test') }
it 'has custom ability' do
expect(subject).to be_able_to(:read, :resque)
expect(subject).to be_able_to(:read, admin_set)
end
end
context 'for an admin user' do
let(:user) { User.create(username: 'admin-ability-test', group_list: ["admin"]) }
it "has all abilities" do
expect(subject).to be_able_to(:read, :resque)
expect(subject).to be_able_to(:create, AdminSet)
expect(subject).to be_able_to(:create, Image)
expect(subject).to be_able_to(:create, Collection)
expect(subject).to be_able_to(:read, admin_set)
expect(subject).to be_able_to(:update, admin_set)
expect(subject).to be_able_to(:allow_downloads, admin_set)
expect(subject).to be_able_to(:prevent_downloads, admin_set)
expect(subject).to be_able_to(:destroy, admin_set)
expect(subject).to be_able_to(:confirm_delete, admin_set)
expect(subject).to be_able_to(:collect, Image.new)
end
end
end
| 32.022727 | 85 | 0.683463 |
28c8e74a4e5bed6a0d14a12b65ebd3b36d7b459d | 242 | FactoryBot.define do
factory :education, class: Candidates::Registrations::Education do
urn { 11_048 }
degree_stage { "Other" }
degree_stage_explaination { "Khan academy, level 3" }
degree_subject { "Bioscience" }
end
end
| 26.888889 | 68 | 0.706612 |
875bc7c14cfd64d8c7d4d27ec0a0cf7e738d375d | 211 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'send_nsca'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
| 21.1 | 66 | 0.739336 |
b9134b8d6abcc0d7e44da5e4444afe38ccd2f31a | 2,834 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Checks::DiffCheck do
include_context 'change access checks context'
describe '#validate!' do
let(:owner) { create(:user) }
let!(:lock) { create(:lfs_file_lock, user: owner, project: project, path: 'README') }
before do
allow(project.repository).to receive(:new_commits).and_return(
project.repository.commits_between('be93687618e4b132087f430a4d8fc3a609c9b77c', '54fcc214b94e78d7a41a9a8fe6d87a5e59500e51')
)
end
context 'with LFS not enabled' do
before do
allow(project).to receive(:lfs_enabled?).and_return(false)
end
it 'does not invoke :lfs_file_locks_validation' do
expect(subject).not_to receive(:lfs_file_locks_validation)
subject.validate!
end
end
context 'with LFS enabled' do
before do
allow(project).to receive(:lfs_enabled?).and_return(true)
end
context 'when change is sent by a different user' do
it 'raises an error if the user is not allowed to update the file' do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, "The path 'README' is locked in Git LFS by #{lock.user.name}")
end
end
context 'when change is sent by the author of the lock' do
let(:user) { owner }
it "doesn't raise any error" do
expect { subject.validate! }.not_to raise_error
end
end
end
context 'commit diff validations' do
before do
allow(subject).to receive(:validations_for_diff).and_return([lambda { |diff| return }])
expect_any_instance_of(Commit).to receive(:raw_deltas).and_call_original
subject.validate!
end
context 'when request store is inactive' do
it 'are run for every commit' do
expect_any_instance_of(Commit).to receive(:raw_deltas).and_call_original
subject.validate!
end
end
context 'when request store is active', :request_store do
it 'are cached for every commit' do
expect_any_instance_of(Commit).not_to receive(:raw_deltas)
subject.validate!
end
it 'are run for not cached commits' do
allow(project.repository).to receive(:new_commits).and_return(
project.repository.commits_between('be93687618e4b132087f430a4d8fc3a609c9b77c', 'a5391128b0ef5d21df5dd23d98557f4ef12fae20')
)
change_access.instance_variable_set(:@commits, project.repository.new_commits)
expect(project.repository.new_commits.first).not_to receive(:raw_deltas).and_call_original
expect(project.repository.new_commits.last).to receive(:raw_deltas).and_call_original
subject.validate!
end
end
end
end
end
| 31.842697 | 154 | 0.676076 |
0816013b3eabb89f85c9ce5b371332d6cde6def2 | 1,558 | Shindo.tests('AWS::Glacier | glacier archive tests', ['aws']) do
pending if Fog.mocking?
Fog::AWS[:glacier].create_vault('Fog-Test-Vault-upload')
tests('initiate and abort') do
id = Fog::AWS[:glacier].initiate_multipart_upload('Fog-Test-Vault-upload', 1024*1024).headers['x-amz-multipart-upload-id']
returns(true){ Fog::AWS[:glacier].list_multipart_uploads('Fog-Test-Vault-upload').body['UploadsList'].map {|item| item['MultipartUploadId']}.include?(id)}
Fog::AWS[:glacier].abort_multipart_upload('Fog-Test-Vault-upload', id)
returns(false){ Fog::AWS[:glacier].list_multipart_uploads('Fog-Test-Vault-upload').body['UploadsList'].map {|item| item['MultipartUploadId']}.include?(id)}
end
tests('do multipart upload') do
hash = Fog::AWS::Glacier::TreeHash.new
id = Fog::AWS[:glacier].initiate_multipart_upload('Fog-Test-Vault-upload', 1024*1024).headers['x-amz-multipart-upload-id']
part = 't'*1024*1024
hash_for_part = hash.add_part(part)
Fog::AWS[:glacier].upload_part('Fog-Test-Vault-upload', id, part, 0, hash_for_part)
part_2 = 'u'*1024*1024
hash_for_part_2 = hash.add_part(part_2)
Fog::AWS[:glacier].upload_part('Fog-Test-Vault-upload', id, part_2, 1024*1024, hash_for_part_2)
archive = Fog::AWS[:glacier].complete_multipart_upload('Fog-Test-Vault-upload', id, 2*1024*1024, hash.hexdigest).headers['x-amz-archive-id']
Fog::AWS[:glacier].delete_archive('Fog-Test-Vault-upload', archive)
#amazon won't let us delete the vault because it has been written to in the past day
end
end
| 51.933333 | 159 | 0.716945 |
6a7e28f2f6f59aeea88ef82c6393fc61e420763e | 636 | class Object
##
# call-seq:
# obj.tap{|x|...} -> obj
#
# Yields <code>x</code> to the block, and then returns <code>x</code>.
# The primary purpose of this method is to "tap into" a method chain,
# in order to perform operations on intermediate results within the chain.
#
# (1..10) .tap {|x| puts "original: #{x.inspect}"}
# .to_a .tap {|x| puts "array: #{x.inspect}"}
# .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
# .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"}
#
def tap
yield self
self
end
end
| 31.8 | 78 | 0.512579 |
bbdcc102dc741742412c0a904b30866b69ec5b91 | 2,722 | # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
#
# This file is part of Maruku.
#
# Maruku is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Maruku 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 the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Maruku; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
module MaRuKu
class Exception < RuntimeError; end
module Errors
FRAME_WIDTH = 75
# Properly handles a formatting error.
# All such errors go through this method.
#
# The behavior depends on {MaRuKu::Globals `MaRuKu::Globals[:on_error]`}.
# If this is `:warning`, this prints the error to stderr
# (or `@error_stream if` it's defined) and tries to continue.
# If `:on_error` is `:ignore`, this doesn't print anything
# and tries to continue. If it's `:raise`, this raises a {MaRuKu::Exception}.
#
# By default, `:on_error` is set to `:warning`.
#
# @overload def maruku_error(s, src = nil, con = nil)
# @param s [String] The text of the error
# @param src [#describe, nil] The source of the error
# @param con [#describe, nil] The context of the error
# @raise [MaRuKu::Exception] If `:on_error` is set to `:raise`
def maruku_error(*args)
policy = get_setting(:on_error)
case policy
when :ignore
when :raise
raise_error create_frame(describe_error(*args))
when :warning
tell_user create_frame(describe_error(*args))
else
raise "Unknown on_error policy: #{policy.inspect}"
end
end
def maruku_recover(*args)
tell_user create_frame(describe_error(*args))
end
alias error maruku_error
def raise_error(s)
raise MaRuKu::Exception, s, caller
end
def tell_user(s)
(self.attributes[:error_stream] || $stderr) << s
end
private
def create_frame(s)
"\n" + <<FRAME
#{"_" * FRAME_WIDTH}
| Maruku tells you:
+#{"-" * FRAME_WIDTH}
#{s.gsub(/^/, '| ').rstrip}
+#{"-" * FRAME_WIDTH}
#{caller[0...5].join("\n").gsub(/^/, '!')}
\\#{"_" * FRAME_WIDTH}
FRAME
end
def describe_error(s, src = nil, con = nil)
s += "\n#{src.describe}\n" if src
s += "\n#{con.describe}\n" if con
s
end
end
end
| 30.244444 | 81 | 0.648053 |
ed37f28821d51f4603e4f7b5ec9cfa2c431dddf8 | 4,478 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe V2::ProfileSerializer do
subject(:serializer) { described_class.new(profile, adapter_options) }
let(:profile) { create(:profile) }
let(:adapter_options) { {} }
let(:result) { JSON.parse(serializer.serializable_hash.to_json).deep_symbolize_keys }
let(:expected_document) do
{
data: {
id: profile.id,
type: 'profiles',
attributes: { assessment_answers: [], csra: nil, requires_youth_risk_assessment: nil },
relationships: {
category: {
data: nil,
},
person: {
data: { id: profile.person.id, type: 'people' },
},
documents: {
data: [],
},
person_escort_record: {
data: nil,
},
youth_risk_assessment: {
data: nil,
},
},
},
}
end
it 'returns the expected serialized `Profile`' do
expect(result).to eq(expected_document)
end
context 'with assessment_answers' do
let(:risk_alert_type) { create :assessment_question, :risk }
let(:health_alert_type) { create :assessment_question, :health }
let(:risk_alert) do
{
title: risk_alert_type.title,
comments: 'Former miner',
assessment_question_id: risk_alert_type.id,
}
end
let(:health_alert) do
{
title: health_alert_type.title,
comments: 'Needs something for a headache',
assessment_question_id: health_alert_type.id,
}
end
let(:profile) { create(:profile, assessment_answers: [risk_alert, health_alert]) }
it 'contains an `assessment_answers` nested collection' do
assessment_answers = result[:data][:attributes][:assessment_answers].map { |alert| alert[:title] }
expect(assessment_answers).to match_array [risk_alert_type.title, health_alert_type.title]
end
end
describe 'with supported includes' do
let(:category) { create(:category) }
let(:profile) { create(:profile, documents: [create(:document)], category: category) }
let(:adapter_options) { { include: %i[documents person category] } }
let(:serialized_person) do
serializer = V2::PersonSerializer.new(profile.person)
JSON.parse(serializer.serializable_hash.to_json).deep_symbolize_keys
end
let(:serialized_document) do
serializer = DocumentSerializer.new(profile.documents.first)
JSON.parse(serializer.serializable_hash.to_json).deep_symbolize_keys
end
let(:serialized_category) do
serializer = CategorySerializer.new(profile.category)
JSON.parse(serializer.serializable_hash.to_json).deep_symbolize_keys
end
let(:expected_document) do
{
data: {
id: profile.id,
type: 'profiles',
attributes: { assessment_answers: [], csra: nil },
relationships: {
person: {
data: { id: profile.person.id, type: 'people' },
},
documents: { data: [{ id: profile.documents.first.id, type: 'documents' }] },
category: {
data: { id: category.id, type: 'categories' },
},
},
},
included: UnorderedArray(serialized_person[:data], serialized_document[:data], serialized_category[:data]),
}
end
before { ActiveStorage::Current.host = 'http://www.example.com' } # This is used in the serializer
it 'returns the expected serialized `Profile`' do
expect(result).to include_json(expected_document)
end
end
describe 'with csra' do
let(:profile) { create(:profile, csra: 'Standard') }
let(:expected_document) do
{
data: {
id: profile.id,
type: 'profiles',
attributes: { assessment_answers: [], csra: 'Standard', requires_youth_risk_assessment: nil },
relationships: {
category: {
data: nil,
},
person: {
data: { id: profile.person.id, type: 'people' },
},
documents: {
data: [],
},
person_escort_record: {
data: nil,
},
youth_risk_assessment: {
data: nil,
},
},
},
}
end
it 'returns the expected serialized `Profile`' do
expect(result).to include_json(expected_document)
end
end
end
| 28.705128 | 115 | 0.591335 |
08030c6a414acf343c5263710b2b3079b549d676 | 1,044 | require 'spec_helper'
describe Tapyrus::Message::HeaderAndShortIDs do
describe '#short_id' do
subject {
Tapyrus::Message::HeaderAndShortIDs.parse_from_payload('0100000006d1d602bae800102d3a615fb1d546599308435762d03a8d59e4a7bb35bb7e2abfdb311f857e830878fbb88e1f8dbde23c384db591ceb0c622aa252e2a56a7f6f1f4c8a0b9c648ea35175f91786b12b66bff4d0b3c77562db3b369aadb896777439c235f00406363110e643f3c9580f99c06783d2c85bda3ae9ceb62b79c5a622bf5cb662a0a9b3e8230f29c73793367f1828664a4b4778e2211f97d3d47be822c370792284d000000000000000005c6d41957ce771d1553767292561554210ee32eade5fdda5fe92e2b3f0a310100010000000100000000000000000000000000000000000000000000000000000000000000007e00000000ffffffff0100f2052a01000000015100000000'.htb)
}
it 'should calculate transaction short id.' do
expect(subject.short_id('282cf67861a83768c9321496aa35e6a720442a53e87780abca74a5f5919f405a')).to eq(131728108278982)
expect(subject.short_id('356ecf9f4c9961c6a265e08159770f0f2bb539e946048bd7579a1b3b14734617')).to eq(161020309083421)
end
end
end | 69.6 | 612 | 0.894636 |
e8962777b790f5ebd763968e2737d46706f2c140 | 563 | # frozen_string_literal: true
describe Facts::Debian::Os::Selinux do
describe '#call_the_resolver' do
it 'returns a fact' do
expected_fact = double(Facter::ResolvedFact, name: 'os.selinux', value: { enabled: 'value' })
allow(Facter::Resolvers::SELinux).to receive(:resolve).with(:enabled).and_return('value')
allow(Facter::ResolvedFact).to receive(:new).with('os.selinux', enabled: 'value').and_return(expected_fact)
fact = Facts::Debian::Os::Selinux.new
expect(fact.call_the_resolver).to eq(expected_fact)
end
end
end
| 37.533333 | 113 | 0.705151 |
1db397b1b9c1fff39f183923adeb799e69785aad | 5,951 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
OpenAPI spec version: 3.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.12
=end
require 'date'
module SibApiV3Sdk
class ManageIp
# Dedicated ID
attr_accessor :ip
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'ip' => :'ip'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'ip' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
if attributes.has_key?(:'ip')
self.ip = attributes[:'ip']
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 &&
ip == o.ip
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[ip].hash
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.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the 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(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
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
temp_model = SibApiV3Sdk.const_get(type).new
temp_model.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
end
end
| 32.167568 | 839 | 0.615527 |
f82002d855d64f7f5bec1ab1c048f231712d8bd3 | 1,825 | #
# Author:: Joshua Timberman (<[email protected]>)
# Author:: Graeme Mathieson (<[email protected]>)
# Cookbook Name:: homebrew
# Providers:: tap
#
# Copyright 2011-2015, Chef Software, 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.
#
include ::Homebrew::Mixin
use_inline_resources
def load_current_resource
@tap = Chef::Resource::HomebrewTap.new(new_resource.name)
tap_dir = @tap.name.gsub('/', '/homebrew-')
Chef::Log.debug("Checking whether we've already tapped #{new_resource.name}")
if ::File.directory?("/usr/local/Library/Taps/#{tap_dir}")
@tap.tapped true
else
@tap.tapped false
end
end
action :tap do
unless @tap.tapped
execute "tapping #{new_resource.name}" do
command "/usr/local/bin/brew tap #{new_resource.name}"
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
not_if "/usr/local/bin/brew tap | grep #{new_resource.name}"
user homebrew_owner
end
end
end
action :untap do
if @tap.tapped
execute "untapping #{new_resource.name}" do
command "/usr/local/bin/brew untap #{new_resource.name}"
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
only_if "/usr/local/bin/brew tap | grep #{new_resource.name}"
user homebrew_owner
end
end
end
| 30.932203 | 93 | 0.703562 |
5d5a7ef0aa64a778c8e5bc5e8cfe026faaed6120 | 1,724 | module Api
class LogosController < ApplicationController
before_action :set_logo, only: [:show, :update, :destroy]
# GET /logos
# def index
# @logos = Logo.all
# render json: @logos
# end
# GET /logos_full
def index_full
query = 'SELECT l.id, l.text, l.image_id, i.location, i.key'
query << ' FROM logos as l'
query << ' INNER JOIN images as i ON l.image_id = i.id'
@logos = Logo.connection.select_all(query).to_a
render json: @logos
end
# GET /logos_home
def index_home
query = 'SELECT l.text, i.location, i.key'
query << ' FROM logos as l'
query << ' INNER JOIN images as i ON l.image_id = i.id'
query << ' WHERE l.status = true'
@logos = Logo.connection.select_all(query).to_a
render json: @logos
end
# GET /logos/1
# def show
# render json: @logo
# end
# POST /logos
def create
@logo = Logo.new(logo_params)
if @logo.save
render json: @logo, status: :created
else
render json: @logo.errors, status: :unprocessable_entity
end
end
# PATCH/PUT /logos/1
def update
if @logo.update(logo_params)
render json: @logo
else
render json: @logo.errors, status: :unprocessable_entity
end
end
# DELETE /logos/1
# def destroy
# @logo.destroy
# end
private
# Use callbacks to share common setup or constraints between actions.
def set_logo
@logo = Logo.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def logo_params
params.require(:logo).permit(:text, :status, :image_id)
end
end
end | 23.944444 | 75 | 0.593387 |
4abc5898e20113739ae7dfe1015bede49f96d9ee | 2,273 | class Ortp < Formula
desc "Real-time transport protocol (RTP, RFC3550) library"
homepage "https://www.linphone.org/technical-corner/ortp"
url "https://gitlab.linphone.org/BC/public/ortp/-/archive/4.4.26/ortp-4.4.26.tar.bz2"
sha256 "8c50f7fef2b2d7ab9549ebc4108a49656b62e134575a73c3a875ac682be95648"
license "GPL-3.0-or-later"
head "https://gitlab.linphone.org/BC/public/ortp.git"
bottle do
sha256 arm64_big_sur: "3181a7e27bf8b6ff7db068682852746a280477cfbe9a6e183fae3874d147c3e3"
sha256 big_sur: "b6f18cd333833af665c1369868875f034aed10cc666780de94dfd0790d34fbca"
sha256 catalina: "19603d8199f0c18cec30f8d9b68bc83161d2e4633b1586df7afab43dc8a1922f"
sha256 mojave: "45472544b9754fc96ca5e3e272294dda6c501ce4ff1778c960679d36e1f8c23c"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "mbedtls"
# bctoolbox appears to follow ortp's version. This can be verified at the GitHub mirror:
# https://github.com/BelledonneCommunications/bctoolbox
resource "bctoolbox" do
url "https://gitlab.linphone.org/BC/public/bctoolbox/-/archive/4.4.26/bctoolbox-4.4.26.tar.bz2"
sha256 "4068fcfd51f8d63010b37d84ce6ab39a1cbd3b6bce94c7ce5e1c328483c87c1a"
end
def install
resource("bctoolbox").stage do
args = std_cmake_args.reject { |s| s["CMAKE_INSTALL_PREFIX"] } + %W[
-DCMAKE_INSTALL_PREFIX=#{libexec}
-DENABLE_TESTS_COMPONENT=OFF
]
system "cmake", ".", *args
system "make", "install"
end
ENV.prepend_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
args = std_cmake_args + %W[
-DCMAKE_PREFIX_PATH=#{libexec}
-DCMAKE_C_FLAGS=-I#{libexec}/include
-DCMAKE_CXX_FLAGS=-I#{libexec}/include
-DENABLE_DOC=NO
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#include "ortp/logging.h"
#include "ortp/rtpsession.h"
#include "ortp/sessionset.h"
int main()
{
ORTP_PUBLIC void ortp_init(void);
return 0;
}
EOS
system ENV.cc, "-I#{include}", "-I#{libexec}/include", "-L#{lib}", "-lortp",
testpath/"test.c", "-o", "test"
system "./test"
end
end
| 33.925373 | 99 | 0.688517 |
87c85413f07cbf19ace67647836ba398066a2524 | 4,054 | require_relative './operation'
require 'bigdecimal'
require 'bigdecimal/util'
module Dentaku
module AST
class Arithmetic < Operation
def initialize(*)
super
unless valid_left?
raise NodeError.new(:numeric, left.type, :left),
"#{self.class} requires numeric operands"
end
unless valid_right?
raise NodeError.new(:numeric, right.type, :right),
"#{self.class} requires numeric operands"
end
end
def type
:numeric
end
def operator
raise NotImplementedError
end
def value(context = {})
l = cast(left.value(context))
r = cast(right.value(context))
l.public_send(operator, r)
end
private
def cast(val, prefer_integer = true)
validate_value(val)
numeric(val, prefer_integer)
end
def numeric(val, prefer_integer)
v = BigDecimal.new(val, Float::DIG + 1)
v = v.to_i if prefer_integer && v.frac.zero?
v
rescue ::TypeError
# If we got a TypeError BigDecimal or to_i failed;
# let value through so ruby things like Time - integer work
val
end
def valid_node?(node)
node && (node.dependencies.any? || node.type == :numeric)
end
def valid_left?
valid_node?(left)
end
def valid_right?
valid_node?(right)
end
def validate_value(val)
if val.is_a?(::String)
validate_format(val)
else
validate_operation(val)
end
end
def validate_operation(val)
unless val.respond_to?(operator)
raise Dentaku::ArgumentError.for(:invalid_operator, operation: self.class, operator: operator),
"#{ self.class } requires operands that respond to #{operator}"
end
end
def validate_format(string)
unless string =~ /\A-?\d*(\.\d+)?\z/
raise Dentaku::ArgumentError.for(:invalid_value, value: string, for: BigDecimal),
"String input '#{string}' is not coercible to numeric"
end
end
end
class Addition < Arithmetic
def operator
:+
end
def self.precedence
10
end
end
class Subtraction < Arithmetic
def operator
:-
end
def self.precedence
10
end
end
class Multiplication < Arithmetic
def operator
:*
end
def self.precedence
20
end
end
class Division < Arithmetic
def operator
:/
end
def value(context = {})
r = cast(right.value(context), false)
raise Dentaku::ZeroDivisionError if r.zero?
cast(cast(left.value(context)) / r)
end
def self.precedence
20
end
end
class Modulo < Arithmetic
def self.arity
@arity
end
def self.peek(input)
@arity = 1
@arity = 2 if input.length > 1
end
def initialize(left, right = nil)
if right
@left = left
@right = right
else
@right = left
end
unless valid_left?
raise NodeError.new(%i[numeric nil], left.type, :left),
"#{self.class} requires numeric operands or nil"
end
unless valid_right?
raise NodeError.new(:numeric, right.type, :right),
"#{self.class} requires numeric operands"
end
end
def percent?
left.nil?
end
def value(context = {})
if percent?
cast(right.value(context)) * 0.01
else
super
end
end
def operator
:%
end
def self.precedence
20
end
def valid_left?
valid_node?(left) || left.nil?
end
end
class Exponentiation < Arithmetic
def operator
:**
end
def self.precedence
30
end
end
end
end
| 20.474747 | 105 | 0.540207 |
79a492a7b3d1b8915dffaed9041157f056b41d03 | 582 | require 'sinatra'
require 'net/ftp'
require 'uri'
get '/' do
'Use /download?uri=ftp://127.0.0.1:2121/&file=/path/to/file.txt to download a ftp file.'
end
get '/download' do
content_type 'application/octet-stream'
begin
uri = URI.parse(params['uri'])
ftp = Net::FTP.new
ftp.connect(uri.host, uri.port)
ftp.login(uri.user || 'anonymous', uri.password)
ftp.getbinaryfile(params['file'])
ftp.close
rescue
return '404 Not Found'
end
File.open(params['file'], 'rb') {|f|
return f.read
}
end | 21.555556 | 92 | 0.592784 |
b91811d5327e665dfe0db7d9734ebb35180896c9 | 332 | module Rails # :nodoc:
class Initializer # :nodoc:
WarpDrive::RAILS_INIT_METHODS.each do |meth|
alias_method "#{meth}_without_warp_drive", meth
define_method("#{meth}_with_warp_drive", WarpDrive::Procs.send(meth))
alias_method meth, "#{meth}_with_warp_drive"
end
end # Initializer
end # Rails | 30.181818 | 75 | 0.689759 |
1c9ff1f6111bbb1dff9a2d937fec47fd5126b502 | 784 | # Include it in your workers to enable progress monitoring and stopping jobs.
module BackgroundFu::WorkerMonitoring
# In most cases you will have some loop which will execute known (m) times.
# Every time the loop iterates you increment a counter (n).
# The formula to get progress in percents is: 100 * n / m.
# If you invoke this method with second argument, then this is calculated for you.
# You also can omit second argument and progress will be passed directly to db.
def record_progress(progress_or_iteration, iterations_count = nil)
if iterations_count.to_i > 0
@progress = ((progress_or_iteration.to_f / iterations_count) * 100).to_i
else
@progress = progress_or_iteration.to_i
end
throw(:stopping, true) if @stopping
end
end
| 39.2 | 84 | 0.735969 |
7a66044c5b69a30ce788738a27befc89fafa2fb1 | 9,210 | # frozen_string_literal: true
module API
class ProjectImport < ::API::Base
include PaginationParams
helpers Helpers::ProjectsHelpers
helpers Helpers::FileUploadHelpers
feature_category :importers
urgency :low
before { authenticate! unless route.settings[:skip_authentication] }
helpers do
def import_params
declared_params(include_missing: false)
end
def namespace_from(params, current_user)
if params[:namespace]
find_namespace!(params[:namespace])
else
current_user.namespace
end
end
def filtered_override_params(params)
override_params = params.delete(:override_params)
filter_attributes_using_license!(override_params) if override_params
override_params
end
end
before do
forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Workhorse authorize the project import upload' do
detail 'This feature was introduced in GitLab 12.9'
end
post 'import/authorize' do
require_gitlab_workhorse!
status 200
content_type Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE
ImportExportUploader.workhorse_authorize(
has_length: false,
maximum_size: Gitlab::CurrentSettings.max_import_size.megabytes
)
end
params do
requires :path, type: String, desc: 'The new project path and name'
requires :file, type: ::API::Validations::Types::WorkhorseFile, desc: 'The project export file to be imported'
optional :name, type: String, desc: 'The name of the project to be imported. Defaults to the path of the project if not provided.'
optional :namespace, type: String, desc: "The ID or name of the namespace that the project will be imported into. Defaults to the current user's namespace."
optional :overwrite, type: Boolean, default: false, desc: 'If there is a project in the same namespace and with the same name overwrite it'
optional :override_params,
type: Hash,
desc: 'New project params to override values in the export' do
use :optional_project_params
end
optional 'file.path', type: String, desc: 'Path to locally stored body (generated by Workhorse)'
optional 'file.name', type: String, desc: 'Real filename as send in Content-Disposition (generated by Workhorse)'
optional 'file.type', type: String, desc: 'Real content type as send in Content-Type (generated by Workhorse)'
optional 'file.size', type: Integer, desc: 'Real size of file (generated by Workhorse)'
optional 'file.md5', type: String, desc: 'MD5 checksum of the file (generated by Workhorse)'
optional 'file.sha1', type: String, desc: 'SHA1 checksum of the file (generated by Workhorse)'
optional 'file.sha256', type: String, desc: 'SHA256 checksum of the file (generated by Workhorse)'
optional 'file.etag', type: String, desc: 'Etag of the file (generated by Workhorse)'
optional 'file.remote_id', type: String, desc: 'Remote_id of the file (generated by Workhorse)'
optional 'file.remote_url', type: String, desc: 'Remote_url of the file (generated by Workhorse)'
end
desc 'Create a new project import' do
detail 'This feature was introduced in GitLab 10.6.'
success Entities::ProjectImportStatus
end
post 'import' do
require_gitlab_workhorse!
check_rate_limit! :project_import, scope: [current_user, :project_import]
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/21041')
validate_file!
response = ::Import::GitlabProjects::CreateProjectService.new(
current_user,
params: {
path: import_params[:path],
namespace: namespace_from(import_params, current_user),
name: import_params[:name],
file: import_params[:file],
overwrite: import_params[:overwrite],
override: filtered_override_params(import_params)
}
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
else
render_api_error!(response.message, response.http_status)
end
end
params do
requires :id, type: String, desc: 'The ID of a project'
end
desc 'Get a project import status' do
detail 'This feature was introduced in GitLab 10.6.'
success Entities::ProjectImportStatus
end
route_setting :skip_authentication, true
get ':id/import' do
present user_project, with: Entities::ProjectImportStatus
end
params do
requires :url, type: String, desc: 'The URL for the file.'
requires :path, type: String, desc: 'The new project path and name'
optional :name, type: String, desc: 'The name of the project to be imported. Defaults to the path of the project if not provided.'
optional :namespace, type: String, desc: "The ID or name of the namespace that the project will be imported into. Defaults to the current user's namespace."
optional :overwrite, type: Boolean, default: false, desc: 'If there is a project in the same namespace and with the same name overwrite it'
optional :override_params,
type: Hash,
desc: 'New project params to override values in the export' do
use :optional_project_params
end
end
desc 'Create a new project import using a remote object storage path' do
detail 'This feature was introduced in GitLab 13.2.'
success Entities::ProjectImportStatus
end
post 'remote-import' do
check_rate_limit! :project_import, scope: [current_user, :project_import]
response = ::Import::GitlabProjects::CreateProjectService.new(
current_user,
params: {
path: import_params[:path],
namespace: namespace_from(import_params, current_user),
name: import_params[:name],
remote_import_url: import_params[:url],
overwrite: import_params[:overwrite],
override: filtered_override_params(import_params)
},
file_acquisition_strategy: ::Import::GitlabProjects::FileAcquisitionStrategies::RemoteFile
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
else
render_api_error!(response.message, response.http_status)
end
end
params do
requires :region, type: String, desc: 'AWS region'
requires :bucket_name, type: String, desc: 'Bucket name'
requires :file_key, type: String, desc: 'File key'
requires :access_key_id, type: String, desc: 'Access key id'
requires :secret_access_key, type: String, desc: 'Secret access key'
requires :path, type: String, desc: 'The new project path and name'
optional :name, type: String, desc: 'The name of the project to be imported. Defaults to the path of the project if not provided.'
optional :namespace, type: String, desc: "The ID or name of the namespace that the project will be imported into. Defaults to the current user's namespace."
optional :overwrite, type: Boolean, default: false, desc: 'If there is a project in the same namespace and with the same name overwrite it'
optional :override_params,
type: Hash,
desc: 'New project params to override values in the export' do
use :optional_project_params
end
end
desc 'Create a new project import using a file from AWS S3' do
detail 'This feature was introduced in GitLab 14.9.'
success Entities::ProjectImportStatus
end
post 'remote-import-s3' do
not_found! unless ::Feature.enabled?(:import_project_from_remote_file_s3)
check_rate_limit! :project_import, scope: [current_user, :project_import]
response = ::Import::GitlabProjects::CreateProjectService.new(
current_user,
params: {
path: import_params[:path],
namespace: namespace_from(import_params, current_user),
name: import_params[:name],
overwrite: import_params[:overwrite],
override: filtered_override_params(import_params),
region: import_params[:region],
bucket_name: import_params[:bucket_name],
file_key: import_params[:file_key],
access_key_id: import_params[:access_key_id],
secret_access_key: import_params[:secret_access_key]
},
file_acquisition_strategy: ::Import::GitlabProjects::FileAcquisitionStrategies::RemoteFileS3
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
else
render_api_error!(response.message, response.http_status)
end
end
end
end
end
| 43.443396 | 164 | 0.666992 |
3951106dd227f4b1927c3ffa8d2bf1b3cbfdd954 | 140 | class WorkflowsProjectIdNotNull < ActiveRecord::Migration[5.1]
def change
change_column_null :workflows, :project_id, false
end
end
| 23.333333 | 62 | 0.785714 |
33233ec6e3fcbf9d319396290f4c8da6dffdde70 | 17,206 | # encoding: utf-8
#
# This file is machine generated. DO NOT EDIT!
#
if Kernel.respond_to?(:require_relative)
require_relative("./helper")
else
$:.unshift(File.dirname(__FILE__))
require 'helper'
end
#
# == Purpose
#
# Tests for the #{UTF8::Validator} implementation.
#
# Test data pulled and generated from:
#
# https://www.unicode.org/Public/10.0.0/ucd/
#
class TestUnicode10ScriptExtensions < Test::Unit::TestCase
#
def setup
@validator = UTF8::Validator.new
@vercheck = ((RUBY_VERSION =~ /1.9/) or (RUBY_VERSION =~ /2./)) ? true : false
end
#
def teardown
@validator = nil
end
def test_unicode10_ScriptExtensions
test_data = [
"\u1CF7", # ; Beng # Mc VEDIC SIGN ATIKRAMA
"\u1CD1", # ; Deva # Mn VEDIC TONE SHARA
"\u1cd4","\u1cd5","\u1cd6", # ; Deva # Mn [3] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE YAJURVEDIC INDEPENDENT SVARITA
"\u1CD8", # ; Deva # Mn VEDIC TONE CANDRA BELOW
"\u1CDB", # ; Deva # Mn VEDIC TONE TRIPLE SVARITA
"\u1cde","\u1cdf", # ; Deva # Mn [2] VEDIC TONE TWO DOTS BELOW..VEDIC TONE THREE DOTS BELOW
"\u1CE1", # ; Deva # Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA
"\u1ce2","\u1ce3","\u1ce4","\u1ce5","\u1ce6","\u1ce7","\u1ce8", # ; Deva # Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL
"\u1ce9","\u1cea","\u1ceb","\u1cec", # ; Deva # Lo [4] VEDIC SIGN ANUSVARA ANTARGOMUKHA..VEDIC SIGN ANUSVARA VAMAGOMUKHA WITH TAIL
"\u1CED", # ; Deva # Mn VEDIC SIGN TIRYAK
"\u1cee","\u1cef","\u1cf0","\u1cf1", # ; Deva # Lo [4] VEDIC SIGN HEXIFORM LONG ANUSVARA..VEDIC SIGN ANUSVARA UBHAYATO MUKHA
"\u1CF6", # ; Deva # Lo VEDIC SIGN UPADHMANIYA
"\u1bca0","\u1bca1","\u1bca2","\u1bca3", # ; Dupl # Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP
"\u0342", # ; Grek # Mn COMBINING GREEK PERISPOMENI
"\u0345", # ; Grek # Mn COMBINING GREEK YPOGEGRAMMENI
"\u1dc0","\u1dc1", # ; Grek # Mn [2] COMBINING DOTTED GRAVE ACCENT..COMBINING DOTTED ACUTE ACCENT
"\u3006", # ; Hani # Lo IDEOGRAPHIC CLOSING MARK
"\u303e","\u303f", # ; Hani # So [2] IDEOGRAPHIC VARIATION INDICATOR..IDEOGRAPHIC HALF FILL SPACE
"\u3190","\u3191", # ; Hani # So [2] IDEOGRAPHIC ANNOTATION LINKING MARK..IDEOGRAPHIC ANNOTATION REVERSE MARK
"\u3192","\u3193","\u3194","\u3195", # ; Hani # No [4] IDEOGRAPHIC ANNOTATION ONE MARK..IDEOGRAPHIC ANNOTATION FOUR MARK
"\u3196","\u3197","\u3198","\u3199","\u319a","\u319b","\u319c","\u319d","\u319e","\u319f", # ; Hani # So [10] IDEOGRAPHIC ANNOTATION TOP MARK..IDEOGRAPHIC ANNOTATION MAN MARK
"\u31c0","\u31c1","\u31c2","\u31c3","\u31c4","\u31c5","\u31c6","\u31c7","\u31c8","\u31c9","\u31ca","\u31cb","\u31cc","\u31cd","\u31ce","\u31cf","\u31d0","\u31d1","\u31d2","\u31d3","\u31d4","\u31d5","\u31d6","\u31d7","\u31d8","\u31d9","\u31da","\u31db","\u31dc","\u31dd","\u31de","\u31df","\u31e0","\u31e1","\u31e2","\u31e3", # ; Hani # So [36] CJK STROKE T..CJK STROKE Q
"\u3220","\u3221","\u3222","\u3223","\u3224","\u3225","\u3226","\u3227","\u3228","\u3229", # ; Hani # No [10] PARENTHESIZED IDEOGRAPH ONE..PARENTHESIZED IDEOGRAPH TEN
"\u322a","\u322b","\u322c","\u322d","\u322e","\u322f","\u3230","\u3231","\u3232","\u3233","\u3234","\u3235","\u3236","\u3237","\u3238","\u3239","\u323a","\u323b","\u323c","\u323d","\u323e","\u323f","\u3240","\u3241","\u3242","\u3243","\u3244","\u3245","\u3246","\u3247", # ; Hani # So [30] PARENTHESIZED IDEOGRAPH MOON..CIRCLED IDEOGRAPH KOTO
"\u3280","\u3281","\u3282","\u3283","\u3284","\u3285","\u3286","\u3287","\u3288","\u3289", # ; Hani # No [10] CIRCLED IDEOGRAPH ONE..CIRCLED IDEOGRAPH TEN
"\u328a","\u328b","\u328c","\u328d","\u328e","\u328f","\u3290","\u3291","\u3292","\u3293","\u3294","\u3295","\u3296","\u3297","\u3298","\u3299","\u329a","\u329b","\u329c","\u329d","\u329e","\u329f","\u32a0","\u32a1","\u32a2","\u32a3","\u32a4","\u32a5","\u32a6","\u32a7","\u32a8","\u32a9","\u32aa","\u32ab","\u32ac","\u32ad","\u32ae","\u32af","\u32b0", # ; Hani # So [39] CIRCLED IDEOGRAPH MOON..CIRCLED IDEOGRAPH NIGHT
"\u32c0","\u32c1","\u32c2","\u32c3","\u32c4","\u32c5","\u32c6","\u32c7","\u32c8","\u32c9","\u32ca","\u32cb", # ; Hani # So [12] IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY..IDEOGRAPHIC TELEGRAPH SYMBOL FOR DECEMBER
"\u3358","\u3359","\u335a","\u335b","\u335c","\u335d","\u335e","\u335f","\u3360","\u3361","\u3362","\u3363","\u3364","\u3365","\u3366","\u3367","\u3368","\u3369","\u336a","\u336b","\u336c","\u336d","\u336e","\u336f","\u3370", # ; Hani # So [25] IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO..IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-FOUR
"\u337b","\u337c","\u337d","\u337e","\u337f", # ; Hani # So [5] SQUARE ERA NAME HEISEI..SQUARE CORPORATION
"\u33e0","\u33e1","\u33e2","\u33e3","\u33e4","\u33e5","\u33e6","\u33e7","\u33e8","\u33e9","\u33ea","\u33eb","\u33ec","\u33ed","\u33ee","\u33ef","\u33f0","\u33f1","\u33f2","\u33f3","\u33f4","\u33f5","\u33f6","\u33f7","\u33f8","\u33f9","\u33fa","\u33fb","\u33fc","\u33fd","\u33fe", # ; Hani # So [31] IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ONE..IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY-ONE
"\u1d360","\u1d361","\u1d362","\u1d363","\u1d364","\u1d365","\u1d366","\u1d367","\u1d368","\u1d369","\u1d36a","\u1d36b","\u1d36c","\u1d36d","\u1d36e","\u1d36f","\u1d370","\u1d371", # ; Hani # No [18] COUNTING ROD UNIT DIGIT ONE..COUNTING ROD TENS DIGIT NINE
"\u1f250","\u1f251", # ; Hani # So [2] CIRCLED IDEOGRAPH ADVANTAGE..CIRCLED IDEOGRAPH ACCEPT
"\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036a","\u036b","\u036c","\u036d","\u036e","\u036f", # ; Latn # Mn [13] COMBINING LATIN SMALL LETTER A..COMBINING LATIN SMALL LETTER X
"\u102E0", # ; Arab Copt # Mn COPTIC EPACT THOUSANDS MARK
"\u102e1","\u102e2","\u102e3","\u102e4","\u102e5","\u102e6","\u102e7","\u102e8","\u102e9","\u102ea","\u102eb","\u102ec","\u102ed","\u102ee","\u102ef","\u102f0","\u102f1","\u102f2","\u102f3","\u102f4","\u102f5","\u102f6","\u102f7","\u102f8","\u102f9","\u102fa","\u102fb", # ; Arab Copt # No [27] COPTIC EPACT DIGIT ONE..COPTIC EPACT NUMBER NINE HUNDRED
"\u064b","\u064c","\u064d","\u064e","\u064f","\u0650","\u0651","\u0652","\u0653","\u0654","\u0655", # ; Arab Syrc # Mn [11] ARABIC FATHATAN..ARABIC HAMZA BELOW
"\u0670", # ; Arab Syrc # Mn ARABIC LETTER SUPERSCRIPT ALEF
"\u0660","\u0661","\u0662","\u0663","\u0664","\u0665","\u0666","\u0667","\u0668","\u0669", # ; Arab Thaa # Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE
"\uFDF2", # ; Arab Thaa # Lo ARABIC LIGATURE ALLAH ISOLATED FORM
"\uFDFD", # ; Arab Thaa # So ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM
"\u0589", # ; Armn Geor # Po ARMENIAN FULL STOP
"\uA8F1", # ; Beng Deva # Mn COMBINING DEVANAGARI SIGN AVAGRAHA
"\u302a","\u302b","\u302c","\u302d", # ; Bopo Hani # Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK
"\uA9CF", # ; Bugi Java # Lm JAVANESE PANGRANGKEP
"\u10100","\u10101","\u10102", # ; Cprt Linb # Po [3] AEGEAN WORD SEPARATOR LINE..AEGEAN CHECK MARK
"\u10137","\u10138","\u10139","\u1013a","\u1013b","\u1013c","\u1013d","\u1013e","\u1013f", # ; Cprt Linb # So [9] AEGEAN WEIGHT BASE UNIT..AEGEAN MEASURE THIRD SUBUNIT
"\u0484", # ; Cyrl Glag # Mn COMBINING CYRILLIC PALATALIZATION
"\u0487", # ; Cyrl Glag # Mn COMBINING CYRILLIC POKRYTIE
"\u2E43", # ; Cyrl Glag # Po DASH WITH LEFT UPTURN
"\uA66F", # ; Cyrl Glag # Mn COMBINING CYRILLIC VZMET
"\u0485","\u0486", # ; Cyrl Latn # Mn [2] COMBINING CYRILLIC DASIA PNEUMATA..COMBINING CYRILLIC PSILI PNEUMATA
"\u0483", # ; Cyrl Perm # Mn COMBINING CYRILLIC TITLO
"\u1CD0", # ; Deva Gran # Mn VEDIC TONE KARSHANA
"\u1CD2", # ; Deva Gran # Mn VEDIC TONE PRENKHA
"\u1CD3", # ; Deva Gran # Po VEDIC SIGN NIHSHVASA
"\u1cf2","\u1cf3", # ; Deva Gran # Mc [2] VEDIC SIGN ARDHAVISARGA..VEDIC SIGN ROTATED ARDHAVISARGA
"\u1CF4", # ; Deva Gran # Mn VEDIC TONE CANDRA ABOVE
"\u1cf8","\u1cf9", # ; Deva Gran # Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE
"\u1CF5", # ; Deva Knda # Lo VEDIC SIGN JIHVAMULIYA
"\u1CD7", # ; Deva Shrd # Mn VEDIC TONE YAJURVEDIC KATHAKA INDEPENDENT SVARITA
"\u1CD9", # ; Deva Shrd # Mn VEDIC TONE YAJURVEDIC KATHAKA INDEPENDENT SVARITA SCHROEDER
"\u1cdc","\u1cdd", # ; Deva Shrd # Mn [2] VEDIC TONE KATHAKA ANUDATTA..VEDIC TONE DOT BELOW
"\u1CE0", # ; Deva Shrd # Mn VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA
"\uA8F3", # ; Deva Taml # Lo DEVANAGARI SIGN CANDRABINDU VIRAMA
"\u10FB", # ; Geor Latn # Po GEORGIAN PARAGRAPH SEPARATOR
"\u0BAA", # ; Gran Taml # Lo TAMIL LETTER PA
"\u0BB5", # ; Gran Taml # Lo TAMIL LETTER VA
"\u0be6","\u0be7","\u0be8","\u0be9","\u0bea","\u0beb","\u0bec","\u0bed","\u0bee","\u0bef", # ; Gran Taml # Nd [10] TAMIL DIGIT ZERO..TAMIL DIGIT NINE
"\u0bf0","\u0bf1","\u0bf2", # ; Gran Taml # No [3] TAMIL NUMBER TEN..TAMIL NUMBER ONE THOUSAND
"\u11301", # ; Gran Taml # Mn GRANTHA SIGN CANDRABINDU
"\u11303", # ; Gran Taml # Mc GRANTHA SIGN VISARGA
"\u1133C", # ; Gran Taml # Mn GRANTHA SIGN NUKTA
"\u0ae6","\u0ae7","\u0ae8","\u0ae9","\u0aea","\u0aeb","\u0aec","\u0aed","\u0aee","\u0aef", # ; Gujr Khoj # Nd [10] GUJARATI DIGIT ZERO..GUJARATI DIGIT NINE
"\u0a66","\u0a67","\u0a68","\u0a69","\u0a6a","\u0a6b","\u0a6c","\u0a6d","\u0a6e","\u0a6f", # ; Guru Mult # Nd [10] GURMUKHI DIGIT ZERO..GURMUKHI DIGIT NINE
"\u3031","\u3032","\u3033","\u3034","\u3035", # ; Hira Kana # Lm [5] VERTICAL KANA REPEAT MARK..VERTICAL KANA REPEAT MARK LOWER HALF
"\u3099","\u309a", # ; Hira Kana # Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
"\u309b","\u309c", # ; Hira Kana # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
"\u30A0", # ; Hira Kana # Pd KATAKANA-HIRAGANA DOUBLE HYPHEN
"\u30FC", # ; Hira Kana # Lm KATAKANA-HIRAGANA PROLONGED SOUND MARK
"\uFF70", # ; Hira Kana # Lm HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
"\uff9e","\uff9f", # ; Hira Kana # Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
"\u1802","\u1803", # ; Mong Phag # Po [2] MONGOLIAN COMMA..MONGOLIAN FULL STOP
"\u1805", # ; Mong Phag # Po MONGOLIAN FOUR DOTS
"\u060C", # ; Arab Syrc Thaa # Po ARABIC COMMA
"\u061B", # ; Arab Syrc Thaa # Po ARABIC SEMICOLON
"\u061C", # ; Arab Syrc Thaa # Cf ARABIC LETTER MARK
"\u061F", # ; Arab Syrc Thaa # Po ARABIC QUESTION MARK
"\u09e6","\u09e7","\u09e8","\u09e9","\u09ea","\u09eb","\u09ec","\u09ed","\u09ee","\u09ef", # ; Beng Cakm Sylo # Nd [10] BENGALI DIGIT ZERO..BENGALI DIGIT NINE
"\u1040","\u1041","\u1042","\u1043","\u1044","\u1045","\u1046","\u1047","\u1048","\u1049", # ; Cakm Mymr Tale # Nd [10] MYANMAR DIGIT ZERO..MYANMAR DIGIT NINE
"\u10107","\u10108","\u10109","\u1010a","\u1010b","\u1010c","\u1010d","\u1010e","\u1010f","\u10110","\u10111","\u10112","\u10113","\u10114","\u10115","\u10116","\u10117","\u10118","\u10119","\u1011a","\u1011b","\u1011c","\u1011d","\u1011e","\u1011f","\u10120","\u10121","\u10122","\u10123","\u10124","\u10125","\u10126","\u10127","\u10128","\u10129","\u1012a","\u1012b","\u1012c","\u1012d","\u1012e","\u1012f","\u10130","\u10131","\u10132","\u10133", # ; Cprt Lina Linb # No [45] AEGEAN NUMBER ONE..AEGEAN NUMBER NINETY THOUSAND
"\u20F0", # ; Deva Gran Latn # Mn COMBINING ASTERISK ABOVE
"\u0966","\u0967","\u0968","\u0969","\u096a","\u096b","\u096c","\u096d","\u096e","\u096f", # ; Deva Kthi Mahj # Nd [10] DEVANAGARI DIGIT ZERO..DEVANAGARI DIGIT NINE
"\u303C", # ; Hani Hira Kana # Lo MASU MARK
"\u303D", # ; Hani Hira Kana # Po PART ALTERNATION MARK
"\uA92E", # ; Kali Latn Mymr # Po KAYAH LI SIGN CWI
"\u1735","\u1736", # ; Buhd Hano Tagb Tglg # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION
"\u3003", # ; Bopo Hang Hani Hira Kana # Po DITTO MARK
"\u3013", # ; Bopo Hang Hani Hira Kana # So GETA MARK
"\u301C", # ; Bopo Hang Hani Hira Kana # Pd WAVE DASH
"\u301D", # ; Bopo Hang Hani Hira Kana # Ps REVERSED DOUBLE PRIME QUOTATION MARK
"\u301e","\u301f", # ; Bopo Hang Hani Hira Kana # Pe [2] DOUBLE PRIME QUOTATION MARK..LOW DOUBLE PRIME QUOTATION MARK
"\u3030", # ; Bopo Hang Hani Hira Kana # Pd WAVY DASH
"\u3037", # ; Bopo Hang Hani Hira Kana # So IDEOGRAPHIC TELEGRAPH LINE FEED SEPARATOR SYMBOL
"\ufe45","\ufe46", # ; Bopo Hang Hani Hira Kana # Po [2] SESAME DOT..WHITE SESAME DOT
"\u1CDA", # ; Deva Knda Mlym Taml Telu # Mn VEDIC TONE DOUBLE SVARITA
"\u0640", # ; Adlm Arab Mand Mani Phlp Syrc # Lm ARABIC TATWEEL
"\u3001","\u3002", # ; Bopo Hang Hani Hira Kana Yiii # Po [2] IDEOGRAPHIC COMMA..IDEOGRAPHIC FULL STOP
"\u3008", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT ANGLE BRACKET
"\u3009", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT ANGLE BRACKET
"\u300A", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT DOUBLE ANGLE BRACKET
"\u300B", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT DOUBLE ANGLE BRACKET
"\u300C", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT CORNER BRACKET
"\u300D", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT CORNER BRACKET
"\u300E", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT WHITE CORNER BRACKET
"\u300F", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT WHITE CORNER BRACKET
"\u3010", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT BLACK LENTICULAR BRACKET
"\u3011", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT BLACK LENTICULAR BRACKET
"\u3014", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT TORTOISE SHELL BRACKET
"\u3015", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT TORTOISE SHELL BRACKET
"\u3016", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT WHITE LENTICULAR BRACKET
"\u3017", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT WHITE LENTICULAR BRACKET
"\u3018", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT WHITE TORTOISE SHELL BRACKET
"\u3019", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT WHITE TORTOISE SHELL BRACKET
"\u301A", # ; Bopo Hang Hani Hira Kana Yiii # Ps LEFT WHITE SQUARE BRACKET
"\u301B", # ; Bopo Hang Hani Hira Kana Yiii # Pe RIGHT WHITE SQUARE BRACKET
"\u30FB", # ; Bopo Hang Hani Hira Kana Yiii # Po KATAKANA MIDDLE DOT
"\uFF61", # ; Bopo Hang Hani Hira Kana Yiii # Po HALFWIDTH IDEOGRAPHIC FULL STOP
"\uFF62", # ; Bopo Hang Hani Hira Kana Yiii # Ps HALFWIDTH LEFT CORNER BRACKET
"\uFF63", # ; Bopo Hang Hani Hira Kana Yiii # Pe HALFWIDTH RIGHT CORNER BRACKET
"\uff64","\uff65", # ; Bopo Hang Hani Hira Kana Yiii # Po [2] HALFWIDTH IDEOGRAPHIC COMMA..HALFWIDTH KATAKANA MIDDLE DOT
"\ua836","\ua837", # ; Deva Gujr Guru Kthi Mahj Modi Sind Takr Tirh # So [2] NORTH INDIC QUARTER MARK..NORTH INDIC PLACEHOLDER MARK
"\uA838", # ; Deva Gujr Guru Kthi Mahj Modi Sind Takr Tirh # Sc NORTH INDIC RUPEE MARK
"\uA839", # ; Deva Gujr Guru Kthi Mahj Modi Sind Takr Tirh # So NORTH INDIC QUANTITY MARK
"\ua830","\ua831","\ua832","\ua833","\ua834","\ua835", # ; Deva Gujr Guru Knda Kthi Mahj Modi Sind Takr Tirh # No [6] NORTH INDIC FRACTION ONE QUARTER..NORTH INDIC FRACTION THREE SIXTEENTHS
"\u0952", # ; Beng Deva Gran Gujr Guru Knda Latn Mlym Orya Taml Telu # Mn DEVANAGARI STRESS SIGN ANUDATTA
"\u0951", # ; Beng Deva Gran Gujr Guru Knda Latn Mlym Orya Shrd Taml Telu # Mn DEVANAGARI STRESS SIGN UDATTA
"\u0964", # ; Beng Deva Gran Gujr Guru Knda Mahj Mlym Orya Sind Sinh Sylo Takr Taml Telu Tirh # Po DEVANAGARI DANDA
"\u0965", # ; Beng Deva Gran Gujr Guru Knda Limb Mahj Mlym Orya Sind Sinh Sylo Takr Taml Telu Tirh # Po DEVANAGARI DOUBLE DANDA
]
test_data.each do |string|
assert @validator.valid_encoding?(string), "U10_ScriptExtensions: #{string}"
assert string.force_encoding("UTF-8").valid_encoding?, "U10_ScriptExtensions: #{string}" if @vercheck
end
end
end
| 95.588889 | 538 | 0.597989 |
3964cf8d689fbefa6f2170527e56d11ab5452dce | 1,282 | # encoding: utf-8
require 'spec_helper'
describe Yardstick::MeasurementSet, '#puts' do
let(:document) { DocumentMock.new }
let(:set) do
described_class.new([failed.new, successful.new, successful.new])
end
let(:failed) do
Class.new do
def ok?
false
end
def puts(io)
io.puts('measurement info')
end
end
end
let(:successful) do
Class.new do
def ok?
true
end
def puts(io)
io.puts('measurement info')
end
end
end
describe 'with no arguments' do
before do
capture_stdout { set.puts }
end
it 'outputs the summary' do
expect(@output).to eql([
'measurement info',
'measurement info',
'measurement info',
"\nYARD-Coverage: 66.6% Success: 2 Failed: 1 Total: 3\n"
].join("\n"))
end
end
describe 'with an object implementing #puts' do
before do
io = StringIO.new
set.puts(io)
io.rewind
@output = io.read
end
it 'outputs the summary' do
expect(@output).to eql([
'measurement info',
'measurement info',
'measurement info',
"\nYARD-Coverage: 66.6% Success: 2 Failed: 1 Total: 3\n",
].join("\n"))
end
end
end
| 18.57971 | 69 | 0.562402 |
9122b5e31ea56c6c94a9e548003704c3b3ff1c01 | 80 | require 'spec_helper'
module ChiliPepper
describe ItemDecorator do
end
end
| 11.428571 | 27 | 0.8 |
332ee1b98c0f5f05b5e2bcc695bc6c40278b6dc3 | 97 | # desc "Explaining what the task does"
# task :postload_google_ads do
# # Task goes here
# end
| 19.4 | 38 | 0.71134 |
e289f8ce36662545306a8a39392c3bdf10f8bae2 | 164 | require File.expand_path('../../../spec_helper', __FILE__)
require 'date'
describe "DateTime#to_datetime" do
it "needs to be reviewed for spec completeness"
end
| 23.428571 | 58 | 0.743902 |
e80a3d70c8425f101aa7fc3551286f8f1773091d | 2,482 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::FlowCustomTransactionPKArgs
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
# Please update as you see appropriate
describe 'FlowCustomTransactionPKArgs' do
before do
# run before each test
@instance = Tatum::FlowCustomTransactionPKArgs.new
end
after do
# run after each test
end
describe 'test an instance of FlowCustomTransactionPKArgs' do
it 'should create an instance of FlowCustomTransactionPKArgs' do
expect(@instance).to be_instance_of(Tatum::FlowCustomTransactionPKArgs)
end
end
describe 'test attribute "value"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["Identity", "UInt", "Int", "UInt8", "Int8", "UInt16", "Int16", "UInt32", "Int32", "UInt64", "Int64", "UInt128", "Int128", "UInt256", "Int256", "Word8", "Word16", "Word32", "Word64", "UFix64", "Fix64", "String", "Character", "Bool", "Address", "Void", "Optional", "Reference", "Array", "Dictionary", "Event", "Resource", "Struct"])
# validator.allowable_values.each do |value|
# expect { @instance.type = value }.not_to raise_error
# end
end
end
describe 'test attribute "sub_type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["Identity", "UInt", "Int", "UInt8", "Int8", "UInt16", "Int16", "UInt32", "Int32", "UInt64", "Int64", "UInt128", "Int128", "UInt256", "Int256", "Word8", "Word16", "Word32", "Word64", "UFix64", "Fix64", "String", "Character", "Bool", "Address", "Void", "Optional", "Reference", "Array", "Dictionary", "Event", "Resource", "Struct"])
# validator.allowable_values.each do |value|
# expect { @instance.sub_type = value }.not_to raise_error
# end
end
end
end
| 40.688525 | 408 | 0.686543 |
01de4cd40e5c50aa9f44f256cd7961c61ef6f7eb | 2,674 | class Libantlr3c < Formula
desc "ANTLRv3 parsing library for C"
homepage "https://www.antlr3.org/"
url "https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz"
sha256 "ca914a97f1a2d2f2c8e1fca12d3df65310ff0286d35c48b7ae5f11dcc8b2eb52"
license "BSD-3-Clause"
revision 1
bottle do
sha256 cellar: :any, arm64_monterey: "192faf2b2502946c3a8b27cade6a6febbd579de8fb1b9da136c48ea6a74bc621"
sha256 cellar: :any, arm64_big_sur: "0ba9d61434c3b1a05ef0ff9bb86e1e6d238c91723383204daeb5115976b05b02"
sha256 cellar: :any, monterey: "8fa311163c90642a02332aebc6b4bd77d24fc2d0a45ecbc6f5670acb54e29977"
sha256 cellar: :any, big_sur: "3e442dfcc1083a693b77995703d2a2bb5100d13dfbae8cf174816fd112e90cb5"
sha256 cellar: :any, catalina: "53bc5810ecd6cc4be26da750839d53981ebba6ad931e13005661e599cfd69501"
sha256 cellar: :any, mojave: "c4df9f53203a7e21abc1fb22bf74256017f646e9177606c7da6c222db16dd3cb"
sha256 cellar: :any, high_sierra: "2de7942e4bc89830c0d92bfda55e60a4ad82723430bcc7477abb5d1b1ade7f86"
sha256 cellar: :any, sierra: "a5e779c431e16bdaab829c774468ce11f8e7ea359412800e294433b011704541"
sha256 cellar: :any, el_capitan: "fea1cde8ae732cdbbffa6a6d329239b1da067d2b69424d53178e60309748c403"
sha256 cellar: :any, yosemite: "8026d876b20980138c076cb4008f358deb858204b6399c436cf45e93594274e7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "acd166cf59163343b31b229124ddf4e982c4fa42b196ec443b5ff8b02e12566a"
end
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-pre-0.4.2.418-big_sur.diff"
sha256 "83af02f2aa2b746bb7225872cab29a253264be49db0ecebb12f841562d9a2923"
end
def install
args = ["--disable-dependency-tracking",
"--disable-antlrdebug",
"--prefix=#{prefix}",
"--enable-64bit"]
system "./configure", *args
inreplace "Makefile" do |s|
cflags = s.get_make_var "CFLAGS"
cflags = cflags << " -fexceptions"
s.change_make_var! "CFLAGS", cflags
end
system "make", "install"
end
test do
(testpath/"hello.c").write <<~EOS
#include <antlr3.h>
int main() {
if (0) {
antlr3GenericSetupStream(NULL);
}
return 0;
}
EOS
system ENV.cc, "hello.c", "-L#{lib}", "-lantlr3c", "-o", "hello", "-O0"
system testpath/"hello"
end
end
| 45.322034 | 154 | 0.686986 |
39e0f5afd8e401b09b7b1b68df2f96d43da9670d | 734 | cask 'electron' do
version '6.0.9'
sha256 '635cb3a6915fde5e859ed5f4a0641051c1ffd690c468313f339d5654ecdab65a'
# github.com/electron/electron was verified as official when first introduced to the cask
url "https://github.com/electron/electron/releases/download/v#{version}/electron-v#{version}-darwin-x64.zip"
appcast 'https://github.com/electron/electron/releases.atom'
name 'Electron'
homepage 'https://electron.atom.io/'
app 'Electron.app'
zap trash: [
'~/Library/Application Support/Electron',
'~/Library/Caches/Electron',
'~/Library/Preferences/com.github.electron.helper.plist',
'~/Library/Preferences/com.github.electron.plist',
]
end
| 36.7 | 110 | 0.689373 |
21ce1aa78974a54e785fe93d36bfb9209c56ba81 | 1,941 | # Use this setup block to configure all options available in Bootsy.
Bootsy.setup do |config|
# Default editor options
# You can also override them locally by passing an
# editor_options hash to bootsy_area
config.editor_options = {
font_styles: true,
emphasis: true,
lists: true,
html: true,
link: true,
image: false,
color: true
}
#
# Image versions available
# Possible values: :small, :medium, :large and/or :original
config.image_versions_available = [:small, :medium, :large, :original]
#
#
# SMALL IMAGES
#
# Width limit for small images
# config.small_image[:width] = 160
#
# Height limit for small images
# config.small_image[:height] = 160
#
#
# MEDIUM IMAGES
#
# Width limit for medium images
# config.medium_image[:width] = 360
#
# Height limit for medium images
# config.medium_image[:height] = 360
#
#
# LARGE IMAGES
#
# Width limit for large images
# config.large_image[:width] = 760
#
# Height limit for large images
# config.large_image[:height] = 760
#
#
# Whether user can destroy uploaded files
# config.allow_destroy = true
#
#
# Storage mode
# You can change the sorage mode below from :file to :fog if you want
# to use Amazon S3 and other cloud services. If you do that, please add
# 'fog' to your Gemfile and create and configure your credentials in an
# initializer file, as described in Carrierwave's docs:
# https://github.com/carrierwaveuploader/carrierwave#using-amazon-s3
# config.storage = :file
#
#
# Store directory (inside 'public') for storage = :file
# BE CAREFUL! Changing this may break previously uploaded file paths!
# config.store_dir = 'uploads'
#
#
# Specify the controller to inherit from. Using ApplicationController
# allows you to perform authentication from within your app.
# config.base_controller = ActionController::Base
end
| 27.728571 | 75 | 0.685729 |
4ac7c7df38de4a3b0dcdc342f1c11d687125f94e | 3,064 | # config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"
set :application, "in_the_eyes"
set :repo_url, "https://github.com/tuliang/in-the-eyes.git"
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/home/deploy/www/in_the_eyes"
# Default value for :format is :airbrussh.
# set :format, :airbrussh
# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# append :linked_files, "config/database.yml"
# Default value for linked_dirs is []
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config user.name`.chomp }
# Default value for keep_releases is 5
# set :keep_releases, 5
# Uncomment the following to require manually verifying the host key before first deploy.
# set :ssh_options, verify_host_key: :secure
namespace :deploy do
task :update_nginx do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/update_nginx | bash"
end
end
end
task :update do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/update | bash"
end
end
end
task :seed do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/seed | bash"
end
end
end
task :restart do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/restart | bash"
end
end
end
task :install do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
install_docker
init
end
end
end
task :init do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
init
end
end
end
task :stop do
on roles(:web), in: :sequence, wait: 3 do
within release_path do
stop
end
end
end
def stop
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/stop | bash"
end
def init
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/init | bash"
end
def install_docker
sudo "curl -sSL https://raw.githubusercontent.com/tuliang/in-the-eyes/master/scripts/install-docker | bash"
sudo "docker-compose --version"
end
end | 26.643478 | 113 | 0.680483 |
790b5a9bad0309b1f8c9a77b093cec2e5ca5c535 | 1,646 | class Fetch < Formula
desc "Download assets from a commit, branch, or tag of GitHub repositories"
homepage "https://www.gruntwork.io/"
url "https://github.com/gruntwork-io/fetch/archive/v0.4.2.tar.gz"
sha256 "b8ba80823e961fd2761ef2d855d308b69313930e0ffd445e34840a2ef9b4c6fb"
license "MIT"
head "https://github.com/gruntwork-io/fetch.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "cf51eff4cbaa2c04a0e44dd3b720694df1c3fa3a396d0a42ff9c2a089b1c2f27"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "dad3c162a7e7856f05418531b52e57b637f2c996c41a471eb8b8fadd4aec0770"
sha256 cellar: :any_skip_relocation, monterey: "bfee44ee5a7daff97a9f8059fbdf65de2dbbc5e9e7ed9f4d9ff53f6939f8a312"
sha256 cellar: :any_skip_relocation, big_sur: "85cdfcf652c09182573850736a47b509dee83710c6fba83f6e36d58ea04c0257"
sha256 cellar: :any_skip_relocation, catalina: "1c753e963f8cf9b1b9ea7af0a056fcc7e9f88246894a51865c115d1e3991b03d"
sha256 cellar: :any_skip_relocation, mojave: "2acd0666bf17c0e50b7324647dae8b46c2e35360e37e15733487d2c72e66aacf"
sha256 cellar: :any_skip_relocation, x86_64_linux: "8a045530b21c651ad2ac4c095e44179ff2c69ca9dd666ef4418e1e8ea75e6720"
end
depends_on "go" => :build
def install
system "go", "build", *std_go_args(ldflags: "-X main.VERSION=v#{version}")
end
test do
repo_url = "https://github.com/gruntwork-io/fetch"
assert_match "Downloading release asset SHA256SUMS to SHA256SUMS",
shell_output("#{bin}/fetch --repo=\"#{repo_url}\" --tag=\"v0.3.10\" --release-asset=\"SHA256SUMS\" . 2>&1")
end
end
| 51.4375 | 123 | 0.776428 |
21d5741ae86989069cbc9299a7d63f98d90a6d9a | 26,989 | require 'active_merchant/billing/gateways/braintree/braintree_common'
begin
require 'braintree'
rescue LoadError
raise 'Could not load the braintree gem. Use `gem install braintree` to install it.'
end
unless Braintree::Version::Major == 2 && Braintree::Version::Minor >= 78
raise "Need braintree gem >= 2.78.0. Run `gem install braintree --version '~>2.78'` to get the correct version."
end
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# For more information on the Braintree Gateway please visit their
# {Developer Portal}[https://www.braintreepayments.com/developers]
#
# ==== About this implementation
#
# This implementation leverages the Braintree-authored ruby gem:
# https://github.com/braintree/braintree_ruby
#
# ==== Debugging Information
#
# Setting an ActiveMerchant +wiredump_device+ will automatically
# configure the Braintree logger (via the Braintree gem's
# configuration) when the BraintreeBlueGateway is instantiated.
# Additionally, the log level will be set to +DEBUG+. Therefore,
# all you have to do is set the +wiredump_device+ and you'll get
# your debug output from your HTTP interactions with the remote
# gateway. (Don't enable this in production.) The ActiveMerchant
# implementation doesn't mess with the Braintree::Configuration
# globals at all, so there won't be any side effects outside
# Active Merchant.
#
# If no +wiredump_device+ is set, the logger in
# +Braintree::Configuration.logger+ will be cloned and the log
# level set to +WARN+.
#
class BraintreeBlueGateway < Gateway
include BraintreeCommon
include Empty
self.display_name = 'Braintree (Blue Platform)'
ERROR_CODES = {
cannot_refund_if_unsettled: 91506
}
def initialize(options = {})
requires!(options, :merchant_id, :public_key, :private_key)
@merchant_account_id = options[:merchant_account_id]
super
if wiredump_device.present?
logger = (Logger === wiredump_device ? wiredump_device : Logger.new(wiredump_device))
logger.level = Logger::DEBUG
else
logger = Braintree::Configuration.logger.clone
logger.level = Logger::WARN
end
@configuration = Braintree::Configuration.new(
:merchant_id => options[:merchant_id],
:public_key => options[:public_key],
:private_key => options[:private_key],
:environment => (options[:environment] || (test? ? :sandbox : :production)).to_sym,
:custom_user_agent => "ActiveMerchant #{ActiveMerchant::VERSION}",
:logger => options[:logger] || logger
)
@braintree_gateway = Braintree::Gateway.new(@configuration)
end
def authorize(money, credit_card_or_vault_id, options = {})
create_transaction(:sale, money, credit_card_or_vault_id, options)
end
def capture(money, authorization, options = {})
commit do
result = @braintree_gateway.transaction.submit_for_settlement(authorization, localized_amount(money, options[:currency] || default_currency).to_s)
response_from_result(result)
end
end
def purchase(money, credit_card_or_vault_id, options = {})
authorize(money, credit_card_or_vault_id, options.merge(:submit_for_settlement => true))
end
def credit(money, credit_card_or_vault_id, options = {})
create_transaction(:credit, money, credit_card_or_vault_id, options)
end
def refund(*args)
# legacy signature: #refund(transaction_id, options = {})
# new signature: #refund(money, transaction_id, options = {})
money, transaction_id, options = extract_refund_args(args)
money = localized_amount(money, options[:currency] || default_currency).to_s if money
commit do
response = response_from_result(@braintree_gateway.transaction.refund(transaction_id, money))
return response if response.success?
return response unless options[:force_full_refund_if_unsettled]
void(transaction_id) if response.message =~ /#{ERROR_CODES[:cannot_refund_if_unsettled]}/
end
end
def void(authorization, options = {})
commit do
response_from_result(@braintree_gateway.transaction.void(authorization))
end
end
def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
def store(creditcard, options = {})
if options[:customer].present?
MultiResponse.new.tap do |r|
customer_exists_response = nil
r.process { customer_exists_response = check_customer_exists(options[:customer]) }
r.process do
if customer_exists_response.params['exists']
add_credit_card_to_customer(creditcard, options)
else
add_customer_with_credit_card(creditcard, options)
end
end
end
else
add_customer_with_credit_card(creditcard, options)
end
end
def update(vault_id, creditcard, options = {})
braintree_credit_card = nil
commit do
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.nil?
options[:update_existing_token] = braintree_credit_card.token
credit_card_params = merge_credit_card_options({
:credit_card => {
:cardholder_name => creditcard.name,
:number => creditcard.number,
:cvv => creditcard.verification_value,
:expiration_month => creditcard.month.to_s.rjust(2, '0'),
:expiration_year => creditcard.year.to_s
}
}, options)[:credit_card]
result = @braintree_gateway.customer.update(vault_id,
:first_name => creditcard.first_name,
:last_name => creditcard.last_name,
:email => scrub_email(options[:email]),
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
options[:billing_address][:phone]),
:credit_card => credit_card_params
)
Response.new(result.success?, message_from_result(result),
:braintree_customer => (customer_hash(@braintree_gateway.customer.find(vault_id), :include_credit_cards) if result.success?),
:customer_vault_id => (result.customer.id if result.success?)
)
end
end
def unstore(customer_vault_id, options = {})
commit do
if(!customer_vault_id && options[:credit_card_token])
@braintree_gateway.credit_card.delete(options[:credit_card_token])
else
@braintree_gateway.customer.delete(customer_vault_id)
end
Response.new(true, 'OK')
end
end
alias_method :delete, :unstore
def supports_network_tokenization?
true
end
def verify_credentials
begin
@braintree_gateway.transaction.find('non_existent_token')
rescue Braintree::AuthenticationError
return false
rescue Braintree::NotFoundError
return true
end
true
end
private
def check_customer_exists(customer_vault_id)
commit do
begin
@braintree_gateway.customer.find(customer_vault_id)
ActiveMerchant::Billing::Response.new(true, 'Customer found', {exists: true}, authorization: customer_vault_id)
rescue Braintree::NotFoundError
ActiveMerchant::Billing::Response.new(true, 'Customer not found', {exists: false})
end
end
end
def add_customer_with_credit_card(creditcard, options)
commit do
if options[:payment_method_nonce]
credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
else
credit_card_params = {
:credit_card => {
:cardholder_name => creditcard.name,
:number => creditcard.number,
:cvv => creditcard.verification_value,
:expiration_month => creditcard.month.to_s.rjust(2, '0'),
:expiration_year => creditcard.year.to_s,
:token => options[:credit_card_token]
}
}
end
parameters = {
:first_name => creditcard.first_name,
:last_name => creditcard.last_name,
:email => scrub_email(options[:email]),
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
options[:billing_address][:phone]),
:id => options[:customer],
:device_data => options[:device_data],
}.merge credit_card_params
result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
Response.new(result.success?, message_from_result(result),
{
:braintree_customer => (customer_hash(result.customer, :include_credit_cards) if result.success?),
:customer_vault_id => (result.customer.id if result.success?),
:credit_card_token => (result.customer.credit_cards[0].token if result.success?)
},
:authorization => (result.customer.id if result.success?)
)
end
end
def add_credit_card_to_customer(credit_card, options)
commit do
parameters = {
customer_id: options[:customer],
token: options[:credit_card_token],
cardholder_name: credit_card.name,
number: credit_card.number,
cvv: credit_card.verification_value,
expiration_month: credit_card.month.to_s.rjust(2, '0'),
expiration_year: credit_card.year.to_s,
device_data: options[:device_data],
}
if options[:billing_address]
address = map_address(options[:billing_address])
parameters[:credit_card][:billing_address] = address unless address.all? { |_k, v| empty?(v) }
end
result = @braintree_gateway.credit_card.create(parameters)
ActiveMerchant::Billing::Response.new(
result.success?,
message_from_result(result),
{
customer_vault_id: (result.credit_card.customer_id if result.success?),
credit_card_token: (result.credit_card.token if result.success?)
},
authorization: (result.credit_card.customer_id if result.success?)
)
end
end
def scrub_email(email)
return nil unless email.present?
return nil if
email !~ /^.+@[^\.]+(\.[^\.]+)+[a-z]$/i ||
email =~ /\.(con|met)$/i
email
end
def scrub_zip(zip)
return nil unless zip.present?
return nil if(
zip.gsub(/[^a-z0-9]/i, '').length > 9 ||
zip =~ /[^a-z0-9\- ]/i
)
zip
end
def merge_credit_card_options(parameters, options)
valid_options = {}
options.each do |key, value|
valid_options[key] = value if [:update_existing_token, :verify_card, :verification_merchant_account_id].include?(key)
end
if valid_options.include?(:verify_card) && @merchant_account_id
valid_options[:verification_merchant_account_id] ||= @merchant_account_id
end
parameters[:credit_card] ||= {}
parameters[:credit_card][:options] = valid_options
if options[:billing_address]
address = map_address(options[:billing_address])
parameters[:credit_card][:billing_address] = address unless address.all? { |_k, v| empty?(v) }
end
parameters
end
def map_address(address)
mapped = {
:street_address => address[:address1],
:extended_address => address[:address2],
:company => address[:company],
:locality => address[:city],
:region => address[:state],
:postal_code => scrub_zip(address[:zip]),
}
mapped[:country_code_alpha2] = (address[:country] || address[:country_code_alpha2]) if address[:country] || address[:country_code_alpha2]
mapped[:country_name] = address[:country_name] if address[:country_name]
mapped[:country_code_alpha3] = address[:country_code_alpha3] if address[:country_code_alpha3]
unless address[:country].blank?
mapped[:country_code_alpha3] ||= Country.find(address[:country]).code(:alpha3).value
end
mapped[:country_code_numeric] = address[:country_code_numeric] if address[:country_code_numeric]
mapped
end
def commit(&block)
yield
rescue Braintree::BraintreeError => ex
Response.new(false, ex.class.to_s)
end
def message_from_result(result)
if result.success?
'OK'
elsif result.errors.any?
result.errors.map { |e| "#{e.message} (#{e.code})" }.join(' ')
elsif result.credit_card_verification
"Processor declined: #{result.credit_card_verification.processor_response_text} (#{result.credit_card_verification.processor_response_code})"
else
result.message.to_s
end
end
def response_from_result(result)
response_hash = { braintree_transaction: transaction_hash(result) }
Response.new(
result.success?,
message_from_result(result),
response_hash,
authorization: result.transaction&.id,
test: test?
)
end
def response_params(result)
params = {}
params[:customer_vault_id] = result.transaction.customer_details.id if result.success?
params[:braintree_transaction] = transaction_hash(result)
params
end
def response_options(result)
options = {}
if result.transaction
options[:authorization] = result.transaction.id
options[:avs_result] = { code: avs_code_from(result.transaction) }
options[:cvv_result] = result.transaction.cvv_response_code
end
options[:test] = test?
options
end
def avs_code_from(transaction)
transaction.avs_error_response_code ||
avs_mapping["street: #{transaction.avs_street_address_response_code}, zip: #{transaction.avs_postal_code_response_code}"]
end
def avs_mapping
{
'street: M, zip: M' => 'M',
'street: M, zip: N' => 'A',
'street: M, zip: U' => 'B',
'street: M, zip: I' => 'B',
'street: M, zip: A' => 'B',
'street: N, zip: M' => 'Z',
'street: N, zip: N' => 'C',
'street: N, zip: U' => 'C',
'street: N, zip: I' => 'C',
'street: N, zip: A' => 'C',
'street: U, zip: M' => 'P',
'street: U, zip: N' => 'N',
'street: U, zip: U' => 'I',
'street: U, zip: I' => 'I',
'street: U, zip: A' => 'I',
'street: I, zip: M' => 'P',
'street: I, zip: N' => 'C',
'street: I, zip: U' => 'I',
'street: I, zip: I' => 'I',
'street: I, zip: A' => 'I',
'street: A, zip: M' => 'P',
'street: A, zip: N' => 'C',
'street: A, zip: U' => 'I',
'street: A, zip: I' => 'I',
'street: A, zip: A' => 'I'
}
end
def message_from_transaction_result(result)
if result.transaction && result.transaction.status == 'gateway_rejected'
'Transaction declined - gateway rejected'
elsif result.transaction
"#{result.transaction.processor_response_code} #{result.transaction.processor_response_text}"
else
message_from_result(result)
end
end
def response_code_from_result(result)
if result.transaction
result.transaction.processor_response_code
elsif result.errors.size == 0 && result.credit_card_verification
result.credit_card_verification.processor_response_code
elsif result.errors.size > 0
result.errors.first.code
end
end
def create_transaction(transaction_type, money, credit_card_or_vault_id, options)
transaction_params = create_transaction_parameters(money, credit_card_or_vault_id, options)
commit do
result = @braintree_gateway.transaction.send(transaction_type, transaction_params)
response = Response.new(result.success?, message_from_transaction_result(result), response_params(result), response_options(result))
response.cvv_result['message'] = ''
response
end
end
def extract_refund_args(args)
options = args.extract_options!
# money, transaction_id, options
if args.length == 1 # legacy signature
return nil, args[0], options
elsif args.length == 2
return args[0], args[1], options
else
raise ArgumentError, "wrong number of arguments (#{args.length} for 2)"
end
end
def customer_hash(customer, include_credit_cards=false)
hash = {
'email' => customer.email,
'phone' => customer.phone,
'first_name' => customer.first_name,
'last_name' => customer.last_name,
'id' => customer.id
}
if include_credit_cards
hash['credit_cards'] = customer.credit_cards.map do |cc|
{
'bin' => cc.bin,
'expiration_date' => cc.expiration_date,
'token' => cc.token,
'last_4' => cc.last_4,
'card_type' => cc.card_type,
'masked_number' => cc.masked_number
}
end
end
hash
end
def transaction_hash(result)
unless result.success?
return { 'processor_response_code' => response_code_from_result(result) }
end
transaction = result.transaction
if transaction.vault_customer
vault_customer = {
}
vault_customer['credit_cards'] = transaction.vault_customer.credit_cards.map do |cc|
{
'bin' => cc.bin
}
end
else
vault_customer = nil
end
customer_details = {
'id' => transaction.customer_details.id,
'email' => transaction.customer_details.email,
'phone' => transaction.customer_details.phone,
}
billing_details = {
'street_address' => transaction.billing_details.street_address,
'extended_address' => transaction.billing_details.extended_address,
'company' => transaction.billing_details.company,
'locality' => transaction.billing_details.locality,
'region' => transaction.billing_details.region,
'postal_code' => transaction.billing_details.postal_code,
'country_name' => transaction.billing_details.country_name,
}
shipping_details = {
'street_address' => transaction.shipping_details.street_address,
'extended_address' => transaction.shipping_details.extended_address,
'company' => transaction.shipping_details.company,
'locality' => transaction.shipping_details.locality,
'region' => transaction.shipping_details.region,
'postal_code' => transaction.shipping_details.postal_code,
'country_name' => transaction.shipping_details.country_name,
}
credit_card_details = {
'masked_number' => transaction.credit_card_details.masked_number,
'bin' => transaction.credit_card_details.bin,
'last_4' => transaction.credit_card_details.last_4,
'card_type' => transaction.credit_card_details.card_type,
'token' => transaction.credit_card_details.token
}
{
'order_id' => transaction.order_id,
'amount' => transaction.amount.to_s,
'status' => transaction.status,
'credit_card_details' => credit_card_details,
'customer_details' => customer_details,
'billing_details' => billing_details,
'shipping_details' => shipping_details,
'vault_customer' => vault_customer,
'merchant_account_id' => transaction.merchant_account_id,
'processor_response_code' => response_code_from_result(result)
}
end
def create_transaction_parameters(money, credit_card_or_vault_id, options)
parameters = {
:amount => localized_amount(money, options[:currency] || default_currency).to_s,
:order_id => options[:order_id],
:customer => {
:id => options[:store] == true ? '' : options[:store],
:email => scrub_email(options[:email]),
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
options[:billing_address][:phone])
},
:options => {
:store_in_vault => options[:store] ? true : false,
:submit_for_settlement => options[:submit_for_settlement],
:hold_in_escrow => options[:hold_in_escrow],
}
}
if options[:skip_advanced_fraud_checking]
parameters[:options][:skip_advanced_fraud_checking] = options[:skip_advanced_fraud_checking]
end
parameters[:custom_fields] = options[:custom_fields]
parameters[:device_data] = options[:device_data] if options[:device_data]
parameters[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
if merchant_account_id = (options[:merchant_account_id] || @merchant_account_id)
parameters[:merchant_account_id] = merchant_account_id
end
if options[:transaction_source]
parameters[:transaction_source] = options[:transaction_source]
elsif options[:recurring]
parameters[:recurring] = true
end
add_payment_method(parameters, credit_card_or_vault_id, options)
parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
channel = @options[:channel] || application_id
parameters[:channel] = channel if channel
if options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
parameters[:descriptor] = {
name: options[:descriptor_name],
phone: options[:descriptor_phone],
url: options[:descriptor_url]
}
end
if options[:three_d_secure]
parameters[:three_d_secure_pass_thru] = {
cavv: options[:three_d_secure][:cavv],
eci_flag: options[:three_d_secure][:eci],
xid: options[:three_d_secure][:xid],
}
end
parameters[:tax_amount] = options[:tax_amount] if options[:tax_amount]
parameters[:tax_exempt] = options[:tax_exempt] if options[:tax_exempt]
parameters[:purchase_order_number] = options[:purchase_order_number] if options[:purchase_order_number]
parameters[:shipping_amount] = options[:shipping_amount] if options[:shipping_amount]
parameters[:discount_amount] = options[:discount_amount] if options[:discount_amount]
parameters[:ships_from_postal_code] = options[:ships_from_postal_code] if options[:ships_from_postal_code]
parameters[:line_items] = options[:line_items] if options[:line_items]
parameters
end
def add_payment_method(parameters, credit_card_or_vault_id, options)
if credit_card_or_vault_id.is_a?(String) || credit_card_or_vault_id.is_a?(Integer)
if options[:payment_method_token]
parameters[:payment_method_token] = credit_card_or_vault_id
options.delete(:billing_address)
elsif options[:payment_method_nonce]
parameters[:payment_method_nonce] = credit_card_or_vault_id
else
parameters[:customer_id] = credit_card_or_vault_id
end
else
parameters[:customer].merge!(
:first_name => credit_card_or_vault_id.first_name,
:last_name => credit_card_or_vault_id.last_name
)
if credit_card_or_vault_id.is_a?(NetworkTokenizationCreditCard)
if credit_card_or_vault_id.source == :apple_pay
parameters[:apple_pay_card] = {
:number => credit_card_or_vault_id.number,
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
:expiration_year => credit_card_or_vault_id.year.to_s,
:cardholder_name => credit_card_or_vault_id.name,
:cryptogram => credit_card_or_vault_id.payment_cryptogram,
:eci_indicator => credit_card_or_vault_id.eci
}
elsif credit_card_or_vault_id.source == :android_pay || credit_card_or_vault_id.source == :google_pay
parameters[:android_pay_card] = {
:number => credit_card_or_vault_id.number,
:cryptogram => credit_card_or_vault_id.payment_cryptogram,
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
:expiration_year => credit_card_or_vault_id.year.to_s,
:google_transaction_id => credit_card_or_vault_id.transaction_id,
:source_card_type => credit_card_or_vault_id.brand,
:source_card_last_four => credit_card_or_vault_id.last_digits,
:eci_indicator => credit_card_or_vault_id.eci
}
end
else
parameters[:credit_card] = {
:number => credit_card_or_vault_id.number,
:cvv => credit_card_or_vault_id.verification_value,
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
:expiration_year => credit_card_or_vault_id.year.to_s,
:cardholder_name => credit_card_or_vault_id.name
}
end
end
end
end
end
end
| 39.573314 | 156 | 0.614547 |
e9d3770834ac6490cba051b42993820953ba6fe1 | 334 | Deface::Override.new(:virtual_path => "products/_cart_form",
:name => "converted_product_price_331970321",
:insert_after => "[data-hook='product_price'], #product_price[data-hook]",
:partial => "products/pricing",
:disabled => false)
| 55.666667 | 99 | 0.517964 |
7a7931a86583889448cfcacfcfb2002a610892cf | 145 | class RemoveSectionGroupsFromJourneys < ActiveRecord::Migration[6.1]
def change
remove_column :journeys, :section_groups, :jsonb
end
end
| 24.166667 | 68 | 0.786207 |
1ae5ab7d08e855427e2525eb77e59c52fcf541e5 | 4,410 | module CurationConcern
module Model
extend ActiveSupport::Autoload
extend ActiveSupport::Concern
included do
include Sufia::ModelMethods
include Hydra::ModelMethods
include Curate::ActiveModelAdaptor
#after_solrize << :index_collection_pids
has_many :collections, property: :has_collection_member, :class_name => "ActiveFedora::Base"
include Solrizer::Common
include CurationConcern::HumanReadableType
include CurationConcern::WithStandardizedMetadata
include CurationConcern::WithCollaborators
has_and_belongs_to_many :record_editors, class_name: "::Person", property: :has_editor
accepts_nested_attributes_for :record_editors, allow_destroy: true, reject_if: :all_blank
has_and_belongs_to_many :record_editor_groups, class_name: "::Hydramata::Group", property: :has_editor_group
accepts_nested_attributes_for :record_editor_groups, allow_destroy: true, reject_if: :all_blank
has_and_belongs_to_many :record_viewers, class_name: "::Person", property: :has_viewer
accepts_nested_attributes_for :record_viewers, allow_destroy: true, reject_if: :all_blank
has_and_belongs_to_many :record_viewer_groups, class_name: "::Hydramata::Group", property: :has_viewer_group
accepts_nested_attributes_for :record_viewer_groups, allow_destroy: true, reject_if: :all_blank
has_metadata 'properties', type: Curate::PropertiesDatastream
has_attributes :relative_path, :depositor, :owner, :representative, :license, :type_of_license, datastream: :properties, multiple: false
class_attribute :human_readable_short_description
end
def as_json(options)
{ pid: pid, title: title, model: self.class.to_s, curation_concern_type: human_readable_type }
end
def as_rdf_object
RDF::URI.new(internal_uri)
end
def to_solr(solr_doc={}, opts={})
super(solr_doc, opts)
index_collection_pids(solr_doc)
solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
solr_doc[Solrizer.solr_name('representative', :stored_searchable)] = self.representative
add_derived_date_created(solr_doc)
return solr_doc
end
def to_s
title
end
# Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object.
def to_partial_path
"curation_concern/#{super}"
end
def can_be_member_of_collection?(collection)
collection == self ? false : true
end
def index_collection_pids(solr_doc={})
solr_doc[Solrizer.solr_name(:collection, :facetable)] = self.collection_ids
solr_doc[Solrizer.solr_name(:collection)] = self.collection_ids
solr_doc
end
protected
# A single searchable/sortable date field that is derived from other (text) fields
def add_derived_date_created(solr_doc)
# The derived date is assigned based on a priority sequence of:
# Publication Date -> Date Issued -> Date Created
# This seems to be a global pattern for these fields across all models,
# so I'm putting this here. If this changes, then it may make sense to move
# this logic into the individual model's to_solr methods.
# See ticket DLTP-1258
derived_date = case true
when self.respond_to?(:publication_date)
parse_date(publication_date)
when self.respond_to?(:date_issued)
parse_date(date_issued)
when self.respond_to?(:date)
parse_date(date)
when self.respond_to?(:date_created)
parse_date(date_created)
end
self.class.create_and_insert_terms('date_created_derived', derived_date, [:stored_sortable], solr_doc)
end
def parse_date(source_date)
Curate::DateFormatter.parse(source_date.to_s) unless source_date.blank?
end
def index_collection_pids(solr_doc)
solr_doc[Solrizer.solr_name(:collection, :facetable)] ||= []
solr_doc[Solrizer.solr_name(:collection)] ||= []
self.collection_ids.each do |collection_id|
collection_obj = ActiveFedora::Base.load_instance_from_solr(collection_id)
if collection_obj.is_a?(Collection)
solr_doc[Solrizer.solr_name(:collection, :facetable)] << collection_id
solr_doc[Solrizer.solr_name(:collection)] << collection_id
end
end
solr_doc
end
end
end
| 39.375 | 144 | 0.728118 |
08adbd848d0e40a9da6ede35983075feef283676 | 1,219 | require "spec_helper"
describe CacheHelper do
describe "#cache_keys_for_all" do
it "returns an array of cache keys" do
create(:project)
create(:category)
expect(helper).to receive(:current_subdomain).
and_return("some_subdomain").twice
expect(helper.cache_keys_for_all(:projects, :categories).size).to eq(2)
end
end
describe "#cache_key_for_current_user" do
it "returns a different key for the current_user" do
current_user = build(:user)
other_user = build(:user)
yet_another_user = build(:user)
entry = build(:hour, user: current_user)
expect(helper).to receive(:current_user).and_return(current_user)
current_users_cache_key = helper.cache_key_for_current_user(entry)
expect(helper).to receive(:current_user).and_return(other_user)
other_users_cache_key = helper.cache_key_for_current_user(entry)
expect(helper).to receive(:current_user).and_return(yet_another_user)
yet_another_users_cache_key = helper.cache_key_for_current_user(entry)
expect(current_users_cache_key).to_not eq(other_users_cache_key)
expect(yet_another_users_cache_key).to eq(other_users_cache_key)
end
end
end
| 32.945946 | 77 | 0.73831 |
d5c136e79c4fd4a17495a4cbf975b663f3aaad26 | 1,398 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150414102734) do
create_table "answers", force: true do |t|
t.integer "order"
t.text "answer_text"
t.boolean "correct_answer"
t.integer "question_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "questions", force: true do |t|
t.integer "order"
t.text "question_text"
t.integer "quiz_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "quizzes", force: true do |t|
t.string "name"
t.text "description"
t.date "quiz_date"
t.datetime "created_at"
t.datetime "updated_at"
end
end
| 33.285714 | 86 | 0.722461 |
03939b25651c5206a6c9657a34956cc7997f6567 | 1,357 | require 'rake'
require 'rake/clean'
namespace(:dependencies) do
namespace(:glib) do
# glib needs mingw and downloads
package = Shoes::Glib
directory package.target
CLEAN.include(package.target)
# Put files for the :download task
dt = checkpoint(:glib, :download)
package.files.each do |f|
file_source = "#{package.url}/#{f}"
file_target = "downloads/#{f}"
download file_target => file_source
# depend on downloads directory
file file_target => "downloads"
# download task need these files as pre-requisites
dt.enhance [file_target]
end
task :download => dt
# Prepare the :sandbox, it requires the :download task
et = checkpoint(:glib, :extract) do
dt.prerequisites.each { |f|
extract(File.join(RubyInstaller::ROOT, f), package.target)
}
end
task :extract => [:extract_utils, :download, package.target, et]
# glib needs some relocation of files ??
pt = checkpoint(:glib, :prepare) do
# no op
end
task :prepare => [:extract, pt]
task :activate => [:prepare] do
puts "Activating glib version #{package.version}"
activate(package.target)
end
end
end
task :glib => [
'dependencies:glib:download',
'dependencies:glib:extract',
'dependencies:glib:prepare',
'dependencies:glib:activate'
]
| 25.603774 | 68 | 0.649226 |
1c446ab1da1bae595f29473203f687d6e1a8657a | 1,319 | require 'rails_helper'
RSpec.describe EventsController, type: :controller do
describe 'GET #index' do
it 'response 200 when visiting' do
get :index
expect(response).to have_http_status(200)
end
it 'renders index.html template' do
get :index
expect(response).to render_template(:index)
end
it 'loads all upcoming event into @events' do
event1 = Event.new(starts_at_date: 1.day.from_now, starts_at_hour: '10', starts_at_minute: '30')
event2 = Event.new(starts_at_date: 1.day.ago, starts_at_hour: '10', starts_at_minute: '30')
event1.save(validate: false)
event2.save(validate: false)
get :index
expect(assigns(:events)).to match_array([event1])
end
end
describe 'GET #show' do
it 'response 200 when visiting' do
event = Event.new
event.save(validate: false)
get :show, id: event.id
expect(response).to have_http_status(200)
end
it 'assigns the requested event to @event' do
event = Event.new
event.save(validate: false)
get :show, id: event.id
assigns(:event).should eq(event)
end
it 'renders the #show view' do
event = Event.new
event.save(validate: false)
get :show, id: event.id
response.should render_template :show
end
end
end
| 30.674419 | 102 | 0.658074 |
0189b8255916e0484c24ef80f54a22f2fe321cbc | 393 | class CreateNotifications < ActiveRecord::Migration[5.2]
def change
create_table :notifications do |t|
t.references :apartment, index: true, foreign_key: true, null: false
t.references :user, index: true, foreign_key: true
t.string :title, null: false
t.string :message, null: false
t.timestamps
end
add_index :notifications, :created_at
end
end
| 28.071429 | 74 | 0.692112 |
111e609e1ef650a0f0bcc5cf6d163107ef4b8d50 | 1,734 | # coding: utf-8
#
# Be sure to run `pod lib lint SDGPostMan.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouragedSDGPostMan
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'SDGPostMan'
s.version = "0.0.5"
s.summary = 'A short description of SDGPostMan.'
# 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 = 'http://gitlab.51xianqu.com/xq_ios/sdgpostman'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '[email protected]' => '[email protected]' }
s.source = { :git => '[email protected]:xq_ios/sdgpostman.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'SDGPostMan/Classes/**/*'
# s.resource_bundles = {
# 'SDGPostMan' => ['SDGPostMan/Assets/*']
# }
s.prefix_header_contents = <<-EOS
#ifdef __OBJC__
#import "SDGPostMan.h"
#endif
EOS
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 35.387755 | 106 | 0.647059 |
1dd56d1cb4716246e5454c757dd462b58c7a8713 | 42 | module NxtSchema
module Node
end
end
| 7 | 16 | 0.738095 |
01c77dedbbf6b9ec2cb87dd6050215d90af20727 | 3,133 | # This migration comes from gatherin_auth (originally 20191225033339)
class CreateDoorkeeperTables < ActiveRecord::Migration[6.0]
def change
create_table :oauth_applications do |t|
t.string :name, null: false
t.string :uid, null: false
t.string :secret, null: false
# Remove `null: false` if you are planning to use grant flows
# that doesn't require redirect URI to be used during authorization
# like Client Credentials flow or Resource Owner Password.
t.text :redirect_uri, null: false
t.string :scopes, null: false, default: ''
t.boolean :confidential, null: false, default: true
t.timestamps null: false
end
add_index :oauth_applications, :uid, unique: true
create_table :oauth_access_grants do |t|
t.references :resource_owner, null: false
t.references :application, null: false
t.string :token, null: false
t.integer :expires_in, null: false
t.text :redirect_uri, null: false
t.datetime :created_at, null: false
t.datetime :revoked_at
t.string :scopes, null: false, default: ''
end
add_index :oauth_access_grants, :token, unique: true
add_foreign_key(
:oauth_access_grants,
:oauth_applications,
column: :application_id
)
create_table :oauth_access_tokens do |t|
t.references :resource_owner, index: true
# Remove `null: false` if you are planning to use Password
# Credentials Grant flow that doesn't require an application.
t.references :application, null: false
# If you use a custom token generator you may need to change this column
# from string to text, so that it accepts tokens larger than 255
# characters. More info on custom token generators in:
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
#
# t.text :token, null: false
t.string :token, null: false
t.string :refresh_token
t.integer :expires_in
t.datetime :revoked_at
t.datetime :created_at, null: false
t.string :scopes
# If there is a previous_refresh_token column,
# refresh tokens will be revoked after a related access token is used.
# If there is no previous_refresh_token column,
# previous tokens are revoked as soon as a new access token is created.
# Comment out this line if you'd rather have refresh tokens
# instantly revoked.
t.string :previous_refresh_token, null: false, default: ""
end
add_index :oauth_access_tokens, :token, unique: true
add_index :oauth_access_tokens, :refresh_token, unique: true
add_foreign_key(
:oauth_access_tokens,
:oauth_applications,
column: :application_id
)
# Uncomment below to ensure a valid reference to the resource owner's table
add_foreign_key :oauth_access_grants, :gatherin_users, column: :resource_owner_id
add_foreign_key :oauth_access_tokens, :gatherin_users, column: :resource_owner_id
end
end
| 38.679012 | 98 | 0.675391 |
62628daf24da4c2683b053130793bb3205e4fd35 | 1,695 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::SlashCommands::IssueShow do
describe '#execute' do
let(:issue) { create(:issue, project: project) }
let(:project) { create(:project) }
let(:user) { issue.author }
let(:chat_name) { double(:chat_name, user: user) }
let(:regex_match) { described_class.match("issue show #{issue.iid}") }
before do
project.add_maintainer(user)
end
subject do
described_class.new(project, chat_name).execute(regex_match)
end
context 'the issue exists' do
let(:title) { subject[:attachments].first[:title] }
it 'returns the issue' do
expect(subject[:response_type]).to be(:in_channel)
expect(title).to start_with(issue.title)
end
context 'when its reference is given' do
let(:regex_match) { described_class.match("issue show #{issue.to_reference}") }
it 'shows the issue' do
expect(subject[:response_type]).to be(:in_channel)
expect(title).to start_with(issue.title)
end
end
end
context 'the issue does not exist' do
let(:regex_match) { described_class.match("issue show 2343242") }
it "returns not found" do
expect(subject[:response_type]).to be(:ephemeral)
expect(subject[:text]).to match("not found")
end
end
end
describe '.match' do
it 'matches the iid' do
match = described_class.match("issue show 123")
expect(match[:iid]).to eq("123")
end
it 'accepts a reference' do
match = described_class.match("issue show #{Issue.reference_prefix}123")
expect(match[:iid]).to eq("123")
end
end
end
| 26.904762 | 87 | 0.641888 |
26fbeb5445bb4fd93b1fab82a57a2ab421548fde | 1,565 | # frozen_string_literal: true
# Copyright (c) 2018 Robert Haines.
#
# 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.
##
module CFF
# Util provides utility methods useful throughout the rest of the CFF library.
#
# Util does not provide any methods or fields for the public API.
module Util
# :stopdoc:
def method_to_field(name)
name.tr('_', '-')
end
def build_actor_collection!(source)
source.map! do |s|
s.has_key?('given-names') ? Person.new(s) : Entity.new(s)
end
end
def normalize_modelpart_array!(array)
array.select! { |i| i.respond_to?(:fields) }
end
def fields_to_hash(fields)
hash = {}
fields.each do |field, value|
if value.respond_to?(:map)
unless value.empty?
hash[field] = value.map do |v|
v.respond_to?(:fields) ? v.fields : v.to_s
end
end
else
hash[field] = value.respond_to?(:fields) ? value.fields : value
end
end
hash
end
# :startdoc:
end
end
| 25.655738 | 80 | 0.644728 |
385e0fa4f7e0737a18e7442d7df88857d1562b1e | 2,423 | # frozen_string_literal: true
module QA
module Resource
##
# Ensure we're in our sandbox namespace, either by navigating to it or by
# creating it if it doesn't yet exist.
#
class Sandbox < GroupBase
class << self
# Force top level group creation via UI if test is executed on dot_com environment
def fabricate!(*args, &prepare_block)
return fabricate_via_browser_ui!(*args, &prepare_block) if Specs::Helpers::ContextSelector.dot_com?
fabricate_via_api!(*args, &prepare_block)
rescue NotImplementedError
fabricate_via_browser_ui!(*args, &prepare_block)
end
end
def initialize
@path = Runtime::Namespace.sandbox_name
end
alias_method :full_path, :path
def fabricate!
Flow::Login.sign_in_unless_signed_in
Page::Main::Menu.perform(&:go_to_groups)
Page::Dashboard::Groups.perform do |groups_page|
if groups_page.has_group?(path)
groups_page.click_group(path)
else
groups_page.click_new_group
Page::Group::New.perform do |group|
group.click_create_group
group.set_path(path)
group.set_visibility('Public')
group.create
end
@id = Page::Group::Show.perform(&:group_id)
end
end
end
def fabricate_via_api!
resource_web_url(api_get)
rescue ResourceNotFoundError
super
# If the group was just created the runners token might not be
# available via the API immediately.
Support::Retrier.retry_on_exception(sleep_interval: 5) do
resource = resource_web_url(api_get)
populate(:runners_token)
resource
end
end
def api_get_path
"/groups/#{path}"
end
def api_post_body
{
path: path,
name: path,
visibility: 'public'
}
end
def update_group_setting(group_setting:, value:)
response = put(Runtime::API::Request.new(api_client, api_put_path).url, { "#{group_setting}": value })
return if response.code == HTTP_STATUS_OK
raise(
ResourceUpdateFailedError,
"Could not update #{group_setting} to #{value}. Request returned (#{response.code}): `#{response}`."
)
end
end
end
end
| 27.534091 | 110 | 0.605861 |
614eae5320a8fc6d883ab922d96d16a9a7ff0d2e | 911 | require 'spec_helper_acceptance'
describe 'unique function' do
describe 'success' do
pp1 = <<-DOC
$a = ["wallless", "wallless", "brrr", "goddessship"]
$o = unique($a)
notice(inline_template('unique is <%= @o.inspect %>'))
DOC
it 'uniques arrays' do
apply_manifest(pp1, :catch_failures => true) do |r|
expect(r.stdout).to match(%r{unique is \["wallless", "brrr", "goddessship"\]})
end
end
pp2 = <<-DOC
$a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
$o = unique($a)
notice(inline_template('unique is <%= @o.inspect %>'))
DOC
it 'uniques strings' do
apply_manifest(pp2, :catch_failures => true) do |r|
expect(r.stdout).to match(%r{unique is "wales prohytingcmbd"})
end
end
end
describe 'failure' do
it 'handles no arguments'
it 'handles non strings or arrays'
end
end
| 28.46875 | 86 | 0.616905 |
f8b44e177ae99f3b5433865060f14fcb585e09de | 6,061 | # == Schema Information
#
# Table name: builds
#
# id :integer not null, primary key
# project_id :integer
# ref :string(255)
# status :string(255)
# finished_at :datetime
# trace :text
# created_at :datetime
# updated_at :datetime
# sha :string(255)
# started_at :datetime
# tmp_file :string(255)
# before_sha :string(255)
# push_data :text
# runner_id :integer
# coverage :float
# commit_id :integer
# commands :text
# job_id :integer
#
require 'spec_helper'
describe Build do
let(:project) { FactoryGirl.create :project }
let(:commit) { FactoryGirl.create :commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit }
it { should belong_to(:commit) }
it { should validate_presence_of :status }
it { should respond_to :success? }
it { should respond_to :failed? }
it { should respond_to :running? }
it { should respond_to :pending? }
it { should respond_to :trace_html }
it { should allow_mass_assignment_of(:commit_id) }
it { should allow_mass_assignment_of(:status) }
it { should allow_mass_assignment_of(:started_at) }
it { should allow_mass_assignment_of(:finished_at) }
it { should allow_mass_assignment_of(:trace) }
it { should allow_mass_assignment_of(:runner_id) }
describe :first_pending do
let(:first) { FactoryGirl.create :build, commit: commit, status: 'pending', created_at: Date.yesterday }
let(:second) { FactoryGirl.create :build, commit: commit, status: 'pending' }
before { first; second }
subject { Build.first_pending }
it { should be_a(Build) }
it('returns with the first pending build') { should eq(first) }
end
describe :create_from do
before do
build.status = 'success'
build.save
end
let(:create_from_build) { Build.create_from build }
it ('there should be a pending task') do
Build.pending.count.should eq(0)
create_from_build
Build.pending.count.should > 0
end
end
describe :started? do
subject { build.started? }
context 'without started_at' do
before { build.started_at = nil }
it { should be_false }
end
%w(running success failed).each do |status|
context "if build status is #{status}" do
before { build.status = status }
it { should be_true }
end
end
%w(pending canceled).each do |status|
context "if build status is #{status}" do
before { build.status = status }
it { should be_false }
end
end
end
describe :active? do
subject { build.active? }
%w(pending running).each do |state|
context "if build.status is #{state}" do
before { build.status = state }
it { should be_true }
end
end
%w(success failed canceled).each do |state|
context "if build.status is #{state}" do
before { build.status = state }
it { should be_false }
end
end
end
describe :complete? do
subject { build.complete? }
%w(success failed canceled).each do |state|
context "if build.status is #{state}" do
before { build.status = state }
it { should be_true }
end
end
%w(pending running).each do |state|
context "if build.status is #{state}" do
before { build.status = state }
it { should be_false }
end
end
end
describe :trace do
subject { build.trace_html }
it { should be_empty }
context 'if build.trace contains text' do
let(:text) { 'example output' }
before { build.trace = text }
it { should include(text) }
it { should have_at_least(text.length).items }
end
end
describe :timeout do
subject { build.timeout }
it { should eq(commit.project.timeout) }
end
describe :duration do
subject { build.duration }
it { should eq(120.0) }
context 'if the building process has not started yet' do
before do
build.started_at = nil
build.finished_at = nil
end
it { should be_nil }
end
context 'if the building process has started' do
before do
build.started_at = Time.now - 1.minute
build.finished_at = nil
end
it { should be_a(Float) }
it { should > 0.0 }
end
end
describe :ref do
subject { build.ref }
it { should eq(commit.ref) }
end
describe :sha do
subject { build.sha }
it { should eq(commit.sha) }
end
describe :short_sha do
subject { build.short_sha }
it { should eq(commit.short_sha) }
end
describe :before_sha do
subject { build.before_sha }
it { should eq(commit.before_sha) }
end
describe :allow_git_fetch do
subject { build.allow_git_fetch }
it { should eq(project.allow_git_fetch) }
end
describe :project do
subject { build.project }
it { should eq(commit.project) }
end
describe :project_id do
subject { build.project_id }
it { should eq(commit.project_id) }
end
describe :project_name do
subject { build.project_name }
it { should eq(project.name) }
end
describe :repo_url do
subject { build.repo_url }
it { should eq(project.repo_url_with_auth) }
end
describe :extract_coverage do
context 'valid content & regex' do
subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', '\(\d+.\d+\%\) covered') }
it { should eq(98.29) }
end
context 'valid content & bad regex' do
subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', 'very covered') }
it { should be_nil }
end
context 'no coverage content & regex' do
subject { build.extract_coverage('No coverage for today :sad:', '\(\d+.\d+\%\) covered') }
it { should be_nil }
end
context 'multiple results in content & regex' do
subject { build.extract_coverage(' (98.39%) covered. (98.29%) covered', '\(\d+.\d+\%\) covered') }
it { should eq(98.29) }
end
end
end
| 23.045627 | 110 | 0.626629 |
183a6a4f6920cd3e0544e0df4b3f98e5e02740e6 | 12,587 | require_relative '../../../../environments/rspec_env'
RSpec.describe CukeLinter do
let(:test_model_tree) { generate_lintable_model }
let(:test_linters) { [generate_fake_linter] }
let(:test_formatters) { [[generate_fake_formatter, "#{create_directory}/junk_output_file.txt"]] }
let(:linting_options) { { model_trees: [test_model_tree], linters: test_linters, formatters: test_formatters } }
it 'returns the un-formatted linting data when linting' do
results = subject.lint(linting_options)
expect(results).to eq([{ linter: 'FakeLinter', location: 'path_to_file:1', problem: 'FakeLinter problem' }])
end
it 'uses every formatter provided' do
linting_options[:formatters] = [[generate_fake_formatter(name: 'Formatter1')],
[generate_fake_formatter(name: 'Formatter2')]]
expect { subject.lint(linting_options) }.to output("Formatter1: FakeLinter problem: path_to_file:1\nFormatter2: FakeLinter problem: path_to_file:1\n").to_stdout # rubocop:disable Metrics/LineLength
end
it "uses the 'pretty' formatter if none are provided" do
linting_options.delete(:formatters)
expect { subject.lint(linting_options) }.to output(['FakeLinter',
' FakeLinter problem',
' path_to_file:1',
'',
'1 issues found',
''].join("\n")).to_stdout
end
it 'outputs formatted linting data to the provided output location' do
output_path = "#{create_directory}/output.txt"
linting_options[:formatters] = [[generate_fake_formatter(name: 'Formatter1'),
output_path]]
expect { subject.lint(linting_options) }.to_not output.to_stdout
expect(File.read(output_path)).to eq("Formatter1: FakeLinter problem: path_to_file:1\n")
end
it 'outputs formatted data to STDOUT if not location is provided' do
linting_options[:formatters] = [[generate_fake_formatter(name: 'Formatter1')]]
expect { subject.lint(linting_options) }.to output("Formatter1: FakeLinter problem: path_to_file:1\n").to_stdout
end
context 'with only model trees' do
before(:each) do
child_model = generate_lintable_model(source_line: 3)
parent_model = generate_lintable_model(source_line: 5, children: [child_model])
multi_node_tree = parent_model
single_node_tree = generate_lintable_model(source_line: 7)
linting_options[:model_trees] = [single_node_tree, multi_node_tree]
linting_options.delete(:file_paths)
end
it 'lints every model in each model tree' do
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter',
location: 'path_to_file:3',
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: 'path_to_file:5',
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: 'path_to_file:7',
problem: 'FakeLinter problem' }])
end
end
context 'with only file paths' do
before(:each) do
@a_feature_file = create_file(text: "\nFeature:", extension: '.feature')
a_non_feature_file = create_file(text: 'Some text', extension: '.foo')
@a_directory = create_directory
File.write("#{@a_directory}/test_feature.feature", 'Feature:')
linting_options[:file_paths] = [@a_feature_file, a_non_feature_file, @a_directory]
linting_options.delete(:model_trees)
end
# TODO: add a negative test that makes sure that non-included paths
# aren't linted when paths are explicitly included
it 'lints every model in each path' do
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter',
location: @a_directory,
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: "#{@a_directory}/test_feature.feature",
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: "#{@a_directory}/test_feature.feature:1",
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: @a_feature_file,
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: "#{@a_feature_file}:2",
problem: 'FakeLinter problem' }])
end
end
context 'with both model trees and file paths' do
before(:each) do
a_model = generate_lintable_model(source_line: 3)
@a_feature_file = create_file(text: 'Feature:', extension: '.feature')
linting_options[:model_trees] = [a_model]
linting_options[:file_paths] = [@a_feature_file]
end
it 'lints every model in each model tree and file path' do
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter',
location: 'path_to_file:3',
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: @a_feature_file,
problem: 'FakeLinter problem' },
{ linter: 'FakeLinter',
location: "#{@a_feature_file}:1",
problem: 'FakeLinter problem' }])
end
end
context 'with neither model trees or file paths' do
before(:each) do
linting_options.delete(:model_trees)
linting_options.delete(:file_paths)
end
it 'models the current directory' do
test_dir = create_directory
File.write("#{test_dir}/test_feature.feature", 'Feature:')
Dir.chdir(test_dir) do
@results = subject.lint(linting_options)
end
# There should be 3 models to lint: the directory, the feature file, and the feature
expect(@results.count).to eq(3)
end
end
it 'uses evey linter provided' do
linting_options[:linters] = [generate_fake_linter(name: 'FakeLinter1'),
generate_fake_linter(name: 'FakeLinter2')]
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter1',
location: 'path_to_file:1',
problem: 'FakeLinter1 problem' },
{ linter: 'FakeLinter2',
location: 'path_to_file:1',
problem: 'FakeLinter2 problem' }])
end
it 'uses all registered linters if none are provided', :linter_registration do
CukeLinter.clear_registered_linters
CukeLinter.register_linter(linter: generate_fake_linter(name: 'FakeLinter1'), name: 'FakeLinter1')
CukeLinter.register_linter(linter: generate_fake_linter(name: 'FakeLinter2'), name: 'FakeLinter2')
CukeLinter.register_linter(linter: generate_fake_linter(name: 'FakeLinter3'), name: 'FakeLinter3')
begin
linting_options.delete(:linters)
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter1',
location: 'path_to_file:1',
problem: 'FakeLinter1 problem' },
{ linter: 'FakeLinter2',
location: 'path_to_file:1',
problem: 'FakeLinter2 problem' },
{ linter: 'FakeLinter3',
location: 'path_to_file:1',
problem: 'FakeLinter3 problem' }])
ensure
CukeLinter.reset_linters
end
end
it 'includes the name of the linter in the linting data' do
linting_options[:linters] = [generate_fake_linter(name: 'FakeLinter1'),
generate_fake_linter(name: 'FakeLinter2')]
results = subject.lint(linting_options)
expect(results).to match_array([{ linter: 'FakeLinter1',
location: 'path_to_file:1',
problem: 'FakeLinter1 problem' },
{ linter: 'FakeLinter2',
location: 'path_to_file:1',
problem: 'FakeLinter2 problem' }])
end
it 'has a default set of registered linters' do
subject.reset_linters
default_linter_classes = %w[BackgroundDoesMoreThanSetupLinter
ElementWithCommonTagsLinter
ElementWithDuplicateTagsLinter
ElementWithTooManyTagsLinter
ExampleWithoutNameLinter
FeatureFileWithInvalidNameLinter
FeatureFileWithMismatchedNameLinter
FeatureWithTooManyDifferentTagsLinter
FeatureWithoutDescriptionLinter
FeatureWithoutNameLinter
FeatureWithoutScenariosLinter
OutlineWithSingleExampleRowLinter
SingleTestBackgroundLinter
StepWithEndPeriodLinter
StepWithTooManyCharactersLinter
TestShouldUseBackgroundLinter
TestWithActionStepAsFinalStepLinter
TestWithBadNameLinter
TestWithNoActionStepLinter
TestWithNoNameLinter
TestWithNoVerificationStepLinter
TestWithSetupStepAfterActionStepLinter
TestWithSetupStepAfterVerificationStepLinter
TestWithSetupStepAsFinalStepLinter
TestWithTooManyStepsLinter]
expect(subject.registered_linters.keys).to eq(default_linter_classes)
default_linter_classes.each do |clazz|
expect(subject.registered_linters[clazz]).to be_a(CukeLinter.const_get(clazz))
end
end
it 'returns to its default set of linters after being reset' do
CukeLinter.reset_linters
original_names = CukeLinter.registered_linters.keys
original_linter_types = CukeLinter.registered_linters.values.map(&:class)
new_linter = generate_fake_linter
CukeLinter.register_linter(linter: new_linter, name: 'FakeLinter')
expect(CukeLinter.registered_linters.keys).to include('FakeLinter')
CukeLinter.reset_linters
expect(CukeLinter.registered_linters.keys).to eq(original_names)
expect(CukeLinter.registered_linters.values.map(&:class)).to eq(original_linter_types)
end
# To protect against someone modifying them
it 'does not reuse the old linting objects when resetting to the default linters' do
original_linter_ids = CukeLinter.registered_linters.values.map(&:object_id)
CukeLinter.reset_linters
expect(CukeLinter.registered_linters.values.map(&:object_id)).to_not match_array(original_linter_ids)
end
it 'can handle a mixture of problematic and non-problematic models' do
linting_options[:linters] = [generate_fake_linter(finds_problems: true),
generate_fake_linter(finds_problems: false)]
expect { subject.lint(linting_options) }.to_not raise_error
end
end
| 44.320423 | 201 | 0.558433 |
4afc5837d3a7f73fa71604257f0e9f51db718fda | 998 | Pod::Spec.new do |s|
s.name = 'Layout-Swift'
s.module_name = 'Layout'
s.version = '1.0.0'
s.summary = 'Swift Autolayout DSL for iOS & macOS'
s.description = <<-DESC
Swift Autolayout DSL for iOS & macOS.
DESC
s.homepage = 'https://github.com/mitchtreece/Layout'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Mitch Treece' => '[email protected]' }
s.source = { :git => 'https://github.com/mitchtreece/Layout.git', :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
s.default_subspec = 'Core'
s.subspec 'Core' do |core|
core.source_files = 'Layout/Classes/Core/**/*'
end
s.subspec 'Shorthand' do |sh|
sh.dependency 'Layout-Swift/Core'
sh.source_files = 'Layout/Classes/Shorthand/**/*'
end
s.subspec 'All' do |all|
all.dependency 'Layout-Swift/Core'
all.dependency 'Layout-Swift/Shorthand'
end
end
| 24.341463 | 102 | 0.572144 |
ed1b94b845362a85536646cd1e33f4bfdfabe002 | 295 | class TranslateCategories < ActiveRecord::Migration
def self.up
Category.create_translation_table!({
:name => :string,
:shortname => :string
}, {
:migrate_data => true
})
end
def self.down
Category.drop_translation_table! :migrate_data => true
end
end
| 19.666667 | 58 | 0.654237 |
2674069613840cb720162c1b220286d3ed8a912f | 1,143 | require 'spec_helper'
describe Machined::Sprocket do
describe '#initialize' do
it 'keeps a reference to the Machined environment' do
sprocket = create_sprocket
sprocket.machined.should be(machined)
end
it 'sets the root path' do
sprocket = create_sprocket
sprocket.root.should == Pathname.new('.').expand_path.to_s
sprocket = create_sprocket :root => 'spec/machined'
sprocket.root.should == Pathname.new('spec/machined').expand_path.to_s
end
end
describe '#context_class' do
it 'subclasses Machined::Context' do
sprocket = create_sprocket
sprocket.context_class.should < Sprockets::Context
sprocket.context_class.should < Machined::Context
end
end
describe '#use_all_templates' do
it 'registers available templates as engines' do
sprocket = create_sprocket :assets => true
sprocket.engines('.haml').should be_nil
sprocket.engines('.md').should be_nil
sprocket.use_all_templates
sprocket.engines('.haml').should be(Tilt::HamlTemplate)
sprocket.engines('.md').should be(Tilt::RDiscountTemplate)
end
end
end
| 30.891892 | 76 | 0.700787 |
33b185b5af6c108045b054be20025bc1b854bda6 | 836 | require "pry"
public_keys = open("./25-input.txt").read.split("\n").map { |str| str.to_i }
DIVISOR = 20201227
def self.encryption_loop(multiplier, loops, divisor, seeking, start = 1)
num = start
(1..loops).each do |i|
num = multiplier * num % divisor
if num == seeking
puts "Encrypted to #{num} after #{i} tries"
return {loop_size: i, value: num}
end
end
puts "Encrypted result is #{num}"
end
res1 = encryption_loop(7, 10000000, DIVISOR, public_keys[0], 1) # Encrypted to 12232269 after 4173465 tries
res2 = encryption_loop(7, 10000000, DIVISOR, public_keys[1], 1) # Encrypted to 19452773 after 5882067 tries
encryption_loop(res1[:value], res2[:loop_size], DIVISOR, nil, 1) # Encrypted result is 354320
encryption_loop(res2[:value], res1[:loop_size], DIVISOR, nil, 1) # Encrypted result is 354320 | 36.347826 | 107 | 0.696172 |
913eab462b5f06721e3702eaf3a8dc2a8cd6c7fb | 293 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
private
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in"
redirect_to login_url
end
end
end
| 19.533333 | 52 | 0.696246 |
4a22a4e6ff5563d2a794aedf9e3784c9445931d5 | 66,108 | # 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 'date'
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 RunV1alpha1
class Addressable
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AuditConfig
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AuditLogConfig
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AuthorizedDomain
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Binding
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Capabilities
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigMapEnvSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigMapKeySelector
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigMapVolumeSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Configuration
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigurationCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigurationSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ConfigurationStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Container
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ContainerPort
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DomainMapping
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DomainMappingCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DomainMappingSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DomainMappingStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Empty
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EnvFromSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EnvVar
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EnvVarSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EventType
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EventTypeImporter
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EventTypeParameter
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class EventTypeSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ExecAction
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Expr
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class GoogleRpcStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class HttpGetAction
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class HttpHeader
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Handler
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Initializer
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Initializers
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class IntOrString
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class KeyToPath
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Lifecycle
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListAuthorizedDomainsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListConfigurationsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListDomainMappingsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListEventTypesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListLocationsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListMeta
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListRevisionsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListRoutesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListServicesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListTriggersResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LocalObjectReference
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Location
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ObjectMeta
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ObjectReference
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OwnerReference
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Policy
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Probe
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Quantity
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RegionDetails
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ResourceRecord
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ResourceRequirements
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Revision
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RevisionCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RevisionSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RevisionStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RevisionTemplate
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Route
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RouteCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RouteSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RouteStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SeLinuxOptions
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SecretEnvSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SecretKeySelector
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SecretVolumeSource
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SecurityContext
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Service
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceSpecManualType
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceSpecPinnedType
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceSpecReleaseType
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceSpecRunLatest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ServiceStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SetIamPolicyRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SubscriberSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TcpSocketAction
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestIamPermissionsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestIamPermissionsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TrafficTarget
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Trigger
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerCondition
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerFilter
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerFilterSourceAndType
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerImporterSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerSpec
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TriggerStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Volume
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class VolumeDevice
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class VolumeMount
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Addressable
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :hostname, as: 'hostname'
property :url, as: 'url'
end
end
class AuditConfig
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :audit_log_configs, as: 'auditLogConfigs', class: Google::Apis::RunV1alpha1::AuditLogConfig, decorator: Google::Apis::RunV1alpha1::AuditLogConfig::Representation
property :service, as: 'service'
end
end
class AuditLogConfig
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :exempted_members, as: 'exemptedMembers'
property :log_type, as: 'logType'
end
end
class AuthorizedDomain
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :id, as: 'id'
property :name, as: 'name'
end
end
class Binding
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :condition, as: 'condition', class: Google::Apis::RunV1alpha1::Expr, decorator: Google::Apis::RunV1alpha1::Expr::Representation
collection :members, as: 'members'
property :role, as: 'role'
end
end
class Capabilities
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :add, as: 'add'
collection :drop, as: 'drop'
end
end
class ConfigMapEnvSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :local_object_reference, as: 'localObjectReference', class: Google::Apis::RunV1alpha1::LocalObjectReference, decorator: Google::Apis::RunV1alpha1::LocalObjectReference::Representation
property :optional, as: 'optional'
end
end
class ConfigMapKeySelector
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :key, as: 'key'
property :local_object_reference, as: 'localObjectReference', class: Google::Apis::RunV1alpha1::LocalObjectReference, decorator: Google::Apis::RunV1alpha1::LocalObjectReference::Representation
property :optional, as: 'optional'
end
end
class ConfigMapVolumeSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :default_mode, as: 'defaultMode'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::KeyToPath, decorator: Google::Apis::RunV1alpha1::KeyToPath::Representation
property :name, as: 'name'
property :optional, as: 'optional'
end
end
class Configuration
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::ConfigurationSpec, decorator: Google::Apis::RunV1alpha1::ConfigurationSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::ConfigurationStatus, decorator: Google::Apis::RunV1alpha1::ConfigurationStatus::Representation
end
end
class ConfigurationCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class ConfigurationSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :generation, as: 'generation'
property :revision_template, as: 'revisionTemplate', class: Google::Apis::RunV1alpha1::RevisionTemplate, decorator: Google::Apis::RunV1alpha1::RevisionTemplate::Representation
property :template, as: 'template', class: Google::Apis::RunV1alpha1::RevisionTemplate, decorator: Google::Apis::RunV1alpha1::RevisionTemplate::Representation
end
end
class ConfigurationStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::ConfigurationCondition, decorator: Google::Apis::RunV1alpha1::ConfigurationCondition::Representation
property :latest_created_revision_name, as: 'latestCreatedRevisionName'
property :latest_ready_revision_name, as: 'latestReadyRevisionName'
property :observed_generation, as: 'observedGeneration'
end
end
class Container
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :args, as: 'args'
collection :command, as: 'command'
collection :env, as: 'env', class: Google::Apis::RunV1alpha1::EnvVar, decorator: Google::Apis::RunV1alpha1::EnvVar::Representation
collection :env_from, as: 'envFrom', class: Google::Apis::RunV1alpha1::EnvFromSource, decorator: Google::Apis::RunV1alpha1::EnvFromSource::Representation
property :image, as: 'image'
property :image_pull_policy, as: 'imagePullPolicy'
property :lifecycle, as: 'lifecycle', class: Google::Apis::RunV1alpha1::Lifecycle, decorator: Google::Apis::RunV1alpha1::Lifecycle::Representation
property :liveness_probe, as: 'livenessProbe', class: Google::Apis::RunV1alpha1::Probe, decorator: Google::Apis::RunV1alpha1::Probe::Representation
property :name, as: 'name'
collection :ports, as: 'ports', class: Google::Apis::RunV1alpha1::ContainerPort, decorator: Google::Apis::RunV1alpha1::ContainerPort::Representation
property :readiness_probe, as: 'readinessProbe', class: Google::Apis::RunV1alpha1::Probe, decorator: Google::Apis::RunV1alpha1::Probe::Representation
property :resources, as: 'resources', class: Google::Apis::RunV1alpha1::ResourceRequirements, decorator: Google::Apis::RunV1alpha1::ResourceRequirements::Representation
property :security_context, as: 'securityContext', class: Google::Apis::RunV1alpha1::SecurityContext, decorator: Google::Apis::RunV1alpha1::SecurityContext::Representation
property :stdin, as: 'stdin'
property :stdin_once, as: 'stdinOnce'
property :termination_message_path, as: 'terminationMessagePath'
property :termination_message_policy, as: 'terminationMessagePolicy'
property :tty, as: 'tty'
collection :volume_devices, as: 'volumeDevices', class: Google::Apis::RunV1alpha1::VolumeDevice, decorator: Google::Apis::RunV1alpha1::VolumeDevice::Representation
collection :volume_mounts, as: 'volumeMounts', class: Google::Apis::RunV1alpha1::VolumeMount, decorator: Google::Apis::RunV1alpha1::VolumeMount::Representation
property :working_dir, as: 'workingDir'
end
end
class ContainerPort
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :container_port, as: 'containerPort'
property :host_ip, as: 'hostIP'
property :host_port, as: 'hostPort'
property :name, as: 'name'
property :protocol, as: 'protocol'
end
end
class DomainMapping
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::DomainMappingSpec, decorator: Google::Apis::RunV1alpha1::DomainMappingSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::DomainMappingStatus, decorator: Google::Apis::RunV1alpha1::DomainMappingStatus::Representation
end
end
class DomainMappingCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class DomainMappingSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :certificate_mode, as: 'certificateMode'
property :force_override, as: 'forceOverride'
property :route_name, as: 'routeName'
end
end
class DomainMappingStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::DomainMappingCondition, decorator: Google::Apis::RunV1alpha1::DomainMappingCondition::Representation
property :mapped_route_name, as: 'mappedRouteName'
property :observed_generation, as: 'observedGeneration'
collection :resource_records, as: 'resourceRecords', class: Google::Apis::RunV1alpha1::ResourceRecord, decorator: Google::Apis::RunV1alpha1::ResourceRecord::Representation
end
end
class Empty
# @private
class Representation < Google::Apis::Core::JsonRepresentation
end
end
class EnvFromSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :config_map_ref, as: 'configMapRef', class: Google::Apis::RunV1alpha1::ConfigMapEnvSource, decorator: Google::Apis::RunV1alpha1::ConfigMapEnvSource::Representation
property :prefix, as: 'prefix'
property :secret_ref, as: 'secretRef', class: Google::Apis::RunV1alpha1::SecretEnvSource, decorator: Google::Apis::RunV1alpha1::SecretEnvSource::Representation
end
end
class EnvVar
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :value, as: 'value'
property :value_from, as: 'valueFrom', class: Google::Apis::RunV1alpha1::EnvVarSource, decorator: Google::Apis::RunV1alpha1::EnvVarSource::Representation
end
end
class EnvVarSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :config_map_key_ref, as: 'configMapKeyRef', class: Google::Apis::RunV1alpha1::ConfigMapKeySelector, decorator: Google::Apis::RunV1alpha1::ConfigMapKeySelector::Representation
property :secret_key_ref, as: 'secretKeyRef', class: Google::Apis::RunV1alpha1::SecretKeySelector, decorator: Google::Apis::RunV1alpha1::SecretKeySelector::Representation
end
end
class EventType
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::EventTypeSpec, decorator: Google::Apis::RunV1alpha1::EventTypeSpec::Representation
end
end
class EventTypeImporter
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
collection :parameters, as: 'parameters', class: Google::Apis::RunV1alpha1::EventTypeParameter, decorator: Google::Apis::RunV1alpha1::EventTypeParameter::Representation
end
end
class EventTypeParameter
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :name, as: 'name'
end
end
class EventTypeSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :broker, as: 'broker'
property :description, as: 'description'
property :importer, as: 'importer', class: Google::Apis::RunV1alpha1::EventTypeImporter, decorator: Google::Apis::RunV1alpha1::EventTypeImporter::Representation
property :schema, as: 'schema'
property :source, as: 'source'
property :type, as: 'type'
end
end
class ExecAction
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :command, as: 'command'
end
end
class Expr
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :expression, as: 'expression'
property :location, as: 'location'
property :title, as: 'title'
end
end
class GoogleRpcStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :code, as: 'code'
collection :details, as: 'details'
property :message, as: 'message'
end
end
class HttpGetAction
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :host, as: 'host'
collection :http_headers, as: 'httpHeaders', class: Google::Apis::RunV1alpha1::HttpHeader, decorator: Google::Apis::RunV1alpha1::HttpHeader::Representation
property :path, as: 'path'
property :port, as: 'port', class: Google::Apis::RunV1alpha1::IntOrString, decorator: Google::Apis::RunV1alpha1::IntOrString::Representation
property :scheme, as: 'scheme'
end
end
class HttpHeader
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :value, as: 'value'
end
end
class Handler
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :exec, as: 'exec', class: Google::Apis::RunV1alpha1::ExecAction, decorator: Google::Apis::RunV1alpha1::ExecAction::Representation
property :http_get, as: 'httpGet', class: Google::Apis::RunV1alpha1::HttpGetAction, decorator: Google::Apis::RunV1alpha1::HttpGetAction::Representation
property :tcp_socket, as: 'tcpSocket', class: Google::Apis::RunV1alpha1::TcpSocketAction, decorator: Google::Apis::RunV1alpha1::TcpSocketAction::Representation
end
end
class Initializer
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
end
end
class Initializers
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :pending, as: 'pending', class: Google::Apis::RunV1alpha1::Initializer, decorator: Google::Apis::RunV1alpha1::Initializer::Representation
end
end
class IntOrString
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :int_val, as: 'intVal'
property :str_val, as: 'strVal'
property :type, as: 'type'
end
end
class KeyToPath
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :key, as: 'key'
property :mode, as: 'mode'
property :path, as: 'path'
end
end
class Lifecycle
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :post_start, as: 'postStart', class: Google::Apis::RunV1alpha1::Handler, decorator: Google::Apis::RunV1alpha1::Handler::Representation
property :pre_stop, as: 'preStop', class: Google::Apis::RunV1alpha1::Handler, decorator: Google::Apis::RunV1alpha1::Handler::Representation
end
end
class ListAuthorizedDomainsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :domains, as: 'domains', class: Google::Apis::RunV1alpha1::AuthorizedDomain, decorator: Google::Apis::RunV1alpha1::AuthorizedDomain::Representation
property :next_page_token, as: 'nextPageToken'
end
end
class ListConfigurationsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::Configuration, decorator: Google::Apis::RunV1alpha1::Configuration::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListDomainMappingsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::DomainMapping, decorator: Google::Apis::RunV1alpha1::DomainMapping::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListEventTypesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::EventType, decorator: Google::Apis::RunV1alpha1::EventType::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListLocationsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :locations, as: 'locations', class: Google::Apis::RunV1alpha1::Location, decorator: Google::Apis::RunV1alpha1::Location::Representation
property :next_page_token, as: 'nextPageToken'
end
end
class ListMeta
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :continue, as: 'continue'
property :resource_version, as: 'resourceVersion'
property :self_link, as: 'selfLink'
end
end
class ListRevisionsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::Revision, decorator: Google::Apis::RunV1alpha1::Revision::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListRoutesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::Route, decorator: Google::Apis::RunV1alpha1::Route::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListServicesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::Service, decorator: Google::Apis::RunV1alpha1::Service::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class ListTriggersResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::Trigger, decorator: Google::Apis::RunV1alpha1::Trigger::Representation
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ListMeta, decorator: Google::Apis::RunV1alpha1::ListMeta::Representation
hash :region_details, as: 'regionDetails', class: Google::Apis::RunV1alpha1::RegionDetails, decorator: Google::Apis::RunV1alpha1::RegionDetails::Representation
collection :unreachable, as: 'unreachable'
end
end
class LocalObjectReference
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
end
end
class Location
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :display_name, as: 'displayName'
hash :labels, as: 'labels'
property :location_id, as: 'locationId'
hash :metadata, as: 'metadata'
property :name, as: 'name'
end
end
class ObjectMeta
# @private
class Representation < Google::Apis::Core::JsonRepresentation
hash :annotations, as: 'annotations'
property :cluster_name, as: 'clusterName'
property :creation_timestamp, as: 'creationTimestamp'
property :deletion_grace_period_seconds, as: 'deletionGracePeriodSeconds'
property :deletion_timestamp, as: 'deletionTimestamp'
collection :finalizers, as: 'finalizers'
property :generate_name, as: 'generateName'
property :generation, as: 'generation'
property :initializers, as: 'initializers', class: Google::Apis::RunV1alpha1::Initializers, decorator: Google::Apis::RunV1alpha1::Initializers::Representation
hash :labels, as: 'labels'
property :name, as: 'name'
property :namespace, as: 'namespace'
collection :owner_references, as: 'ownerReferences', class: Google::Apis::RunV1alpha1::OwnerReference, decorator: Google::Apis::RunV1alpha1::OwnerReference::Representation
property :resource_version, as: 'resourceVersion'
property :self_link, as: 'selfLink'
property :uid, as: 'uid'
end
end
class ObjectReference
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :field_path, as: 'fieldPath'
property :kind, as: 'kind'
property :name, as: 'name'
property :namespace, as: 'namespace'
property :resource_version, as: 'resourceVersion'
property :uid, as: 'uid'
end
end
class OwnerReference
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :block_owner_deletion, as: 'blockOwnerDeletion'
property :controller, as: 'controller'
property :kind, as: 'kind'
property :name, as: 'name'
property :uid, as: 'uid'
end
end
class Policy
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :audit_configs, as: 'auditConfigs', class: Google::Apis::RunV1alpha1::AuditConfig, decorator: Google::Apis::RunV1alpha1::AuditConfig::Representation
collection :bindings, as: 'bindings', class: Google::Apis::RunV1alpha1::Binding, decorator: Google::Apis::RunV1alpha1::Binding::Representation
property :etag, :base64 => true, as: 'etag'
property :version, as: 'version'
end
end
class Probe
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :failure_threshold, as: 'failureThreshold'
property :handler, as: 'handler', class: Google::Apis::RunV1alpha1::Handler, decorator: Google::Apis::RunV1alpha1::Handler::Representation
property :initial_delay_seconds, as: 'initialDelaySeconds'
property :period_seconds, as: 'periodSeconds'
property :success_threshold, as: 'successThreshold'
property :timeout_seconds, as: 'timeoutSeconds'
end
end
class Quantity
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :string, as: 'string'
end
end
class RegionDetails
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :error, as: 'error', class: Google::Apis::RunV1alpha1::GoogleRpcStatus, decorator: Google::Apis::RunV1alpha1::GoogleRpcStatus::Representation
end
end
class ResourceRecord
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :rrdata, as: 'rrdata'
property :type, as: 'type'
end
end
class ResourceRequirements
# @private
class Representation < Google::Apis::Core::JsonRepresentation
hash :limits, as: 'limits'
hash :limits_in_map, as: 'limitsInMap', class: Google::Apis::RunV1alpha1::Quantity, decorator: Google::Apis::RunV1alpha1::Quantity::Representation
hash :requests, as: 'requests'
hash :requests_in_map, as: 'requestsInMap', class: Google::Apis::RunV1alpha1::Quantity, decorator: Google::Apis::RunV1alpha1::Quantity::Representation
end
end
class Revision
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::RevisionSpec, decorator: Google::Apis::RunV1alpha1::RevisionSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::RevisionStatus, decorator: Google::Apis::RunV1alpha1::RevisionStatus::Representation
end
end
class RevisionCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class RevisionSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :concurrency_model, as: 'concurrencyModel'
property :container, as: 'container', class: Google::Apis::RunV1alpha1::Container, decorator: Google::Apis::RunV1alpha1::Container::Representation
property :container_concurrency, as: 'containerConcurrency'
collection :containers, as: 'containers', class: Google::Apis::RunV1alpha1::Container, decorator: Google::Apis::RunV1alpha1::Container::Representation
property :generation, as: 'generation'
property :service_account_name, as: 'serviceAccountName'
property :serving_state, as: 'servingState'
property :timeout_seconds, as: 'timeoutSeconds'
collection :volumes, as: 'volumes', class: Google::Apis::RunV1alpha1::Volume, decorator: Google::Apis::RunV1alpha1::Volume::Representation
end
end
class RevisionStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::RevisionCondition, decorator: Google::Apis::RunV1alpha1::RevisionCondition::Representation
property :image_digest, as: 'imageDigest'
property :log_url, as: 'logUrl'
property :observed_generation, as: 'observedGeneration'
property :service_name, as: 'serviceName'
end
end
class RevisionTemplate
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::RevisionSpec, decorator: Google::Apis::RunV1alpha1::RevisionSpec::Representation
end
end
class Route
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::RouteSpec, decorator: Google::Apis::RunV1alpha1::RouteSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::RouteStatus, decorator: Google::Apis::RunV1alpha1::RouteStatus::Representation
end
end
class RouteCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class RouteSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :generation, as: 'generation'
collection :traffic, as: 'traffic', class: Google::Apis::RunV1alpha1::TrafficTarget, decorator: Google::Apis::RunV1alpha1::TrafficTarget::Representation
end
end
class RouteStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :address, as: 'address', class: Google::Apis::RunV1alpha1::Addressable, decorator: Google::Apis::RunV1alpha1::Addressable::Representation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::RouteCondition, decorator: Google::Apis::RunV1alpha1::RouteCondition::Representation
property :domain, as: 'domain'
property :domain_internal, as: 'domainInternal'
property :observed_generation, as: 'observedGeneration'
collection :traffic, as: 'traffic', class: Google::Apis::RunV1alpha1::TrafficTarget, decorator: Google::Apis::RunV1alpha1::TrafficTarget::Representation
property :url, as: 'url'
end
end
class SeLinuxOptions
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :level, as: 'level'
property :role, as: 'role'
property :type, as: 'type'
property :user, as: 'user'
end
end
class SecretEnvSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :local_object_reference, as: 'localObjectReference', class: Google::Apis::RunV1alpha1::LocalObjectReference, decorator: Google::Apis::RunV1alpha1::LocalObjectReference::Representation
property :optional, as: 'optional'
end
end
class SecretKeySelector
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :key, as: 'key'
property :local_object_reference, as: 'localObjectReference', class: Google::Apis::RunV1alpha1::LocalObjectReference, decorator: Google::Apis::RunV1alpha1::LocalObjectReference::Representation
property :optional, as: 'optional'
end
end
class SecretVolumeSource
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :default_mode, as: 'defaultMode'
collection :items, as: 'items', class: Google::Apis::RunV1alpha1::KeyToPath, decorator: Google::Apis::RunV1alpha1::KeyToPath::Representation
property :optional, as: 'optional'
property :secret_name, as: 'secretName'
end
end
class SecurityContext
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :allow_privilege_escalation, as: 'allowPrivilegeEscalation'
property :capabilities, as: 'capabilities', class: Google::Apis::RunV1alpha1::Capabilities, decorator: Google::Apis::RunV1alpha1::Capabilities::Representation
property :privileged, as: 'privileged'
property :read_only_root_filesystem, as: 'readOnlyRootFilesystem'
property :run_as_group, as: 'runAsGroup'
property :run_as_non_root, as: 'runAsNonRoot'
property :run_as_user, as: 'runAsUser'
property :se_linux_options, as: 'seLinuxOptions', class: Google::Apis::RunV1alpha1::SeLinuxOptions, decorator: Google::Apis::RunV1alpha1::SeLinuxOptions::Representation
end
end
class Service
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::ServiceSpec, decorator: Google::Apis::RunV1alpha1::ServiceSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::ServiceStatus, decorator: Google::Apis::RunV1alpha1::ServiceStatus::Representation
end
end
class ServiceCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class ServiceSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :generation, as: 'generation'
property :manual, as: 'manual', class: Google::Apis::RunV1alpha1::ServiceSpecManualType, decorator: Google::Apis::RunV1alpha1::ServiceSpecManualType::Representation
property :pinned, as: 'pinned', class: Google::Apis::RunV1alpha1::ServiceSpecPinnedType, decorator: Google::Apis::RunV1alpha1::ServiceSpecPinnedType::Representation
property :release, as: 'release', class: Google::Apis::RunV1alpha1::ServiceSpecReleaseType, decorator: Google::Apis::RunV1alpha1::ServiceSpecReleaseType::Representation
property :run_latest, as: 'runLatest', class: Google::Apis::RunV1alpha1::ServiceSpecRunLatest, decorator: Google::Apis::RunV1alpha1::ServiceSpecRunLatest::Representation
property :template, as: 'template', class: Google::Apis::RunV1alpha1::RevisionTemplate, decorator: Google::Apis::RunV1alpha1::RevisionTemplate::Representation
collection :traffic, as: 'traffic', class: Google::Apis::RunV1alpha1::TrafficTarget, decorator: Google::Apis::RunV1alpha1::TrafficTarget::Representation
end
end
class ServiceSpecManualType
# @private
class Representation < Google::Apis::Core::JsonRepresentation
end
end
class ServiceSpecPinnedType
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :configuration, as: 'configuration', class: Google::Apis::RunV1alpha1::ConfigurationSpec, decorator: Google::Apis::RunV1alpha1::ConfigurationSpec::Representation
property :revision_name, as: 'revisionName'
end
end
class ServiceSpecReleaseType
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :configuration, as: 'configuration', class: Google::Apis::RunV1alpha1::ConfigurationSpec, decorator: Google::Apis::RunV1alpha1::ConfigurationSpec::Representation
collection :revisions, as: 'revisions'
property :rollout_percent, as: 'rolloutPercent'
end
end
class ServiceSpecRunLatest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :configuration, as: 'configuration', class: Google::Apis::RunV1alpha1::ConfigurationSpec, decorator: Google::Apis::RunV1alpha1::ConfigurationSpec::Representation
end
end
class ServiceStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :address, as: 'address', class: Google::Apis::RunV1alpha1::Addressable, decorator: Google::Apis::RunV1alpha1::Addressable::Representation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::ServiceCondition, decorator: Google::Apis::RunV1alpha1::ServiceCondition::Representation
property :domain, as: 'domain'
property :latest_created_revision_name, as: 'latestCreatedRevisionName'
property :latest_ready_revision_name, as: 'latestReadyRevisionName'
property :observed_generation, as: 'observedGeneration'
collection :traffic, as: 'traffic', class: Google::Apis::RunV1alpha1::TrafficTarget, decorator: Google::Apis::RunV1alpha1::TrafficTarget::Representation
property :url, as: 'url'
end
end
class SetIamPolicyRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :policy, as: 'policy', class: Google::Apis::RunV1alpha1::Policy, decorator: Google::Apis::RunV1alpha1::Policy::Representation
property :update_mask, as: 'updateMask'
end
end
class SubscriberSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :ref, as: 'ref', class: Google::Apis::RunV1alpha1::ObjectReference, decorator: Google::Apis::RunV1alpha1::ObjectReference::Representation
property :uri, as: 'uri'
end
end
class TcpSocketAction
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :host, as: 'host'
property :port, as: 'port', class: Google::Apis::RunV1alpha1::IntOrString, decorator: Google::Apis::RunV1alpha1::IntOrString::Representation
end
end
class TestIamPermissionsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :permissions, as: 'permissions'
end
end
class TestIamPermissionsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :permissions, as: 'permissions'
end
end
class TrafficTarget
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :configuration_name, as: 'configurationName'
property :latest_revision, as: 'latestRevision'
property :name, as: 'name'
property :percent, as: 'percent'
property :revision_name, as: 'revisionName'
property :tag, as: 'tag'
property :url, as: 'url'
end
end
class Trigger
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :api_version, as: 'apiVersion'
property :kind, as: 'kind'
property :metadata, as: 'metadata', class: Google::Apis::RunV1alpha1::ObjectMeta, decorator: Google::Apis::RunV1alpha1::ObjectMeta::Representation
property :spec, as: 'spec', class: Google::Apis::RunV1alpha1::TriggerSpec, decorator: Google::Apis::RunV1alpha1::TriggerSpec::Representation
property :status, as: 'status', class: Google::Apis::RunV1alpha1::TriggerStatus, decorator: Google::Apis::RunV1alpha1::TriggerStatus::Representation
end
end
class TriggerCondition
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :last_transition_time, as: 'lastTransitionTime'
property :message, as: 'message'
property :reason, as: 'reason'
property :severity, as: 'severity'
property :status, as: 'status'
property :type, as: 'type'
end
end
class TriggerFilter
# @private
class Representation < Google::Apis::Core::JsonRepresentation
hash :attributes, as: 'attributes'
property :source_and_type, as: 'sourceAndType', class: Google::Apis::RunV1alpha1::TriggerFilterSourceAndType, decorator: Google::Apis::RunV1alpha1::TriggerFilterSourceAndType::Representation
end
end
class TriggerFilterSourceAndType
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :source, as: 'source'
property :type, as: 'type'
end
end
class TriggerImporterSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
hash :arguments, as: 'arguments'
property :event_type_name, as: 'eventTypeName'
end
end
class TriggerSpec
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :broker, as: 'broker'
property :filter, as: 'filter', class: Google::Apis::RunV1alpha1::TriggerFilter, decorator: Google::Apis::RunV1alpha1::TriggerFilter::Representation
collection :importers, as: 'importers', class: Google::Apis::RunV1alpha1::TriggerImporterSpec, decorator: Google::Apis::RunV1alpha1::TriggerImporterSpec::Representation
property :subscriber, as: 'subscriber', class: Google::Apis::RunV1alpha1::SubscriberSpec, decorator: Google::Apis::RunV1alpha1::SubscriberSpec::Representation
end
end
class TriggerStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :conditions, as: 'conditions', class: Google::Apis::RunV1alpha1::TriggerCondition, decorator: Google::Apis::RunV1alpha1::TriggerCondition::Representation
property :observed_generation, as: 'observedGeneration'
property :subscriber_uri, as: 'subscriberUri'
end
end
class Volume
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :config_map, as: 'configMap', class: Google::Apis::RunV1alpha1::ConfigMapVolumeSource, decorator: Google::Apis::RunV1alpha1::ConfigMapVolumeSource::Representation
property :name, as: 'name'
property :secret, as: 'secret', class: Google::Apis::RunV1alpha1::SecretVolumeSource, decorator: Google::Apis::RunV1alpha1::SecretVolumeSource::Representation
end
end
class VolumeDevice
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :device_path, as: 'devicePath'
property :name, as: 'name'
end
end
class VolumeMount
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :mount_path, as: 'mountPath'
property :mount_propagation, as: 'mountPropagation'
property :name, as: 'name'
property :read_only, as: 'readOnly'
property :sub_path, as: 'subPath'
end
end
end
end
end
| 38.864198 | 202 | 0.643992 |
f8f57842e82d3183e10afa00cc6381b427062fd7 | 60 | class DisabledImplementation
implements TestInterface
end
| 15 | 28 | 0.883333 |
28385cc3317907346d6698c690c822ccaef5fe62 | 191 | VCR.configure do |c|
c.cassette_library_dir = Rails.root.join("spec", "vcr")
c.hook_into :faraday
c.default_cassette_options = { record: :new_episodes }
c.ignore_localhost = true
end
| 27.285714 | 57 | 0.732984 |
e261caa5c812c87b42f4eb6b310e22ca753699d4 | 1,795 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'devise-security/version'
Gem::Specification.new do |s|
s.name = 'devise-security'
s.version = DeviseSecurity::VERSION.dup
s.platform = Gem::Platform::RUBY
s.licenses = ['MIT']
s.summary = 'Security extension for devise'
s.email = '[email protected]'
s.homepage = 'https://github.com/devise-security/devise-security'
s.description = 'An enterprise security extension for devise.'
s.authors = [
'Marco Scholl',
'Alexander Dreher',
'Nate Bird',
'Dillon Welch',
'Kevin Olbrich'
]
s.post_install_message = 'WARNING: devise-security will drop support for Rails 4.2 in version 0.16.0'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
s.require_paths = ['lib']
s.required_ruby_version = '>= 2.3.0'
s.add_runtime_dependency 'devise', '>= 4.3.0', '< 5.0'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'bundler'
s.add_development_dependency 'coveralls'
s.add_development_dependency 'database_cleaner'
s.add_development_dependency 'easy_captcha'
s.add_development_dependency 'm'
s.add_development_dependency 'minitest'
s.add_development_dependency 'omniauth'
s.add_development_dependency 'pry-byebug'
s.add_development_dependency 'pry-rescue'
s.add_development_dependency 'rails_email_validator'
s.add_development_dependency 'rubocop', '~> 0.80.0' # NOTE: also update .codeclimate.yml and make sure it uses the same version
s.add_development_dependency 'rubocop-rails'
s.add_development_dependency 'solargraph'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'wwtd'
end
| 36.632653 | 129 | 0.71922 |
bbde6f1c4fdb07b0259c158add09e5fd20ed33b4 | 1,560 | module Views
class Base < Fortitude::Widget
include Views::Widgets::Helpers
doctype :html5
def fa_icon(fa_icon_name, *classes)
i(class: "fa fa-#{fa_icon_name} #{classes.join(' ')}")
end
private
def set_progress_bar!(index:)
content_for :progress_bar do
div class: "progress-bar progress-bar--#{index}"
end
end
def card_title(text)
h4 text, class: 'assessments__title'
end
def back_button(url, options = {})
link_to url, options.merge(class: "button button--back") do
fa_icon 'arrow-left'
span 'BACK'
end
end
def row(classes=[], expanded: true, &block)
classes = CssClasses.new(classes, ("expanded" if expanded), "row")
div class: classes.to_s, &block
end
def columns(classes=[], small: 12, medium: nil, large: nil, &block)
classes = CssClasses.new(
classes,
"columns",
("small-#{small}" if small.present?),
("medium-#{medium}" if medium.present?),
("large-#{large}" if large.present?)
)
div class: classes.to_s, &block
end
alias :column :columns
def card_header_actions(model:)
div class: "card-header__actions" do
link_to '#', class: 'card-header__actions-link', data: { open: "send-#{model}-email-modal" } do
fa_icon "envelope"
text "Email"
end
link_to '#', id: "print", class: 'card-header__actions-link' do
fa_icon 'print'
text "Print"
end
end
end
end
end
| 25.16129 | 103 | 0.586538 |
18e954a02ce2ac40c1d306591c4a786a0160ad64 | 1,031 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'refile/s3/version'
Gem::Specification.new do |spec|
spec.name = "refile-s3"
spec.version = Refile::S3::VERSION
spec.authors = ["Jonas Nicklas"]
spec.email = ["[email protected]"]
spec.summary = "Amazon S3 backend for the Refile gem"
spec.homepage = ""
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.required_ruby_version = ">= 2.1.0"
spec.add_dependency "refile", "~> 0.7.0"
spec.add_dependency "aws-sdk-s3", "~> 1.13"
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "webmock"
end
| 35.551724 | 74 | 0.645005 |
acd1973fce01965cd9f7999e8a653490e5b9bdbf | 920 | Pod::Spec.new do |s|
s.name = "TTVideoEditor"
s.version = "7.9.0.30-D"
s.summary = "TTVideoEditor"
s.license = "MIT"
s.authors = {"zhouyi.ysj"=>"[email protected]"}
s.homepage = "https://github.com/volcengine"
s.description = "ttvideoeditor"
s.frameworks = ["AVFoundation", "Foundation", "UIKit", "CoreTelephony", "AudioToolbox", "CoreMotion", "MediaToolbox", "GLKit", "OpenGLES", "VideoToolbox", "CoreMedia", "MetalPerformanceShaders", "MobileCoreServices"]
s.libraries = ["xml2", "iconv", "compression", "z", "c++"]
s.requires_arc = true
s.source = {"http"=>"https://sf3-ttcdn-tos.pstatp.com/obj/volcengine/TTVideoEditor/7.9.0.30-D/TTVideoEditor.zip"}
s.ios.resource = "**/*.bundle"
s.dependency "KVOController"
s.pod_target_xcconfig = { "VALID_ARCHS" => "x86_64 armv7 arm64" }
s.ios.deployment_target = '8.0'
s.ios.vendored_framework = 'TTVideoEditor.framework'
end
| 46 | 218 | 0.679348 |
ed8770569b258fc06ac1a01d5bc43e0d89379828 | 680 | require 'formula'
class Arm < Formula
desc "Terminal status monitor for Tor"
homepage 'http://www.atagar.com/arm/'
url 'http://www.atagar.com/arm/resources/static/arm-1.4.5.0.tar.bz2'
sha256 'fc0e771585dde3803873b4807578060f0556cf1cac6c38840a714ffada3b28fa'
def install
(share+"arm").install Dir["*"]
bin.write_exec_script share/'arm/arm'
end
def caveats; <<-EOS.undent
You'll need to enable the Tor Control Protocol in your torrc.
See here for details: http://www.torproject.org/tor-manual.html.en
To configure Arm, copy the sample configuration from
#{share}/arm/armrc.sample
to ~/.arm/armrc, adjusting as needed.
EOS
end
end
| 28.333333 | 75 | 0.717647 |
6274c7b3c9e8bd2ea42fa078e971d1a1e63ae7e9 | 1,208 | require 'model/project_build_log'
require 'model/project_build'
module Bamboo
class ProjectBuildLogParser
def parse(plan, result)
ProjectBuild.new(ProjectBuildResult.new(plan, result).to_hash)
end
private
class ProjectBuildResult
def initialize(plan, result)
@plan = plan
@result = result
end
def web_url
@result.url
end
def last_build_label
@result.number
end
def name
@plan.short_name
end
def activity
@plan.active? ? :building : :sleeping
end
def last_build_time
@result.completed_time
end
def last_build_status
case @result.state
when :successful then
:success
when :failed then
:failure
else
:unknown
end
end
def to_hash
{
:name => name,
:activity => activity,
:last_build_status => last_build_status,
:last_build_label => last_build_label,
:last_build_time => last_build_time,
:next_build_time => nil,
:web_url => web_url
}
end
end
end
end | 19.174603 | 68 | 0.558775 |
0323a8d222a3b53356c2ba9027012bdb3332bd89 | 484 | # frozen_string_literal: true
class ForkNetwork < ApplicationRecord
belongs_to :root_project, class_name: 'Project'
has_many :fork_network_members
has_many :projects, through: :fork_network_members
after_create :add_root_as_member, if: :root_project
def add_root_as_member
projects << root_project
end
def find_forks_in(other_projects)
projects.where(id: other_projects)
end
def merge_requests
MergeRequest.where(target_project: projects)
end
end
| 22 | 53 | 0.785124 |
2870531d0d893f5c1fa6aa89de033f154277d079 | 1,366 | class UsersController < ApplicationController
before_action :get_user, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource
def new
redirect_to root_path if logged_in?
@user = User.new
end
def create
redirect_to root_path if logged_in?
@user = User.new(user_params)
@user.name = "%{@user.first_name} %{@user.last_name}" if @user.name.nil?
@user.current_cart ||= Cart.new
if @user.save
session[:user_id] = @user.id
if params[:type] == "artist"
@user.permissions = 10
redirect_to artist_path(@user)
else
redirect_to user_path(@user)
end
else
render new_user_path
end
end
def index
end
def edit
end
def update
@user.update(user_params)
if params[:user][:type] == "artist"
@user.permissions = 10
elsif params[:user][:type] == "user"
@user.permissions = 100
end
@user.current_cart ||= Cart.new #Nil protection
@user.save
redirect_to user_path(@user)
end
def show
redirect_to artist_cp_path(@user) if @user.is_artist?
end
def destroy
@user.destroy
redirect_to users_path
end
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)
end
def get_user
@user = User.find(params[:id])
end
end
| 21.34375 | 100 | 0.651537 |
bbdf5ffafbd18a1c86dca51d741294189a50c218 | 1,780 | # frozen_string_literal: true
class Checkpoint::Credential
# Credential Resolver that supports a basic role map model.
#
# The role map should be a hash containing all of the roles and each key
# should be an array of the permissions that role would grant. For example:
#
# ```
# {
# admin: [:read, :create, :edit, :delete],
# guest: [:read]
# }
# ```
#
# Note that this example is not a recommendation of how to model an
# application's permissions; it is only to show the expected format of the
# hash and that there is no inheritance of permissions between roles (:read
# is included in both roles). Any more sophisticated rules should be
# implemented in a custom Resolver, or custom Credential types.
#
# Actions convert to Permissions according to the base {Resolver} and expand
# according to the map.
class RoleMapResolver < Resolver
attr_reader :role_map, :permission_map
def initialize(role_map)
@role_map = role_map
@permission_map = invert_role_map
end
# Expand an action name into the matching permission and any roles that
# would grant it.
#
# @return [Array<Credential>]
def expand(action)
permissions_for(action) + roles_granting(action)
end
private
def permissions_for(action)
[Permission.new(action)]
end
def roles_granting(action)
if permission_map.key?(action)
permission_map[action].map { |role| Role.new(role) }
else
[]
end
end
def invert_role_map
{}.tap do |hash|
role_map.each do |role, permissions|
permissions.each do |permission|
hash[permission] ||= []
hash[permission] << role
end
end
end
end
end
end
| 26.969697 | 78 | 0.654494 |
62ff52915d51314f1fbc949c14412c39931e3dfc | 270 | module Moonshot
module Commands
class Push < Moonshot::Command
self.usage = 'push [options]'
self.description = 'Build and deploy a development artifact from the working directory'
def execute
controller.push
end
end
end
end
| 20.769231 | 93 | 0.666667 |
21625ed436e68355e0a7d99d3a1c94b331f5545f | 377 | require 'spec_helper'
module Refinery
module CountyPages
describe CountyPage do
describe "validations" do
subject do
FactoryGirl.create(:county_page,
:name => "Refinery CMS")
end
it { should be_valid }
its(:errors) { should be_empty }
its(:name) { should == "Refinery CMS" }
end
end
end
end
| 19.842105 | 47 | 0.583554 |
1dcdb4dd9f3560dc190d53ac6be2d0171db18500 | 121 | # frozen_string_literal: true
class UsersController < BussinessController
def info
@user = current_user
end
end
| 15.125 | 43 | 0.768595 |
ff60405fdce6d36759d7ba2266a3665eaa0eb61a | 43 | module Hyperclient
VERSION = "0.0.1"
end
| 10.75 | 19 | 0.697674 |
d5e7b052338ae889fad717c5a735fcc86f3e28a0 | 228 | # frozen_string_literal: true
Sequel.migration do
change do
alter_table SC::Billing.user_model.table_name do
add_foreign_key :default_stripe_payment_source_id, :stripe_payment_sources, index: true
end
end
end
| 22.8 | 93 | 0.785088 |
e986eabcb650aeaf2c8f7a12134349ca97a4cc2d | 156 | Airbrake.configure do |config|
config.project_id = ENV['AIRBRAKE_PROJECT_ID']
config.project_key = ENV['AIRBRAKE_API_KEY']
end if Rails.env.production?
| 31.2 | 48 | 0.782051 |
ffa85f2b11ddab1d3eb631dfb23369f5a26e3f55 | 4,319 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# 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 the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
module Redmine
module MimeType
MIME_TYPES = {
'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade',
'text/css' => 'css',
'text/html' => 'html,htm,xhtml',
'text/jsp' => 'jsp',
'text/x-c' => 'c,cpp,cc,h,hh',
'text/x-csharp' => 'cs',
'text/x-java' => 'java',
'text/x-javascript' => 'js',
'text/x-html-template' => 'rhtml',
'text/x-perl' => 'pl,pm',
'text/x-php' => 'php,php3,php4,php5',
'text/x-python' => 'py',
'text/x-ruby' => 'rb,rbw,ruby,rake,erb',
'text/x-csh' => 'csh',
'text/x-sh' => 'sh',
'text/xml' => 'xml,xsd,mxml',
'text/yaml' => 'yml,yaml',
'text/csv' => 'csv',
'text/x-po' => 'po',
'image/gif' => 'gif',
'image/jpeg' => 'jpg,jpeg,jpe',
'image/png' => 'png',
'image/tiff' => 'tiff,tif',
'image/x-ms-bmp' => 'bmp',
'image/x-xpixmap' => 'xpm',
'application/pdf' => 'pdf',
'application/rtf' => 'rtf',
'application/msword' => 'doc',
'application/vnd.ms-excel' => 'xls',
'application/vnd.ms-powerpoint' => 'ppt,pps',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx',
'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
'application/vnd.oasis.opendocument.text' => 'odt',
'application/vnd.oasis.opendocument.presentation' => 'odp',
'application/x-7z-compressed' => '7z',
'application/x-rar-compressed' => 'rar',
'application/x-tar' => 'tar',
'application/zip' => 'zip',
'application/x-gzip' => 'gz',
'video/x-flv' => 'flv,f4v',
'video/mpeg' => 'mpeg,mpg,mpe',
'video/mp4' => 'mp4',
'video/x-ms-wmv' => 'wmv',
'video/quicktime' => 'qt,mov',
'video/vnd.vivo' => 'viv,vivo',
'video/x-msvideo' => 'avi',
}.freeze
EXTENSIONS = MIME_TYPES.inject({}) { |map, (type, exts)|
exts.split(',').each do |ext| map[ext.strip] = type end
map
}
# returns mime type for name or nil if unknown
def self.of(name)
return nil unless name
m = name.to_s.match(/(\A|\.)([^\.]+)\z/)
EXTENSIONS[m[2].downcase] if m
end
# Returns the css class associated to
# the mime type of name
def self.css_class_of(name)
mime = of(name)
mime && mime.gsub('/', '-')
end
def self.main_mimetype_of(name)
mimetype = of(name)
mimetype.split('/').first if mimetype
end
# return true if mime-type for name is type/*
# otherwise false
def self.is_type?(type, name)
main_mimetype = main_mimetype_of(name)
type.to_s == main_mimetype
end
def self.narrow_type(name, content_type)
(content_type.split('/').first == main_mimetype_of(name)) ? of(name) : content_type
end
end
end
| 35.991667 | 92 | 0.624682 |
877568bfe4bfbba2b54f4ba8a0ddd583202741ce | 439 | require "spec_helper"
require 'benchmark'
require 'matrix'
RSpec.describe "Hello world sample" do
it "prints hello world" do
# Simple hello world using TensorStream
# Create a Constant op
hello = TensorStream.constant('Hello, TensorStream!')
# Start the TensorStream session
sess = TensorStream.session(:ruby_evaluator)
expect(sess.run(hello)).to eq('Hello, TensorStream!')
puts(sess.run(hello))
end
end | 24.388889 | 57 | 0.71754 |
4a7b14f3427e293f92d4d8c12692e5d112a87258 | 3,508 | #------------------------------------------------------------------------------
describe 'api' do
#------------------------------------------------------------------------------
it 'renderer' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'spoiler',
{ render: lambda {|tokens, idx, _options, env, renderer|
tokens[idx].nesting == 1 ? "<details><summary>click me</summary>\n" : "</details>\n" }})
res = md.render("::: spoiler\n*content*\n:::\n")
expect(res).to eq "<details><summary>click me</summary>\n<p><em>content</em></p>\n</details>\n"
end
#------------------------------------------------------------------------------
it '2 char marker' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'spoiler', {marker: '->'})
res = md.render("->->-> spoiler\n*content*\n->->->\n")
expect(res).to eq "<div class=\"spoiler\">\n<p><em>content</em></p>\n</div>\n"
end
#------------------------------------------------------------------------------
it 'marker should not collide with fence' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'spoiler', {marker: '`'})
res = md.render("``` spoiler\n*content*\n```\n")
expect(res).to eq "<div class=\"spoiler\">\n<p><em>content</em></p>\n</div>\n"
end
#------------------------------------------------------------------------------
it 'marker should not collide with fence #2' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'spoiler', {marker: '`'})
res = md.render("\n``` not spoiler\n*content*\n```\n")
expect(res).to eq "<pre><code class=\"language-not\">*content*\n</code></pre>\n"
end
#------------------------------------------------------------------------------
describe 'validator' do
#------------------------------------------------------------------------------
it 'should skip rule if return value is falsy' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'name', {validate: lambda {|params| false} })
res = md.render(":::foo\nbar\n:::\n")
expect(res).to eq "<p>:::foo\nbar\n:::</p>\n"
end
#------------------------------------------------------------------------------
it 'should accept rule if return value is true' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'name', {validate: lambda {|params| true} })
res = md.render(":::foo\nbar\n:::\n")
expect(res).to eq "<div class=\"name\">\n<p>bar</p>\n</div>\n"
end
#------------------------------------------------------------------------------
it 'rule should call it' do
count = 0
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'name', {validate: lambda {|params| count += 1} })
md.parse(":\n::\n:::\n::::\n:::::\n", {})
# called by paragraph and lheading 3 times each
expect(count).to be > 0
expect(count % 3).to eq 0
end
#------------------------------------------------------------------------------
it 'should not trim params' do
md = MarkdownIt::Parser.new
md.use(MotionMarkdownItPlugins::Container, 'name',
{validate: lambda do |params|
expect(params).to eq " \tname "
return 1
end
})
md.parse("::: \tname \ncontent\n:::\n", {})
end
end
end
| 41.761905 | 106 | 0.446123 |
26aa12d92d666ec2c106d0d1164042cbdad79273 | 480 | cask '[email protected]' do
version '1.4.5'
sha256 '7a5e2aff2e1d64a97eafc63d36aa561e5d44a036912b359c3e34d1e1e7f2ec91'
# releases.hashicorp.com was verified as official when first introduced to the cask
url 'https://releases.hashicorp.com/consul/1.4.5/consul_1.4.5_darwin_amd64.zip'
appcast 'https://github.com/hashicorp/consul/releases.atom'
name 'Consul'
homepage 'https://www.consul.io/'
auto_updates false
conflicts_with formula: 'consul'
binary 'consul'
end
| 30 | 85 | 0.766667 |
bfb4d9358f09c5c24617621a2e919c82ac33b1a0 | 173 | # frozen_string_literal: true
class ChargeOrderJob < ApplicationJob
queue_as :default
def perform(order, pay_type_params)
order.charge!(pay_type_params)
end
end
| 17.3 | 37 | 0.780347 |
61c4700784826bde649361f4adf6e6d9b7628c16 | 730 | # frozen_string_literal: true
module Idnow
module API
module AutomatedTesting
HOST = 'https://api.test.idnow.de'
def testing_start(transaction_number:)
path = full_path_for("identifications/#{transaction_number}/start")
request = Idnow::PostJsonRequest.new(path, {})
execute(request, 'X-API_KEY' => @api_key, http_client: automated_testing_http_client)
end
def testing_request_video_chat(transaction_number:)
path = full_path_for("identifications/#{transaction_number}/requestVideoChat")
request = Idnow::PostJsonRequest.new(path, {})
execute(request, 'X-API_KEY' => @api_key, http_client: automated_testing_http_client)
end
end
end
end
| 33.181818 | 93 | 0.70274 |
1144ee9369db095a8c5ddd4fa062a5f972f0f565 | 6,198 | # frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Quality::Helm3Client do
let(:namespace) { 'review-apps-ee' }
let(:release_name) { 'my-release' }
let(:raw_helm_list_page1) do
<<~OUTPUT
[
{"name":"review-qa-60-reor-1mugd1","namespace":"#{namespace}","revision":1,"updated":"2020-04-03 17:27:10.245952 +0800 +08","status":"failed","chart":"gitlab-1.1.3","app_version":"12.9.2"},
{"name":"review-7846-fix-s-261vd6","namespace":"#{namespace}","revision":2,"updated":"2020-04-02 17:27:12.245952 +0800 +08","status":"deployed","chart":"gitlab-1.1.3","app_version":"12.9.2"},
{"name":"review-7867-snowp-lzo3iy","namespace":"#{namespace}","revision":1,"updated":"2020-04-02 15:27:12.245952 +0800 +08","status":"deployed","chart":"gitlab-1.1.3","app_version":"12.9.1"},
{"name":"review-6709-group-2pzeec","namespace":"#{namespace}","revision":2,"updated":"2020-04-01 21:27:12.245952 +0800 +08","status":"failed","chart":"gitlab-1.1.3","app_version":"12.9.1"}
]
OUTPUT
end
let(:raw_helm_list_page2) do
<<~OUTPUT
[
{"name":"review-6709-group-t40qbv","namespace":"#{namespace}","revision":2,"updated":"2020-04-01 11:27:12.245952 +0800 +08","status":"deployed","chart":"gitlab-1.1.3","app_version":"12.9.1"}
]
OUTPUT
end
let(:raw_helm_list_empty) do
<<~OUTPUT
[]
OUTPUT
end
subject { described_class.new(namespace: namespace) }
describe '#releases' do
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.releases.to_a }.to raise_error(described_class::CommandFailedError)
end
it 'calls helm list with default arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
subject.releases.to_a
end
it 'calls helm list with extra arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json --deployed)])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
subject.releases(args: ['--deployed']).to_a
end
it 'returns a list of Release objects' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json --deployed)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page2, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_empty, '', double(success?: true)))
releases = subject.releases(args: ['--deployed']).to_a
expect(releases.size).to eq(1)
expect(releases[0]).to have_attributes(
name: 'review-6709-group-t40qbv',
revision: 2,
last_update: Time.parse('2020-04-01 11:27:12.245952 +0800 +08'),
status: 'deployed',
chart: 'gitlab-1.1.3',
app_version: '12.9.1',
namespace: namespace
)
end
it 'automatically paginates releases' do
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 0 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page1, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 256 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_page2, '', double(success?: true)))
expect(Gitlab::Popen).to receive(:popen_with_detail).ordered
.with([%(helm list --namespace "#{namespace}" --max 256 --offset 512 --output json)])
.and_return(Gitlab::Popen::Result.new([], raw_helm_list_empty, '', double(success?: true)))
releases = subject.releases.to_a
expect(releases.size).to eq(5)
expect(releases.last.name).to eq('review-6709-group-t40qbv')
end
end
describe '#delete' do
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm uninstall --namespace "#{namespace}" #{release_name})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.delete(release_name: release_name) }.to raise_error(described_class::CommandFailedError)
end
it 'calls helm uninstall with default arguments' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm uninstall --namespace "#{namespace}" #{release_name})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
expect(subject.delete(release_name: release_name)).to eq('')
end
context 'with multiple release names' do
let(:release_name) { %w[my-release my-release-2] }
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm uninstall --namespace "#{namespace}" #{release_name.join(' ')})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: false)))
expect { subject.delete(release_name: release_name) }.to raise_error(described_class::CommandFailedError)
end
it 'calls helm uninstall with multiple release names' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(helm uninstall --namespace "#{namespace}" #{release_name.join(' ')})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
expect(subject.delete(release_name: release_name)).to eq('')
end
end
end
end
| 46.253731 | 197 | 0.632785 |
791b4c4fd18e8339852a96dae2ec82942e190ef7 | 394 | class SessionsController < ApplicationController
def new
end
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
log_in user
redirect_to user
else
flash[:danger] = 'Invalid email/password combination' # Not quite right!
render 'new'
end
end
def destroy
end
end
| 20.736842 | 78 | 0.675127 |
ac751d6e468275b866fb4e49e0b3fd31fbf15a3c | 137 | # frozen_string_literal: true
json.array!(@events) do |event|
json.extract! event, :id
json.url event_url(event, format: :json)
end
| 19.571429 | 42 | 0.722628 |
bf15321ebbe8a99fff70d590aee0eb4dc3d2e541 | 5,608 | ##########################GO-LICENSE-START################################
# Copyright 2014 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##################################
require File.join(File.dirname(__FILE__), "..", "spec_helper")
describe "agent_bulk_editor" do
include AgentBulkEditor
before :each do
allow(self).to receive(:agent_service).and_return(@agent_service = double('agent-service'))
allow(self).to receive(:current_user).and_return(@user = Object.new)
end
it "should enable selected agents" do
@agent_service.should_receive(:enableAgents).with(@user, anything(), ["UUID1", "UUID2"]) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Enable', :selected => ["UUID1", "UUID2"], :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should disable selected agents" do
@agent_service.should_receive(:disableAgents).with(@user, anything(), ["UUID1", "UUID2"]) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Disable', :selected => ["UUID1", "UUID2"], :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should delete selected agents" do
@agent_service.should_receive(:deleteAgents).with(@user, anything(), ["UUID1", "UUID2"]) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Delete', :selected => ["UUID1", "UUID2"], :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should add resources to selected agents" do
selections = [TriStateSelection.new("new-resource", 'add')]
@agent_service.should_receive(:modifyResources).with(@user, anything(), ["UUID1", "UUID2"], selections) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Add_Resource', :selected => ["UUID1", "UUID2"], :add_resource => "new-resource", :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should add multiple resources to selected agents" do
selections = [TriStateSelection.new("new-resource", 'add'), TriStateSelection.new("old-resource", 'remove')]
@agent_service.should_receive(:modifyResources).with(@user, anything(), ["UUID1", "UUID2"], selections) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Apply_Resource', :selected => ["UUID1", "UUID2"], :selections => {"new-resource" => 'add', "old-resource" => "remove"}, :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should add/remove agents from environments" do
selections = [TriStateSelection.new("uat", 'add'), TriStateSelection.new("prod", 'remove')]
@agent_service.should_receive(:modifyEnvironments).with(@user, anything(), ["UUID1", "UUID2"], selections) do |user, result, uuids|
result.ok("Accepted")
end
params = {:operation => 'Apply_Environment', :selected => ["UUID1", "UUID2"], :selections => {"uat" => 'add', "prod" => "remove"}, :no_layout => true}
allow(self).to receive(:params).and_return(params)
bulk_edit
end
it "should show message if there is a problem" do
@agent_service.should_receive(:enableAgents).with(@user, anything(), ["UUID1", "UUID2"]) do |user, result, uuids|
result.notAcceptable("Error message", HealthStateType.general(HealthStateScope::GLOBAL))
end
params = { :operation => 'Enable', :selected => ["UUID1", "UUID2"], :no_layout => true }
allow(self).to receive(:params).and_return(params)
expect(bulk_edit.message()).to eq("Error message")
end
it "should show message for a successful bulk_edit" do
@agent_service.should_receive(:enableAgents).with(@user, anything(), ["UUID1", "UUID2"]) do |user, result, uuids|
result.ok("Enabled 3 agent(s)")
end
params = {:operation => 'Enable', :selected => ["UUID1", "UUID2"], :no_layout => true}
allow(self).to receive(:params).and_return(params)
expect(bulk_edit.message()).to eq("Enabled 3 agent(s)")
end
it "should show message for an unrecognised operation" do
params = {:operation => 'BAD_OPERATION', :selected => ["UUID1", "UUID2"], :no_layout => true}
allow(self).to receive(:params).and_return(params)
expect(bulk_edit.message()).to eq("The operation BAD_OPERATION is not recognized.")
end
it "should show error if selected parameter is omitted" do
params = {:operation => 'Enable', :no_layout => true}
allow(self).to receive(:params).and_return(params)
expect(bulk_edit.message()).to eq("No agents were selected. Please select at least one agent and try again.")
end
it "should show error if no agents are selected" do
params = {:operation => 'Enable', :selected => [], :no_layout => true}
allow(self).to receive(:params).and_return(params)
expect(bulk_edit.message()).to eq("No agents were selected. Please select at least one agent and try again.")
end
end
| 42.484848 | 168 | 0.669044 |
33e721ea45750d7cfd57546c76dc7a5241c81e63 | 1,012 | require 'spec_helper'
describe Omnivault::AbstractVault do
before do
# Override parent class initialization exception in tests
described_class.send(:define_method, :initialize) {}
end
describe '#configure_aws!' do
before do
allow(subject).to receive(:entries) do
{
'AWS_ACCESS_KEY_ID' => 'id',
'AWS_SECRET_ACCESS_KEY' => 'secret'
}
end
end
it 'configures credentials for aws-sdk-v1' do
require 'aws-sdk-v1'
subject.configure_aws!
v1_credentials = AWS.config.credential_provider.credentials
expect(v1_credentials[:access_key_id]).to eq 'id'
expect(v1_credentials[:secret_access_key]).to eq 'secret'
end
it 'configures credentials for aws-sdk-v2' do
require 'aws-sdk'
subject.configure_aws!
v2_credentials = Aws.config[:credentials].credentials
expect(v2_credentials.access_key_id).to eq 'id'
expect(v2_credentials.secret_access_key).to eq 'secret'
end
end
end
| 27.351351 | 65 | 0.678854 |
ab0af2cf60c886eec67a3b4bc48a7c78ae068cec | 1,269 | require 'pbl/models/concerns/base'
module Pbl
module Models
module Projects
class Project
include Pbl::Models::Users::Base
include ActiveModel::Validations::Callbacks
include ActiveModel::Serializers::JSON
# attribute :id, String
# attribute :name, String
# attribute :description, String
# attribute :driven_issue, String
# attribute :standard_analysis, String
# attribute :duration, Integer
# attribute :public, Boolean
# attribute :limitation, String
# attribute :location_id, Integer
# attribute :grade_id, Integer
# attribute :rule_head, String
# attribute :rule_template, String
class << self
def release(id, params = {})
response = client.custom("#{id}/actions/release", params: query_string(params), method: :patch)
response_class.build(self, response, :update)
end
private
def client
@client ||= Pbl::Base::Client.new(model_name: model_origin_name.pluralize, name_space: 'pbl')
end
def model_origin_name
self.name.demodulize.to_s.underscore.downcase
end
end
end
end
end
end | 27.586957 | 107 | 0.608353 |
7ab6c166533787218c7069148e5d309cea9ac11a | 1,137 | Pod::Spec.new do |s|
s.name = 'TDSwipeSheet'
s.version = '1.1'
s.summary = 'TDSwipeSheet is a simple and easy to integrate solution for presenting UIViewController or any view in bottom or top sheet'
s.description = <<-DESC
TDSwipeSheet is a simple and easy to integrate solution for presenting UIViewController or any view in bottom or top sheet. We handle all the hard work for you - transitions, gestures, taps and more are all automatically provided by the library. Styling, however, is intentionally left out, allowing you to integrate your own design with ease.
DESC
s.homepage = 'http://topdevs.org'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Andrew' => '[email protected]' }
s.source = { :git => 'https://github.com/TheTopDevs/TDSwipeSheet.git', :branch => "master", :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.platform = :ios
s.source_files = 'TDSwipeSheet/*.{h,m}'
s.resource = "TDSwipeSheet/*.{png,bundle,xib,nib}"
end
| 51.681818 | 347 | 0.620932 |
33c7e084aa29568b7247d8fddbf135f813bb5c9f | 2,445 | class Gazebo2 < Formula
desc "Gazebo robot simulator"
homepage "http://gazebosim.org"
url "https://osrf-distributions.s3.amazonaws.com/gazebo/releases/gazebo-2.2.6.tar.bz2"
sha256 "c5e886a9d43a99865d3393dab643493c906c106781ea2ee50555bb8dcf03bd81"
license "Apache-2.0"
head "https://github.com/osrf/gazebo.git", branch: "gazebo_2.2"
deprecate! because: "is past end-of-life date", date: "2016-01-25"
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "bullet"
depends_on "cartr/qt4/qt@4"
depends_on "doxygen"
depends_on "freeimage"
depends_on "libtar"
depends_on "ogre"
depends_on "protobuf"
depends_on "protobuf-c"
depends_on "sdformat"
depends_on "simbody"
depends_on "tbb"
depends_on "tinyxml"
conflicts_with "gazebo3", because: "differing version of the same formula"
conflicts_with "gazebo4", because: "differing version of the same formula"
conflicts_with "gazebo5", because: "differing version of the same formula"
conflicts_with "gazebo6", because: "differing version of the same formula"
conflicts_with "gazebo7", because: "differing version of the same formula"
conflicts_with "gazebo8", because: "differing version of the same formula"
patch do
# Fix build when homebrew python is installed
url "https://gist.githubusercontent.com/scpeters/9199370/raw/afe595587e38737c537124a3652db99de026c272/brew_python_fix.patch"
sha256 "c4774f64c490fa03236564312bd24a8630963762e25d98d072e747f0412df18e"
end
patch do
# Fix for compatibility with boost 1.58
url "https://github.com/osrf/gazebo/commit/5f533662e72cf63c18f122a21cdc61599238d4c5.patch?full_index=1"
sha256 "43453d5c7b97dc55ef88797dd488b7a7111de72521a2cdd44f8d68188e2db7ee"
end
patch do
# Fix for compatibility with boost 1.62
url "https://github.com/osrf/gazebo/commit/ff37ecfed0af9da0e9e98f26fa49217f51c4ac0f.patch?full_index=1"
sha256 "374954bafa9cee8299839bc46039cf8296dd692878fabd2f87fabdee5bcddcca"
end
def install
cmake_args = std_cmake_args
cmake_args << "-DENABLE_TESTS_COMPILATION:BOOL=False"
cmake_args << "-DFORCE_GRAPHIC_TESTS_COMPILATION:BOOL=True"
cmake_args << "-DDARTCore_FOUND:BOOL=False"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end
end
test do
system "gazebo", "--help"
end
end
| 34.928571 | 128 | 0.754601 |
9161f2a0038f7fafb115a179cb777b99f2b4c13a | 181 | class TestImageDefinitionFactory
def create(image_name, image_dir = nil)
KuberKit::Core::ImageDefinition
.new(image_name, image_dir || "/images/#{image_name}")
end
end | 30.166667 | 60 | 0.734807 |
7abc310adb2e9a296ffd11114a7fbdf05576ca06 | 2,361 | # encoding: utf-8
require 'spec_helper'
describe 'url input' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
end
describe "when object is provided" do
before do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:url))
end)
end
it_should_have_input_wrapper_with_class(:url)
it_should_have_input_wrapper_with_class("control-group")
it_should_have_input_wrapper_with_class(:stringish)
it_should_have_input_class_in_the_right_place
it_should_have_input_wrapper_with_id("post_url_input")
it_should_have_label_with_text(/Url/)
it_should_have_label_for("post_url")
it_should_have_input_with_id("post_url")
it_should_have_input_with_type(:url)
it_should_have_input_with_name("post[url]")
end
describe "when namespace is provided" do
before do
concat(semantic_form_for(@new_post, :namespace => "context2") do |builder|
concat(builder.input(:url))
end)
end
it_should_have_input_wrapper_with_id("context2_post_url_input")
it_should_have_label_and_input_with_id("context2_post_url")
end
describe "when index is provided" do
before do
@output_buffer = ''
mock_everything
concat(semantic_form_for(@new_post) do |builder|
concat(builder.fields_for(:author, :index => 3) do |author|
concat(author.input(:name, :as => :url))
end)
end)
end
it 'should index the id of the wrapper' do
output_buffer.should have_tag("div#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
output_buffer.should have_tag("input#post_author_attributes_3_name")
end
it 'should index the name of the select tag' do
output_buffer.should have_tag("input[@name='post[author_attributes][3][name]']")
end
end
describe "when required" do
it "should add the required attribute to the input's html options" do
with_config :use_required_attribute, true do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :url, :required => true))
end)
output_buffer.should have_tag("input[@required]")
end
end
end
end
| 26.829545 | 86 | 0.707751 |
39c9b8f22ea1d7f4277ede725af17202af7cc7f8 | 13,087 | module Archimate
module Examples
module Factories
def build_any_attribute(attribute: nil, prefix: "", value: nil)
DataModel::AnyAttribute.new(
attribute: attribute || Faker::Company.buzzword.downcase,
value: value || Faker::Company.buzzword,
prefix: prefix
)
end
def build_any_element(element: nil, prefix: "", attributes: [], content: nil, children: [])
DataModel::AnyElement.new(
element: element || Faker::Company.buzzword.downcase,
prefix: prefix,
attributes: attributes,
content: content,
children: children
)
end
def build_bounds(options = {})
DataModel::Bounds.new(
x: fetch_or_fake_positive_number(options, :x),
y: fetch_or_fake_positive_number(options, :y),
width: fetch_or_fake_positive_number(options, :width),
height: fetch_or_fake_positive_number(options, :height)
)
end
def build_color(options = {})
DataModel::Color.new(
r: options.fetch(:r) { random(0, 255) },
g: options.fetch(:g) { random(0, 255) },
b: options.fetch(:b) { random(0, 255) },
a: options.fetch(:a) { random(0, 100) }
)
end
def build_concern(label: nil, documentation: nil, stakeholders: nil)
DataModel::Concern.new(
label: label || DataModel::LangString.new(Faker::Company.buzzword),
documentation: documentation,
stakeholders: stakeholders || []
)
end
def build_connection(options = {})
diagram = options.fetch(:diagram) { build_diagram }
relationship = options.fetch(:relationship) do
build_relationship(
source: build_element,
target: build_element
)
end
source = options.fetch(:source) { build_view_node(element: relationship&.source, diagram: diagram) }
target = options.fetch(:target) { build_view_node(element: relationship&.target, diagram: diagram) }
DataModel::Connection.new(
id: fetch_or_fake_id(options),
name: fetch_or_fake_name(options),
documentation: optional_documentation(options),
type: options.fetch(:type) { random_element_type },
source_attachment: options.fetch(:source_attachment, nil),
bendpoints: options.fetch(:bendpoints, []),
target_attachment: options.fetch(:target_attachment, nil),
source: source,
target: target,
relationship: relationship,
style: options.fetch(:style, nil),
properties: options.fetch(:properties, []),
diagram: diagram
)
end
def build_diagram(options = {})
diagram = DataModel::Diagram.new(
id: fetch_or_fake_id(options),
name: fetch_or_fake_name(options),
viewpoint: options.fetch(:viewpoint, nil),
documentation: options.fetch(:documentation, nil),
properties: options.fetch(:properties, []),
nodes: [],
connections: [],
connection_router_type: nil,
type: options.fetch(:type, nil),
background: options.fetch(:background, nil)
)
diagram.nodes = options.fetch(:nodes) { build_view_nodes(diagram: diagram) }
diagram
end
def build_diagram_list(options)
elements = options.fetch(:elements, [])
relationships = options.fetch(:relationships, [])
count = options.fetch(:with_diagrams, 0)
(1..count).map do
diagram = build_diagram(nodes: [])
diagram.nodes = relationships.map do |rel|
[build_view_node(diagram: diagram, element: elements.find { |i| i == rel.source }, relationships: [rel]),
build_view_node(diagram: diagram, element: elements.find { |i| i == rel.target }, relationships: [])]
end.flatten
diagram
end
end
def build_documentation(options = {})
DataModel::PreservedLangString.new(lang_hash: {"en" => "Something", "es" => "Hola"}, default_lang: "en")
end
def build_element(options = {})
cls_name = options.delete(:type)
if cls_name
if cls_name.is_a?(Class)
cls = cls_name
else
cls = DataModel::Elements.const_get(cls_name)
end
else
cls = random_element_type
end
cls.new(
id: fetch_or_fake_id(options),
name: fetch_or_fake_name(options),
documentation: optional_documentation(options),
properties: options.fetch(:properties, [])
)
end
def build_element_list(options = {})
given_elements = options.fetch(:elements, [])
given_element_count = given_elements.size
el_count = [options.fetch(:with_relationships, 0) * 2, options.fetch(:with_elements, 0) + given_element_count].max
count = el_count - given_element_count
given_elements = given_elements.values if given_elements.is_a? Hash
(1..count).map { build_element(options) } + given_elements
end
def build_font(options = {})
DataModel::Font.new(
name: options.fetch(:name) { Faker::Name.name },
size: options.fetch(:size) { random(6, 20) },
style: options.fetch(:style) { random(0, 3) },
font_data: nil
)
end
def build_location(options = {})
DataModel::Location.new(
x: options.fetch(:x) { random(0, 1000) },
y: options.fetch(:y) { random(0, 1000) }
)
end
def build_model(options = {})
elements = build_element_list(options)
relationships = build_relationship_list(options.merge(elements: elements))
diagrams = options.fetch(:diagrams) { build_diagram_list(options.merge(elements: elements, relationships: relationships)) }
organizations = options.fetch(:organizations) { build_organization_list(options) }
DataModel::Model.new(
id: fetch_or_fake_id(options),
name: fetch_or_fake_name(options),
documentation: optional_documentation(options),
properties: options.fetch(:properties, []),
elements: elements,
organizations: organizations,
relationships: relationships,
property_definitions: options.fetch(:property_definitions, []),
diagrams: diagrams,
viewpoints: [],
filename: options.fetch(:filename, nil),
file_format: options.fetch(:file_format, nil),
archimate_version: options.fetch(:archimate_version, :archimate_3_0),
version: options.fetch(:version, nil),
namespaces: {},
schema_locations: []
).organize
end
def build_organization(options = {})
DataModel::Organization.new(
id: fetch_or_fake_id(options),
name: fetch_or_fake_name(options),
type: options.fetch(:type, nil),
documentation: optional_documentation(options),
items: options.fetch(:items, []),
organizations: options.fetch(:organizations, [])
)
end
def build_organization_list(options)
count = options.fetch(:with_organizations, 0)
(1..count).map do
build_organization(
items: options.fetch(:items, []),
organizations: options.fetch(:child_organizations, [])
)
end
end
def build_preserved_lang_string(options = {})
DataModel::PreservedLangString.new(
lang_hash: options.fetch(:lang_hash) { { nil => "##{random(1, 1_000_000)} #{Faker::ChuckNorris.fact}" } },
default_lang: options.fetch(:default_lang, nil)
)
end
def build_property(options = {})
value = options.fetch(:value) { Faker::Company.buzzword }
value = DataModel::LangString.new(value) if value
DataModel::Property.new(
value: value,
property_definition:
options.fetch(:property_definition) { build_property_definition(name: options.fetch(:key, nil)) }
)
end
def build_property_definition(id: nil, name: nil, documentation: nil, type: "string")
DataModel::PropertyDefinition.new(
id: id || build_id,
name: name || DataModel::LangString.new(Faker::Company.buzzword),
documentation: documentation,
type: type
)
end
def build_relationship(options = {})
cls_name = options.delete(:type)
if cls_name
cls_name = cls_name.sub(/Relationship$/, "")
cls = DataModel::Relationships.const_get(cls_name)
else
cls = random_relationship_type
end
cls.new(
id: fetch_or_fake_id(options),
source: options.fetch(:source) { build_element },
target: options.fetch(:target) { build_element },
name: fetch_or_fake_name(options),
documentation: optional_documentation(options),
properties: options.fetch(:properties, []),
access_type: options.fetch(:access_type, nil)
)
end
def build_relationship_list(options = {})
count = options.fetch(:with_relationships, 0)
other_rels = options.fetch(:relationships, [])
elements = options.fetch(:elements, []).dup
needed_elements = [0, count * 2 - elements.size].max
elements.concat(build_element_list(with_elements: needed_elements)) unless needed_elements.zero?
(1..count).map do
src, target = elements.shift(2)
build_relationship(source: src, target: target)
end + other_rels
end
def build_style(options = {})
DataModel::Style.new(
text_alignment: random(0, 2),
fill_color: build_color,
line_color: build_color,
font_color: build_color,
line_width: random(1, 10),
font: build_font,
text_position: nil
)
end
def build_view_node(options = {})
diagram = options.fetch(:diagram) { build_diagram }
node_element = options.fetch(:element) { build_element }
relationships = options.fetch(:relationships, [])
with_nodes = build_view_nodes(count: options.delete(:with_nodes) || 0)
connections = options.fetch(
:connections,
relationships.map { |rel| build_connection(relationship: rel) }
)
DataModel::ViewNode.new(
id: fetch_or_fake_id(options),
type: "archimate:DiagramObject",
parent: options.fetch(:parent, nil),
view_refs: nil,
name: options[:name],
nodes: options.fetch(:nodes) { with_nodes },
element: options.fetch(:element) { node_element },
bounds: options.fetch(:bounds) { build_bounds },
connections: connections,
style: build_style,
child_type: options.fetch(:child_type, nil),
documentation: options.fetch(:documentation, nil),
diagram: diagram
)
end
def build_view_nodes(options = {})
(1..options.fetch(:count, 3)).map { build_view_node(options) }
end
########################################################
# Diff Builders
########################################################
def build_diff_list(options = {})
(1..options.fetch(:with_diffs, 3)).map { build_diff(options) }
end
def build_diff(options = {})
model = options.fetch(:model) { build_model }
Diff::Insert.new(Diff::ArchimateNodeAttributeReference.new(model, :name))
end
########################################################
# Helpers
########################################################
def build_id
Faker::Number.hexadecimal(8)
end
def fetch_or_fake_id(options = {})
options.fetch(:id) { build_id }
end
def fetch_or_fake_name(options)
return nil if options.include?(:name) && options[:name].nil?
DataModel::LangString.new(options.fetch(:name) { Faker::Company.buzzword })
end
def fetch_or_fake_positive_number(options, key)
options.fetch(key) { Faker::Number.positive }
end
def optional_documentation(options)
attrs = options[:documentation]
return nil unless attrs
DataModel::PreservedLangString.new(attrs)
end
def random(min, max)
@random ||= Random.new(Random.new_seed)
@random.rand(max - min) + min
end
def random_element_type
@random ||= Random.new(Random.new_seed)
@el_types ||= Archimate::DataModel::Elements.classes
@el_types[@random.rand(@el_types.size)]
end
def random_relationship_type
@random ||= Random.new(Random.new_seed)
@rel_types ||= Archimate::DataModel::Relationships.classes
@rel_types[@random.rand(@rel_types.size)]
end
end
end
end
| 36.454039 | 131 | 0.593184 |
01e6fdb2d3e3797ac3c246e956494c21f58327cf | 4,221 | # frozen_string_literal: true
module ObjectStorage
class MigrateUploadsWorker
include ApplicationWorker
include ObjectStorageQueue
feature_category_not_owned!
SanityCheckError = Class.new(StandardError)
class MigrationResult
attr_reader :upload
attr_accessor :error
def initialize(upload, error = nil)
@upload, @error = upload, error
end
def success?
error.nil?
end
def to_s
success? ? _("Migration successful.") : _("Error while migrating %{upload_id}: %{error_message}") % { upload_id: upload.id, error_message: error.message }
end
end
module Report
class MigrationFailures < StandardError
attr_reader :errors
def initialize(errors)
@errors = errors
end
def message
errors.map(&:message).join("\n")
end
end
# rubocop:disable Gitlab/RailsLogger
def report!(results)
success, failures = results.partition(&:success?)
Rails.logger.info header(success, failures)
Rails.logger.warn failures(failures)
raise MigrationFailures.new(failures.map(&:error)) if failures.any?
end
# rubocop:enable Gitlab/RailsLogger
def header(success, failures)
_("Migrated %{success_count}/%{total_count} files.") % { success_count: success.count, total_count: success.count + failures.count }
end
def failures(failures)
failures.map { |f| "\t#{f}" }.join('\n')
end
end
include Report
# rubocop: disable CodeReuse/ActiveRecord
def self.enqueue!(uploads, model_class, mounted_as, to_store)
sanity_check!(uploads, model_class, mounted_as)
perform_async(uploads.ids, model_class.to_s, mounted_as, to_store)
end
# rubocop: enable CodeReuse/ActiveRecord
# We need to be sure all the uploads are for the same uploader and model type
# and that the mount point exists if provided.
#
def self.sanity_check!(uploads, model_class, mounted_as)
upload = uploads.first
uploader_class = upload.uploader.constantize
uploader_types = uploads.map(&:uploader).uniq
model_types = uploads.map(&:model_type).uniq
model_has_mount = mounted_as.nil? || model_class.uploaders[mounted_as] == uploader_class
raise(SanityCheckError, _("Multiple uploaders found: %{uploader_types}") % { uploader_types: uploader_types }) unless uploader_types.count == 1
raise(SanityCheckError, _("Multiple model types found: %{model_types}") % { model_types: model_types }) unless model_types.count == 1
raise(SanityCheckError, _("Mount point %{mounted_as} not found in %{model_class}.") % { mounted_as: mounted_as, model_class: model_class }) unless model_has_mount
end
# rubocop: disable CodeReuse/ActiveRecord
def perform(*args)
args_check!(args)
(ids, model_type, mounted_as, to_store) = args
@model_class = model_type.constantize
@mounted_as = mounted_as&.to_sym
@to_store = to_store
uploads = Upload.preload(:model).where(id: ids)
sanity_check!(uploads)
results = migrate(uploads)
report!(results)
rescue SanityCheckError => e
# do not retry: the job is insane
Rails.logger.warn "#{self.class}: Sanity check error (#{e.message})" # rubocop:disable Gitlab/RailsLogger
end
# rubocop: enable CodeReuse/ActiveRecord
def sanity_check!(uploads)
self.class.sanity_check!(uploads, @model_class, @mounted_as)
end
def args_check!(args)
return if args.count == 4
case args.count
when 3 then raise SanityCheckError, _("Job is missing the `model_type` argument.")
else
raise SanityCheckError, _("Job has wrong arguments format.")
end
end
def build_uploaders(uploads)
uploads.map { |upload| upload.retrieve_uploader(@mounted_as) }
end
def migrate(uploads)
build_uploaders(uploads).map(&method(:process_uploader))
end
def process_uploader(uploader)
MigrationResult.new(uploader.upload).tap do |result|
uploader.migrate!(@to_store)
rescue => e
result.error = e
end
end
end
end
| 30.15 | 168 | 0.669983 |
083626b22d3b9c96e04d8e7198c958d17505fe9a | 26 | puts "Hello World".reverse | 26 | 26 | 0.807692 |
9109e1c58e700d2ba3a07356afa6505aebf0e690 | 3,338 | cask "font-ysabeau" do
version "0.003"
sha256 "70b0a1041c81b1e37fb80951a84616ed40668293f872f47b97fb87a88d4c1c62"
url "https://github.com/CatharsisFonts/EauDeGaramond/releases/download/v#{version}/Ysabeau_Install_v#{version}.zip"
appcast "https://github.com/CatharsisFonts/EauDeGaramond/releases.atom"
name "Ysabeau"
homepage "https://github.com/CatharsisFonts/EauDeGaramond/"
font "Ysabeau_Install_v#{version}/Ysabeau-Black.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Bold.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-BoldItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Extralight.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-ExtralightItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Hairline.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-HairlineItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Heavy.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Italic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Light.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-LightItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Medium.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-MediumItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Regular.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Semibold.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-SemiboldItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Semilight.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-SemilightItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Thin.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-ThinItalic.ttf"
font "Ysabeau_Install_v#{version}/Ysabeau-Ultrabold.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Bold.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-BoldItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Extralight.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-ExtralightItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Hairline.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-HairlineItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Italic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Light.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-LightItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Medium.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-MediumItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Regular.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Semibold.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-SemiboldItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Semilight.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-SemilightItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-Thin.ttf"
font "Ysabeau_Install_v#{version}/YsabeauInfant-ThinItalic.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Bold.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Extralight.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Hairline.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Light.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Medium.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Regular.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Semibold.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Semilight.ttf"
font "Ysabeau_Install_v#{version}/YsabeauSC-Thin.ttf"
end
| 56.576271 | 117 | 0.804074 |
e89f6dab0a067ea9c2e6f84c75b39477e9c33c12 | 79 | require 'refinery/core_ext/uri/generic'
require 'refinery/core_ext/uri/module'
| 26.333333 | 39 | 0.822785 |
d55c771bb1bb03574a6104295a18e3e87cf45d75 | 1,507 | # frozen_string_literal: true
module SolidusYotpo
module ProductDecorator
YOTPO_ENDPOINT = {
index: 'v1/widget/%{app_key}/products/%{product_id}/reviews.json',
create: "apps/%{app_key}/products/mass_create",
update: "apps/%{app_key}/products/mass_update",
}.freeze
def self.prepended(base)
base.class_eval do
include SolidusYotpo::Model
has_many :reviews, class_name: 'SolidusYotpo::Review'
end
end
def yotpo_sync
response = yotpo_api.get(YOTPO_ENDPOINT[:index], product_id: master.sku)
sync_yotpo_reviews Array(response.dig('reviews'))
update_reviews_summary
rescue SolidusYotpo::Api::RequestFailed => e
raise e # for now
end
def sync_yotpo_reviews(raw_reviews)
raw_reviews.each do |raw_review|
update_atts = raw_review.slice('score', 'votes_up', 'votes_down', 'content', 'title')
review = reviews.find_by(external_id: raw_review['id'])
next unless review
if raw_review['deleted']
review.destroy
else
review.update(update_atts)
end
end
end
def update_reviews_summary
update(
average_score: reviews.average(:score),
star_distribution: reviews.each_with_object(Hash.new { |h, k| h[k] = 0 }) { |review, acc| acc[review.score] += 1 }.values
)
end
module ClassMethods
::Spree::Product.singleton_class.prepend(self)
end
::Spree::Product.prepend(self)
end
end
| 27.4 | 129 | 0.651626 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.