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
|
---|---|---|---|---|---|
f796658a8e4b0e9ebf878ba258bae601cb01016f
| 2,255 |
# frozen_string_literal: true
# This class is used as a proxy for all outbounding http connection
# coming from callbacks, services and hooks. The direct use of the HTTParty
# is discouraged because it can lead to several security problems, like SSRF
# calling internal IP or services.
module EyedP
class HTTP
BlockedUrlError = Class.new(StandardError)
RedirectionTooDeep = Class.new(StandardError)
ReadTotalTimeout = Class.new(Net::ReadTimeout)
HTTP_TIMEOUT_ERRORS = [
Net::OpenTimeout, Net::ReadTimeout, Net::WriteTimeout, EyedP::HTTP::ReadTotalTimeout
].freeze
HTTP_ERRORS = HTTP_TIMEOUT_ERRORS + [
SocketError, OpenSSL::SSL::SSLError, OpenSSL::OpenSSLError,
Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,
EyedP::HTTP::BlockedUrlError, EyedP::HTTP::RedirectionTooDeep
].freeze
DEFAULT_TIMEOUT_OPTIONS = {
open_timeout: 10,
read_timeout: 20,
write_timeout: 30
}.freeze
DEFAULT_READ_TOTAL_TIMEOUT = 20.seconds
include HTTParty
class << self
alias httparty_perform_request perform_request
end
def self.perform_request(http_method, path, options, &block) # rubocop:disable Metrics/MethodLength
options_with_timeouts =
if options.key?(:timeout)
options
else
options.with_defaults(DEFAULT_TIMEOUT_OPTIONS)
end
unless options.key?(:use_read_total_timeout)
return httparty_perform_request(http_method, path, options_with_timeouts, &block)
end
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
read_total_timeout = options.fetch(:timeout, DEFAULT_READ_TOTAL_TIMEOUT)
httparty_perform_request(http_method, path, options_with_timeouts) do |fragment|
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time
raise ReadTotalTimeout, "Request timed out after #{elapsed} seconds" if elapsed > read_total_timeout
block&.call fragment
end
rescue HTTParty::RedirectionTooDeep
raise RedirectionTooDeep
rescue *HTTP_ERRORS => e
raise e
end
def self.try_get(path, options = {}, &block)
get(path, options, &block)
rescue *HTTP_ERRORS
nil
end
end
end
| 32.681159 | 108 | 0.715299 |
4aa25281e93ad223e8f4125dbb277a4f0bd99b1f
| 2,540 |
# frozen_string_literal: true
RSpec.describe SqsSimplify::Worker do
context 'instance methods' do
before(:all) { SqsSimplify.configure.faker = true }
after(:all) { SqsSimplify.configure.faker = nil }
context '#perform' do
it 'must return an Integer' do
worker = SqsSimplify::Worker.new
response = worker.perform
expect(response).to be_an(Integer)
end
it 'should throw an exception when there is no consumer' do
allow_any_instance_of(SqsSimplify::Worker).to receive(:sqs_consumers).and_return([])
worker = SqsSimplify::Worker.new
expect { worker.perform }.to raise_error('No queue consumers were found in this project')
end
it 'should throw an exception when there is no consumer' do
worker = SqsSimplify::Worker.new(queues: %w[fake_queue fake_queue1])
expect { worker.perform }.to raise_error('Option queue invalid: [fake_queue, fake_queue1]')
end
context 'with queues arguments' do
before { require_relative '../examples/job_with_consumer_spec' }
it 'must match the queues' do
queues = %w[job_slow job_medium job_fast]
worker = SqsSimplify::Worker.new(queues: queues)
response = worker.perform
expect(response).to be_an(Integer)
sqs_consumers = worker.send(:sqs_consumers)
expect(sqs_consumers.map(&:queue_name)).to eq(queues)
end
it 'must return error to non existent queue' do
queues = %w[job_slow job_medium job_fast job_not_exiting]
worker = SqsSimplify::Worker.new(queues: queues)
expect { worker.perform }.to raise_error(/Option queue invalid:/)
end
it 'must execution' do
40.times { JobFast.my_method.later }
5.times { JobMedium.my_method.later }
2.times { JobSlow.my_method.later }
executions = []
queues = %w[job_fast job_slow job_medium]
worker = SqsSimplify::Worker.new(queues: queues, priority: true) do |_number, job|
executions << job.queue_name if executions.last != job.queue_name
end
response = worker.perform
expect(JobFast.count_messages).to eq(0)
expect(JobMedium.count_messages).to eq(0)
expect(JobSlow.count_messages).to eq(0)
expect(response).to eq(47)
expect(executions).to eq(%w[job_fast job_slow job_fast job_slow job_medium job_fast job_slow job_medium])
end
end
end
end
end
| 34.794521 | 115 | 0.648031 |
bb67b895711acc81a1041c1a18874e17dd135ff6
| 487 |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.12' unless defined? RAILS_GEM_VERSION
TEST_ORM = :active_record unless defined? TEST_ORM
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
config.frameworks -= [ :active_record ] unless TEST_ORM == :active_record
end
| 37.461538 | 75 | 0.784394 |
ac87bceb4798066a63a28eed81c44999edca1fe3
| 2,646 |
# encoding: UTF-8
require 'test_helper'
module Elasticsearch
module Test
class SuggestIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search
context "Suggest integration" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end
setup do
@client.indices.create index: 'test', body: {
mappings: {
d: {
properties: {
title: { type: 'text' },
suggest: {
type: 'object',
properties: {
title: { type: 'completion' },
payload: { type: 'object', enabled: false }
}
}
}
}
}
}
@client.index index: 'test', type: 'd', id: '1', body: {
title: 'One',
suggest: {
title: { input: ['one', 'uno', 'jedna'] },
payload: { id: '1' }
}
}
@client.index index: 'test', type: 'd', id: '2', body: {
title: 'Two',
suggest: {
title: { input: ['two', 'due', 'dvě'] },
payload: { id: '2' }
}
}
@client.index index: 'test', type: 'd', id: '3', body: {
title: 'Three',
suggest: {
title: { input: ['three', 'tres', 'tři'] },
payload: { id: '3' }
}
}
@client.indices.refresh index: 'test'
end
should "return suggestions" do
s = search do
suggest :title, text: 't', completion: { field: 'suggest.title' }
end
response = @client.search index: 'test', body: s.to_hash
assert_equal 2, response['suggest']['title'][0]['options'].size
assert_same_elements %w[2 3], response['suggest']['title'][0]['options'].map { |d| d['_source']['suggest']['payload']['id'] }
end
should "return a single suggestion" do
s = search do
suggest :title, text: 'th', completion: { field: 'suggest.title' }
end
response = @client.search index: 'test', body: s.to_hash
assert_equal 1, response['suggest']['title'][0]['options'].size
assert_same_elements %w[3], response['suggest']['title'][0]['options'].map { |d| d['_source']['suggest']['payload']['id'] }
end
end
end
end
end
| 31.5 | 171 | 0.471655 |
1ce9b21c8517247f50f64dc8f0990a14dcef81e1
| 779 |
# frozen_string_literal: true
require 'spec_helper'
describe 'cis_hardening::setup::sudo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Section 1.3 - Configure sudo
# Ensure sudo is installed - Section 1.3.1
it {
is_expected.to contain_package('sudo').with(
'ensure' => 'installed',
)
}
# Ensure sudo commands use pty - Section 1.3.2
it {
is_expected.to contain_file('/etc/sudoers.d/cis_sudoers_defaults.conf').with(
'ensure' => 'present',
'owner' => 'root',
'group => 'root',
mode => '0440',
)
}
it { is_expected.to compile }
end
end
end
| 21.638889 | 87 | 0.527599 |
91c94271caaf61533875411220b7b856d28c58ca
| 432 |
module Garb
module ProfileReports
def self.add_report_method(klass)
# demodulize leaves potential to redefine
# these methods given different namespaces
method_name = klass.name.to_s.demodulize.underscore
return unless method_name.length > 0
class_eval <<-CODE
def #{method_name}(opts = {}, &block)
#{klass}.results(self, opts, &block)
end
CODE
end
end
end
| 25.411765 | 57 | 0.652778 |
799373622a67ae545a885ae4cae8024c336f4aa8
| 192 |
class AddBookshelfIdToBooks < ActiveRecord::Migration[5.1]
def change
add_column :books, :bookshelf_id, :bigint
add_foreign_key :books, :bookshelves, column: :bookshelf_id
end
end
| 27.428571 | 63 | 0.760417 |
f75af7f6da950442be48f00f12f80a99de862fc4
| 133 |
json.array!(@comments) do |comment|
json.extract! comment, :id, :post_id, :body
json.url comment_url(comment, format: :json)
end
| 26.6 | 46 | 0.714286 |
b9e2e4e6884dc0ef4278159d922357047834fbed
| 1,501 |
module SessionsHelper
#logs in the given user
def log_in(user)
session[:user_id] = user.id
end
# Remembers a user in a persistent session.
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
# Returns true if the given user is the current user.
def current_user?(user)
user == current_user
end
# Returns the current logged-in user (if any)
def current_user
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id = cookies.signed[:user_id])
user = User.find_by(id: user_id)
if user && user.authenticated?(:remember, cookies[:remember_token])
log_in user
@current_user = user
end
end
end
# Returns true if the user is logged in, false otherwise.
def logged_in?
!current_user.nil?
end
# Forgets a persistent session.
def forget(user)
user.forget
cookies.delete(:user_id)
cookies.delete(:remember_token)
end
# Logs out the current user.
def log_out
forget(current_user)
session.delete(:user_id)
@current_user = nil
end
# Redirects to stored location (or to the default).
def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarding_url)
end
# Stores the URL trying to be accessed.
def store_location
session[:forwarding_url] = request.original_url if request.get?
end
end
| 23.825397 | 73 | 0.696203 |
28e56dad44362fcef13d30856a06324a9e649505
| 2,615 |
class Rollout
def initialize(redis, features=nil)
@redis = redis
@features = features
@groups = {"all" => lambda { |user| true }}
end
def activate_group(feature, group)
activate(group_key(feature), group)
end
def deactivate_group(feature, group)
deactivate(group_key(feature), group)
end
def deactivate_all(feature)
deactivate_feature(group_key(feature))
deactivate_feature(user_key(feature))
deactivate_feature(percentage_key(feature))
end
def activate_user(feature, user)
activate(user_key(feature), user.id)
end
def deactivate_user(feature, user)
deactivate(user_key(feature), user.id)
end
def define_group(group, &block)
@groups[group.to_s] = block
end
def active?(feature, user)
user_in_active_group?(feature, user) ||
user_active?(feature, user) ||
user_within_active_percentage?(feature, user)
end
def activate_percentage(feature, percentage)
key = percentage_key(feature)
raise 'Invalid feature' unless valid_feature?(key)
@redis.set(key, percentage)
end
def deactivate_percentage(feature)
deactivate_feature(percentage_key(feature))
end
def registered_features
@features
end
def active_features
active_keys = @redis.keys('feature:*')
active_keys.collect { |key| feature_name(key) }.uniq
end
private
def key(name)
"feature:#{name}"
end
def group_key(name)
"#{key(name)}:groups"
end
def user_key(name)
"#{key(name)}:users"
end
def percentage_key(name)
"#{key(name)}:percentage"
end
def user_in_active_group?(feature, user)
(@redis.smembers(group_key(feature)) || []).any? { |group| @groups.key?(group) && @groups[group].call(user) }
end
def user_active?(feature, user)
user ? @redis.sismember(user_key(feature), user.id) : false
end
def user_within_active_percentage?(feature, user)
percentage = @redis.get(percentage_key(feature))
return false if percentage.nil?
user.id % 100 < percentage.to_i
end
def activate(key, member)
raise 'Invalid feature' unless valid_feature?(key)
@redis.sadd(key, member)
end
def deactivate(key, member)
raise 'Invalid feature' unless valid_feature?(key)
@redis.srem(key, member)
end
def deactivate_feature(key)
raise 'Invalid feature' unless valid_feature?(key)
@redis.del(key)
end
def valid_feature?(key)
@features ? @features.include?(feature_name(key)) : true
end
def feature_name(key)
key.split(':')[1]
end
end
| 23.141593 | 115 | 0.668834 |
79ebb01fb9165e1a9a01dc22310944eddea9232f
| 4,715 |
require "rails_helper"
describe "create", :type => :api, vcr: true, :order => :defined do
let(:doi) { "10.5072/0000-03vc" }
let(:username) { ENV['MDS_USERNAME'] }
let(:password) { ENV['MDS_PASSWORD'] }
let(:headers) do
{ "HTTP_CONTENT_TYPE" => "text/plain",
"HTTP_AUTHORIZATION" => ActionController::HttpAuthentication::Basic.encode_credentials(username, password) }
end
it "missing valid doi parameter" do
doi = "20.5072/0000-03vc"
put "/id/doi:#{doi}", nil, headers
expect(last_response.body).to eq("error: no doi provided")
expect(last_response.status).to eq(400)
end
it "missing login credentials" do
put "/id/doi:#{doi}"
expect(last_response.headers["WWW-Authenticate"]).to eq("Basic realm=\"ez.stage.datacite.org\"")
expect(last_response.body).to eq("HTTP Basic: Access denied.\n")
expect(last_response.status).to eq(401)
end
it "wrong login credentials" do
doi = "10.5072/bc11-cqw70"
wrong_credentials = { "HTTP_CONTENT_TYPE" => "text/plain", "HTTP_AUTHORIZATION" => ActionController::HttpAuthentication::Basic.encode_credentials(username, "123") }
datacite = File.read(file_fixture('10.5072_bc11-cqw7.xml'))
url = "https://blog.datacite.org/differences-between-orcid-and-datacite-metadata/"
params = { "datacite" => datacite, "_target" => url }.to_anvl
put "/id/doi:#{doi}", params, wrong_credentials
expect(last_response.status).to eq(401)
expect(last_response.body).to eq("error: unauthorized")
end
it "no params" do
doi = "10.5072/bc11-cqw1"
put "/id/doi:#{doi}", nil, headers
expect(last_response.status).to eq(400)
response = last_response.body.from_anvl
expect(response["error"]).to eq("no _profile provided")
end
it "create new doi" do
datacite = File.read(file_fixture('10.5072_bc11-cqw7.xml'))
url = "https://blog.datacite.org/differences-between-orcid-and-datacite-metadata/"
params = { "datacite" => datacite, "_target" => url }.to_anvl
doi = "10.5072/bc11-cqw7"
put "/id/doi:#{doi}", params, headers
response = last_response.body.from_anvl
expect(response["success"]).to eq("doi:10.5072/bc11-cqw7")
expect(response["datacite"]).to eq(datacite.strip)
expect(response["_target"]).to eq(url)
expect(response["_status"]).to eq("reserved")
expect(last_response.status).to eq(200)
end
it "doi already exists" do
datacite = File.read(file_fixture('10.5072_bc11-cqw7.xml'))
url = "https://blog.datacite.org/differences-between-orcid-and-datacite-metadata/"
params = { "datacite" => datacite, "_target" => url }.to_anvl
doi = "10.5072/bc11-cqw7"
put "/id/doi:#{doi}", params, headers
expect(last_response.status).to eq(400)
response = last_response.body.from_anvl
expect(response["error"]).to eq("doi:10.5072/bc11-cqw7 has already been registered")
end
it "change using schema.org" do
schema_org = File.read(file_fixture('schema_org.json'))
params = { "schema_org" => schema_org, "_profile" => "schema_org" }.to_anvl
doi = "10.5072/bc11-cqw7"
post "/id/doi:#{doi}", params, headers
response = last_response.body.from_anvl
input = JSON.parse(schema_org)
output = JSON.parse(response["schema_org"])
expect(response["success"]).to eq("doi:10.5072/bc11-cqw7")
expect(response["_status"]).to eq("reserved")
expect(output["author"]).to eq("@id"=>"https://orcid.org/0000-0003-1419-2405", "@type"=>"Person", "familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Martin Fenner")
expect(response["datacite"]).to be_nil
expect(last_response.status).to eq(200)
end
it "change datacite xml" do
datacite = File.read(file_fixture('10.5072_bc11-cqw7.xml'))
params = { "datacite" => datacite }.to_anvl
doi = "10.5072/bc11-cqw7"
post "/id/doi:#{doi}", params, headers
expect(last_response.status).to eq(200)
response = last_response.body.from_anvl
expect(response["success"]).to eq("doi:10.5072/bc11-cqw7")
expect(response["datacite"]).to eq(datacite.strip)
expect(response["_status"]).to eq("reserved")
end
it "delete new doi" do
datacite = File.read(file_fixture('10.5072_bc11-cqw7.xml'))
url = "https://blog.datacite.org/differences-between-orcid-and-datacite-metadata/"
doi = "10.5072/bc11-cqw7"
delete "/id/doi:#{doi}", nil, headers
expect(last_response.status).to eq(200)
response = last_response.body.from_anvl
expect(response["success"]).to eq("doi:10.5072/bc11-cqw7")
expect(response["_target"]).to eq(url)
doc = Nokogiri::XML(response["datacite"], nil, 'UTF-8', &:noblanks)
expect(doc.at_css("identifier").content.upcase).to eq("10.5072/BC11-CQW7")
end
end
| 41.725664 | 173 | 0.678049 |
f76e3f1450cfea6b34228a5f9009fc20f8d621ca
| 187 |
module Faker
class Currency < Base
class << self
def name
fetch('currency.name')
end
def code
fetch('currency.code')
end
end
end
end
| 12.466667 | 30 | 0.534759 |
03d3234cf9193c23bf13869f6efd6ce48aa0eac3
| 423 |
module BradI18n
class Scope
def initialize scope, parent = I18n
@scope = scope
@parent = parent
@children = Hash.new do |children, scope|
children[scope.to_s] = self.class.new scope.to_s, self
end
end
def t key, options = {}
@parent.t "#{@scope}.#{key}", options
end
def derive scope
@children[scope.to_s]
end
alias_method :[], :derive
end
end
| 19.227273 | 62 | 0.588652 |
1c9a97602e79f719f628429aacb92024375aeace
| 1,857 |
require_relative '../helper'
###############
## 512x512 (24x24)
## assume 21px per pixel 21x24 = 504 + 8 = 512
##
## e.g. 24.times {|i| puts "#{(12+i*21+8.0/24.0*i).to_i} => #{i}," }
PIXEL_OFFSET = {
12 => 0,
33 => 1,
54 => 2,
76 => 3,
97 => 4,
118 => 5,
140 => 6,
161 => 7,
182 => 8,
204 => 9,
225 => 10,
246 => 11,
268 => 12,
289 => 13,
310 => 14,
332 => 15,
353 => 16,
374 => 17,
396 => 18,
417 => 19,
438 => 20,
460 => 21,
481 => 22,
502 => 23,
}
collection = 'cinepunkss'
range = (0..360) # 361 items
range.each do |id|
meta = read_meta( "./#{collection}/meta/#{id}.json" )
puts meta.name
# e.g. CinePunk #0 Travis Bickle => 0
# CinePunk Custom Edition #1 Donnie Darko
# CinePunk Special Edition #1 Mr. Blonde
name, num = if m=meta.name.match( /^CinePunk( (Custom|Special) Edition)? #(?<num>[0-9]+) (?<name>.+)$/ )
[m[:name].strip,
m[:num].to_i( 10 ) ## note: add base 10 (e.g. 015=>15)
]
else
puts "!! ERROR - cannot find id number in >#{meta.name}<:"
pp asset
exit 1
end
## pp meta.traits
movie = meta.traits[ 'movie' ]['value']
pp movie
slug = "%03d" % num
slug << "-"
slug << slugify( name )
slug << "__(#{slugify( movie )})" if movie
puts "==> #{id} - #{name} => #{num} | #{slug}"
img = Image.read( "./#{collection}/i/#{id}.png" )
if img.width == 512 && img.height == 512
## do nothing; everything ok
else
puts "!! ERROR - unknown image dimension #{img.width}x#{img.height}; sorry"
exit 1
end
pix = img.pixelate( PIXEL_OFFSET )
pix.save( "./#{collection}/ii/#{slug}.png")
end
puts "bye"
| 20.406593 | 110 | 0.466344 |
0191d9a620a956e301af630b5a39bcd0f4b436ee
| 4,045 |
require File.dirname(__FILE__)+'/test_helper'
require 'compass'
class ConfigurationTest < Test::Unit::TestCase
def setup
Compass.configuration.reset!
end
def test_parse_and_serialize
contents = <<-CONFIG
require 'compass'
# Require any additional compass plugins here.
project_type = :stand_alone
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"
output_style = :nested
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
CONFIG
Compass.configuration.parse_string(contents, "test_parse")
assert_equal 'sass', Compass.configuration.sass_dir
assert_equal 'css', Compass.configuration.css_dir
assert_equal 'img', Compass.configuration.images_dir
assert_equal 'js', Compass.configuration.javascripts_dir
expected_lines = contents.split("\n").map{|l|l.strip}
actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip}
assert_equal expected_lines, actual_lines
end
def test_serialization_fails_with_asset_host_set
contents = <<-CONFIG
asset_host do |path|
"http://example.com"
end
CONFIG
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set")
assert_raise Compass::Error do
Compass.configuration.serialize
end
end
def test_serialization_fails_with_asset_cache_buster_set
contents = <<-CONFIG
asset_cache_buster do |path|
"http://example.com"
end
CONFIG
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set")
assert_raise Compass::Error do
Compass.configuration.serialize
end
end
def test_additional_import_paths
contents = <<-CONFIG
http_path = "/"
project_path = "/home/chris/my_compass_project"
css_dir = "css"
additional_import_paths = ["../foo"]
add_import_path "/path/to/my/framework"
CONFIG
Compass.configuration.parse_string(contents, "test_additional_import_paths")
assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo")
assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect
assert_equal "/home/chris/my_compass_project/css/framework", Compass.configuration.to_sass_plugin_options[:template_location]["/path/to/my/framework"]
assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location]["/home/chris/my_compass_project/../foo"]
expected_serialization = <<EXPECTED
# Require any additional compass plugins here.
project_path = "/home/chris/my_compass_project"
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
additional_import_paths = ["../foo", "/path/to/my/framework"]
EXPECTED
assert_equal "/", Compass.configuration.http_path
assert_equal expected_serialization, Compass.configuration.serialize
end
def test_sass_options
contents = <<-CONFIG
sass_options = {:foo => 'bar'}
CONFIG
Compass.configuration.parse_string(contents, "test_sass_options")
assert_equal 'bar', Compass.configuration.to_sass_engine_options[:foo]
assert_equal 'bar', Compass.configuration.to_sass_plugin_options[:foo]
expected_serialization = <<EXPECTED
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
sass_options = {:foo=>"bar"}
EXPECTED
assert_equal expected_serialization, Compass.configuration.serialize
end
end
| 34.279661 | 169 | 0.738937 |
1dec8b63402954c32e74a455814c74f28b9a85f8
| 125 |
class MakeUserUnique < ActiveRecord::Migration[5.2]
def change
add_index :users, :github_login, unique: true
end
end
| 20.833333 | 51 | 0.744 |
911e98164d13eb227e720bb0e3703e0e415c1275
| 369 |
#
# Copyright (c) 2013-2017 SKYARCH NETWORKS INC.
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#
class MasterMonitoring < ApplicationRecord
validates :name, uniqueness: true
validates :item, uniqueness: true, allow_nil: true
has_many :monitorings
has_many :infrastructures, through: :monitorings
end
| 23.0625 | 52 | 0.764228 |
18f1196a3d90ff7bdd80621114338562efe7769d
| 7,616 |
=begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class LbPoolListResult
# Link to this resource
attr_accessor :_self
# The server will populate this field when returing the resource. Ignored on PUT and POST.
attr_accessor :_links
# Schema for this resource
attr_accessor :_schema
# Opaque cursor to be used for getting next page of records (supplied by current result page)
attr_accessor :cursor
# If true, results are sorted in ascending order
attr_accessor :sort_ascending
# Field by which records are sorted
attr_accessor :sort_by
# Count of results found (across all pages), set only on first page
attr_accessor :result_count
# paginated list of pools
attr_accessor :results
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'_self' => :'_self',
:'_links' => :'_links',
:'_schema' => :'_schema',
:'cursor' => :'cursor',
:'sort_ascending' => :'sort_ascending',
:'sort_by' => :'sort_by',
:'result_count' => :'result_count',
:'results' => :'results'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'_self' => :'SelfResourceLink',
:'_links' => :'Array<ResourceLink>',
:'_schema' => :'String',
:'cursor' => :'String',
:'sort_ascending' => :'BOOLEAN',
:'sort_by' => :'String',
:'result_count' => :'Integer',
:'results' => :'Array<LbPool>'
}
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?(:'_self')
self._self = attributes[:'_self']
end
if attributes.has_key?(:'_links')
if (value = attributes[:'_links']).is_a?(Array)
self._links = value
end
end
if attributes.has_key?(:'_schema')
self._schema = attributes[:'_schema']
end
if attributes.has_key?(:'cursor')
self.cursor = attributes[:'cursor']
end
if attributes.has_key?(:'sort_ascending')
self.sort_ascending = attributes[:'sort_ascending']
end
if attributes.has_key?(:'sort_by')
self.sort_by = attributes[:'sort_by']
end
if attributes.has_key?(:'result_count')
self.result_count = attributes[:'result_count']
end
if attributes.has_key?(:'results')
if (value = attributes[:'results']).is_a?(Array)
self.results = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @results.nil?
invalid_properties.push('invalid value for "results", results cannot be nil.')
end
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?
return false if @results.nil?
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 &&
_self == o._self &&
_links == o._links &&
_schema == o._schema &&
cursor == o.cursor &&
sort_ascending == o.sort_ascending &&
sort_by == o.sort_by &&
result_count == o.result_count &&
results == o.results
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
[_self, _links, _schema, cursor, sort_ascending, sort_by, result_count, results].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 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 = NSXT.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
| 28.739623 | 107 | 0.606092 |
389d424c31b08b5cdcb34aec232fd10bdb9f0de6
| 3,156 |
# frozen_string_literal: true
# Print full backtrace for failiures:
ENV["BACKTRACE"] = "1"
def rails_should_be_installed?
ENV['WITHOUT_RAILS'] != 'yes'
end
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
if rails_should_be_installed?
require "rake"
require "rails/all"
require "rails/generators"
require "jdbc/sqlite3" if RUBY_ENGINE == 'jruby'
require "sqlite3" if RUBY_ENGINE == 'ruby'
require "pg" if RUBY_ENGINE == 'ruby'
require "mongoid" if RUBY_ENGINE == 'ruby'
require "sequel"
end
require "graphql"
require "graphql/rake_task"
require "benchmark"
require "pry"
require "minitest/autorun"
require "minitest/focus"
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new(color: true)
Minitest::Spec.make_my_diffs_pretty!
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
# This is for convenient access to metadata in test definitions
assign_metadata_key = ->(target, key, value) { target.metadata[key] = value }
assign_metadata_flag = ->(target, flag) { target.metadata[flag] = true }
GraphQL::Schema.accepts_definitions(set_metadata: assign_metadata_key)
GraphQL::BaseType.accepts_definitions(metadata: assign_metadata_key)
GraphQL::BaseType.accepts_definitions(metadata2: assign_metadata_key)
GraphQL::Field.accepts_definitions(metadata: assign_metadata_key)
GraphQL::Argument.accepts_definitions(metadata: assign_metadata_key)
GraphQL::Argument.accepts_definitions(metadata_flag: assign_metadata_flag)
GraphQL::EnumType::EnumValue.accepts_definitions(metadata: assign_metadata_key)
# Can be used as a GraphQL::Schema::Warden for some purposes, but allows nothing
module NothingWarden
def self.enum_values(enum_type)
[]
end
end
# Use this when a schema requires a `resolve_type` hook
# but you know it won't be called
NO_OP_RESOLVE_TYPE = ->(type, obj, ctx) {
raise "this should never be called"
}
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each do |f|
unless rails_should_be_installed?
next if f.end_with?('star_wars/data.rb')
next if f.end_with?('star_trek/data.rb')
next if f.end_with?('base_generator_test.rb')
end
require f
end
def star_trek_query(string, variables={}, context: {})
StarTrek::Schema.execute(string, variables: variables, context: context)
end
def star_wars_query(string, variables={}, context: {})
StarWars::Schema.execute(string, variables: variables, context: context)
end
def with_bidirectional_pagination
prev_value = GraphQL::Relay::ConnectionType.bidirectional_pagination
GraphQL::Relay::ConnectionType.bidirectional_pagination = true
yield
ensure
GraphQL::Relay::ConnectionType.bidirectional_pagination = prev_value
end
module TestTracing
class << self
def clear
traces.clear
end
def with_trace
clear
yield
traces
end
def traces
@traces ||= []
end
def trace(key, data)
data[:key] = key
result = yield
data[:result] = result
traces << data
result
end
end
end
| 27.684211 | 80 | 0.751901 |
62707d38553adb5d05d80c6a1f1e4752caa9b04c
| 631 |
# frozen_string_literal: true
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
module DeviseHelpers
def login
user = create :user
perform_login(user)
end
def login_admin
admin = FactoryBot.create(:user, admin: true)
perform_login(admin)
end
def perform_login(user)
user.confirm
user.update_attribute(:suspended_at, nil)
sign_in user
end
def current_user
User.find_by_id(session["warden.user.user.key"][0][0])
end
end
| 21.758621 | 76 | 0.727417 |
87e1c72bbcae4d06c4372ec717c4bf963a636e0d
| 783 |
class Undercover < Cask
version '6.0'
sha256 '07d9b20eba2a873e538e4f2ae4c1dcafafd282fb8af01f3374b08e54069d9932'
url "http://assets.undercoverhq.com/client/#{version}/undercover_mac.pkg"
homepage 'http://www.orbicule.com/undercover/mac/'
license :unknown
pkg 'undercover_mac.pkg'
uninstall :pkgutil => 'com.orbicule.pkg.Undercover',
:quit => [ 'com.orbicule.uc', 'com.orbicule.UCAgent' ],
:launchctl => [ 'com.orbicule.uc', 'com.orbicule.UCAgent' ],
:early_script => '/usr/local/uc/bin/Undercover Registration.app/Contents/MacOS/uc-uninstall',
:script => {
:executable => '/usr/bin/killall',
:args => %w[-9 uc UCAgent]
}
caveats do
files_in_usr_local
reboot
end
end
| 31.32 | 105 | 0.639847 |
03f8a878dbacc383efcae88a9b2a5eb0744714b9
| 503 |
require 'ghpe/operation'
class Ghpe::Operation::ModifyTeam
def initialize(new, old)
@new = new
@old = old
end
def diff
@new.attributes.select do |k, v|
v != @old.attributes[k]
end
end
def display(shell)
shell.say("+/- Update team: #{@new.name}", :yellow)
diff.each_pair do |k, v|
shell.say(" - #{k}: #{@old.attributes[k]} -> #{v}", :yellow)
end
end
def order
1
end
def call(client)
client.update_team(@old.id, diff)
end
end
| 16.225806 | 71 | 0.574553 |
bb7798ad2ee84797cf3197a5bf8d429d72588f9a
| 1,037 |
require "active_support/concern"
module Etl::GA::Concerns::TransformPath
extend ActiveSupport::Concern
def format_events_with_invalid_prefix
events_with_prefix = Events::GA.where("page_path ~ '^\/https:\/\/www.gov.uk'")
log(process: :ga, message: "Transforming #{events_with_prefix.count} events with page_path starting https://gov.uk")
events_with_prefix.find_each do |event|
transformed_attributes = transform_event_attributes(event)
event.update!(transformed_attributes)
end
end
private
def transform_event_attributes(event)
sanitised_page_path = event.page_path.remove "/https://www.gov.uk"
duplicate_event = Events::GA.find_by(page_path: sanitised_page_path)
attributes = { page_path: sanitised_page_path }
if duplicate_event
metric_names = Metric.ga_metrics.map(&:name)
metric_names.each do |metric|
attributes[metric.to_sym] = event.send(metric) + duplicate_event.send(metric)
end
duplicate_event.destroy!
end
attributes
end
end
| 30.5 | 120 | 0.735776 |
080b1cefbba16108d4a87ae077f6e3c618132ce4
| 84 |
# desc "Explaining what the task does"
# task :my_txn do
# # Task goes here
# end
| 16.8 | 38 | 0.666667 |
03d18b764a7f3551d7b2e4c8fca7f30b7e6ca7ef
| 1,832 |
# frozen_string_literal: true
# Copyright 2020 Google LLC
#
# 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
#
# https://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.
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
module Google
module Cloud
module Monitoring
module Dashboard
module V1
# Widget contains a single dashboard component and configuration of how to
# present the component in the dashboard.
# @!attribute [rw] title
# @return [::String]
# Optional. The title of the widget.
# @!attribute [rw] xy_chart
# @return [::Google::Cloud::Monitoring::Dashboard::V1::XyChart]
# A chart of time series data.
# @!attribute [rw] scorecard
# @return [::Google::Cloud::Monitoring::Dashboard::V1::Scorecard]
# A scorecard summarizing time series data.
# @!attribute [rw] text
# @return [::Google::Cloud::Monitoring::Dashboard::V1::Text]
# A raw string or markdown displaying textual content.
# @!attribute [rw] blank
# @return [::Google::Protobuf::Empty]
# A blank space.
class Widget
include ::Google::Protobuf::MessageExts
extend ::Google::Protobuf::MessageExts::ClassMethods
end
end
end
end
end
end
| 35.921569 | 84 | 0.634825 |
2108a2decbb79ae505109ed8d81b35944fb09a7d
| 125 |
class DailyDeal::CLI
def call
puts "Welcome to daily deal program."
end
def start
end
def print
end
end
| 8.333333 | 41 | 0.648 |
7a25c6e948d0cf4acbb78790d363083cc6433638
| 495 |
class StdDevAccumulator
def initialize
@n, @sum, @sumofsquares = 0, 0.0, 0.0
end
def <<(num)
# return self to make this possible: sd << 1 << 2 << 3 # => 0.816496580927726
@n += 1
@sum += num
@sumofsquares += num**2
self
end
def stddev
Math.sqrt( (@sumofsquares / @n) - (@sum / @n)**2 )
end
def to_s
stddev.to_s
end
end
sd = StdDevAccumulator.new
i = 0
[2,4,4,4,5,5,7,9].each {|n| puts "adding #{n}: stddev of #{i+=1} samples is #{sd << n}" }
| 19.038462 | 89 | 0.557576 |
6206eb8a270a316ebfaed6ca88051027fb59ba6a
| 3,178 |
require "mutex_m"
require "debrew/irb"
module Debrew
extend Mutex_m
Ignorable = Module.new
module Raise
def raise(*)
super
rescue Exception => e # rubocop:disable Lint/RescueException
e.extend(Ignorable)
super(e) unless Debrew.debug(e) == :ignore
end
alias fail raise
end
module Formula
def install
Debrew.debrew { super }
end
def patch
Debrew.debrew { super }
end
def test
Debrew.debrew { super }
end
end
class Menu
Entry = Struct.new(:name, :action)
attr_accessor :prompt, :entries
def initialize
@entries = []
end
def choice(name, &action)
entries << Entry.new(name.to_s, action)
end
def self.choose
menu = new
yield menu
choice = nil
while choice.nil?
menu.entries.each_with_index { |e, i| puts "#{i + 1}. #{e.name}" }
print menu.prompt unless menu.prompt.nil?
input = $stdin.gets || exit
input.chomp!
i = input.to_i
if i.positive?
choice = menu.entries[i - 1]
else
possible = menu.entries.find_all { |e| e.name.start_with?(input) }
case possible.size
when 0 then puts "No such option"
when 1 then choice = possible.first
else puts "Multiple options match: #{possible.map(&:name).join(" ")}"
end
end
end
choice[:action].call
end
end
@active = false
@debugged_exceptions = Set.new
class << self
extend Predicable
alias original_raise raise
attr_predicate :active?
attr_reader :debugged_exceptions
end
def self.debrew
@active = true
Object.send(:include, Raise)
begin
yield
rescue SystemExit
original_raise
rescue Exception => e # rubocop:disable Lint/RescueException
debug(e)
ensure
@active = false
end
end
def self.debug(e)
original_raise(e) unless active? &&
debugged_exceptions.add?(e) &&
try_lock
begin
puts e.backtrace.first.to_s
puts Formatter.error(e, label: e.class.name)
loop do
Menu.choose do |menu|
menu.prompt = "Choose an action: "
menu.choice(:raise) { original_raise(e) }
menu.choice(:ignore) { return :ignore } if e.is_a?(Ignorable)
menu.choice(:backtrace) { puts e.backtrace }
if e.is_a?(Ignorable)
menu.choice(:irb) do
puts "When you exit this IRB session, execution will continue."
set_trace_func proc { |event, _, _, id, binding, klass| # rubocop:disable Metrics/ParameterLists
if klass == Raise && id == :raise && event == "return"
set_trace_func(nil)
synchronize { IRB.start_within(binding) }
end
}
return :ignore
end
end
menu.choice(:shell) do
puts "When you exit this shell, you will return to the menu."
interactive_shell
end
end
end
ensure
unlock
end
end
end
| 22.069444 | 110 | 0.563562 |
f83e2b88d062c193071175c49de76ebd3a2733ac
| 121 |
require 'sinatra'
require 'rack/stats'
use Rack::Stats
get '/' do
[200, 'foo']
end
get '/foo' do
[201, 'bar']
end
| 9.307692 | 20 | 0.603306 |
bfd527fbe05c4beed2ac98a1e4a45037b16e869d
| 85,314 |
# encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_compute'
module Azure::Profiles::Latest
module Compute
module Mgmt
ResourceSkus = Azure::Compute::Mgmt::V2019_04_01::ResourceSkus
Galleries = Azure::Compute::Mgmt::V2019_12_01::Galleries
GalleryImages = Azure::Compute::Mgmt::V2019_12_01::GalleryImages
GalleryImageVersions = Azure::Compute::Mgmt::V2019_12_01::GalleryImageVersions
GalleryApplications = Azure::Compute::Mgmt::V2019_12_01::GalleryApplications
GalleryApplicationVersions = Azure::Compute::Mgmt::V2019_12_01::GalleryApplicationVersions
Operations = Azure::Compute::Mgmt::V2020_06_01::Operations
AvailabilitySets = Azure::Compute::Mgmt::V2020_06_01::AvailabilitySets
ProximityPlacementGroups = Azure::Compute::Mgmt::V2020_06_01::ProximityPlacementGroups
DedicatedHostGroups = Azure::Compute::Mgmt::V2020_06_01::DedicatedHostGroups
DedicatedHosts = Azure::Compute::Mgmt::V2020_06_01::DedicatedHosts
SshPublicKeys = Azure::Compute::Mgmt::V2020_06_01::SshPublicKeys
VirtualMachineExtensionImages = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineExtensionImages
VirtualMachineExtensions = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineExtensions
VirtualMachineImages = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineImages
UsageOperations = Azure::Compute::Mgmt::V2020_06_01::UsageOperations
VirtualMachines = Azure::Compute::Mgmt::V2020_06_01::VirtualMachines
VirtualMachineSizes = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineSizes
Images = Azure::Compute::Mgmt::V2020_06_01::Images
VirtualMachineScaleSets = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineScaleSets
VirtualMachineScaleSetExtensions = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineScaleSetExtensions
VirtualMachineScaleSetRollingUpgrades = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineScaleSetRollingUpgrades
VirtualMachineScaleSetVMExtensions = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineScaleSetVMExtensions
VirtualMachineScaleSetVMs = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineScaleSetVMs
LogAnalytics = Azure::Compute::Mgmt::V2020_06_01::LogAnalytics
VirtualMachineRunCommands = Azure::Compute::Mgmt::V2020_06_01::VirtualMachineRunCommands
Disks = Azure::Compute::Mgmt::V2020_06_30::Disks
Snapshots = Azure::Compute::Mgmt::V2020_06_30::Snapshots
DiskEncryptionSets = Azure::Compute::Mgmt::V2020_06_30::DiskEncryptionSets
DiskAccesses = Azure::Compute::Mgmt::V2020_06_30::DiskAccesses
module Models
ResourceSkuRestrictionInfo = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionInfo
ResourceSkuRestrictions = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictions
ResourceSkuCosts = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCosts
ResourceSkuLocationInfo = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuLocationInfo
ResourceSkuZoneDetails = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuZoneDetails
ResourceSku = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSku
ResourceSkuCapabilities = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapabilities
ResourceSkusResult = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkusResult
ResourceSkuCapacity = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapacity
ResourceSkuCapacityScaleType = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapacityScaleType
ResourceSkuRestrictionsType = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionsType
ResourceSkuRestrictionsReasonCode = Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionsReasonCode
ReplicationStatus = Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationStatus
RegionalReplicationStatus = Azure::Compute::Mgmt::V2019_12_01::Models::RegionalReplicationStatus
GalleryApplicationList = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationList
GalleryImageList = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageList
GalleryDiskImage = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryDiskImage
UserArtifactSource = Azure::Compute::Mgmt::V2019_12_01::Models::UserArtifactSource
GalleryIdentifier = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryIdentifier
ManagedArtifact = Azure::Compute::Mgmt::V2019_12_01::Models::ManagedArtifact
TargetRegion = Azure::Compute::Mgmt::V2019_12_01::Models::TargetRegion
EncryptionImages = Azure::Compute::Mgmt::V2019_12_01::Models::EncryptionImages
Disallowed = Azure::Compute::Mgmt::V2019_12_01::Models::Disallowed
RecommendedMachineConfiguration = Azure::Compute::Mgmt::V2019_12_01::Models::RecommendedMachineConfiguration
GalleryApplicationVersionList = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionList
GalleryArtifactSource = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactSource
DiskImageEncryption = Azure::Compute::Mgmt::V2019_12_01::Models::DiskImageEncryption
GalleryArtifactPublishingProfileBase = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactPublishingProfileBase
GalleryImageVersionStorageProfile = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionStorageProfile
ImagePurchasePlan = Azure::Compute::Mgmt::V2019_12_01::Models::ImagePurchasePlan
GalleryImageVersionList = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionList
UpdateResourceDefinition = Azure::Compute::Mgmt::V2019_12_01::Models::UpdateResourceDefinition
GalleryArtifactVersionSource = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactVersionSource
ResourceRange = Azure::Compute::Mgmt::V2019_12_01::Models::ResourceRange
GalleryImageIdentifier = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageIdentifier
GalleryList = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryList
Gallery = Azure::Compute::Mgmt::V2019_12_01::Models::Gallery
GalleryUpdate = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryUpdate
GalleryApplication = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplication
GalleryApplicationUpdate = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationUpdate
GalleryApplicationVersionPublishingProfile = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionPublishingProfile
GalleryApplicationVersion = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersion
GalleryApplicationVersionUpdate = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionUpdate
GalleryImage = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImage
GalleryImageUpdate = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageUpdate
GalleryImageVersionPublishingProfile = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionPublishingProfile
GalleryOSDiskImage = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryOSDiskImage
GalleryDataDiskImage = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryDataDiskImage
GalleryImageVersion = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersion
GalleryImageVersionUpdate = Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionUpdate
OSDiskImageEncryption = Azure::Compute::Mgmt::V2019_12_01::Models::OSDiskImageEncryption
DataDiskImageEncryption = Azure::Compute::Mgmt::V2019_12_01::Models::DataDiskImageEncryption
AggregatedReplicationState = Azure::Compute::Mgmt::V2019_12_01::Models::AggregatedReplicationState
ReplicationState = Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationState
StorageAccountType = Azure::Compute::Mgmt::V2019_12_01::Models::StorageAccountType
HostCaching = Azure::Compute::Mgmt::V2019_12_01::Models::HostCaching
ReplicationStatusTypes = Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationStatusTypes
AvailablePatchSummary = Azure::Compute::Mgmt::V2020_06_01::Models::AvailablePatchSummary
ComputeOperationValue = Azure::Compute::Mgmt::V2020_06_01::Models::ComputeOperationValue
LastPatchInstallationSummary = Azure::Compute::Mgmt::V2020_06_01::Models::LastPatchInstallationSummary
DisallowedConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::DisallowedConfiguration
VirtualMachinePatchStatus = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachinePatchStatus
InstanceViewStatus = Azure::Compute::Mgmt::V2020_06_01::Models::InstanceViewStatus
VirtualMachineInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineInstanceView
Sku = Azure::Compute::Mgmt::V2020_06_01::Models::Sku
VirtualMachineAgentInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineAgentInstanceView
DiskInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::DiskInstanceView
AvailabilitySetListResult = Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetListResult
BootDiagnosticsInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::BootDiagnosticsInstanceView
AutomaticRepairsPolicy = Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticRepairsPolicy
VirtualMachineScaleSetVMListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMListResult
VirtualMachineScaleSetVMExtensionsSummary = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMExtensionsSummary
VirtualMachineScaleSetVMProtectionPolicy = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMProtectionPolicy
NetworkProfile = Azure::Compute::Mgmt::V2020_06_01::Models::NetworkProfile
SubResourceReadOnly = Azure::Compute::Mgmt::V2020_06_01::Models::SubResourceReadOnly
BootDiagnostics = Azure::Compute::Mgmt::V2020_06_01::Models::BootDiagnostics
VirtualMachineScaleSetVMInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceView
DiagnosticsProfile = Azure::Compute::Mgmt::V2020_06_01::Models::DiagnosticsProfile
DedicatedHostAllocatableVM = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostAllocatableVM
BillingProfile = Azure::Compute::Mgmt::V2020_06_01::Models::BillingProfile
DedicatedHostInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostInstanceView
VirtualMachineExtensionHandlerInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionHandlerInstanceView
UpgradeOperationHistoricalStatusInfo = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoricalStatusInfo
DedicatedHostListResult = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostListResult
SshPublicKeyGenerateKeyPairResult = Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyGenerateKeyPairResult
VirtualMachineStatusCodeCount = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineStatusCodeCount
RollingUpgradeProgressInfo = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeProgressInfo
VirtualMachineScaleSetVMInstanceRequiredIDs = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceRequiredIDs
VirtualMachineSize = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSize
VirtualMachineScaleSetInstanceViewStatusesSummary = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetInstanceViewStatusesSummary
UpgradeOperationHistoryStatus = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoryStatus
VirtualMachineIdentityUserAssignedIdentitiesValue = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineIdentityUserAssignedIdentitiesValue
VirtualMachineExtensionInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionInstanceView
VirtualMachineIdentity = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineIdentity
VirtualMachineScaleSetSku = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSku
MaintenanceRedeployStatus = Azure::Compute::Mgmt::V2020_06_01::Models::MaintenanceRedeployStatus
VirtualMachineSoftwarePatchProperties = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSoftwarePatchProperties
VirtualMachineHealthStatus = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineHealthStatus
ComputeOperationListResult = Azure::Compute::Mgmt::V2020_06_01::Models::ComputeOperationListResult
VirtualMachineAssessPatchesResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineAssessPatchesResult
RetrieveBootDiagnosticsDataResult = Azure::Compute::Mgmt::V2020_06_01::Models::RetrieveBootDiagnosticsDataResult
OSDiskImage = Azure::Compute::Mgmt::V2020_06_01::Models::OSDiskImage
SubResource = Azure::Compute::Mgmt::V2020_06_01::Models::SubResource
AutomaticOSUpgradeProperties = Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticOSUpgradeProperties
VirtualMachineScaleSetSkuCapacity = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSkuCapacity
VirtualMachineScaleSetVMInstanceIDs = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceIDs
Usage = Azure::Compute::Mgmt::V2020_06_01::Models::Usage
RunCommandResult = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandResult
VirtualMachineReimageParameters = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineReimageParameters
RunCommandListResult = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandListResult
VirtualMachineScaleSetListWithLinkResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListWithLinkResult
VirtualMachineListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineListResult
HardwareProfile = Azure::Compute::Mgmt::V2020_06_01::Models::HardwareProfile
AutomaticOSUpgradePolicy = Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticOSUpgradePolicy
KeyVaultSecretReference = Azure::Compute::Mgmt::V2020_06_01::Models::KeyVaultSecretReference
RollingUpgradePolicy = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradePolicy
KeyVaultKeyReference = Azure::Compute::Mgmt::V2020_06_01::Models::KeyVaultKeyReference
UpgradePolicy = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradePolicy
VirtualHardDisk = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualHardDisk
ScaleInPolicy = Azure::Compute::Mgmt::V2020_06_01::Models::ScaleInPolicy
OrchestrationServiceSummary = Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceSummary
RunCommandDocumentBase = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandDocumentBase
DataDisk = Azure::Compute::Mgmt::V2020_06_01::Models::DataDisk
RunCommandParameterDefinition = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandParameterDefinition
SecurityProfile = Azure::Compute::Mgmt::V2020_06_01::Models::SecurityProfile
ImageDisk = Azure::Compute::Mgmt::V2020_06_01::Models::ImageDisk
AdditionalUnattendContent = Azure::Compute::Mgmt::V2020_06_01::Models::AdditionalUnattendContent
ImageStorageProfile = Azure::Compute::Mgmt::V2020_06_01::Models::ImageStorageProfile
WinRMConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::WinRMConfiguration
RunCommandInput = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandInput
WindowsConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::WindowsConfiguration
RunCommandInputParameter = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandInputParameter
SshConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::SshConfiguration
ImageListResult = Azure::Compute::Mgmt::V2020_06_01::Models::ImageListResult
VaultCertificate = Azure::Compute::Mgmt::V2020_06_01::Models::VaultCertificate
VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue
OSProfile = Azure::Compute::Mgmt::V2020_06_01::Models::OSProfile
VirtualMachineScaleSetIdentity = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIdentity
DedicatedHostGroupInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupInstanceView
VirtualMachineScaleSetOSProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetOSProfile
DedicatedHostGroupListResult = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupListResult
VirtualMachineScaleSetUpdateOSProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateOSProfile
VirtualMachineScaleSetListOSUpgradeHistory = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListOSUpgradeHistory
VirtualMachineScaleSetManagedDiskParameters = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetManagedDiskParameters
SshPublicKeysGroupListResult = Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeysGroupListResult
VirtualMachineScaleSetOSDisk = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetOSDisk
RollbackStatusInfo = Azure::Compute::Mgmt::V2020_06_01::Models::RollbackStatusInfo
VirtualMachineScaleSetUpdateOSDisk = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateOSDisk
VirtualMachineExtensionsListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionsListResult
VirtualMachineScaleSetDataDisk = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetDataDisk
VirtualMachineScaleSetStorageProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetStorageProfile
DataDiskImage = Azure::Compute::Mgmt::V2020_06_01::Models::DataDiskImage
VirtualMachineScaleSetUpdateStorageProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateStorageProfile
ListUsagesResult = Azure::Compute::Mgmt::V2020_06_01::Models::ListUsagesResult
ApiEntityReference = Azure::Compute::Mgmt::V2020_06_01::Models::ApiEntityReference
Plan = Azure::Compute::Mgmt::V2020_06_01::Models::Plan
VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings
VirtualMachineScaleSetInstanceView = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetInstanceView
VirtualMachineScaleSetIpTag = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIpTag
DiffDiskSettings = Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskSettings
VirtualMachineScaleSetPublicIPAddressConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetPublicIPAddressConfiguration
StorageProfile = Azure::Compute::Mgmt::V2020_06_01::Models::StorageProfile
VirtualMachineScaleSetUpdatePublicIPAddressConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdatePublicIPAddressConfiguration
WinRMListener = Azure::Compute::Mgmt::V2020_06_01::Models::WinRMListener
OrchestrationServiceStateInput = Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceStateInput
SshPublicKey = Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKey
VMScaleSetConvertToSinglePlacementGroupInput = Azure::Compute::Mgmt::V2020_06_01::Models::VMScaleSetConvertToSinglePlacementGroupInput
VaultSecretGroup = Azure::Compute::Mgmt::V2020_06_01::Models::VaultSecretGroup
VirtualMachineScaleSetNetworkConfigurationDnsSettings = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkConfigurationDnsSettings
VirtualMachineScaleSetVMNetworkProfileConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMNetworkProfileConfiguration
LogAnalyticsOperationResult = Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsOperationResult
UpgradeOperationHistoricalStatusInfoProperties = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoricalStatusInfoProperties
LogAnalyticsOutput = Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsOutput
VirtualMachineScaleSetListSkusResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListSkusResult
VirtualMachineScaleSetNetworkProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkProfile
PurchasePlan = Azure::Compute::Mgmt::V2020_06_01::Models::PurchasePlan
VirtualMachineScaleSetUpdateNetworkProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateNetworkProfile
VirtualMachineCaptureParameters = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineCaptureParameters
LogAnalyticsInputBase = Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsInputBase
DiskEncryptionSettings = Azure::Compute::Mgmt::V2020_06_01::Models::DiskEncryptionSettings
RecoveryWalkResponse = Azure::Compute::Mgmt::V2020_06_01::Models::RecoveryWalkResponse
AdditionalCapabilities = Azure::Compute::Mgmt::V2020_06_01::Models::AdditionalCapabilities
VirtualMachineScaleSetExtensionListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionListResult
LinuxConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::LinuxConfiguration
VirtualMachineScaleSetExtensionProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionProfile
DedicatedHostAvailableCapacity = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostAvailableCapacity
TerminateNotificationProfile = Azure::Compute::Mgmt::V2020_06_01::Models::TerminateNotificationProfile
ScheduledEventsProfile = Azure::Compute::Mgmt::V2020_06_01::Models::ScheduledEventsProfile
VirtualMachineScaleSetListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListResult
VirtualMachineScaleSetVMProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMProfile
PatchSettings = Azure::Compute::Mgmt::V2020_06_01::Models::PatchSettings
VirtualMachineScaleSetUpdateVMProfile = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateVMProfile
VirtualMachineSizeListResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSizeListResult
UpdateResource = Azure::Compute::Mgmt::V2020_06_01::Models::UpdateResource
OSDisk = Azure::Compute::Mgmt::V2020_06_01::Models::OSDisk
UsageName = Azure::Compute::Mgmt::V2020_06_01::Models::UsageName
ProximityPlacementGroupListResult = Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupListResult
RollingUpgradeRunningStatus = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeRunningStatus
AvailabilitySet = Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySet
AvailabilitySetUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetUpdate
SubResourceWithColocationStatus = Azure::Compute::Mgmt::V2020_06_01::Models::SubResourceWithColocationStatus
ProximityPlacementGroup = Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroup
ProximityPlacementGroupUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupUpdate
DedicatedHostInstanceViewWithName = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostInstanceViewWithName
DedicatedHostGroup = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroup
DedicatedHostGroupUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupUpdate
DedicatedHost = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHost
DedicatedHostUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostUpdate
SshPublicKeyResource = Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyResource
SshPublicKeyUpdateResource = Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyUpdateResource
VirtualMachineExtensionImage = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionImage
VirtualMachineImageResource = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineImageResource
VirtualMachineExtension = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtension
VirtualMachineExtensionUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionUpdate
VirtualMachineImage = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineImage
VirtualMachineCaptureResult = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineCaptureResult
ImageReference = Azure::Compute::Mgmt::V2020_06_01::Models::ImageReference
DiskEncryptionSetParameters = Azure::Compute::Mgmt::V2020_06_01::Models::DiskEncryptionSetParameters
ManagedDiskParameters = Azure::Compute::Mgmt::V2020_06_01::Models::ManagedDiskParameters
NetworkInterfaceReference = Azure::Compute::Mgmt::V2020_06_01::Models::NetworkInterfaceReference
VirtualMachine = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachine
VirtualMachineUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineUpdate
ImageOSDisk = Azure::Compute::Mgmt::V2020_06_01::Models::ImageOSDisk
ImageDataDisk = Azure::Compute::Mgmt::V2020_06_01::Models::ImageDataDisk
Image = Azure::Compute::Mgmt::V2020_06_01::Models::Image
ImageUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::ImageUpdate
VirtualMachineScaleSetIPConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIPConfiguration
VirtualMachineScaleSetUpdateIPConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateIPConfiguration
VirtualMachineScaleSetNetworkConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkConfiguration
VirtualMachineScaleSetUpdateNetworkConfiguration = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateNetworkConfiguration
VirtualMachineScaleSetExtension = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtension
VirtualMachineScaleSetExtensionUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionUpdate
VirtualMachineScaleSet = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSet
VirtualMachineScaleSetVMReimageParameters = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMReimageParameters
VirtualMachineScaleSetReimageParameters = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetReimageParameters
VirtualMachineScaleSetUpdate = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdate
VirtualMachineScaleSetVM = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVM
RollingUpgradeStatusInfo = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeStatusInfo
RequestRateByIntervalInput = Azure::Compute::Mgmt::V2020_06_01::Models::RequestRateByIntervalInput
ThrottledRequestsInput = Azure::Compute::Mgmt::V2020_06_01::Models::ThrottledRequestsInput
RunCommandDocument = Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandDocument
VmDiskTypes = Azure::Compute::Mgmt::V2020_06_01::Models::VmDiskTypes
HyperVGenerationTypes = Azure::Compute::Mgmt::V2020_06_01::Models::HyperVGenerationTypes
StatusLevelTypes = Azure::Compute::Mgmt::V2020_06_01::Models::StatusLevelTypes
AvailabilitySetSkuTypes = Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetSkuTypes
ProximityPlacementGroupType = Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupType
DedicatedHostLicenseTypes = Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostLicenseTypes
SoftwareUpdateRebootBehavior = Azure::Compute::Mgmt::V2020_06_01::Models::SoftwareUpdateRebootBehavior
PatchAssessmentState = Azure::Compute::Mgmt::V2020_06_01::Models::PatchAssessmentState
PatchOperationStatus = Azure::Compute::Mgmt::V2020_06_01::Models::PatchOperationStatus
VirtualMachineSizeTypes = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSizeTypes
CachingTypes = Azure::Compute::Mgmt::V2020_06_01::Models::CachingTypes
DiskCreateOptionTypes = Azure::Compute::Mgmt::V2020_06_01::Models::DiskCreateOptionTypes
StorageAccountTypes = Azure::Compute::Mgmt::V2020_06_01::Models::StorageAccountTypes
DiffDiskOptions = Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskOptions
DiffDiskPlacement = Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskPlacement
PassNames = Azure::Compute::Mgmt::V2020_06_01::Models::PassNames
ComponentNames = Azure::Compute::Mgmt::V2020_06_01::Models::ComponentNames
SettingNames = Azure::Compute::Mgmt::V2020_06_01::Models::SettingNames
ProtocolTypes = Azure::Compute::Mgmt::V2020_06_01::Models::ProtocolTypes
InGuestPatchMode = Azure::Compute::Mgmt::V2020_06_01::Models::InGuestPatchMode
VirtualMachinePriorityTypes = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachinePriorityTypes
VirtualMachineEvictionPolicyTypes = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineEvictionPolicyTypes
ResourceIdentityType = Azure::Compute::Mgmt::V2020_06_01::Models::ResourceIdentityType
MaintenanceOperationResultCodeTypes = Azure::Compute::Mgmt::V2020_06_01::Models::MaintenanceOperationResultCodeTypes
HyperVGenerationType = Azure::Compute::Mgmt::V2020_06_01::Models::HyperVGenerationType
RebootStatus = Azure::Compute::Mgmt::V2020_06_01::Models::RebootStatus
UpgradeMode = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeMode
VirtualMachineScaleSetScaleInRules = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetScaleInRules
OperatingSystemStateTypes = Azure::Compute::Mgmt::V2020_06_01::Models::OperatingSystemStateTypes
IPVersion = Azure::Compute::Mgmt::V2020_06_01::Models::IPVersion
OrchestrationServiceNames = Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceNames
OrchestrationServiceState = Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceState
VirtualMachineScaleSetSkuScaleType = Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSkuScaleType
UpgradeState = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeState
UpgradeOperationInvoker = Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationInvoker
RollingUpgradeStatusCode = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeStatusCode
RollingUpgradeActionType = Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeActionType
IntervalInMins = Azure::Compute::Mgmt::V2020_06_01::Models::IntervalInMins
OrchestrationServiceStateAction = Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceStateAction
InstanceViewTypes = Azure::Compute::Mgmt::V2020_06_01::Models::InstanceViewTypes
SnapshotUpdate = Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotUpdate
Resource = Azure::Compute::Mgmt::V2020_06_30::Models::Resource
SnapshotList = Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotList
ImageDiskReference = Azure::Compute::Mgmt::V2020_06_30::Models::ImageDiskReference
EncryptionSetIdentity = Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSetIdentity
SourceVault = Azure::Compute::Mgmt::V2020_06_30::Models::SourceVault
KeyVaultAndSecretReference = Azure::Compute::Mgmt::V2020_06_30::Models::KeyVaultAndSecretReference
KeyVaultAndKeyReference = Azure::Compute::Mgmt::V2020_06_30::Models::KeyVaultAndKeyReference
EncryptionSettingsCollection = Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSettingsCollection
DiskEncryptionSetUpdate = Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetUpdate
ShareInfoElement = Azure::Compute::Mgmt::V2020_06_30::Models::ShareInfoElement
DiskEncryptionSetList = Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetList
DiskUpdate = Azure::Compute::Mgmt::V2020_06_30::Models::DiskUpdate
ResourceUriList = Azure::Compute::Mgmt::V2020_06_30::Models::ResourceUriList
SnapshotSku = Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotSku
PrivateEndpoint = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpoint
AccessUri = Azure::Compute::Mgmt::V2020_06_30::Models::AccessUri
PrivateLinkServiceConnectionState = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkServiceConnectionState
DiskSku = Azure::Compute::Mgmt::V2020_06_30::Models::DiskSku
PrivateEndpointConnection = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointConnection
EncryptionSettingsElement = Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSettingsElement
ApiError = Azure::Compute::Mgmt::V2020_06_30::Models::ApiError
Encryption = Azure::Compute::Mgmt::V2020_06_30::Models::Encryption
ApiErrorBase = Azure::Compute::Mgmt::V2020_06_30::Models::ApiErrorBase
GrantAccessData = Azure::Compute::Mgmt::V2020_06_30::Models::GrantAccessData
DiskAccessList = Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccessList
CreationData = Azure::Compute::Mgmt::V2020_06_30::Models::CreationData
DiskAccessUpdate = Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccessUpdate
InnerError = Azure::Compute::Mgmt::V2020_06_30::Models::InnerError
PrivateLinkResource = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkResource
DiskList = Azure::Compute::Mgmt::V2020_06_30::Models::DiskList
PrivateLinkResourceListResult = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkResourceListResult
Disk = Azure::Compute::Mgmt::V2020_06_30::Models::Disk
Snapshot = Azure::Compute::Mgmt::V2020_06_30::Models::Snapshot
DiskEncryptionSet = Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSet
DiskAccess = Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccess
DiskStorageAccountTypes = Azure::Compute::Mgmt::V2020_06_30::Models::DiskStorageAccountTypes
OperatingSystemTypes = Azure::Compute::Mgmt::V2020_06_30::Models::OperatingSystemTypes
HyperVGeneration = Azure::Compute::Mgmt::V2020_06_30::Models::HyperVGeneration
DiskCreateOption = Azure::Compute::Mgmt::V2020_06_30::Models::DiskCreateOption
DiskState = Azure::Compute::Mgmt::V2020_06_30::Models::DiskState
EncryptionType = Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionType
NetworkAccessPolicy = Azure::Compute::Mgmt::V2020_06_30::Models::NetworkAccessPolicy
SnapshotStorageAccountTypes = Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotStorageAccountTypes
DiskEncryptionSetType = Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetType
AccessLevel = Azure::Compute::Mgmt::V2020_06_30::Models::AccessLevel
DiskEncryptionSetIdentityType = Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetIdentityType
PrivateEndpointServiceConnectionStatus = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointServiceConnectionStatus
PrivateEndpointConnectionProvisioningState = Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointConnectionProvisioningState
end
class ComputeManagementClass
attr_reader :resource_skus, :galleries, :gallery_images, :gallery_image_versions, :gallery_applications, :gallery_application_versions, :operations, :availability_sets, :proximity_placement_groups, :dedicated_host_groups, :dedicated_hosts, :ssh_public_keys, :virtual_machine_extension_images, :virtual_machine_extensions, :virtual_machine_images, :usage_operations, :virtual_machines, :virtual_machine_sizes, :images, :virtual_machine_scale_sets, :virtual_machine_scale_set_extensions, :virtual_machine_scale_set_rolling_upgrades, :virtual_machine_scale_set_vmextensions, :virtual_machine_scale_set_vms, :log_analytics, :virtual_machine_run_commands, :disks, :snapshots, :disk_encryption_sets, :disk_accesses, :configurable, :base_url, :options, :model_classes
def initialize(configurable, base_url=nil, options=nil)
@configurable, @base_url, @options = configurable, base_url, options
@client_0 = Azure::Compute::Mgmt::V2019_04_01::ComputeManagementClient.new(configurable.credentials, base_url, options)
if(@client_0.respond_to?(:subscription_id))
@client_0.subscription_id = configurable.subscription_id
end
add_telemetry(@client_0)
@resource_skus = @client_0.resource_skus
@client_1 = Azure::Compute::Mgmt::V2019_12_01::ComputeManagementClient.new(configurable.credentials, base_url, options)
if(@client_1.respond_to?(:subscription_id))
@client_1.subscription_id = configurable.subscription_id
end
add_telemetry(@client_1)
@galleries = @client_1.galleries
@gallery_images = @client_1.gallery_images
@gallery_image_versions = @client_1.gallery_image_versions
@gallery_applications = @client_1.gallery_applications
@gallery_application_versions = @client_1.gallery_application_versions
@client_2 = Azure::Compute::Mgmt::V2020_06_01::ComputeManagementClient.new(configurable.credentials, base_url, options)
if(@client_2.respond_to?(:subscription_id))
@client_2.subscription_id = configurable.subscription_id
end
add_telemetry(@client_2)
@operations = @client_2.operations
@availability_sets = @client_2.availability_sets
@proximity_placement_groups = @client_2.proximity_placement_groups
@dedicated_host_groups = @client_2.dedicated_host_groups
@dedicated_hosts = @client_2.dedicated_hosts
@ssh_public_keys = @client_2.ssh_public_keys
@virtual_machine_extension_images = @client_2.virtual_machine_extension_images
@virtual_machine_extensions = @client_2.virtual_machine_extensions
@virtual_machine_images = @client_2.virtual_machine_images
@usage_operations = @client_2.usage_operations
@virtual_machines = @client_2.virtual_machines
@virtual_machine_sizes = @client_2.virtual_machine_sizes
@images = @client_2.images
@virtual_machine_scale_sets = @client_2.virtual_machine_scale_sets
@virtual_machine_scale_set_extensions = @client_2.virtual_machine_scale_set_extensions
@virtual_machine_scale_set_rolling_upgrades = @client_2.virtual_machine_scale_set_rolling_upgrades
@virtual_machine_scale_set_vmextensions = @client_2.virtual_machine_scale_set_vmextensions
@virtual_machine_scale_set_vms = @client_2.virtual_machine_scale_set_vms
@log_analytics = @client_2.log_analytics
@virtual_machine_run_commands = @client_2.virtual_machine_run_commands
@client_3 = Azure::Compute::Mgmt::V2020_06_30::ComputeManagementClient.new(configurable.credentials, base_url, options)
if(@client_3.respond_to?(:subscription_id))
@client_3.subscription_id = configurable.subscription_id
end
add_telemetry(@client_3)
@disks = @client_3.disks
@snapshots = @client_3.snapshots
@disk_encryption_sets = @client_3.disk_encryption_sets
@disk_accesses = @client_3.disk_accesses
@model_classes = ModelClasses.new
end
def add_telemetry(client)
profile_information = "Profiles/azure_sdk/#{Azure::VERSION}/Latest/Compute/Mgmt"
client.add_user_agent_information(profile_information)
end
def method_missing(method, *args)
if @client_3.respond_to?method
@client_3.send(method, *args)
elsif @client_2.respond_to?method
@client_2.send(method, *args)
elsif @client_1.respond_to?method
@client_1.send(method, *args)
elsif @client_0.respond_to?method
@client_0.send(method, *args)
else
super
end
end
class ModelClasses
def resource_sku_restriction_info
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionInfo
end
def resource_sku_restrictions
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictions
end
def resource_sku_costs
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCosts
end
def resource_sku_location_info
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuLocationInfo
end
def resource_sku_zone_details
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuZoneDetails
end
def resource_sku
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSku
end
def resource_sku_capabilities
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapabilities
end
def resource_skus_result
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkusResult
end
def resource_sku_capacity
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapacity
end
def resource_sku_capacity_scale_type
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuCapacityScaleType
end
def resource_sku_restrictions_type
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionsType
end
def resource_sku_restrictions_reason_code
Azure::Compute::Mgmt::V2019_04_01::Models::ResourceSkuRestrictionsReasonCode
end
def replication_status
Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationStatus
end
def regional_replication_status
Azure::Compute::Mgmt::V2019_12_01::Models::RegionalReplicationStatus
end
def gallery_application_list
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationList
end
def gallery_image_list
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageList
end
def gallery_disk_image
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryDiskImage
end
def user_artifact_source
Azure::Compute::Mgmt::V2019_12_01::Models::UserArtifactSource
end
def gallery_identifier
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryIdentifier
end
def managed_artifact
Azure::Compute::Mgmt::V2019_12_01::Models::ManagedArtifact
end
def target_region
Azure::Compute::Mgmt::V2019_12_01::Models::TargetRegion
end
def encryption_images
Azure::Compute::Mgmt::V2019_12_01::Models::EncryptionImages
end
def disallowed
Azure::Compute::Mgmt::V2019_12_01::Models::Disallowed
end
def recommended_machine_configuration
Azure::Compute::Mgmt::V2019_12_01::Models::RecommendedMachineConfiguration
end
def gallery_application_version_list
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionList
end
def gallery_artifact_source
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactSource
end
def disk_image_encryption
Azure::Compute::Mgmt::V2019_12_01::Models::DiskImageEncryption
end
def gallery_artifact_publishing_profile_base
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactPublishingProfileBase
end
def gallery_image_version_storage_profile
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionStorageProfile
end
def image_purchase_plan
Azure::Compute::Mgmt::V2019_12_01::Models::ImagePurchasePlan
end
def gallery_image_version_list
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionList
end
def update_resource_definition
Azure::Compute::Mgmt::V2019_12_01::Models::UpdateResourceDefinition
end
def gallery_artifact_version_source
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryArtifactVersionSource
end
def resource_range
Azure::Compute::Mgmt::V2019_12_01::Models::ResourceRange
end
def gallery_image_identifier
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageIdentifier
end
def gallery_list
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryList
end
def gallery
Azure::Compute::Mgmt::V2019_12_01::Models::Gallery
end
def gallery_update
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryUpdate
end
def gallery_application
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplication
end
def gallery_application_update
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationUpdate
end
def gallery_application_version_publishing_profile
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionPublishingProfile
end
def gallery_application_version
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersion
end
def gallery_application_version_update
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryApplicationVersionUpdate
end
def gallery_image
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImage
end
def gallery_image_update
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageUpdate
end
def gallery_image_version_publishing_profile
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionPublishingProfile
end
def gallery_osdisk_image
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryOSDiskImage
end
def gallery_data_disk_image
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryDataDiskImage
end
def gallery_image_version
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersion
end
def gallery_image_version_update
Azure::Compute::Mgmt::V2019_12_01::Models::GalleryImageVersionUpdate
end
def osdisk_image_encryption
Azure::Compute::Mgmt::V2019_12_01::Models::OSDiskImageEncryption
end
def data_disk_image_encryption
Azure::Compute::Mgmt::V2019_12_01::Models::DataDiskImageEncryption
end
def aggregated_replication_state
Azure::Compute::Mgmt::V2019_12_01::Models::AggregatedReplicationState
end
def replication_state
Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationState
end
def storage_account_type
Azure::Compute::Mgmt::V2019_12_01::Models::StorageAccountType
end
def host_caching
Azure::Compute::Mgmt::V2019_12_01::Models::HostCaching
end
def replication_status_types
Azure::Compute::Mgmt::V2019_12_01::Models::ReplicationStatusTypes
end
def available_patch_summary
Azure::Compute::Mgmt::V2020_06_01::Models::AvailablePatchSummary
end
def compute_operation_value
Azure::Compute::Mgmt::V2020_06_01::Models::ComputeOperationValue
end
def last_patch_installation_summary
Azure::Compute::Mgmt::V2020_06_01::Models::LastPatchInstallationSummary
end
def disallowed_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::DisallowedConfiguration
end
def virtual_machine_patch_status
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachinePatchStatus
end
def instance_view_status
Azure::Compute::Mgmt::V2020_06_01::Models::InstanceViewStatus
end
def virtual_machine_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineInstanceView
end
def sku
Azure::Compute::Mgmt::V2020_06_01::Models::Sku
end
def virtual_machine_agent_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineAgentInstanceView
end
def disk_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::DiskInstanceView
end
def availability_set_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetListResult
end
def boot_diagnostics_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::BootDiagnosticsInstanceView
end
def automatic_repairs_policy
Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticRepairsPolicy
end
def virtual_machine_scale_set_vmlist_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMListResult
end
def virtual_machine_scale_set_vmextensions_summary
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMExtensionsSummary
end
def virtual_machine_scale_set_vmprotection_policy
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMProtectionPolicy
end
def network_profile
Azure::Compute::Mgmt::V2020_06_01::Models::NetworkProfile
end
def sub_resource_read_only
Azure::Compute::Mgmt::V2020_06_01::Models::SubResourceReadOnly
end
def boot_diagnostics
Azure::Compute::Mgmt::V2020_06_01::Models::BootDiagnostics
end
def virtual_machine_scale_set_vminstance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceView
end
def diagnostics_profile
Azure::Compute::Mgmt::V2020_06_01::Models::DiagnosticsProfile
end
def dedicated_host_allocatable_vm
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostAllocatableVM
end
def billing_profile
Azure::Compute::Mgmt::V2020_06_01::Models::BillingProfile
end
def dedicated_host_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostInstanceView
end
def virtual_machine_extension_handler_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionHandlerInstanceView
end
def upgrade_operation_historical_status_info
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoricalStatusInfo
end
def dedicated_host_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostListResult
end
def ssh_public_key_generate_key_pair_result
Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyGenerateKeyPairResult
end
def virtual_machine_status_code_count
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineStatusCodeCount
end
def rolling_upgrade_progress_info
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeProgressInfo
end
def virtual_machine_scale_set_vminstance_required_ids
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceRequiredIDs
end
def virtual_machine_size
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSize
end
def virtual_machine_scale_set_instance_view_statuses_summary
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetInstanceViewStatusesSummary
end
def upgrade_operation_history_status
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoryStatus
end
def virtual_machine_identity_user_assigned_identities_value
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineIdentityUserAssignedIdentitiesValue
end
def virtual_machine_extension_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionInstanceView
end
def virtual_machine_identity
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineIdentity
end
def virtual_machine_scale_set_sku
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSku
end
def maintenance_redeploy_status
Azure::Compute::Mgmt::V2020_06_01::Models::MaintenanceRedeployStatus
end
def virtual_machine_software_patch_properties
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSoftwarePatchProperties
end
def virtual_machine_health_status
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineHealthStatus
end
def compute_operation_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::ComputeOperationListResult
end
def virtual_machine_assess_patches_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineAssessPatchesResult
end
def retrieve_boot_diagnostics_data_result
Azure::Compute::Mgmt::V2020_06_01::Models::RetrieveBootDiagnosticsDataResult
end
def osdisk_image
Azure::Compute::Mgmt::V2020_06_01::Models::OSDiskImage
end
def sub_resource
Azure::Compute::Mgmt::V2020_06_01::Models::SubResource
end
def automatic_osupgrade_properties
Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticOSUpgradeProperties
end
def virtual_machine_scale_set_sku_capacity
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSkuCapacity
end
def virtual_machine_scale_set_vminstance_ids
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMInstanceIDs
end
def usage
Azure::Compute::Mgmt::V2020_06_01::Models::Usage
end
def run_command_result
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandResult
end
def virtual_machine_reimage_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineReimageParameters
end
def run_command_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandListResult
end
def virtual_machine_scale_set_list_with_link_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListWithLinkResult
end
def virtual_machine_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineListResult
end
def hardware_profile
Azure::Compute::Mgmt::V2020_06_01::Models::HardwareProfile
end
def automatic_osupgrade_policy
Azure::Compute::Mgmt::V2020_06_01::Models::AutomaticOSUpgradePolicy
end
def key_vault_secret_reference
Azure::Compute::Mgmt::V2020_06_01::Models::KeyVaultSecretReference
end
def rolling_upgrade_policy
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradePolicy
end
def key_vault_key_reference
Azure::Compute::Mgmt::V2020_06_01::Models::KeyVaultKeyReference
end
def upgrade_policy
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradePolicy
end
def virtual_hard_disk
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualHardDisk
end
def scale_in_policy
Azure::Compute::Mgmt::V2020_06_01::Models::ScaleInPolicy
end
def orchestration_service_summary
Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceSummary
end
def run_command_document_base
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandDocumentBase
end
def data_disk
Azure::Compute::Mgmt::V2020_06_01::Models::DataDisk
end
def run_command_parameter_definition
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandParameterDefinition
end
def security_profile
Azure::Compute::Mgmt::V2020_06_01::Models::SecurityProfile
end
def image_disk
Azure::Compute::Mgmt::V2020_06_01::Models::ImageDisk
end
def additional_unattend_content
Azure::Compute::Mgmt::V2020_06_01::Models::AdditionalUnattendContent
end
def image_storage_profile
Azure::Compute::Mgmt::V2020_06_01::Models::ImageStorageProfile
end
def win_rmconfiguration
Azure::Compute::Mgmt::V2020_06_01::Models::WinRMConfiguration
end
def run_command_input
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandInput
end
def windows_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::WindowsConfiguration
end
def run_command_input_parameter
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandInputParameter
end
def ssh_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::SshConfiguration
end
def image_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::ImageListResult
end
def vault_certificate
Azure::Compute::Mgmt::V2020_06_01::Models::VaultCertificate
end
def virtual_machine_scale_set_identity_user_assigned_identities_value
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue
end
def osprofile
Azure::Compute::Mgmt::V2020_06_01::Models::OSProfile
end
def virtual_machine_scale_set_identity
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIdentity
end
def dedicated_host_group_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupInstanceView
end
def virtual_machine_scale_set_osprofile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetOSProfile
end
def dedicated_host_group_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupListResult
end
def virtual_machine_scale_set_update_osprofile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateOSProfile
end
def virtual_machine_scale_set_list_osupgrade_history
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListOSUpgradeHistory
end
def virtual_machine_scale_set_managed_disk_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetManagedDiskParameters
end
def ssh_public_keys_group_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeysGroupListResult
end
def virtual_machine_scale_set_osdisk
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetOSDisk
end
def rollback_status_info
Azure::Compute::Mgmt::V2020_06_01::Models::RollbackStatusInfo
end
def virtual_machine_scale_set_update_osdisk
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateOSDisk
end
def virtual_machine_extensions_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionsListResult
end
def virtual_machine_scale_set_data_disk
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetDataDisk
end
def virtual_machine_scale_set_storage_profile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetStorageProfile
end
def data_disk_image
Azure::Compute::Mgmt::V2020_06_01::Models::DataDiskImage
end
def virtual_machine_scale_set_update_storage_profile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateStorageProfile
end
def list_usages_result
Azure::Compute::Mgmt::V2020_06_01::Models::ListUsagesResult
end
def api_entity_reference
Azure::Compute::Mgmt::V2020_06_01::Models::ApiEntityReference
end
def plan
Azure::Compute::Mgmt::V2020_06_01::Models::Plan
end
def virtual_machine_scale_set_public_ipaddress_configuration_dns_settings
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings
end
def virtual_machine_scale_set_instance_view
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetInstanceView
end
def virtual_machine_scale_set_ip_tag
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIpTag
end
def diff_disk_settings
Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskSettings
end
def virtual_machine_scale_set_public_ipaddress_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetPublicIPAddressConfiguration
end
def storage_profile
Azure::Compute::Mgmt::V2020_06_01::Models::StorageProfile
end
def virtual_machine_scale_set_update_public_ipaddress_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdatePublicIPAddressConfiguration
end
def win_rmlistener
Azure::Compute::Mgmt::V2020_06_01::Models::WinRMListener
end
def orchestration_service_state_input
Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceStateInput
end
def ssh_public_key
Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKey
end
def vmscale_set_convert_to_single_placement_group_input
Azure::Compute::Mgmt::V2020_06_01::Models::VMScaleSetConvertToSinglePlacementGroupInput
end
def vault_secret_group
Azure::Compute::Mgmt::V2020_06_01::Models::VaultSecretGroup
end
def virtual_machine_scale_set_network_configuration_dns_settings
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkConfigurationDnsSettings
end
def virtual_machine_scale_set_vmnetwork_profile_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMNetworkProfileConfiguration
end
def log_analytics_operation_result
Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsOperationResult
end
def upgrade_operation_historical_status_info_properties
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationHistoricalStatusInfoProperties
end
def log_analytics_output
Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsOutput
end
def virtual_machine_scale_set_list_skus_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListSkusResult
end
def virtual_machine_scale_set_network_profile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkProfile
end
def purchase_plan
Azure::Compute::Mgmt::V2020_06_01::Models::PurchasePlan
end
def virtual_machine_scale_set_update_network_profile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateNetworkProfile
end
def virtual_machine_capture_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineCaptureParameters
end
def log_analytics_input_base
Azure::Compute::Mgmt::V2020_06_01::Models::LogAnalyticsInputBase
end
def disk_encryption_settings
Azure::Compute::Mgmt::V2020_06_01::Models::DiskEncryptionSettings
end
def recovery_walk_response
Azure::Compute::Mgmt::V2020_06_01::Models::RecoveryWalkResponse
end
def additional_capabilities
Azure::Compute::Mgmt::V2020_06_01::Models::AdditionalCapabilities
end
def virtual_machine_scale_set_extension_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionListResult
end
def linux_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::LinuxConfiguration
end
def virtual_machine_scale_set_extension_profile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionProfile
end
def dedicated_host_available_capacity
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostAvailableCapacity
end
def terminate_notification_profile
Azure::Compute::Mgmt::V2020_06_01::Models::TerminateNotificationProfile
end
def scheduled_events_profile
Azure::Compute::Mgmt::V2020_06_01::Models::ScheduledEventsProfile
end
def virtual_machine_scale_set_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetListResult
end
def virtual_machine_scale_set_vmprofile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMProfile
end
def patch_settings
Azure::Compute::Mgmt::V2020_06_01::Models::PatchSettings
end
def virtual_machine_scale_set_update_vmprofile
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateVMProfile
end
def virtual_machine_size_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSizeListResult
end
def update_resource
Azure::Compute::Mgmt::V2020_06_01::Models::UpdateResource
end
def osdisk
Azure::Compute::Mgmt::V2020_06_01::Models::OSDisk
end
def usage_name
Azure::Compute::Mgmt::V2020_06_01::Models::UsageName
end
def proximity_placement_group_list_result
Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupListResult
end
def rolling_upgrade_running_status
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeRunningStatus
end
def availability_set
Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySet
end
def availability_set_update
Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetUpdate
end
def sub_resource_with_colocation_status
Azure::Compute::Mgmt::V2020_06_01::Models::SubResourceWithColocationStatus
end
def proximity_placement_group
Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroup
end
def proximity_placement_group_update
Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupUpdate
end
def dedicated_host_instance_view_with_name
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostInstanceViewWithName
end
def dedicated_host_group
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroup
end
def dedicated_host_group_update
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostGroupUpdate
end
def dedicated_host
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHost
end
def dedicated_host_update
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostUpdate
end
def ssh_public_key_resource
Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyResource
end
def ssh_public_key_update_resource
Azure::Compute::Mgmt::V2020_06_01::Models::SshPublicKeyUpdateResource
end
def virtual_machine_extension_image
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionImage
end
def virtual_machine_image_resource
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineImageResource
end
def virtual_machine_extension
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtension
end
def virtual_machine_extension_update
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineExtensionUpdate
end
def virtual_machine_image
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineImage
end
def virtual_machine_capture_result
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineCaptureResult
end
def image_reference
Azure::Compute::Mgmt::V2020_06_01::Models::ImageReference
end
def disk_encryption_set_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::DiskEncryptionSetParameters
end
def managed_disk_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::ManagedDiskParameters
end
def network_interface_reference
Azure::Compute::Mgmt::V2020_06_01::Models::NetworkInterfaceReference
end
def virtual_machine
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachine
end
def virtual_machine_update
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineUpdate
end
def image_osdisk
Azure::Compute::Mgmt::V2020_06_01::Models::ImageOSDisk
end
def image_data_disk
Azure::Compute::Mgmt::V2020_06_01::Models::ImageDataDisk
end
def image
Azure::Compute::Mgmt::V2020_06_01::Models::Image
end
def image_update
Azure::Compute::Mgmt::V2020_06_01::Models::ImageUpdate
end
def virtual_machine_scale_set_ipconfiguration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetIPConfiguration
end
def virtual_machine_scale_set_update_ipconfiguration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateIPConfiguration
end
def virtual_machine_scale_set_network_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetNetworkConfiguration
end
def virtual_machine_scale_set_update_network_configuration
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdateNetworkConfiguration
end
def virtual_machine_scale_set_extension
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtension
end
def virtual_machine_scale_set_extension_update
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetExtensionUpdate
end
def virtual_machine_scale_set
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSet
end
def virtual_machine_scale_set_vmreimage_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVMReimageParameters
end
def virtual_machine_scale_set_reimage_parameters
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetReimageParameters
end
def virtual_machine_scale_set_update
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetUpdate
end
def virtual_machine_scale_set_vm
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetVM
end
def rolling_upgrade_status_info
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeStatusInfo
end
def request_rate_by_interval_input
Azure::Compute::Mgmt::V2020_06_01::Models::RequestRateByIntervalInput
end
def throttled_requests_input
Azure::Compute::Mgmt::V2020_06_01::Models::ThrottledRequestsInput
end
def run_command_document
Azure::Compute::Mgmt::V2020_06_01::Models::RunCommandDocument
end
def vm_disk_types
Azure::Compute::Mgmt::V2020_06_01::Models::VmDiskTypes
end
def hyper_vgeneration_types
Azure::Compute::Mgmt::V2020_06_01::Models::HyperVGenerationTypes
end
def status_level_types
Azure::Compute::Mgmt::V2020_06_01::Models::StatusLevelTypes
end
def availability_set_sku_types
Azure::Compute::Mgmt::V2020_06_01::Models::AvailabilitySetSkuTypes
end
def proximity_placement_group_type
Azure::Compute::Mgmt::V2020_06_01::Models::ProximityPlacementGroupType
end
def dedicated_host_license_types
Azure::Compute::Mgmt::V2020_06_01::Models::DedicatedHostLicenseTypes
end
def software_update_reboot_behavior
Azure::Compute::Mgmt::V2020_06_01::Models::SoftwareUpdateRebootBehavior
end
def patch_assessment_state
Azure::Compute::Mgmt::V2020_06_01::Models::PatchAssessmentState
end
def patch_operation_status
Azure::Compute::Mgmt::V2020_06_01::Models::PatchOperationStatus
end
def virtual_machine_size_types
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineSizeTypes
end
def caching_types
Azure::Compute::Mgmt::V2020_06_01::Models::CachingTypes
end
def disk_create_option_types
Azure::Compute::Mgmt::V2020_06_01::Models::DiskCreateOptionTypes
end
def storage_account_types
Azure::Compute::Mgmt::V2020_06_01::Models::StorageAccountTypes
end
def diff_disk_options
Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskOptions
end
def diff_disk_placement
Azure::Compute::Mgmt::V2020_06_01::Models::DiffDiskPlacement
end
def pass_names
Azure::Compute::Mgmt::V2020_06_01::Models::PassNames
end
def component_names
Azure::Compute::Mgmt::V2020_06_01::Models::ComponentNames
end
def setting_names
Azure::Compute::Mgmt::V2020_06_01::Models::SettingNames
end
def protocol_types
Azure::Compute::Mgmt::V2020_06_01::Models::ProtocolTypes
end
def in_guest_patch_mode
Azure::Compute::Mgmt::V2020_06_01::Models::InGuestPatchMode
end
def virtual_machine_priority_types
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachinePriorityTypes
end
def virtual_machine_eviction_policy_types
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineEvictionPolicyTypes
end
def resource_identity_type
Azure::Compute::Mgmt::V2020_06_01::Models::ResourceIdentityType
end
def maintenance_operation_result_code_types
Azure::Compute::Mgmt::V2020_06_01::Models::MaintenanceOperationResultCodeTypes
end
def hyper_vgeneration_type
Azure::Compute::Mgmt::V2020_06_01::Models::HyperVGenerationType
end
def reboot_status
Azure::Compute::Mgmt::V2020_06_01::Models::RebootStatus
end
def upgrade_mode
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeMode
end
def virtual_machine_scale_set_scale_in_rules
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetScaleInRules
end
def operating_system_state_types
Azure::Compute::Mgmt::V2020_06_01::Models::OperatingSystemStateTypes
end
def ipversion
Azure::Compute::Mgmt::V2020_06_01::Models::IPVersion
end
def orchestration_service_names
Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceNames
end
def orchestration_service_state
Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceState
end
def virtual_machine_scale_set_sku_scale_type
Azure::Compute::Mgmt::V2020_06_01::Models::VirtualMachineScaleSetSkuScaleType
end
def upgrade_state
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeState
end
def upgrade_operation_invoker
Azure::Compute::Mgmt::V2020_06_01::Models::UpgradeOperationInvoker
end
def rolling_upgrade_status_code
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeStatusCode
end
def rolling_upgrade_action_type
Azure::Compute::Mgmt::V2020_06_01::Models::RollingUpgradeActionType
end
def interval_in_mins
Azure::Compute::Mgmt::V2020_06_01::Models::IntervalInMins
end
def orchestration_service_state_action
Azure::Compute::Mgmt::V2020_06_01::Models::OrchestrationServiceStateAction
end
def instance_view_types
Azure::Compute::Mgmt::V2020_06_01::Models::InstanceViewTypes
end
def snapshot_update
Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotUpdate
end
def resource
Azure::Compute::Mgmt::V2020_06_30::Models::Resource
end
def snapshot_list
Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotList
end
def image_disk_reference
Azure::Compute::Mgmt::V2020_06_30::Models::ImageDiskReference
end
def encryption_set_identity
Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSetIdentity
end
def source_vault
Azure::Compute::Mgmt::V2020_06_30::Models::SourceVault
end
def key_vault_and_secret_reference
Azure::Compute::Mgmt::V2020_06_30::Models::KeyVaultAndSecretReference
end
def key_vault_and_key_reference
Azure::Compute::Mgmt::V2020_06_30::Models::KeyVaultAndKeyReference
end
def encryption_settings_collection
Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSettingsCollection
end
def disk_encryption_set_update
Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetUpdate
end
def share_info_element
Azure::Compute::Mgmt::V2020_06_30::Models::ShareInfoElement
end
def disk_encryption_set_list
Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetList
end
def disk_update
Azure::Compute::Mgmt::V2020_06_30::Models::DiskUpdate
end
def resource_uri_list
Azure::Compute::Mgmt::V2020_06_30::Models::ResourceUriList
end
def snapshot_sku
Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotSku
end
def private_endpoint
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpoint
end
def access_uri
Azure::Compute::Mgmt::V2020_06_30::Models::AccessUri
end
def private_link_service_connection_state
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkServiceConnectionState
end
def disk_sku
Azure::Compute::Mgmt::V2020_06_30::Models::DiskSku
end
def private_endpoint_connection
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointConnection
end
def encryption_settings_element
Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionSettingsElement
end
def api_error
Azure::Compute::Mgmt::V2020_06_30::Models::ApiError
end
def encryption
Azure::Compute::Mgmt::V2020_06_30::Models::Encryption
end
def api_error_base
Azure::Compute::Mgmt::V2020_06_30::Models::ApiErrorBase
end
def grant_access_data
Azure::Compute::Mgmt::V2020_06_30::Models::GrantAccessData
end
def disk_access_list
Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccessList
end
def creation_data
Azure::Compute::Mgmt::V2020_06_30::Models::CreationData
end
def disk_access_update
Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccessUpdate
end
def inner_error
Azure::Compute::Mgmt::V2020_06_30::Models::InnerError
end
def private_link_resource
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkResource
end
def disk_list
Azure::Compute::Mgmt::V2020_06_30::Models::DiskList
end
def private_link_resource_list_result
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateLinkResourceListResult
end
def disk
Azure::Compute::Mgmt::V2020_06_30::Models::Disk
end
def snapshot
Azure::Compute::Mgmt::V2020_06_30::Models::Snapshot
end
def disk_encryption_set
Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSet
end
def disk_access
Azure::Compute::Mgmt::V2020_06_30::Models::DiskAccess
end
def disk_storage_account_types
Azure::Compute::Mgmt::V2020_06_30::Models::DiskStorageAccountTypes
end
def operating_system_types
Azure::Compute::Mgmt::V2020_06_30::Models::OperatingSystemTypes
end
def hyper_vgeneration
Azure::Compute::Mgmt::V2020_06_30::Models::HyperVGeneration
end
def disk_create_option
Azure::Compute::Mgmt::V2020_06_30::Models::DiskCreateOption
end
def disk_state
Azure::Compute::Mgmt::V2020_06_30::Models::DiskState
end
def encryption_type
Azure::Compute::Mgmt::V2020_06_30::Models::EncryptionType
end
def network_access_policy
Azure::Compute::Mgmt::V2020_06_30::Models::NetworkAccessPolicy
end
def snapshot_storage_account_types
Azure::Compute::Mgmt::V2020_06_30::Models::SnapshotStorageAccountTypes
end
def disk_encryption_set_type
Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetType
end
def access_level
Azure::Compute::Mgmt::V2020_06_30::Models::AccessLevel
end
def disk_encryption_set_identity_type
Azure::Compute::Mgmt::V2020_06_30::Models::DiskEncryptionSetIdentityType
end
def private_endpoint_service_connection_status
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointServiceConnectionStatus
end
def private_endpoint_connection_provisioning_state
Azure::Compute::Mgmt::V2020_06_30::Models::PrivateEndpointConnectionProvisioningState
end
end
end
end
end
end
| 58.756198 | 768 | 0.713611 |
18a9f1ebd45e440bdc2d87cf35862d72a98c63bd
| 4,952 |
require 'uri'
module VagrantPlugins
module Shell
class Config < Vagrant.plugin("2", :config)
attr_accessor :inline
attr_accessor :path
attr_accessor :md5
attr_accessor :sha1
attr_accessor :env
attr_accessor :upload_path
attr_accessor :args
attr_accessor :privileged
attr_accessor :binary
attr_accessor :keep_color
attr_accessor :name
attr_accessor :sensitive
attr_accessor :powershell_args
attr_accessor :powershell_elevated_interactive
attr_accessor :reboot
attr_accessor :reset
def initialize
@args = UNSET_VALUE
@inline = UNSET_VALUE
@path = UNSET_VALUE
@md5 = UNSET_VALUE
@sha1 = UNSET_VALUE
@env = UNSET_VALUE
@upload_path = UNSET_VALUE
@privileged = UNSET_VALUE
@binary = UNSET_VALUE
@keep_color = UNSET_VALUE
@name = UNSET_VALUE
@sensitive = UNSET_VALUE
@reboot = UNSET_VALUE
@reset = UNSET_VALUE
@powershell_args = UNSET_VALUE
@powershell_elevated_interactive = UNSET_VALUE
end
def finalize!
@args = nil if @args == UNSET_VALUE
@inline = nil if @inline == UNSET_VALUE
@path = nil if @path == UNSET_VALUE
@md5 = nil if @md5 == UNSET_VALUE
@sha1 = nil if @sha1 == UNSET_VALUE
@env = {} if @env == UNSET_VALUE
@upload_path = "/tmp/vagrant-shell" if @upload_path == UNSET_VALUE
@privileged = true if @privileged == UNSET_VALUE
@binary = false if @binary == UNSET_VALUE
@keep_color = false if @keep_color == UNSET_VALUE
@name = nil if @name == UNSET_VALUE
@sensitive = false if @sensitive == UNSET_VALUE
@reboot = false if @reboot == UNSET_VALUE
@reset = false if @reset == UNSET_VALUE
@powershell_args = "-ExecutionPolicy Bypass" if @powershell_args == UNSET_VALUE
@powershell_elevated_interactive = false if @powershell_elevated_interactive == UNSET_VALUE
if @args && args_valid?
@args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s
end
if @sensitive
@env.each do |_, v|
Vagrant::Util::CredentialScrubber.sensitive(v)
end
end
end
def validate(machine)
errors = _detected_errors
# Validate that the parameters are properly set
if path && inline
errors << I18n.t("vagrant.provisioners.shell.path_and_inline_set")
elsif !path && !inline && !reset && !reboot
errors << I18n.t("vagrant.provisioners.shell.no_path_or_inline")
end
# If it is not an URL, we validate the existence of a script to upload
if path && !remote?
expanded_path = Pathname.new(path).expand_path(machine.env.root_path)
if !expanded_path.file?
errors << I18n.t("vagrant.provisioners.shell.path_invalid",
path: expanded_path)
else
data = expanded_path.read(16)
if data && !data.valid_encoding?
errors << I18n.t(
"vagrant.provisioners.shell.invalid_encoding",
actual: data.encoding.to_s,
default: Encoding.default_external.to_s,
path: expanded_path.to_s)
end
end
end
if !env.is_a?(Hash)
errors << I18n.t("vagrant.provisioners.shell.env_must_be_a_hash")
end
# There needs to be a path to upload the script to
if !upload_path
errors << I18n.t("vagrant.provisioners.shell.upload_path_not_set")
end
if !args_valid?
errors << I18n.t("vagrant.provisioners.shell.args_bad_type")
end
if powershell_elevated_interactive && !privileged
errors << I18n.t("vagrant.provisioners.shell.interactive_not_elevated")
end
{ "shell provisioner" => errors }
end
# Args are optional, but if they're provided we only support them as a
# string or as an array.
def args_valid?
return true if !args
return true if args.is_a?(String)
return true if args.is_a?(Integer)
if args.is_a?(Array)
args.each do |a|
return false if !a.kind_of?(String) && !a.kind_of?(Integer)
end
return true
end
end
def remote?
path =~ URI.regexp(["ftp", "http", "https"])
end
end
end
end
| 35.371429 | 99 | 0.546648 |
7963340848d8b219acd78d71f88f59e81003119d
| 3,686 |
# frozen_string_literal: true
require "spec_helper"
describe Bundle::MacAppStoreInstaller do
def do_install
Bundle::MacAppStoreInstaller.install("foo", 123)
end
context ".installed_app_ids" do
it "shells out" do
Bundle::MacAppStoreInstaller.installed_app_ids
end
end
context ".app_id_installed_and_up_to_date?" do
it "returns result" do
allow(Bundle::MacAppStoreInstaller).to receive(:installed_app_ids).and_return([123, 456])
allow(Bundle::MacAppStoreInstaller).to receive(:outdated_app_ids).and_return([456])
expect(Bundle::MacAppStoreInstaller.app_id_installed_and_up_to_date?(123)).to eql(true)
expect(Bundle::MacAppStoreInstaller.app_id_installed_and_up_to_date?(456)).to eql(false)
end
end
context "when mas is not installed" do
before do
allow(Bundle).to receive(:mas_installed?).and_return(false)
allow(ARGV).to receive(:verbose?).and_return(false)
end
it "tries to install mas" do
expect(Bundle).to receive(:system).with("brew", "install", "mas").and_return(true)
expect { do_install }.to raise_error(RuntimeError)
end
context ".outdated_app_ids" do
it "does not shell out" do
expect(Bundle::MacAppStoreInstaller).not_to receive(:`)
Bundle::MacAppStoreInstaller.reset!
Bundle::MacAppStoreInstaller.outdated_app_ids
end
end
end
context "when mas is installed" do
before do
allow(Bundle).to receive(:mas_installed?).and_return(true)
allow(ARGV).to receive(:verbose?).and_return(false)
end
context ".outdated_app_ids" do
it "returns app ids" do
expect(Bundle::MacAppStoreInstaller).to receive(:`).and_return("foo 123")
Bundle::MacAppStoreInstaller.reset!
Bundle::MacAppStoreInstaller.outdated_app_ids
end
end
context "when mas is not signed in" do
before do
allow(ARGV).to receive(:verbose?).and_return(false)
end
it "tries to sign in with mas" do
expect(Bundle).to receive(:system).with("mas", "account").and_return(false).twice
expect(Bundle).to receive(:system).with("mas", "signin", "--dialog", "").and_return(true)
expect { do_install }.to raise_error(RuntimeError)
end
end
context "when mas is signed in" do
before do
allow(Bundle).to receive(:mas_signedin?).and_return(true)
allow(ARGV).to receive(:verbose?).and_return(false)
allow(Bundle::MacAppStoreInstaller).to receive(:outdated_app_ids).and_return([])
end
context "when app is installed" do
before do
allow(Bundle::MacAppStoreInstaller).to receive(:installed_app_ids).and_return([123])
end
it "skips" do
expect(Bundle).not_to receive(:system)
expect(do_install).to eql(:skipped)
end
end
context "when app is outdated" do
before do
allow(Bundle::MacAppStoreInstaller).to receive(:installed_app_ids).and_return([123])
allow(Bundle::MacAppStoreInstaller).to receive(:outdated_app_ids).and_return([123])
end
it "upgrades" do
expect(Bundle).to receive(:system).with("mas", "upgrade", "123").and_return(true)
expect(do_install).to eql(:success)
end
end
context "when app is not installed" do
before do
allow(Bundle::MacAppStoreInstaller).to receive(:installed_app_ids).and_return([])
end
it "installs app" do
expect(Bundle).to receive(:system).with("mas", "install", "123").and_return(true)
expect(do_install).to eql(:success)
end
end
end
end
end
| 32.333333 | 97 | 0.66522 |
e8c1971f980686500d2894a2401aefcc630eb07d
| 184 |
# frozen_string_literal: true
class BatchDistributeOrderWorker
include Sidekiq::Worker
sidekiq_options queue: :low
def perform
Order.paid.map(&:distribute_async)
end
end
| 16.727273 | 38 | 0.777174 |
1da212712309109b33ebc67e3e2e8f817294df4e
| 5,120 |
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2020_05_01
module Models
#
# Route table resource.
#
class RouteTable < Resource
include MsRestAzure
# @return [Array<Route>] Collection of routes contained within a route
# table.
attr_accessor :routes
# @return [Array<Subnet>] A collection of references to subnets.
attr_accessor :subnets
# @return [Boolean] Whether to disable the routes learned by BGP on that
# route table. True means disable.
attr_accessor :disable_bgp_route_propagation
# @return [ProvisioningState] The provisioning state of the route table
# resource. Possible values include: 'Succeeded', 'Updating', 'Deleting',
# 'Failed'
attr_accessor :provisioning_state
# @return [String] A unique read-only string that changes whenever the
# resource is updated.
attr_accessor :etag
#
# Mapper for RouteTable class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'RouteTable',
type: {
name: 'Composite',
class_name: 'RouteTable',
model_properties: {
id: {
client_side_validation: true,
required: false,
serialized_name: 'id',
type: {
name: 'String'
}
},
name: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'name',
type: {
name: 'String'
}
},
type: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'type',
type: {
name: 'String'
}
},
location: {
client_side_validation: true,
required: false,
serialized_name: 'location',
type: {
name: 'String'
}
},
tags: {
client_side_validation: true,
required: false,
serialized_name: 'tags',
type: {
name: 'Dictionary',
value: {
client_side_validation: true,
required: false,
serialized_name: 'StringElementType',
type: {
name: 'String'
}
}
}
},
routes: {
client_side_validation: true,
required: false,
serialized_name: 'properties.routes',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'RouteElementType',
type: {
name: 'Composite',
class_name: 'Route'
}
}
}
},
subnets: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'properties.subnets',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'SubnetElementType',
type: {
name: 'Composite',
class_name: 'Subnet'
}
}
}
},
disable_bgp_route_propagation: {
client_side_validation: true,
required: false,
serialized_name: 'properties.disableBgpRoutePropagation',
type: {
name: 'Boolean'
}
},
provisioning_state: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'properties.provisioningState',
type: {
name: 'String'
}
},
etag: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'etag',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
| 30.843373 | 79 | 0.433594 |
87a89f82455f12ac5e6ff9039414d474b9e8635b
| 1,004 |
#
# zip.rb
#
module Puppet::Parser::Functions
newfunction(:zip, :type => :rvalue, :doc => <<-DOC
Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments.
*Example:*
zip(['1','2','3'],['4','5','6'])
Would result in:
["1", "4"], ["2", "5"], ["3", "6"]
DOC
) do |arguments|
# Technically we support three arguments but only first is mandatory ...
raise(Puppet::ParseError, "zip(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size < 2
a = arguments[0]
b = arguments[1]
unless a.is_a?(Array) && b.is_a?(Array)
raise(Puppet::ParseError, 'zip(): Requires array to work with')
end
flatten = function_str2bool([arguments[2]]) if arguments[2]
result = a.zip(b)
result = flatten ? result.flatten : result
return result
end
end
# vim: set ts=2 sw=2 et :
| 26.421053 | 187 | 0.618526 |
2888a2df70a65444198ee8b33d8b94d1653dfee9
| 911 |
class Libdvdnav < Formula
homepage "https://dvdnav.mplayerhq.hu/"
url "https://download.videolan.org/pub/videolan/libdvdnav/5.0.3/libdvdnav-5.0.3.tar.bz2"
sha256 "5097023e3d2b36944c763f1df707ee06b19dc639b2b68fb30113a5f2cbf60b6d"
head do
url "git://git.videolan.org/libdvdnav.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
bottle do
cellar :any
sha1 "c99a864651ceff870b4a5826c80b6ef88ad8671d" => :yosemite
sha1 "30322b1a670e188773fea56f23604e02679530f8" => :mavericks
sha1 "c34ab3283adfcc429dbecebec5251a57ffd88a61" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "libdvdread"
def install
system "autoreconf", "-if" if build.head?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
end
| 30.366667 | 90 | 0.700329 |
385c743ebe6a101ac5e615e2682d2c660ed1eb13
| 1,539 |
$:.push(File.dirname(__FILE__))
require 'edn/version'
require 'edn/core_ext'
require 'edn/types'
require 'edn/parser'
require 'edn/transform'
require 'edn/reader'
module EDN
class ParseFailed < StandardError
attr_reader :original_exception
def initialize(message, original_exception)
super(message)
@original_exception = original_exception
end
end
@parser = EDN::Parser.new
@transform = EDN::Transform.new
@tags = Hash.new
def self.read(edn)
begin
tree = @parser.parse(edn)
rescue Parslet::ParseFailed => error
message = "Invalid EDN, cannot parse: #{edn}"
raise ParseFailed.new(message, error)
end
@transform.apply(tree)
end
def self.register(tag, func = nil, &block)
if block_given?
func = block
end
if func.nil?
func = lambda { |x| x }
end
if func.is_a?(Class)
@tags[tag] = lambda { |*args| func.new(*args) }
else
@tags[tag] = func
end
end
def self.unregister(tag)
@tags[tag] = nil
end
def self.tagged_element(tag, element)
func = @tags[tag]
if func
func.call(element)
else
EDN::Type::Unknown.new(tag, element)
end
end
def self.tagout(tag, element)
["##{tag}", element.to_edn].join(" ")
end
def self.symbol(text)
EDN::Type::Symbol.new(text)
end
def self.list(*values)
EDN::Type::List.new(*values)
end
end
EDN.register("inst") do |value|
DateTime.parse(value)
end
EDN.register("uuid") do |value|
EDN::Type::UUID.new(value)
end
| 18.768293 | 53 | 0.636777 |
012e03ece8ffb6ea204681d1455471652a701bba
| 925 |
# frozen_string_literal: true
module Types
module Packages
module Conan
class FileMetadatumType < BaseObject
graphql_name 'ConanFileMetadata'
description 'Conan file metadata'
implements Types::Packages::FileMetadataType
authorize :read_package
field :conan_file_type, ::Types::Packages::Conan::MetadatumFileTypeEnum, null: false, description: 'Type of the Conan file.'
field :conan_package_reference, GraphQL::Types::String, null: true, description: 'Reference of the Conan package.'
field :id, ::Types::GlobalIDType[::Packages::Conan::FileMetadatum], null: false, description: 'ID of the metadatum.'
field :package_revision, GraphQL::Types::String, null: true, description: 'Revision of the package.'
field :recipe_revision, GraphQL::Types::String, null: false, description: 'Revision of the Conan recipe.'
end
end
end
end
| 40.217391 | 132 | 0.709189 |
61081799f1b0b8d28ea95d6dccf5d3af4a693a3c
| 152 |
require File.expand_path('../../../spec_helper', __FILE__)
describe "TracePoint#return_value" do
it "needs to be reviewed for spec completeness"
end
| 25.333333 | 58 | 0.75 |
1a1fa4d13212460b94e58ae92b89db2171b227d0
| 421 |
# frozen_string_literal: true
class AddColumnsToAnnouncements < ActiveRecord::Migration[6.0]
def change
reversible do |dir|
change_table :announcements, bulk: true do |t|
dir.up do
t.boolean :wip, default: false, null: false
t.datetime :published_at
end
dir.down do
t.remove :wip
t.remove :published_at
end
end
end
end
end
| 21.05 | 62 | 0.603325 |
b9bbead176c31df9f48512a812124afd3333592c
| 3,393 |
require 'ox'
require 'nokogiri'
module Ox
module Builder
# args = attributes and/or children in any order, multiple appearance is possible
# @overload build(name,attributes,children)
# @param [String] name name of the Element
# @param [Hash] attributes
# @param [String|Element|Array] children text, child element or array of elements
def x(name, *args)
n = Element.new(name)
yielded = if block_given?
yield
else
[]
end
unless yielded.is_a?(Array)
yielded = [yielded]
end
values = args + yielded
values.each do |val|
case val
when Hash
val.each { |k,v| n[k.to_s] = v }
when Array
val.each { |c| n << c if c}
else
n << val if val
end
end
n
end
def x_if(condition, *args)
x(*args) if condition
end
end
end
module Nokogiri::AlternativeBuilder
class Element
attr_reader :name, :children, :attributes
def initialize(name)
@name = name
@children = []
@attributes = {}
end
def << n
@children << n
end
def []= k,v
@attributes[k] = v
end
end
def x(name, *args)
n = Element.new(name)
yielded = if block_given?
yield
else
[]
end
unless yielded.is_a?(Array)
yielded = [yielded]
end
values = args + yielded
values.each do |val|
case val
when Hash
val.each { |k,v| n[k.to_s] = v }
when Array
val.each { |c| n << c if c}
else
n << val if val
end
end
n
end
def x_if(condition, *args)
x(*args) if condition
end
end
module EM::Xmpp
module NokogiriXmlBuilder
include Nokogiri::AlternativeBuilder
class OutgoingStanza
include NokogiriXmlBuilder
attr_reader :xml,:params
def initialize(*args,&blk)
@root = x(*args,&blk)
@doc = build_doc_from_element_root @root
@xml = @doc.root.to_xml
@params = @root.attributes
end
private
def build_doc_from_element_root(root)
doc = Nokogiri::XML::Document.new
root_node = build_tree doc, root
doc.root = root_node
doc
end
end
def build_xml(*args)
root = x(*args)
doc = Nokogiri::XML::Document.new
doc.root = build_tree(doc, root)
ret = doc.root.to_xml
ret
end
private
def build_tree(doc, node_info)
node = node_info
if node_info.respond_to?(:name)
node = node_for_info doc, node_info
list = node_info.children.map{|child| build_tree doc, child}
list.each{|l| node << l }
end
node
end
def node_for_info(doc, node_info)
node = Nokogiri::XML::Node.new(node_info.name, doc)
node_info.attributes.each_pair {|k,v| node[k] = v}
node
end
end
module OxXmlBuilder
include Ox::Builder
class OutgoingStanza
include OxXmlBuilder
attr_reader :xml,:params
def initialize(*args,&blk)
node = x(*args,&blk)
@xml = Ox.dump(node)
@params = node.attributes
end
end
def build_xml(*args)
Ox.dump(x(*args))
end
end
#XmlBuilder = OxXmlBuilder
XmlBuilder = NokogiriXmlBuilder
end
| 21.074534 | 87 | 0.560566 |
6123de7eb8e9dc112444d6078c9017791b9c3937
| 1,003 |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::CleanupService do
include ::EE::GeoHelpers
let(:project) { create(:project, :repository, bfg_object_map: fixture_file_upload('spec/fixtures/bfg_object_map.txt')) }
let(:object_map) { project.bfg_object_map }
let(:primary) { create(:geo_node, :primary) }
subject(:service) { described_class.new(project) }
describe '#execute' do
before do
stub_current_geo_node(primary)
end
it 'sends a Geo notification about the update on success' do
expect_next_instance_of(Geo::RepositoryUpdatedService) do |service|
expect(service).to receive(:execute)
end
service.execute
end
it 'does not send a Geo notification if the update fails' do
object_map.remove!
expect(Geo::RepositoryUpdatedService).not_to receive(:new)
expect { service.execute }.to raise_error(/object map/)
expect(Geo::RepositoryUpdatedEvent.count).to eq(0)
end
end
end
| 26.394737 | 122 | 0.711864 |
26b095c8a11248f7abfcea0bd89e9c5e8b497132
| 45 |
module PryRemoteEm
VERSION = '0.7.5'
end
| 11.25 | 21 | 0.666667 |
390994d20e84537767e47f588a98c6b4d8fb34e7
| 1,111 |
namespace :exotel_tasks do
desc "Get phone number details from exotel"
task update_all_patients_phone_number_details: :environment do
account_sid = ENV.fetch("EXOTEL_SID")
token = ENV.fetch("EXOTEL_TOKEN")
batch_size = ENV.fetch("EXOTEL_UPDATE_PHONE_NUMBER_DETAILS_BATCH_SIZE").to_i
PatientPhoneNumber.in_batches(of: batch_size) do |batch|
batch.each do |patient_phone_number|
UpdatePhoneNumberDetailsWorker.perform_async(patient_phone_number.id, account_sid, token)
end
end
end
desc "Whitelist patient phone numbers for exotel"
task whitelist_patient_phone_numbers: :environment do
account_sid = ENV.fetch("EXOTEL_SID")
token = ENV.fetch("EXOTEL_TOKEN")
batch_size = ENV.fetch("EXOTEL_WHITELIST_PHONE_NUMBER_DETAILS_BATCH_SIZE").to_i
virtual_number = ENV.fetch("EXOTEL_VIRTUAL_NUMBER")
PatientPhoneNumber.require_whitelisting.in_batches(of: batch_size) do |batch|
phone_number_ids = batch.pluck(:id)
AutomaticPhoneNumberWhitelistingWorker.perform_async(phone_number_ids, virtual_number, account_sid, token)
end
end
end
| 39.678571 | 112 | 0.774977 |
1ddfe0c4374cee56e943c1a70b6f7a692ea6a3af
| 204 |
class CreateUserBookClubs < ActiveRecord::Migration[6.0]
def change
create_table :user_book_clubs do |t|
t.integer :book_club_id
t.integer :user_id
t.timestamps
end
end
end
| 18.545455 | 56 | 0.691176 |
08dca16244e0b6eef8e6faed5c21c953375427a7
| 1,056 |
module Labelary
class Label
def self.render(*args)
self.new(*args).render
end
def initialize(dpmm: nil, width: nil, height: nil, index: nil, zpl:, content_type: nil, font: nil)
@zpl ||= zpl
@dpmm ||= dpmm || config.dpmm
@width ||= width || config.width
@height ||= height || config.height
@index ||= index || config.index
@content_type ||= content_type || config.content_type
@font ||= font || config.font
raise 'Invalid dpmm' if @dpmm.nil?
raise 'Invalid width' if @width.nil?
raise 'Invalid height' if @height.nil?
end
# http://labelary.com/service.html
def render
payload = font_string + @zpl
response = Labelary::Client.connection.post "/v1/printers/#{@dpmm}dpmm/labels/#{@width}x#{@height}/#{@index}/", payload, { Accept: @content_type }
return response.body
end
def font_string
@font.present? ? @font.to_s : ''
end
private
def config
@config ||= Labelary.configuration
end
end
end
| 26.4 | 152 | 0.598485 |
b95a8f5d201e40b23a9e8fb499b62dbeeeba7019
| 148 |
class AddMissingIndexes < ActiveRecord::Migration[4.2]
def change
add_index :evidence_items, :status
add_index :audits, :action
end
end
| 21.142857 | 54 | 0.743243 |
d5ac5ab84f9e40cbb7b893e980e2cee241cfec0b
| 536 |
# This partial provides a segment representation without an id to be included
# in segments attributes as part of a larger structure.
json.extract! segment, :resource_id, :resource_type, :template, :aspect_ratio, :stretch, :alignment, :justification, :margin_top, :margin_bottom, :padding_vertical, :padding_horizontal, :foreground_color, :background_color, :body, :metadata, :inline_styles
if segment.pictures.any?
json.pictures_attributes do
json.array! segment.pictures, partial: 'admin/pictures/copy', as: :picture
end
end
| 53.6 | 256 | 0.785448 |
614061fa018ea85d3e4583c64c9685c5949645b4
| 1,333 |
require 'sinatra/base'
require 'oauth2'
require './test/helpers/dotenv'
require 'authifer'
class TestClient < Sinatra::Base
PORT = 5001
CLIENT_SECRET = "a-am-a-secret-hush-hush"
CLIENT_ID = "i-am-a-client"
SITE_ROOT = "http://localhost:#{PORT}"
REDIRECT_PATH = "/oauth2/callback"
REDIRECT_URL = SITE_ROOT + REDIRECT_PATH
def self.prime_database
user = Authifer::User.find_or_create_by(email: "[email protected]") { |u| u.password = "password" }
user.save
client = user.oauth2_clients.find_or_create_by({
redirect_uri: "#{SITE_ROOT}/oauth2/callback"
}) do |client|
client.name = "Development Test App"
end
client.client_secret = CLIENT_SECRET
client.client_id = CLIENT_ID
client.save
end
Authifer.configure do |config|
config.database_url = ENV['DATABASE_URL']
end
use Authifer::App
def client
@client ||= OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET, :site => "#{SITE_ROOT}")
end
get '/' do
auth_url = client.auth_code.authorize_url(:redirect_uri => "#{REDIRECT_URL}")
"<a href='#{auth_url}'>Log in</a>"
end
get REDIRECT_PATH do
token = client.auth_code.get_token(params[:code], redirect_uri: "#{REDIRECT_URL}")
"Here's yer token: #{token.token}"
end
end
if __FILE__ == $0
TestClient.prime_database
TestClient.run!
end
| 24.236364 | 101 | 0.685671 |
bb23c9122a2128e7383690bdb36107b98a8cde57
| 218 |
include_recipe 'collectd'
collectd_plugin 'custom' do
options :key => "custom_name1",
:custom => 1000
end
collectd_plugin 'custom' do
options :key => "custom_name2",
:second => "String"
end
| 18.166667 | 33 | 0.642202 |
613eb9b63942ff23baa122a1a3492f9b2be8da80
| 3,760 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/cloud/documentai/v1beta3/document_processor_service.proto for package 'Google.Cloud.DocumentAI.V1beta3'
# Original file comments:
# Copyright 2021 Google LLC
#
# 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 'grpc'
require 'google/cloud/documentai/v1beta3/document_processor_service_pb'
module Google
module Cloud
module DocumentAI
module V1beta3
module DocumentProcessorService
# Service to call Cloud DocumentAI to process documents according to the
# processor's definition. Processors are built using state-of-the-art Google
# AI such as natural language, computer vision, and translation to extract
# structured information from unstructured or semi-structured documents.
class Service
include ::GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'google.cloud.documentai.v1beta3.DocumentProcessorService'
# Processes a single document.
rpc :ProcessDocument, ::Google::Cloud::DocumentAI::V1beta3::ProcessRequest, ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse
# LRO endpoint to batch process many documents. The output is written
# to Cloud Storage as JSON in the [Document] format.
rpc :BatchProcessDocuments, ::Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest, ::Google::Longrunning::Operation
# Fetches processor types.
rpc :FetchProcessorTypes, ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest, ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse
# Lists all processors which belong to this project.
rpc :ListProcessors, ::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest, ::Google::Cloud::DocumentAI::V1beta3::ListProcessorsResponse
# Creates a processor from the type processor that the user chose.
# The processor will be at "ENABLED" state by default after its creation.
rpc :CreateProcessor, ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest, ::Google::Cloud::DocumentAI::V1beta3::Processor
# Deletes the processor, unloads all deployed model artifacts if it was
# enabled and then deletes all artifacts associated with this processor.
rpc :DeleteProcessor, ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Google::Longrunning::Operation
# Enables a processor
rpc :EnableProcessor, ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Google::Longrunning::Operation
# Disables a processor
rpc :DisableProcessor, ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Google::Longrunning::Operation
# Send a document for Human Review. The input document should be processed by
# the specified processor.
rpc :ReviewDocument, ::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest, ::Google::Longrunning::Operation
end
Stub = Service.rpc_stub_class
end
end
end
end
end
| 54.492754 | 169 | 0.710904 |
1ca22bbe10b7de7a9fe576cf53d443558f0b8062
| 948 |
module ShippingMethodHelpers
FIXTURE_PARAMS = [
{
name: "USPS First",
available_to_users: true,
admin_name: "USPS First",
code: "First"
},
{
name: "USPS Priority",
available_to_users: true,
admin_name: "USPS Priority",
code: "Priority"
},
{
name: "USPS ParcelSelect",
available_to_users: true,
admin_name: "USPS ParcelSelect",
code: "ParcelSelect"
},
{
name: "USPS Express",
available_to_users: true,
admin_name: "USPS Express",
code: "Express"
}
]
def create_shipping_methods
shipping_category = create :shipping_category
FIXTURE_PARAMS.each do |params|
params.merge!(
calculator: Spree::Calculator::Shipping::FlatRate.new,
shipping_categories: [shipping_category]
)
Spree::ShippingMethod.create! params
end
end
end
| 23.7 | 62 | 0.582278 |
28b45e7c88da7252c7dc165ec229e80112d38578
| 90 |
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "honorific_prefixable"
| 30 | 58 | 0.766667 |
4ac8bc7ad04d53c1ae9783b102d80863bd88e1f8
| 3,269 |
require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "[email protected]",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" do
@user.name = " "
assert_not @user.valid?
end
test "email should be present" do
@user.email = " "
assert_not @user.valid?
end
test "name should not be too long" do
@user.name = "a" * 51
assert_not @user.valid?
end
test "email should not be too long" do
@user.email = "a" * 244 + "@example.com"
assert_not @user.valid?
end
test "email validation should accept valid addresses" do
valid_addresses = %w[[email protected] [email protected] [email protected]
[email protected] [email protected]]
valid_addresses.each do | valid_address |
@user.email = valid_address
assert @user.valid?, "#{valid_address.inspect} should be valid"
end
end
test "email validation should reject invalid addresses" do
invalid_addresses = %w[user@example,com user_at_foo.org user.name@example.
foo@bar_baz.com foo@bar+baz.com [email protected]]
invalid_addresses.each do | invalid_address |
@user.email = invalid_address
assert_not @user.valid?, "#{invalid_address.inspect} should be invalid"
end
end
test "email addresses should be unique" do
duplicate_user = @user.dup
duplicate_user.email = @user.email.upcase
@user.save
assert_not duplicate_user.valid?
end
test "email addresses should be saved as lower-case" do
mixed_case_email = "[email protected]"
@user.email = mixed_case_email
@user.save
assert_equal mixed_case_email.downcase, @user.reload.email
end
test "password should be present" do
@user.password = @user.password_confirmation = " " * 6
assert_not @user.valid?
end
test "password should have a minimum length" do
@user.password = @user.password_confirmation = "a" * 5
assert_not @user.valid?
end
test "authenticated? Should return false for a user with nil digest" do
assert_not @user.authenticated?(:remember, "")
end
test "associated microposts should be destroyed" do
@user.save
@user.microposts.create!(content: "I like dreamies")
assert_difference 'Micropost.count', -1 do
@user.destroy
end
end
test "should follow and unfollow a user" do
marley = users(:marley)
luni = users(:luni)
assert_not marley.following?(luni)
marley.follow(luni)
assert marley.following?(luni)
assert luni.followers.include?(marley)
marley.unfollow(luni)
assert_not marley.following?(luni)
end
test "feed should have the right posts" do
marley = users(:marley)
luni = users(:luni)
trine = users(:trine)
trine.microposts.each do | post_following |
assert marley.feed.include?(post_following)
end
marley.microposts.each do | post_self |
assert marley.feed.include?(post_self)
end
luni.microposts.each do | post_unfollowed |
assert_not marley.feed.include?(post_unfollowed)
end
end
end
| 28.426087 | 78 | 0.665341 |
e933831d6c689a9808f8c3a6083608122ad87bc1
| 535 |
module JeraPayment
class CallbacksController < JeraPaymentController
def callback
status = eval("#{api_name}::HandleCallbacks::#{format_event(params[:event])}.new(#{params}).call")
render json: { status: status }, status: status
end
private
def api_name
JeraPayment.api.to_s.capitalize
end
def format_event(event)
resource = event.split('.').first.capitalize
event = event.split('.').last.split('_').map{|w| w.capitalize}.join
resource + "::" + event
end
end
end
| 24.318182 | 104 | 0.648598 |
289641e7c9631d83fc5f992578e24ba246903a9b
| 1,141 |
describe Spaceship::ConnectAPI::BundleIdCapability do
let(:mock_portal_client) { double('portal_client') }
let(:username) { '[email protected]' }
let(:password) { 'so_secret' }
before do
allow(mock_portal_client).to receive(:team_id).and_return("123")
allow(mock_portal_client).to receive(:select_team)
allow(mock_portal_client).to receive(:csrf_tokens)
allow(Spaceship::PortalClient).to receive(:login).and_return(mock_portal_client)
Spaceship::ConnectAPI.login(username, password, use_portal: true, use_tunes: false)
end
describe '#client' do
it 'through #get_bundle_id' do
response = Spaceship::ConnectAPI.get_bundle_id(bundle_id_id: '123456789')
expect(response).to be_an_instance_of(Spaceship::ConnectAPI::Response)
expect(response.first).to be_an_instance_of(Spaceship::ConnectAPI::BundleId)
bundle_id_capabilities = response.first.bundle_id_capabilities
expect(bundle_id_capabilities.count).to eq(2)
bundle_id_capabilities.each do |model|
expect(model).to be_an_instance_of(Spaceship::ConnectAPI::BundleIdCapability)
end
end
end
end
| 39.344828 | 87 | 0.750219 |
3351cd8c39b16ab85643925de69f882fac96189c
| 257 |
require File.expand_path(File.dirname(__FILE__) + '/lib/template')
# enable cookies
use Rack::Session::Cookie
# rewrite cachebusted asset urls
use Rack::Rewrite do
rewrite %r{^/assets/cb(.[^\/]*)/(.*)}, '/assets/$2'
end
run Template::App
DB.disconnect
| 19.769231 | 66 | 0.700389 |
0817b1dd6a6121a4799867841b46d3542e402036
| 2,057 |
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string default(""), not null
# created_at :datetime
# updated_at :datetime
# slug :string
# budget :integer
# billable :boolean default("false")
# client_id :integer
# archived :boolean default("false"), not null
# description :text
#
class Project < ActiveRecord::Base
include Sluggable
audited allow_mass_assignment: true
validates :name, presence: true,
uniqueness: { case_sensitive: false }
validates_with ClientBillableValidator
has_many :hours
has_many :mileages
has_many :rates
has_many :users, -> { uniq }, through: :hours
has_many :categories, -> { uniq }, through: :hours
has_many :tags, -> { uniq }, through: :hours
belongs_to :client, touch: true
accepts_nested_attributes_for :rates, reject_if: :all_blank
scope :by_last_updated, -> { order("projects.updated_at DESC") }
scope :by_name, -> { order("lower(name)") }
scope :are_archived, -> { where(archived: true) }
scope :unarchived, -> { where(archived: false) }
scope :billable, -> { where(billable: true) }
def sorted_categories
categories.sort_by do |category|
EntryStats.new(hours, category).percentage_for_subject
end.reverse
end
def label
name
end
def budget_status
budget - hours.sum(:value) if budget
end
def has_billable_entries?
hours.exists?(billed: false) ||
mileages.exists?(billed: false)
end
def dollar_budget_status
amount = []
hours.each do |h|
rates.each do |r|
amount << (h.value * r.amount).round(2) if h.user_id == r.user_id && r.amount
end
end
amount.any? ? budget - amount.sum : budget
end
def amount_per_entry_user(hour)
if use_dollars
amount = 0
rates.each do |r|
amount = hour.value * r.amount if hour.user_id == r.user_id
end
amount
end
end
private
def slug_source
name
end
end
| 23.918605 | 85 | 0.639281 |
ed6053981bb1beb4aac95b9d3322d9fb42880cbc
| 6,341 |
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{mrflip-wuclan}
s.version = "0.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Philip (flip) Kromer"]
s.date = %q{2009-09-01}
s.description = %q{Massive-scale social network analysis. Nothing to f with.}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
"LICENSE",
"README.textile"
]
s.files = [
"LICENSE",
"README.textile",
"Rakefile",
"VERSION.yml",
"lib/old/twitter_api.rb",
"lib/wuclan.rb",
"lib/wuclan/delicious/delicious_html_request.rb",
"lib/wuclan/delicious/delicious_models.rb",
"lib/wuclan/delicious/delicious_request.rb",
"lib/wuclan/friendfeed/scrape/friendfeed_search_request.rb",
"lib/wuclan/friendster.rb",
"lib/wuclan/lastfm.rb",
"lib/wuclan/lastfm/model/base.rb",
"lib/wuclan/lastfm/model/sample_responses.txt",
"lib/wuclan/lastfm/scrape.rb",
"lib/wuclan/lastfm/scrape/base.rb",
"lib/wuclan/lastfm/scrape/concrete.rb",
"lib/wuclan/lastfm/scrape/lastfm_job.rb",
"lib/wuclan/lastfm/scrape/lastfm_request_stream.rb",
"lib/wuclan/lastfm/scrape/recursive_requests.rb",
"lib/wuclan/metrics.rb",
"lib/wuclan/metrics/user_graph_metrics.rb",
"lib/wuclan/metrics/user_metrics.rb",
"lib/wuclan/metrics/user_metrics_basic.rb",
"lib/wuclan/metrics/user_scraping_metrics.rb",
"lib/wuclan/myspace.rb",
"lib/wuclan/open_social.rb",
"lib/wuclan/open_social/api_overview.textile",
"lib/wuclan/open_social/model/base.rb",
"lib/wuclan/open_social/scrape/base.rb",
"lib/wuclan/open_social/scrape_request.rb",
"lib/wuclan/rdf_output/relationship_rdf.rb",
"lib/wuclan/rdf_output/text_element_rdf.rb",
"lib/wuclan/rdf_output/tweet_rdf.rb",
"lib/wuclan/rdf_output/twitter_rdf.rb",
"lib/wuclan/rdf_output/twitter_user_rdf.rb",
"lib/wuclan/shorturl/shorturl_request.rb",
"lib/wuclan/twitter.rb",
"lib/wuclan/twitter/api_response_examples.textile",
"lib/wuclan/twitter/model.rb",
"lib/wuclan/twitter/model/base.rb",
"lib/wuclan/twitter/model/multi_edge.rb",
"lib/wuclan/twitter/model/relationship.rb",
"lib/wuclan/twitter/model/text_element.rb",
"lib/wuclan/twitter/model/text_element/extract_info_tests.rb",
"lib/wuclan/twitter/model/text_element/grok_tweets.rb",
"lib/wuclan/twitter/model/text_element/more_regexes.rb",
"lib/wuclan/twitter/model/tweet.rb",
"lib/wuclan/twitter/model/tweet/tokenize.rb",
"lib/wuclan/twitter/model/tweet/tweet_regexes.rb",
"lib/wuclan/twitter/model/tweet/tweet_token.rb",
"lib/wuclan/twitter/model/twitter_user.rb",
"lib/wuclan/twitter/model/twitter_user/style/color_to_hsv.rb",
"lib/wuclan/twitter/parse/ff_ids_parser.rb",
"lib/wuclan/twitter/parse/friends_followers_parser.rb",
"lib/wuclan/twitter/parse/generic_json_parser.rb",
"lib/wuclan/twitter/parse/json_tweet.rb",
"lib/wuclan/twitter/parse/json_twitter_user.rb",
"lib/wuclan/twitter/parse/public_timeline_parser.rb",
"lib/wuclan/twitter/parse/user_parser.rb",
"lib/wuclan/twitter/scrape.rb",
"lib/wuclan/twitter/scrape/base.rb",
"lib/wuclan/twitter/scrape/old_skool_request_classes.rb",
"lib/wuclan/twitter/scrape/twitter_fake_fetcher.rb",
"lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb",
"lib/wuclan/twitter/scrape/twitter_followers_request.rb",
"lib/wuclan/twitter/scrape/twitter_json_response.rb",
"lib/wuclan/twitter/scrape/twitter_request_stream.rb",
"lib/wuclan/twitter/scrape/twitter_search_fake_fetcher.rb",
"lib/wuclan/twitter/scrape/twitter_search_flat_stream.rb",
"lib/wuclan/twitter/scrape/twitter_search_job.rb",
"lib/wuclan/twitter/scrape/twitter_search_request.rb",
"lib/wuclan/twitter/scrape/twitter_search_request_stream.rb",
"lib/wuclan/twitter/scrape/twitter_timeline_request.rb",
"lib/wuclan/twitter/scrape/twitter_user_request.rb"
]
s.homepage = %q{http://github.com/mrflip/wuclan}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Massive-scale social network analysis. Nothing to f with.}
s.test_files = [
"spec/spec_helper.rb",
"spec/wuclan_spec.rb",
"examples/analyze/strong_links/gen_multi_edge.rb",
"examples/analyze/strong_links/main.rb",
"examples/analyze/word_count/dump_schema.rb",
"examples/analyze/word_count/freq_user.rb",
"examples/analyze/word_count/freq_whole_corpus.rb",
"examples/analyze/word_count/word_count.rb",
"examples/lastfm/scrape/load_lastfm.rb",
"examples/lastfm/scrape/scrape_lastfm.rb",
"examples/twitter/old/load_twitter_search_jobs.rb",
"examples/twitter/old/scrape_twitter_api.rb",
"examples/twitter/old/scrape_twitter_search.rb",
"examples/twitter/old/scrape_twitter_trending.rb",
"examples/twitter/parse/parse_twitter_requests.rb",
"examples/twitter/scrape_twitter_api/scrape_twitter_api.rb",
"examples/twitter/scrape_twitter_api/support/make_request_stats.rb",
"examples/twitter/scrape_twitter_api/support/make_requests_by_id_and_date_1.rb",
"examples/twitter/scrape_twitter_search/load_twitter_search_jobs.rb",
"examples/twitter/scrape_twitter_search/scrape_twitter_search.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<mrflip-wukong>, [">= 0"])
s.add_runtime_dependency(%q<mrflip-monkeyshines>, [">= 0"])
s.add_runtime_dependency(%q<mrflip-trollop>, [">= 0"])
else
s.add_dependency(%q<mrflip-wukong>, [">= 0"])
s.add_dependency(%q<mrflip-monkeyshines>, [">= 0"])
s.add_dependency(%q<mrflip-trollop>, [">= 0"])
end
else
s.add_dependency(%q<mrflip-wukong>, [">= 0"])
s.add_dependency(%q<mrflip-monkeyshines>, [">= 0"])
s.add_dependency(%q<mrflip-trollop>, [">= 0"])
end
end
| 44.342657 | 105 | 0.712979 |
61204af38fdff94b23d168df478890ee8321f05c
| 524 |
require "presenter_test_helper"
class TakePartPresenterTest < PresenterTestCase
def schema_name
"take_part"
end
test "presents the basic details of a content item" do
assert_equal schema_item["description"], presented_item.description
assert_equal schema_item["schema_name"], presented_item.schema_name
assert_equal schema_item["locale"], presented_item.locale
assert_equal schema_item["title"], presented_item.title
assert_equal schema_item["details"]["body"], presented_item.body
end
end
| 32.75 | 71 | 0.78626 |
085f368bc594883ad9c0cbe83dbdc018b296a8e0
| 5,842 |
require 'builder'
require 'saml_idp/algorithmable'
require 'saml_idp/signable'
module SamlIdp
class AssertionBuilder
include Algorithmable
include Signable
attr_accessor :reference_id
attr_accessor :issuer_uri
attr_accessor :principal
attr_accessor :audience_uri
attr_accessor :saml_request_id
attr_accessor :saml_acs_url
attr_accessor :raw_algorithm
attr_accessor :authn_context_classref
attr_accessor :expiry
attr_accessor :encryption_opts
attr_accessor :session_expiry
delegate :config, to: :SamlIdp
def initialize(reference_id, issuer_uri, principal, audience_uri, saml_request_id, saml_acs_url, raw_algorithm, authn_context_classref, expiry=60*60, encryption_opts=nil, session_expiry=nil)
self.reference_id = reference_id
self.issuer_uri = issuer_uri
self.principal = principal
self.audience_uri = audience_uri
self.saml_request_id = saml_request_id
self.saml_acs_url = saml_acs_url
self.raw_algorithm = raw_algorithm
self.authn_context_classref = authn_context_classref
self.expiry = expiry
self.encryption_opts = encryption_opts
self.session_expiry = session_expiry.nil? ? config.session_expiry : session_expiry
end
def fresh
builder = Builder::XmlMarkup.new
builder.Assertion xmlns: Saml::XML::Namespaces::ASSERTION,
ID: reference_string,
IssueInstant: now_iso,
Version: "2.0" do |assertion|
assertion.Issuer issuer_uri
sign(assertion)
assertion.Subject do |subject|
subject.NameID name_id, Format: name_id_format[:name]
subject.SubjectConfirmation Method: Saml::XML::Namespaces::Methods::BEARER do |confirmation|
confirmation_hash = {}
confirmation_hash[:InResponseTo] = saml_request_id unless saml_request_id.nil?
confirmation_hash[:NotOnOrAfter] = not_on_or_after_subject
confirmation_hash[:Recipient] = saml_acs_url
confirmation.SubjectConfirmationData "", confirmation_hash
end
end
assertion.Conditions NotBefore: not_before, NotOnOrAfter: not_on_or_after_condition do |conditions|
conditions.AudienceRestriction do |restriction|
restriction.Audience audience_uri
end
end
authn_statement_props = {
AuthnInstant: now_iso,
SessionIndex: reference_string,
}
unless session_expiry.zero?
authn_statement_props[:SessionNotOnOrAfter] = session_not_on_or_after
end
assertion.AuthnStatement authn_statement_props do |statement|
statement.AuthnContext do |context|
context.AuthnContextClassRef authn_context_classref
end
end
if asserted_attributes
assertion.AttributeStatement do |attr_statement|
asserted_attributes.each do |friendly_name, attrs|
attrs = (attrs || {}).with_indifferent_access
attr_statement.Attribute Name: attrs[:name] || friendly_name,
NameFormat: attrs[:name_format] || Saml::XML::Namespaces::Formats::Attr::URI,
FriendlyName: friendly_name.to_s do |attr|
values = get_values_for friendly_name, attrs[:getter]
values.each do |val|
attr.AttributeValue val.to_s
end
end
end
end
end
end
end
alias_method :raw, :fresh
private :fresh
def encrypt(opts = {})
raise "Must set encryption_opts to encrypt" unless encryption_opts
raw_xml = opts[:sign] ? signed : raw
require 'saml_idp/encryptor'
encryptor = Encryptor.new encryption_opts
encryptor.encrypt(raw_xml)
end
def asserted_attributes
if principal.respond_to?(:asserted_attributes)
principal.send(:asserted_attributes)
elsif !config.attributes.nil? && !config.attributes.empty?
config.attributes
end
end
private :asserted_attributes
def get_values_for(friendly_name, getter)
result = nil
if getter.present?
if getter.respond_to?(:call)
result = getter.call(principal)
else
message = getter.to_s.underscore
result = principal.public_send(message) if principal.respond_to?(message)
end
elsif getter.nil?
message = friendly_name.to_s.underscore
result = principal.public_send(message) if principal.respond_to?(message)
end
Array(result)
end
private :get_values_for
def name_id
name_id_getter.call principal
end
private :name_id
def name_id_getter
getter = name_id_format[:getter]
if getter.respond_to? :call
getter
else
->(principal) { principal.public_send getter.to_s }
end
end
private :name_id_getter
def name_id_format
@name_id_format ||= NameIdFormatter.new(config.name_id.formats).chosen
end
private :name_id_format
def reference_string
"_#{reference_id}"
end
private :reference_string
def now
@now ||= Time.now.utc
end
private :now
def now_iso
iso { now }
end
private :now_iso
def not_before
iso { now - 5 }
end
private :not_before
def not_on_or_after_condition
iso { now + expiry }
end
private :not_on_or_after_condition
def not_on_or_after_subject
iso { now + 3 * 60 }
end
private :not_on_or_after_subject
def session_not_on_or_after
iso { now + session_expiry }
end
private :session_not_on_or_after
def iso
yield.iso8601
end
private :iso
end
end
| 31.240642 | 194 | 0.656624 |
b94ad4ac23d0271a1a089413455456b9a79eba1e
| 1,272 |
require 'spec_helper'
describe DirGlobIgnore::IgnoreFileLists do
let(:test_root) { File.expand_path File.join('..', '..', 'test'), __FILE__ }
let(:an_ignored_file) { File.join test_root, 'file1.txt'}
let(:a_non_ignored_file) { File.join test_root, 'file2.rb'}
subject { described_class.new test_root }
it 'should start the search of ignore files from a base dir' do
expect(subject.base_dir).to eq test_root
end
it 'should search for all specified ".ignore" files' do
expect(subject.send(:ignore_files).size).to eq 3
end
context 'when loading ignore files' do
it 'should build lists of files to be ignored into a cache' do
expect {subject.load_ignore_files}.not_to raise_error
cache = subject.send :cache
# There are 3 .ignore files in tests
expect(cache.size).to eq 3
# each path leads to an ignore list
cache.values.each do |info|
expect(info[:ignored_files]).to be_an Array
expect(info[:ignored_files]).not_to be_empty
end
end
it 'should tell if a file should be ignored or not' do
subject.load_ignore_files
expect(subject.ignore_file? an_ignored_file).to be_truthy
expect(subject.ignore_file? a_non_ignored_file).to be_falsey
end
end
end
| 29.581395 | 78 | 0.700472 |
e89898cee4428b96570c65068f1174c5d367e470
| 355 |
class App
# %%mo%%app
def self.root () Gallery::Application.root end
def self.session_options () Gallery::Application.config.session_options end
def self.webmaster () Gallery::Application.config.webmaster end
#-> App.root
#-> App.session_options
#-> App.webmaster # Webmaster's private upload directory.
end
| 27.307692 | 76 | 0.667606 |
087c700dcdda7bc316178becce167b9850ed4b4b
| 1,322 |
cask "setapp" do
version "3.1.1,1646141359"
sha256 "b5c5456872e828a30b7e0af5a1ccc77ec613e6800a7c7a950d892ed59b7d58c5"
url "https://dl.devmate.com/com.setapp.DesktopClient/#{version.csv.first}/#{version.csv.second}/Setapp-#{version.csv.first}.zip",
verified: "devmate.com/com.setapp.DesktopClient/"
name "Setapp"
desc "Collection of apps available by subscription"
homepage "https://setapp.com/"
livecheck do
url "https://s3-us-west-2.amazonaws.com/updateinfo.devmate.com/com.setapp.DesktopClient/updates.xml"
strategy :sparkle do |item|
"#{item.short_version},#{item.url[%r{/(\d+)/Setapp-(?:\d+(?:\.\d+)*)\.zip}i, 1]}"
end
end
auto_updates true
depends_on macos: ">= :sierra"
installer manual: "Setapp.app"
uninstall script: {
executable: "#{appdir}/Setapp.app/Contents/Resources/SetappUninstaller.app/Contents/Resources/removeSetapp.sh",
sudo: true,
}
zap trash: [
"~/Library/Application Scripts/com.setapp.DesktopClient.SetappAgent.FinderSyncExt",
"~/Library/Caches/com.setapp.DesktopClient",
"~/Library/Caches/com.setapp.DesktopClient.SetappAgent",
"~/Library/Logs/Setapp",
"~/Library/Preferences/com.setapp.DesktopClient.SetappAgent.plist",
"~/Library/Saved Application State/com.setapp.DesktopClient.savedState",
]
end
| 35.72973 | 131 | 0.714826 |
18a9ae7e441c765d5c47021ba345d1222705dd18
| 364 |
require "bundler/setup"
require "test/cli"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
| 24.266667 | 66 | 0.75 |
e285d21d5ea0b2a78de1524a8a27eab37317c1d6
| 1,373 |
require 'test_helper'
if ENV.fetch('ACTIVEMODEL_VERSION', '6.1') <= '6.0.0'
module Micro::Case::WithValidation::Safe
class BaseTest < Minitest::Test
class Multiply < Micro::Case::Safe
attribute :a
attribute :b
validates :a, :b, presence: true, numericality: true
def call!
Success(result: { number: a * b })
end
end
class NumberToString < Micro::Case::Safe
attribute :number
validates :number, presence: true, numericality: true
def call!
Success(result: { string: number.to_s })
end
end
def test_success
calculation = Multiply.new(a: 2, b: 2).call
assert_success_result(calculation, value: { number: 4 })
# ---
flow = Micro::Cases.flow([Multiply, NumberToString])
assert_success_result(flow.call(a: 2, b: 2), value: { string: '4' })
end
def test_failure
result = Multiply.new(a: 1, b: nil).call
assert_failure_result(result, type: :validation_error)
assert_equal(["can't be blank", 'is not a number'], result.value[:errors][:b])
# ---
result = Multiply.new(a: 1, b: 'a').call
assert_failure_result(result, type: :validation_error)
assert_equal(['is not a number'], result.value[:errors][:b])
end
end
end
end
| 24.963636 | 86 | 0.587036 |
e2e71b02781992bfc7174c3450e3409a090b6e56
| 11,119 |
class Gdal < Formula
desc "GDAL: Geospatial Data Abstraction Library"
homepage "http://www.gdal.org/"
url "http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz"
sha256 "66bc8192d24e314a66ed69285186d46e6999beb44fc97eeb9c76d82a117c0845"
revision 3
bottle do
sha256 "ee6dd88dbf4c617673407efd4ff29507fc772d9cf1f6f3f33871fff9c7615191" => :yosemite
sha256 "92ea1a96742b8a85f3f6cc9856b75c7f719547069181221cd29b72653bb659d8" => :mavericks
sha256 "52587ccb0f9eb8d3c6560eb9ca0e3b01d215594644000edacea9a5db275a71e7" => :mountain_lion
end
head do
url "https://svn.osgeo.org/gdal/trunk/gdal"
depends_on "doxygen" => :build
end
option "with-complete", "Use additional Homebrew libraries to provide more drivers."
option "with-opencl", "Build with OpenCL acceleration."
option "with-armadillo", "Build with Armadillo accelerated TPS transforms."
option "with-unsupported", "Allow configure to drag in any library it can find. Invoke this at your own risk."
option "with-mdb", "Build with Access MDB driver (requires Java 1.6+ JDK/JRE, from Apple or Oracle)."
option "with-libkml", "Build with Google's libkml driver (requires libkml --HEAD or >= 1.3)"
option "with-swig-java", "Build the swig java bindings"
deprecated_option "enable-opencl" => "with-opencl"
deprecated_option "enable-armadillo" => "with-armadillo"
deprecated_option "enable-unsupported" => "with-unsupported"
deprecated_option "enable-mdb" => "with-mdb"
deprecated_option "complete" => "with-complete"
depends_on :python => :optional
if build.with? "python"
depends_on :fortran => :build
end
depends_on "libpng"
depends_on "jpeg"
depends_on "giflib"
depends_on "libtiff"
depends_on "libgeotiff"
depends_on "proj"
depends_on "geos"
depends_on "sqlite" # To ensure compatibility with SpatiaLite.
depends_on "freexl"
depends_on "libspatialite"
depends_on "postgresql" => :optional
depends_on "mysql" => :optional
depends_on "homebrew/science/armadillo" if build.with? "armadillo"
if build.with? "libkml"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
if build.with? "complete"
# Raster libraries
depends_on "homebrew/science/netcdf" # Also brings in HDF5
depends_on "jasper"
depends_on "webp"
depends_on "cfitsio"
depends_on "epsilon"
depends_on "libdap"
depends_on "libxml2"
# Vector libraries
depends_on "unixodbc" # OS X version is not complete enough
depends_on "xerces-c"
# Other libraries
depends_on "xz" # get liblzma compression algorithm library from XZutils
depends_on "poppler"
depends_on "podofo"
depends_on "json-c"
end
depends_on :java => ["1.7+", :optional, :build]
depends_on "swig" if build.with? "swig-java"
# Extra linking libraries in configure test of armadillo may throw warning
# see: https://trac.osgeo.org/gdal/ticket/5455
# including prefix lib dir added by Homebrew:
# ld: warning: directory not found for option "-L/usr/local/Cellar/gdal/1.11.0/lib"
if build.with? "armadillo"
patch do
url "https://gist.githubusercontent.com/dakcarto/7abad108aa31a1e53fb4/raw/b56887208fd91d0434d5a901dae3806fb1bd32f8/gdal-armadillo.patch"
sha256 "e6880b9256abe2c289f4b1196792a626c689772390430c36976c0c5e0f339124"
end
end
resource "numpy" do
url "https://downloads.sourceforge.net/project/numpy/NumPy/1.8.1/numpy-1.8.1.tar.gz"
sha256 "3d722fc3ac922a34c50183683e828052cd9bb7e9134a95098441297d7ea1c7a9"
end
resource "libkml" do
# Until 1.3 is stable, use master branch
url "https://github.com/google/libkml.git",
:revision => "9b50572641f671194e523ad21d0171ea6537426e"
version "1.3-dev"
end
def configure_args
args = [
# Base configuration.
"--prefix=#{prefix}",
"--mandir=#{man}",
"--disable-debug",
"--with-local=#{prefix}",
"--with-threads",
"--with-libtool",
# GDAL native backends.
"--with-pcraster=internal",
"--with-pcidsk=internal",
"--with-bsb",
"--with-grib",
"--with-pam",
# Backends supported by OS X.
"--with-libiconv-prefix=/usr",
"--with-libz=/usr",
"--with-png=#{Formula["libpng"].opt_prefix}",
"--with-expat=/usr",
"--with-curl=/usr/bin/curl-config",
# Default Homebrew backends.
"--with-jpeg=#{HOMEBREW_PREFIX}",
"--without-jpeg12", # Needs specially configured JPEG and TIFF libraries.
"--with-gif=#{HOMEBREW_PREFIX}",
"--with-libtiff=#{HOMEBREW_PREFIX}",
"--with-geotiff=#{HOMEBREW_PREFIX}",
"--with-sqlite3=#{Formula["sqlite"].opt_prefix}",
"--with-freexl=#{HOMEBREW_PREFIX}",
"--with-spatialite=#{HOMEBREW_PREFIX}",
"--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
"--with-static-proj4=#{HOMEBREW_PREFIX}",
"--with-libjson-c=#{Formula["json-c"].opt_prefix}",
# GRASS backend explicitly disabled. Creates a chicken-and-egg problem.
# Should be installed separately after GRASS installation using the
# official GDAL GRASS plugin.
"--without-grass",
"--without-libgrass"
]
# Optional Homebrew packages supporting additional formats.
supported_backends = %w[
liblzma
cfitsio
hdf5
netcdf
jasper
xerces
odbc
dods-root
epsilon
webp
podofo
]
if build.with? "complete"
supported_backends.delete "liblzma"
args << "--with-liblzma=yes"
args.concat supported_backends.map { |b| "--with-" + b + "=" + HOMEBREW_PREFIX }
else
args.concat supported_backends.map { |b| "--without-" + b } if build.without? "unsupported"
end
# The following libraries are either proprietary, not available for public
# download or have no stable version in the Homebrew core that is
# compatible with GDAL. Interested users will have to install such software
# manually and most likely have to tweak the install routine.
#
# Podofo is disabled because Poppler provides the same functionality and
# then some.
unsupported_backends = %w[
gta
ogdi
fme
hdf4
openjpeg
fgdb
ecw
kakadu
mrsid
jp2mrsid
mrsid_lidar
msg
oci
ingres
dwgdirect
idb
sde
podofo
rasdaman
sosi
]
args.concat unsupported_backends.map { |b| "--without-" + b } if build.without? "unsupported"
# Database support.
args << (build.with?("postgresql") ? "--with-pg=#{HOMEBREW_PREFIX}/bin/pg_config" : "--without-pg")
args << (build.with?("mysql") ? "--with-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config" : "--without-mysql")
if build.with? "mdb"
args << "--with-java=yes"
# The rpath is only embedded for Oracle (non-framework) installs
args << "--with-jvm-lib-add-rpath=yes"
args << "--with-mdb=yes"
end
args << "--with-libkml=#{libexec}" if build.with? "libkml"
# Python is installed manually to ensure everything is properly sandboxed.
args << "--without-python"
# Scripting APIs that have not been re-worked to respect Homebrew prefixes.
#
# Currently disabled as they install willy-nilly into locations outside of
# the Homebrew prefix. Enable if you feel like it, but uninstallation may be
# a manual affair.
#
# TODO: Fix installation of script bindings so they install into the
# Homebrew prefix.
args << "--without-perl"
args << "--without-php"
args << "--without-ruby"
args << (build.with?("opencl") ? "--with-opencl" : "--without-opencl")
args << (build.with?("armadillo") ? "--with-armadillo=#{Formula["armadillo"].opt_prefix}" : "--with-armadillo=no")
args
end
def install
if build.with? "python"
ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python2.7/site-packages"
numpy_args = ["build", "--fcompiler=gnu95",
"install", "--prefix=#{libexec}"]
resource("numpy").stage { system "python", "setup.py", *numpy_args }
end
if build.with? "libkml"
resource("libkml").stage do
# See main `libkml` formula for info on patches
inreplace "configure.ac", "-Werror", ""
inreplace "third_party/Makefile.am" do |s|
s.sub! /(lib_LTLIBRARIES =) libminizip.la liburiparser.la/, "\\1"
s.sub! /(noinst_LTLIBRARIES = libgtest.la libgtest_main.la)/,
"\\1 libminizip.la liburiparser.la"
s.sub! /(libminizip_la_LDFLAGS =)/, "\\1 -static"
s.sub! /(liburiparser_la_LDFLAGS =)/, "\\1 -static"
end
system "./autogen.sh"
system "./configure", "--prefix=#{libexec}"
system "make", "install"
end
end
# Linking flags for SQLite are not added at a critical moment when the GDAL
# library is being assembled. This causes the build to fail due to missing
# symbols. Also, ensure Homebrew SQLite is used so that Spatialite is
# functional.
#
# Fortunately, this can be remedied using LDFLAGS.
sqlite = Formula["sqlite"]
ENV.append "LDFLAGS", "-L#{sqlite.opt_lib} -lsqlite3"
ENV.append "CFLAGS", "-I#{sqlite.opt_include}"
# Reset ARCHFLAGS to match how we build.
ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}"
# Fix hardcoded mandir: http://trac.osgeo.org/gdal/ticket/5092
inreplace "configure", %r[^mandir='\$\{prefix\}/man'$], ""
# These libs are statically linked in vendored libkml and libkml formula
inreplace "configure", " -lminizip -luriparser", "" if build.with? "libkml"
system "./configure", *configure_args
system "make"
system "make", "install"
# `python-config` may try to talk us into building bindings for more
# architectures than we really should.
if MacOS.prefer_64_bit?
ENV.append_to_cflags "-arch #{Hardware::CPU.arch_64_bit}"
else
ENV.append_to_cflags "-arch #{Hardware::CPU.arch_32_bit}"
end
cd "swig/python" do
system "python", "setup.py", "install", "--prefix=#{prefix}", "--record=installed.txt", "--single-version-externally-managed"
bin.install Dir["scripts/*"]
end
if build.with? "swig-java"
cd "swig/java" do
inreplace "java.opt", "linux", "darwin"
inreplace "java.opt", "#JAVA_HOME = /usr/lib/jvm/java-6-openjdk/", "JAVA_HOME=$(shell echo $$JAVA_HOME)"
system "make"
system "make", "install"
end
end
system "make", "man" if build.head?
system "make", "install-man"
# Clean up any stray doxygen files.
Dir.glob("#{bin}/*.dox") { |p| rm p }
end
def caveats
if build.with? "mdb"
<<-EOS.undent
To have a functional MDB driver, install supporting .jar files in:
`/Library/Java/Extensions/`
See: `http://www.gdal.org/ogr/drv_mdb.html`
EOS
end
end
test do
# basic tests to see if third-party dylibs are loading OK
system "#{bin}/gdalinfo", "--formats"
system "#{bin}/ogrinfo", "--formats"
end
end
| 33.290419 | 142 | 0.654645 |
bb33f50e38f1d3da6c4717c6908df29ee7033f5d
| 957 |
require File.dirname(__FILE__) + '/../test_helper'
class DiscoveryControllerTest < ActionController::TestCase
def test_should_create_proxy_server
assert_difference "ProxyServer.count" do
proxy_request
assert_response :success
end
assert_not_nil assigns("proxy_server")
end
def test_should_update_proxy_server
assert_not_nil server = ProxyServer.create(:host => 'hostname', :port => 4000, :updated_at => 1.minute.ago)
initial_updated_at = server.updated_at
assert_no_difference "ProxyServer.count" do
proxy_request(:host => server.host, :port => server.port)
assert_response :success
end
assert_not_equal initial_updated_at, server.reload.updated_at
assert_not_nil assigns("proxy_server")
end
protected
def proxy_request(options = {})
post(:create, {:host => "127.0.0.1", :port => "80", :format => "xml", :type => "proxy_server", :locale => 'ca'}.merge(options))
end
end
| 28.147059 | 131 | 0.712644 |
d5f0c35199122f40137931559aacf7a875bad2a0
| 786 |
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
require 'spec_helper'
describe 'client.cat#fielddata' do
let(:expected_args) do
[
'GET',
'_cat/fielddata',
{},
nil,
{}
]
end
it 'performs the request' do
expect(client_double.cat.fielddata).to eq({})
end
context 'when field are specified' do
let(:expected_args) do
[
'GET',
'_cat/fielddata/foo,bar',
{},
nil,
{}
]
end
it 'performs the request' do
expect(client_double.cat.fielddata(fields: ['foo', 'bar'])).to eq({})
end
end
end
| 19.65 | 75 | 0.583969 |
1c40e15c09637e628a9750b3d9a8d878b757502e
| 57 |
require 'treemap/tree_map'
require 'treemap/bounded_map'
| 19 | 29 | 0.824561 |
bbdaa934fba38344b206a8c80efd450179e87ac0
| 1,117 |
# -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "facterdb/version"
Gem::Specification.new do |s|
s.name = "facterdb"
s.version = FacterDB::Version::STRING
s.authors = ["Mickaël Canévet"]
s.email = ["[email protected]"]
s.homepage = "http://github.com/camptocamp/facterdb"
s.summary = "A Database of OS facts provided by Facter"
s.description = "Contains facts from many Facter version on many Operating Systems"
s.licenses = 'Apache-2.0'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.add_development_dependency 'coveralls'
s.add_development_dependency 'rake'
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec'
s.add_development_dependency 'github_changelog_generator', '~> 1.10', '< 1.10.4'
s.add_runtime_dependency 'json' if RUBY_VERSION =~ /^1\.8/
s.add_runtime_dependency 'facter'
s.add_runtime_dependency 'jgrep'
end
| 39.892857 | 85 | 0.686661 |
1a69935b07454e08810809f1548a8e8e21ae5f79
| 1,656 |
require 'minitest_helper'
class TestTaxManipulator < Minitest::Test
def setup
TaxManipulator.reset_config!
end
def test_that_it_has_a_version_number
refute_nil ::TaxManipulator::VERSION
end
def test_that_for_returns_the_manipulator_without_config
assert_raises TaxManipulator::UnknownStrategyError do
TaxManipulator.for(12)
end
assert TaxManipulator.for(12, scheme: :incl_tax).class == TaxManipulator::Manipulator::IncludingTax
assert TaxManipulator.for(12, scheme: :excl_tax).class == TaxManipulator::Manipulator::ExcludingTax
end
def test_that_for_returns_the_manipulator_with_config
TaxManipulator.config.default_scheme = :excl_tax
assert TaxManipulator.for(12).class == TaxManipulator::Manipulator::ExcludingTax
assert TaxManipulator.for(12, scheme: :incl_tax).class == TaxManipulator::Manipulator::IncludingTax
end
def test_that_it_configures_rates
TaxManipulator.configure do |config|
config.add_rate rate: 20.0, starting: Date.parse('2014-01-01')
config.add_rate rate: 19.6, ending: Date.parse('2013-12-31')
end
assert_equal 2, TaxManipulator.config.rates.size
assert_equal 20.0, TaxManipulator.config.rates.first.rate
assert_equal 19.6, TaxManipulator.config.rates.last.rate
end
def test_that_it_configures_default_scheme
TaxManipulator.configure do |config|
config.default_scheme = :incl_tax
end
assert_equal :incl_tax, TaxManipulator.config.default_scheme
assert_raises TaxManipulator::UnknownStrategyError do
TaxManipulator.configure do |config|
config.default_scheme = :foo
end
end
end
end
| 31.846154 | 103 | 0.766908 |
38a3bf862fb4c4b1a40a8e482a9659e160dcde17
| 1,422 |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
| 36.461538 | 85 | 0.777075 |
215308d420645338e24c4ea736dc184ca67c5612
| 3,316 |
module Puppet::Pops
# A Visitor performs delegation to a given receiver based on the configuration of the Visitor.
# A new visitor is created with a given receiver, a method prefix, min, and max argument counts.
# e.g.
# visitor = Visitor.new(self, "visit_from", 1, 1)
# will make the visitor call "self.visit_from_CLASS(x)" where CLASS is resolved to the given
# objects class, or one of is ancestors, the first class for which there is an implementation of
# a method will be selected.
#
# Raises RuntimeError if there are too few or too many arguments, or if the receiver is not
# configured to handle a given visiting object.
#
class Visitor
attr_reader :receiver, :message, :min_args, :max_args, :cache
def initialize(receiver, message, min_args=0, max_args=nil)
raise ArgumentError.new("min_args must be >= 0") if min_args < 0
raise ArgumentError.new("max_args must be >= min_args or nil") if max_args && max_args < min_args
@receiver = receiver
@message = message
@min_args = min_args
@max_args = max_args
@cache = Hash.new
end
# Visit the configured receiver
def visit(thing, *args)
visit_this(@receiver, thing, args)
end
NO_ARGS = EMPTY_ARRAY
# Visit an explicit receiver
def visit_this(receiver, thing, args)
raise "Visitor Error: Too few arguments passed. min = #{@min_args}" unless args.length >= @min_args
if @max_args
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
end
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, *args)
else
thing.class.ancestors().each do |ancestor|
name = ancestor.name
next if name.nil?
method_name = :"#{@message}_#{name.split(DOUBLE_COLON).last}"
next unless receiver.respond_to?(method_name, true)
@cache[thing.class] = method_name
return receiver.send(method_name, thing, *args)
end
end
raise "Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{thing.class}"
end
# Visit an explicit receiver with 0 args
# (This is ~30% faster than calling the general method)
#
def visit_this_0(receiver, thing)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing)
end
visit_this(receiver, thing, NO_ARGS)
end
# Visit an explicit receiver with 1 args
# (This is ~30% faster than calling the general method)
#
def visit_this_1(receiver, thing, arg)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, arg)
end
visit_this(receiver, thing, [arg])
end
# Visit an explicit receiver with 2 args
# (This is ~30% faster than calling the general method)
#
def visit_this_2(receiver, thing, arg1, arg2)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, arg1, arg2)
end
visit_this(receiver, thing, [arg1, arg2])
end
# Visit an explicit receiver with 3 args
# (This is ~30% faster than calling the general method)
#
def visit_this_3(receiver, thing, arg1, arg2, arg3)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, arg1, arg2, arg3)
end
visit_this(receiver, thing, [arg1, arg2, arg3])
end
end
end
| 34.541667 | 111 | 0.697829 |
01bafc97fec5ecf4b1c10ca2a45c7a2931b1b331
| 36 |
module Jets
VERSION = "3.1.0"
end
| 9 | 19 | 0.638889 |
bb6f031c767ccd9f27c1821f44e5aaa74af6967f
| 3,351 |
require('cartesius/numerificator')
module Cartesius
class Line
include Numerificator
VERTICAL_SLOPE = Float::INFINITY
HORIZONTAL_SLOPE = 0
private_constant(:VERTICAL_SLOPE)
private_constant(:HORIZONTAL_SLOPE)
# equation type: dx + ey + f = 0
def initialize(x:, y:, k:)
@x_coeff, @y_coeff, @k_coeff = x.to_r, y.to_r, k.to_r
validation
end
def self.create(slope:, known_term:)
new(x: -slope.to_r, y: 1, k: -known_term.to_r)
end
def self.horizontal(known_term:)
create(slope: HORIZONTAL_SLOPE, known_term: known_term)
end
def self.vertical(known_term:)
new(x: 1, y: 0, k: -known_term.to_r)
end
def self.by_points(point1:, point2:)
if point1 == point2
raise ArgumentError.new('Points must be different!')
end
if point1.x == point2.x
return vertical(known_term: point1.x)
else
m, q = Cramer.solution2(
[point1.x, 1],
[point2.x, 1],
[point1.y, point2.y]
)
create(slope: m, known_term: q)
end
end
def self.x_axis
horizontal(known_term: 0)
end
def self.y_axis
vertical(known_term: 0)
end
def self.ascending_bisector
create(slope: 1, known_term: 0)
end
def self.descending_bisector
create(slope: -1, known_term: 0)
end
def slope
if @y_coeff.zero?
VERTICAL_SLOPE
else
numberfy(-@x_coeff, @y_coeff)
end
end
def known_term
if @y_coeff.zero?
numberfy(-@k_coeff, @x_coeff)
else
numberfy(-@k_coeff, @y_coeff)
end
end
def x_axis?
self == Line.x_axis
end
def y_axis?
self == Line.y_axis
end
def ascending_bisector?
self == Line.ascending_bisector
end
def descending_bisector?
self == Line.descending_bisector
end
def horizontal?
slope == HORIZONTAL_SLOPE
end
def vertical?
slope == VERTICAL_SLOPE
end
def inclined?
ascending? || descending?
end
def ascending?
slope != VERTICAL_SLOPE && slope > HORIZONTAL_SLOPE
end
def descending?
slope < HORIZONTAL_SLOPE
end
def parallel?(line)
line.slope == slope
end
def perpendicular?(line)
if line.slope == HORIZONTAL_SLOPE
slope == VERTICAL_SLOPE
elsif line.slope == VERTICAL_SLOPE
slope == HORIZONTAL_SLOPE
else
line.slope * slope == -1
end
end
def include?(point)
if vertical?
point.x == known_term
else
point.y == slope * point.x + known_term
end
end
def x_intercept
unless @x_coeff.zero?
numberfy(-@k_coeff, @x_coeff)
end
end
def y_intercept
unless @y_coeff.zero?
numberfy(-@k_coeff, @y_coeff)
end
end
def to_equation
equationfy('x' => @x_coeff, 'y' => @y_coeff, '1' => @k_coeff)
end
def congruent?(line)
line.instance_of?(self.class)
end
def == (line)
line.instance_of?(self.class) &&
line.slope == slope && line.known_term == known_term
end
private
def validation
if @x_coeff.zero? && @y_coeff.zero?
raise ArgumentError.new('Invalid coefficients!')
end
end
end
end
| 19.482558 | 67 | 0.586392 |
bb37c7bb9e79a48b3b85e9231c03c392e3a1d935
| 84 |
# frozen_string_literal: true
require "http"
require "pp"
puts ENV.pretty_inspect
| 12 | 29 | 0.785714 |
f7e6e9b33ed899ecbd8c1d8c720cd03445874d51
| 341 |
class TravelDestinations::Destination
attr_accessor :name, :description
@@all = []
def self.all
@@all
end
def self.save
@@all << self.scrape
end
def self.scrape
doc = Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/countries"))
binding.pry
# continue video from 53:37 here
end
end
| 17.05 | 87 | 0.659824 |
113c77c9e73702365bf5805a75e754d518ae473a
| 1,199 |
class CreateRoadways < ActiveRecord::Migration[5.2]
def change
create_table :roadways do |t|
t.string :object_key, null: false, limit: 12
if ActiveRecord::Base.configurations[Rails.env]['adapter'].include?('mysql2')
t.string :guid, limit: 36
else
t.uuid :guid
end
t.references :transam_asset
t.string :on_under_indicator
t.references :route_signing_prefix
t.references :service_level_type
t.string :route_number
t.decimal :min_vertical_clearance
t.boolean :on_base_network
t.string :lrs_route
t.string :lrs_subroute
t.references :functional_class
t.integer :lanes
t.integer :average_daily_traffic
t.integer :average_daily_traffic_year
t.decimal :total_horizontal_clearance
t.references :strahnet_designation_type
t.references :traffic_direction_type
t.boolean :on_national_higway_system
t.boolean :on_federal_lands_highway
t.integer :average_daily_truck_traffic_percent
t.boolean :on_truck_network
t.integer :future_average_daily_traffic
t.integer :future_average_daily_traffic_year
t.timestamps
end
end
end
| 32.405405 | 83 | 0.710592 |
ab88fa33f82e6abc4940d2ae792e1b4f940e5cb0
| 6,007 |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Capybara::Result do
let :string do
Capybara.string <<-STRING
<ul>
<li>Alpha</li>
<li>Beta</li>
<li>Gamma</li>
<li>Delta</li>
</ul>
STRING
end
let :result do
string.all '//li', minimum: 0 # pass minimum: 0 so lazy evaluation doesn't get triggered yet
end
it "has a length" do
expect(result.length).to eq(4)
end
it "has a first element" do
result.first.text == 'Alpha'
end
it "has a last element" do
result.last.text == 'Delta'
end
it 'can supports values_at method' do
expect(result.values_at(0, 2).map(&:text)).to eq(%w[Alpha Gamma])
end
it "can return an element by its index" do
expect(result.at(1).text).to eq('Beta')
expect(result[2].text).to eq('Gamma')
end
it "can be mapped" do
expect(result.map(&:text)).to eq(%w[Alpha Beta Gamma Delta])
end
it "can be selected" do
expect(result.select do |element|
element.text.include? 't'
end.length).to eq(2)
end
it "can be reduced" do
expect(result.reduce('') do |memo, element|
memo + element.text[0]
end).to eq('ABGD')
end
it 'can be sampled' do
expect(result).to include(result.sample)
end
it 'can be indexed' do
expect(result.index do |el|
el.text == 'Gamma'
end).to eq(2)
end
it 'supports all modes of []' do
expect(result[1].text).to eq 'Beta'
expect(result[0, 2].map(&:text)).to eq %w[Alpha Beta]
expect(result[1..3].map(&:text)).to eq %w[Beta Gamma Delta]
expect(result[-1].text).to eq 'Delta'
expect(result[-2, 3].map(&:text)).to eq %w[Gamma Delta]
expect(result[1..7].map(&:text)).to eq %w[Beta Gamma Delta]
end
it 'works with filter blocks' do
result = string.all('//li') { |node| node.text == 'Alpha' }
expect(result.size).to eq 1
end
it 'should catch invalid element errors during filtering' do
allow_any_instance_of(Capybara::Node::Simple).to receive(:text).and_raise(StandardError)
allow_any_instance_of(Capybara::Node::Simple).to receive(:session).and_return(
instance_double("Capybara::Session", driver: instance_double("Capybara::Driver::Base", invalid_element_errors: [StandardError]))
)
result = string.all('//li', text: 'Alpha')
expect(result.size).to eq 0
end
it 'should return non-invalid element errors during filtering' do
allow_any_instance_of(Capybara::Node::Simple).to receive(:text).and_raise(StandardError)
allow_any_instance_of(Capybara::Node::Simple).to receive(:session).and_return(
instance_double("Capybara::Session", driver: instance_double("Capybara::Driver::Base", invalid_element_errors: [ArgumentError]))
)
expect do
string.all('//li', text: 'Alpha').to_a
end.to raise_error(StandardError)
end
# Not a great test but it indirectly tests what is needed
it "should evaluate filters lazily for idx" do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
# Not processed until accessed
expect(result.instance_variable_get('@result_cache').size).to be 0
# Only one retrieved when needed
result.first
expect(result.instance_variable_get('@result_cache').size).to be 1
# works for indexed access
result[0]
expect(result.instance_variable_get('@result_cache').size).to be 1
result[2]
expect(result.instance_variable_get('@result_cache').size).to be 3
# All cached when converted to array
result.to_a
expect(result.instance_variable_get('@result_cache').size).to eq 4
end
it "should evaluate filters lazily for range" do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
result[0..1]
expect(result.instance_variable_get('@result_cache').size).to be 2
expect(result[0..7].size).to eq 4
expect(result.instance_variable_get('@result_cache').size).to be 4
end
it "should evaluate filters lazily for idx and length" do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
result[1, 2]
expect(result.instance_variable_get('@result_cache').size).to be 3
expect(result[2, 5].size).to eq 2
expect(result.instance_variable_get('@result_cache').size).to be 4
end
it "should only need to evaluate one result for any?" do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
result.any?
expect(result.instance_variable_get('@result_cache').size).to be 1
end
it "should evaluate all elements when #to_a called" do
# All cached when converted to array
result.to_a
expect(result.instance_variable_get('@result_cache').size).to eq 4
end
context '#each' do
it 'lazily evaluates' do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
results = []
result.each do |el|
results << el
expect(result.instance_variable_get('@result_cache').size).to eq results.size
end
expect(results.size).to eq 4
end
context 'without a block' do
it 'returns an iterator' do
expect(result.each).to be_a(Enumerator)
end
it 'lazily evaluates' do
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
result.each.with_index do |_el, idx|
expect(result.instance_variable_get('@result_cache').size).to eq(idx + 1) # 0 indexing
end
end
end
end
context 'lazy select' do
it 'is compatible' do
# This test will let us know when JRuby fixes lazy select so we can re-enable it in Result
pending 'JRuby has an issue with lazy enumberator evaluation' if RUBY_PLATFORM == 'java'
eval_count = 0
enum = %w[Text1 Text2 Text3].lazy.select do
eval_count += 1
true
end
expect(eval_count).to eq 0
enum.next
sleep 1
expect(eval_count).to eq 1
end
end
end
| 30.805128 | 134 | 0.670551 |
21e4e56045e6ee9ceab003b016b1ec31e592d0cb
| 354 |
class GoodCurrencyForeignKey < ActiveRecord::Migration
def change
%i[ account_versions accounts deposits fund_sources payment_addresses payment_transactions proofs withdraws ].each do |t|
remove_index t, :currency if index_exists?(t, :currency)
rename_column t, :currency, :currency_id
add_index t, :currency_id
end
end
end
| 35.4 | 125 | 0.757062 |
913cc40f8a4cfd526dc1d6a14c3dcbc8bfd0b47b
| 38,833 |
require 'test_helper'
require 'webmock/minitest'
class LevelsControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
setup do
Rails.application.config.stubs(:levelbuilder_mode).returns true
Level.any_instance.stubs(:write_to_file?).returns(false) # don't write to level files
@level = create(:level)
@partner_level = create :level, editor_experiment: 'platformization-partners'
@admin = create(:admin)
@not_admin = create(:user)
@platformization_partner = create :platformization_partner
@levelbuilder = create(:levelbuilder)
sign_in(@levelbuilder)
@program = '<hey/>'
enable_level_source_image_s3_urls
@default_update_blocks_params = {
id: @level.id,
game_id: @level.game.id,
type: 'toolbox_blocks',
program: @program,
}
stub_request(:get, /https:\/\/cdo-v3-shared.firebaseio.com/).
to_return({"status" => 200, "body" => "{}", "headers" => {}})
end
test "should get rubric" do
level = create_level_with_rubric
get :get_rubric, params: {id: level.id}
assert_equal JSON.parse(@response.body), {
"keyConcept" => "This is the key concept",
"performanceLevel1" => "This is great",
"performanceLevel2" => "This is good",
"performanceLevel3" => "This is okay",
"performanceLevel4" => "This is bad"
}
end
test "anonymous user can get_rubric" do
sign_out @levelbuilder
level = create_level_with_rubric
get :get_rubric, params: {id: level.id}
assert_equal JSON.parse(@response.body), {
"keyConcept" => "This is the key concept",
"performanceLevel1" => "This is great",
"performanceLevel2" => "This is good",
"performanceLevel3" => "This is okay",
"performanceLevel4" => "This is bad"
}
end
test "empty success response for get_rubric on rubricless level" do
level = create :level
get :get_rubric, params: {id: level.id}
assert_response :no_content
assert_equal '', @response.body
end
def create_level_with_rubric
create(:level,
mini_rubric: 'true',
rubric_key_concept: 'This is the key concept',
rubric_performance_level_1: 'This is great',
rubric_performance_level_2: 'This is good',
rubric_performance_level_3: 'This is okay',
rubric_performance_level_4: 'This is bad'
)
end
test "should get filtered levels with just page param" do
get :get_filtered_levels, params: {page: 1}
assert_equal 7, JSON.parse(@response.body)['levels'].length
assert_equal 22, JSON.parse(@response.body)['numPages']
end
test "should get filtered levels with name matching level key for blockly levels" do
game = Game.find_by_name("CustomMaze")
create(:level, name: 'blockly', level_num: 'special_blockly_level', game_id: game.id, type: "Maze")
get :get_filtered_levels, params: {name: 'blockly:CustomMaze:special_blockly_level'}
assert_equal 'blockly:CustomMaze:special_blockly_level', JSON.parse(@response.body)['levels'][0]["name"]
end
test "should get filtered levels with level_type" do
existing_levels_count = Odometer.all.count
level = create(:odometer)
get :get_filtered_levels, params: {page: 1, level_type: 'Odometer'}
assert_equal existing_levels_count + 1, JSON.parse(@response.body)['levels'].length
assert_equal level.name, JSON.parse(@response.body)['levels'][0]["name"]
assert_equal 1, JSON.parse(@response.body)['numPages']
end
test "should get filtered levels with script_id" do
script = create(:script, :with_levels, levels_count: 7)
get :get_filtered_levels, params: {page: 1, script_id: script.id}
assert_equal 7, JSON.parse(@response.body)['levels'].length
assert_equal 1, JSON.parse(@response.body)['numPages']
end
test "should get filtered levels with owner_id" do
Level.where(user_id: @levelbuilder.id).destroy_all
level = create :applab, user: @levelbuilder
get :get_filtered_levels, params: {page: 1, owner_id: @levelbuilder.id}
assert_equal level.name, JSON.parse(@response.body)['levels'][0]["name"]
assert_equal 1, JSON.parse(@response.body)['numPages']
end
test "get_filtered_levels gets no content if not levelbuilder" do
sign_out @levelbuilder
sign_in create(:teacher)
get :get_filtered_levels, params: {page: 1}
assert_response :forbidden
end
test "should get index" do
get :index, params: {game_id: @level.game}
assert_response :success
assert_not_nil assigns(:levels)
end
test_user_gets_response_for(
:index,
response: :success,
user: :platformization_partner
)
# non-levelbuilder can't index levels
test_user_gets_response_for(
:index,
response: :forbidden,
user: :teacher
)
test "should get new" do
get :new, params: {game_id: @level.game}
assert_response :success
end
test "should get new maze" do
get :new, params: {game_id: @level.game, type: "Maze"}
assert_response :success
end
test "should get new karel" do
get :new, params: {type: 'Karel'}
css = css_select "#level_type"
assert_equal "Karel", css.first.attributes['value'].to_s
assert_response :success
end
test "should get new of all types" do
LevelsController::LEVEL_CLASSES.each do |klass|
get :new, params: {type: klass.name}
assert_response :success
end
end
test "should alphanumeric order custom levels on new" do
Level.where(user_id: @levelbuilder.id).map(&:destroy)
level_1 = create(:level, user: @levelbuilder, name: "BBBB")
level_2 = create(:level, user: @levelbuilder, name: "AAAA")
level_3 = create(:level, user: @levelbuilder, name: "Z1")
level_4 = create(:level, user: @levelbuilder, name: "Z10")
level_5 = create(:level, user: @levelbuilder, name: "Z2")
get :new, params: {game_id: @level.game}
assert_equal [level_2, level_1, level_3, level_5, level_4], assigns(:levels)
end
test "should not get builder if not levelbuilder" do
[@not_admin, @admin].each do |user|
sign_in user
get :new, params: {game_id: @level.game}
assert_response :forbidden
end
end
test "should create maze level" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_creates(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze'
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
end
assert assigns(:level)
assert assigns(:level).game
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create maze levels with step mode" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_creates(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
step_mode: 1,
type: 'Maze'
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
end
assert assigns(:level)
assert assigns(:level).step_mode
end
test "should create maze levels with k1 on" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_creates(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze',
is_k1: true
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
end
assert assigns(:level)
assert assigns(:level).is_k1
end
test "should create maze levels with k1 off" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_creates(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
step_mode: 1,
type: 'Maze',
is_k1: false
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}, as: :json
end
assert assigns(:level)
assert assigns(:level).is_k1 == 'false'
end
test "should not create invalid maze level" do
maze = fixture_file_upload("maze_level_invalid.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_does_not_create(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze'
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
end
assert_response :not_acceptable
end
test "should create karel level" do
karel = fixture_file_upload("karel_level.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_creates(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Karel'
},
game_id: game.id,
program: @program,
maze_source: karel,
size: 8
}
end
assert assigns(:level)
assert assigns(:level).game
assert_equal @levelbuilder, assigns(:level).user
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should not create invalid karel level" do
karel = fixture_file_upload("karel_level_invalid.csv", "r")
game = Game.find_by_name("CustomMaze")
assert_does_not_create(Level) do
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Karel'
},
game_id: game.id,
program: @program,
maze_source: karel,
size: 8
}
end
assert_response :not_acceptable
end
test "should create artist level" do
game = Game.find_by_name("Custom")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Artist'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should return newly created level when do_not_redirect" do
game = Game.find_by_name("Custom")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Artist'},
game_id: game.id,
program: @program,
do_not_redirect: true
}
end
assert_equal 'NewCustomLevel', JSON.parse(@response.body)['name']
assert_equal 'Artist', JSON.parse(@response.body)['type']
end
test "should create studio level" do
game = Game.find_by_name("CustomStudio")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Studio'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create spritelab level" do
game = Game.find_by_name("Spritelab")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'GamelabJr'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create applab level" do
game = Game.find_by_name("Applab")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Applab'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create gamelab level" do
game = Game.find_by_name("Gamelab")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Gamelab'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create dance level" do
game = Game.find_by_name("Dance")
assert_creates(Level) do
post :create, params: {
level: {name: "NewCustomLevel", type: 'Dancelab'},
game_id: game.id,
program: @program
}
end
assert_equal edit_level_path(assigns(:level)), JSON.parse(@response.body)["redirect"]
end
test "should create and destroy custom level with level file" do
# Enable writing custom level to file for this specific test only
Level.any_instance.stubs(:write_to_file?).returns(true)
level_name = 'TestCustomLevel'
begin
post :create, params: {
level: {name: level_name, type: 'Artist', published: true},
game_id: Game.find_by_name("Custom").id,
program: @program
}
level = Level.find_by(name: level_name)
file_path = Level.level_file_path(level.name)
assert_equal true, file_path && File.exist?(file_path)
delete :destroy, params: {id: level}
assert_equal false, file_path && File.exist?(file_path)
ensure
file_path = Level.level_file_path(level_name)
File.delete(file_path) if file_path && File.exist?(file_path)
end
end
test "should not create invalid artist level" do
game = Game.find_by_name("Custom")
assert_does_not_create(Level) do
post :create, params: {
level: {name: '', type: 'Artist'},
game_id: game.id,
program: @program
}
end
assert_response :not_acceptable
end
test "should update blocks" do
post :update_blocks, params: @default_update_blocks_params
assert_response :success
level = assigns(:level)
assert_equal @program, level.properties['toolbox_blocks']
assert_nil level.properties['solution_image_url']
end
test "should update App Lab starter code and starter HTML" do
post :update_properties, params: {
id: create(:applab).id,
}, body:
{
start_html: '<h1>foo</h1>',
start_blocks: 'console.log("hello world");',
}.to_json
assert_response :success
level = assigns(:level)
assert_equal '<h1>foo</h1>', level.properties['start_html']
assert_equal 'console.log("hello world");', level.properties['start_blocks']
end
test "should update App Lab starter code and starter HTML with special characters" do
post :update_properties, params: {
id: create(:applab).id,
}, body:
{
start_html: '<h1>Final Grade: 90%</h1><h2>[email protected]</h2>',
start_blocks: 'console.log(4 % 2 == 0);',
}.to_json
assert_response :success
level = assigns(:level)
assert_equal '<h1>Final Grade: 90%</h1><h2>[email protected]</h2>', level.properties['start_html']
assert_equal 'console.log(4 % 2 == 0);', level.properties['start_blocks']
end
test "non-levelbuilder cannot update_properties" do
sign_out @levelbuilder
sign_in create(:teacher)
post :update_properties, params: {
id: create(:applab).id,
}, body: {
start_html: '<h1>foo</h1>'
}.to_json
assert_response :forbidden
end
test "should update solution image when updating solution blocks" do
LevelSourceImage.stubs(:find_by).returns(nil)
LevelSourceImage.any_instance.expects(:save_to_s3).returns(true)
post :update_blocks, params: @default_update_blocks_params.merge(
type: 'solution_blocks',
image: 'stub-image-data',
)
assert_response :success
level = assigns(:level)
assert_equal @program, level.properties['solution_blocks']
assert_s3_image_url level.properties['solution_image_url']
end
test "should not update solution image when updating toolbox blocks" do
post :update_blocks, params: @default_update_blocks_params.merge(
image: 'stub-image-data',
)
assert_response :success
level = assigns(:level)
assert_equal @program, level.properties['toolbox_blocks']
assert_nil level.properties['solution_image_url']
end
test "should update solution image if existing one is lower resolution" do
small_size = mock('image_size')
small_size.stubs(:width).returns(154)
small_size.stubs(:height).returns(154)
large_size = mock('image_size')
large_size.stubs(:width).returns(400)
large_size.stubs(:height).returns(400)
ImageSize.stubs(:path).returns(small_size)
ImageSize.stubs(:new).returns(large_size)
LevelSourceImage.any_instance.stubs(:s3_url).returns('fake url')
LevelSourceImage.any_instance.expects(:save_to_s3).returns(true)
post :update_blocks, params: @default_update_blocks_params.merge(
type: 'solution_blocks',
image: 'stub-image-data',
)
assert_response :success
end
test "should not update blocks if not levelbuilder" do
[@not_admin, @admin].each do |user|
sign_in user
post :update_blocks, params: @default_update_blocks_params
assert_response :forbidden
end
end
test "should not edit level if not custom level" do
level = create(:deprecated_blockly_level, user_id: nil)
refute Ability.new(@levelbuilder).can? :edit, level
post :update_blocks, params: @default_update_blocks_params.merge(
id: level.id,
game_id: level.game.id,
)
assert_response :forbidden
end
test "should not be able to edit on levelbuilder in locale besides en-US" do
Rails.application.config.stubs(:levelbuilder_mode).returns true
sign_in @levelbuilder
with_default_locale(:de) do
get :edit, params: {id: @level}
end
assert_redirected_to "/"
end
test "should not create level if not levelbuilder" do
[@not_admin, @admin].each do |user|
sign_in user
assert_does_not_create(Level) do
post :create, params: {name: "NewCustomLevel", program: @program}
end
assert_response :forbidden
end
end
# This should represent the behavior on production.
test "should not modify level in production" do
CDO.stubs(:rack_env).returns(:production)
Rails.application.config.stubs(:levelbuilder_mode).returns false
post :create, params: {name: "NewCustomLevel", program: @program}
assert_response :forbidden
end
test "should show level" do
get :show, params: {id: @level}
assert_response :success
end
test "should show level group" do
level_group = create :level_group, :with_sublevels, name: 'lg'
level_group.save!
get :show, params: {id: level_group.id}
assert_response :success
end
test "should show level on test env" do
Rails.env = "test"
get :show, params: {id: @level}
assert_response :success
end
test "should get edit" do
get :edit, params: {id: @level}
assert_response :success
end
test "should get edit blocks" do
@level.update(toolbox_blocks: @program)
get :edit_blocks, params: {id: @level.id, type: 'toolbox_blocks'}
assert_equal @program, assigns[:level_view_options_map][@level.id][:start_blocks]
end
test "should load file contents when editing a dsl defined level" do
level_path = 'config/scripts/test_demo_level.external'
data, _ = External.parse_file level_path
External.setup data
level = Level.find_by_name 'Test Demo Level'
get :edit, params: {id: level.id}
assert_equal level_path, assigns(:level).filename
assert_equal "name 'test demo level'", assigns(:level).dsl_text.split("\n").first
end
test "should load encrypted file contents when editing a dsl defined level with the wrong encryption key" do
level_path = 'config/scripts/test_external_markdown.external'
data, _ = External.parse_file level_path
External.setup data
CDO.stubs(:properties_encryption_key).returns("thisisafakekeyyyyyyyyyyyyyyyyyyyyy")
level = Level.find_by_name 'Test External Markdown'
get :edit, params: {id: level.id}
assert_equal level_path, assigns(:level).filename
assert_equal "name", assigns(:level).dsl_text.split("\n").first.split(" ").first
assert_equal "encrypted", assigns(:level).dsl_text.split("\n")[1].split(" ").first
end
test "should allow rename of new level" do
get :edit, params: {id: @level.id}
assert_response :success
assert_includes @response.body, @level.name
assert_not_includes @response.body, 'level cannot be renamed'
end
test "should prevent rename of level in launched or pilot script" do
script_level = create :script_level
script = script_level.script
script.published_state = 'stable'
script.save!
level = script_level.level
get :edit, params: {id: level.id}
assert_response :success
assert_includes @response.body, level.name
assert_includes @response.body, 'level cannot be renamed'
script.published_state = 'beta'
script.save!
get :edit, params: {id: level.id}
assert_response :success
assert_includes @response.body, level.name
assert_includes @response.body, 'level cannot be renamed'
script.pilot_experiment = 'platformization-partners'
script.published_state = 'pilot'
script.save!
get :edit, params: {id: level.id}
assert_response :success
assert_includes @response.body, level.name
assert_includes @response.body, 'level cannot be renamed'
script_level.destroy!
get :edit, params: {id: level.id}
assert_response :success
assert_includes @response.body, level.name
assert_not_includes @response.body, 'level cannot be renamed'
end
test "should prevent rename of stanadalone project level" do
level_name = ProjectsController::STANDALONE_PROJECTS.values.first[:name]
create(:level, name: level_name) unless Level.where(name: level_name).exists?
level = Level.find_by(name: level_name)
get :edit, params: {id: level.id}
assert_response :success
assert_includes @response.body, level.name
assert_includes @response.body, 'level cannot be renamed'
end
test "should update level" do
patch :update, params: {id: @level, level: {stub: nil}}
# Level update now uses AJAX callback, returns a 200 JSON response instead of redirect
assert_response :success
end
test "update sends JSON::ParserError to user" do
level = create(:applab)
invalid_json = "{,}"
patch :update, params: {
id: level,
level: {'code_functions' => invalid_json}
}
# Level update now uses AJAX callback, returns a 200 JSON response instead of redirect
assert_response :unprocessable_entity
assert_match /JSON::ParserError/, JSON.parse(@response.body)['code_functions'].first
end
test "should destroy level" do
assert_destroys(Level) do
delete :destroy, params: {id: @level}
end
assert_redirected_to levels_path
end
test "should route new to levels" do
assert_routing({method: "post", path: "/levels"}, {controller: "levels", action: "create"})
end
test "should use level for route helper" do
level = create(:artist)
get :edit, params: {id: level}
css = css_select "form[action=\"#{level_path(level)}\"]"
assert_not css.empty?
end
test "should use first skin as default" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze'
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
assert_equal Maze.skins.first, assigns(:level).skin
end
test "should use skin from params on create" do
maze = fixture_file_upload("maze_level.csv", "r")
game = Game.find_by_name("CustomMaze")
post :create, params: {
level: {
skin: Maze.skins.last,
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze'
},
game_id: game.id,
program: @program,
maze_source: maze,
size: 8
}
assert_equal Maze.skins.last, assigns(:level).skin
end
test "edit form should include skins" do
level = create(:artist)
skins = level.class.skins
get :edit, params: {id: level, game_id: level.game}
skin_select = css_select "#level_skin option"
values = skin_select.map {|option| option.attributes["value"].to_s}
assert_equal skins, values
end
test "should populate artist start direction with current value" do
level = create(:artist, start_direction: 180)
get :edit, params: {id: level, game_id: level.game}
assert_select "#level_start_direction[value='180']"
end
test "should populate maze start direction with current value" do
level = create(:maze, start_direction: 2)
get :edit, params: {id: level, game_id: level.game}
assert_select "#level_start_direction option[value='2'][selected='selected']"
end
test "should populate level skin with current value" do
level = create(:maze, skin: 'pvz')
get :edit, params: {id: level, game_id: level.game}
assert_select "#level_skin option[value='pvz'][selected='selected']"
end
test 'should render level name in title' do
get :show, params: {id: @level, game_id: @level.game}
assert_match /#{Regexp.quote(@level.name)}/, Nokogiri::HTML(@response.body).css('title').text.strip
end
test "should update maze data properly" do
game = Game.find_by_name("CustomMaze")
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Maze'
},
game_id: game.id,
maze_source: fixture_file_upload("maze_level.csv", "r"),
size: 8
}
my_level = Level.where(name: 'NewCustomLevel').first
maze_json = JSON.parse(my_level.maze)
maze_json[0][0] = '2'
maze_json[2][0] = 3
patch :update, params: {
level: {maze_data: maze_json.to_json},
id: my_level,
game_id: game.id
}
new_maze = JSON.parse(Level.where(name: 'NewCustomLevel').first.maze)
maze_json[0][0] = 2
assert_equal maze_json, new_maze
end
test "should update karel data properly" do
game = Game.find_by_name("CustomMaze")
maze_array = [
[{"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 2}, {"tileType": 1, "featureType": 2, "value": 1, "cloudType": 1, "range": 1}, {"tileType": 1, "featureType": 2, "value": 1, "cloudType": 2, "range": 1}, {"tileType": 1, "featureType": 2, "value": 1, "cloudType": 3, "range": 1}, {"tileType": 1, "featureType": 1, "value": 1, "cloudType": 4, "range": 1}, {"tileType": 1}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 1}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}],
[{"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}, {"tileType": 0}]
]
post :create, params: {
level: {
name: "NewCustomLevel",
short_instructions: "Some Instructions",
type: 'Karel'
},
game_id: game.id,
size: 8
}
my_level = Level.find_by(name: 'NewCustomLevel')
patch :update, params: {
level: {maze_data: maze_array.to_json},
id: my_level,
game_id: game.id
}
new_maze = Level.find_by(name: 'NewCustomLevel').serialized_maze
assert_equal maze_array.to_json, new_maze
end
test 'should show match level' do
my_level = create :match, name: 'MatchLevel', type: 'Match'
get :show, params: {id: my_level, game_id: my_level.game}
end
test 'should show applab level' do
my_level = create :applab, type: 'Applab'
get :show, params: {id: my_level, game_id: my_level.game}
end
test 'should show legacy unplugged level' do
level = create :unplugged, name: 'OldUnplugged', type: 'Unplugged'
get :show, params: {id: level, game_id: level.game}
assert_select 'div.unplugged > h1', 'Test title'
assert_select 'div.unplugged > p', 'Test description'
end
test 'should hide legacy unplugged pdf download button for students' do
level = create :unplugged, name: 'OldUnplugged', type: 'Unplugged'
teacher = create(:teacher)
sign_out(@levelbuilder)
sign_in(teacher)
get :show, params: {id: level, game_id: level.game}
assert_select '.pdf-button'
@controller = LevelsController.new
student = create(:student)
sign_out(teacher)
sign_in(student)
get :show, params: {id: level, game_id: level.game}
assert_select '.pdf-button', false, "Students shouldn't see PDF download button"
end
test 'should show new style unplugged level' do
level = create :unplugged, name: 'NewUnplugged', type: 'Unplugged'
get :show, params: {id: level, game_id: level.game}
assert_select 'div.unplugged > h1', 'Test title'
assert_select 'div.unplugged > p', 'Test description'
end
test 'should hide unplugged pdf download section for students' do
level = create :unplugged, name: 'NewUnplugged', type: 'Unplugged'
teacher = create(:teacher)
sign_out(@levelbuilder)
sign_in(teacher)
get :show, params: {id: level, game_id: level.game}
assert_select '.pdf-button'
@controller = LevelsController.new
student = create(:student)
sign_out(teacher)
sign_in(student)
get :show, params: {id: level, game_id: level.game}
assert_select '.lesson-plan', false, "Students shouldn't see lesson plan"
end
test "should clone" do
game = Game.find_by_name("Custom")
old = create(:level, game_id: game.id, name: "Fun Level")
assert_creates(Level) do
post :clone, params: {id: old.id, name: "Fun Level (copy 1)"}
end
new_level = assigns(:new_level)
assert_equal old.game, new_level.game
assert_equal "Fun Level (copy 1)", new_level.name
assert_equal "/levels/#{new_level.id}/edit", URI(JSON.parse(@response.body)['redirect']).path
end
test "should clone without redirect" do
game = Game.find_by_name("Custom")
old = create(:level, game_id: game.id, name: "Fun Level")
assert_creates(Level) do
post :clone, params: {id: old.id, name: "Fun Level (copy 1)", do_not_redirect: true}
end
new_level = assigns(:new_level)
assert_equal old.game, new_level.game
assert_equal "Fun Level (copy 1)", new_level.name
assert_equal "Fun Level (copy 1)", JSON.parse(@response.body)['name']
end
test "cannot clone hard-coded levels" do
old = create(:deprecated_blockly_level, game_id: Game.first.id, name: "Fun Level", user_id: nil)
refute old.custom?
refute_creates(Level) do
post :clone, params: {id: old.id, name: "Fun Level (copy 1)"}
assert_response :forbidden
end
end
test "cloning a level requires a name parameter" do
old = create(:level, game_id: Game.first.id, name: "Fun Level")
assert_raise ActionController::ParameterMissing do
post :clone, params: {id: old.id, name: ''}
end
end
test "platformization partner should own cloned level" do
sign_out @levelbuilder
sign_in @platformization_partner
game = Game.find_by_name("Custom")
old = create(:level, game_id: game.id, name: "Fun Level")
assert_creates(Level) do
post :clone, params: {id: old.id, name: "Fun Level (copy 1)"}
end
new_level = assigns(:new_level)
assert_equal new_level.game, old.game
assert_equal new_level.name, "Fun Level (copy 1)"
assert_equal "/levels/#{new_level.id}/edit", URI(JSON.parse(@response.body)['redirect']).path
assert_equal 'platformization-partners', new_level.editor_experiment
end
test "platformization partner cannot clone hard-coded levels" do
sign_out @levelbuilder
sign_in @platformization_partner
old = create(:deprecated_blockly_level, game_id: Game.first.id, name: "Fun Level", user_id: nil)
refute old.custom?
refute_creates(Level) do
post :clone, params: {id: old.id, name: "Fun Level (copy 1)"}
assert_response :forbidden
end
end
test 'cannot update level name with just a case change' do
level = create :level, name: 'original name'
post :update, params: {id: level.id, level: {name: 'ORIGINAL NAME'}}
assert_response 422
# error message
assert assigns(:level).errors[:name]
level = level.reload
# same name
assert_equal 'original name', level.name
end
test 'no error message when not actually changing level name' do
level = create :level, name: 'original name'
post :update, params: {id: level.id, level: {name: 'original name'}}
assert_response 200
# no error message
assert assigns(:level).errors[:name].blank?
level = level.reload
# same name
assert_equal 'original name', level.name
end
test 'can update level name' do
level = create :level, name: 'original name'
post :update, params: {id: level.id, level: {name: 'different name'}}
level = level.reload
# same name
assert_equal 'different name', level.name
end
test 'trailing spaces in level name get stripped' do
level = create :level, name: 'original name '
assert_equal 'original name', level.name
post :update, params: {id: level.id, level: {name: 'different name '}}
level = level.reload
# same name
assert_equal 'different name', level.name
end
test 'can show level when not signed in' do
set_env :test
level = create :artist
sign_out @levelbuilder
get :edit, params: {id: level}
assert_response :redirect
get :show, params: {id: level}
assert_response :success
end
test 'can show embed level when not signed in' do
set_env :test
level = create :artist
sign_out @levelbuilder
get :embed_level, params: {id: level}
assert_response :success
end
test 'external markdown levels will render <user_id/> as the actual user id' do
File.stubs(:write)
dsl_text = <<DSL
name 'user_id_replace'
title 'title for user_id_replace'
markdown 'this is the markdown for <user_id/>'
DSL
level = External.create_from_level_builder({}, {name: 'my_user_id_replace', dsl_text: dsl_text})
sign_in @not_admin
get :show, params: {id: level}
assert_response :success
assert_select '.markdown-container[data-markdown=?]', "this is the markdown for #{@not_admin.id}"
end
# test_platformization_partner_calling_get_new_should_receive_success
test_user_gets_response_for(
:new,
response: :success,
user: :platformization_partner
)
test 'platformization partner creates and owns new artist level' do
sign_out @levelbuilder
sign_in @platformization_partner
game = Game.find_by_name('Custom')
assert_creates(Level) do
post :create, params: {
level: {name: 'partner artist level', type: 'Artist'},
game_id: game.id,
program: @program
}
end
level = Level.last
assert_equal 'partner artist level', level.name
assert_equal 'platformization-partners', level.editor_experiment
end
test "should get serialized_maze" do
level = create_level_with_serialized_maze
get :get_serialized_maze, params: {id: level.id}
expected_maze = [[{"tileType" => 1, "value" => 0}], [{"tileType" => 0, "assetId" => 5, "value" => 0}]]
assert_equal expected_maze, JSON.parse(@response.body)
end
test "anonymous user can get_serialized_maze" do
sign_out @levelbuilder
level = create_level_with_serialized_maze
get :get_serialized_maze, params: {id: level.id}
expected_maze = [[{"tileType" => 1, "value" => 0}], [{"tileType" => 0, "assetId" => 5, "value" => 0}]]
assert_equal expected_maze, JSON.parse(@response.body)
end
test "empty success response for get_serialized_maze on level without maze" do
level = create :level
get :get_serialized_maze, params: {id: level.id}
assert_response :no_content
assert_equal '', @response.body
end
def create_level_with_serialized_maze
create(:javalab,
serialized_maze: [[{tileType: 1, value: 0}], [{tileType: 0, assetId: 5, value: 0}]]
)
end
test_user_gets_response_for(
:edit,
response: :forbidden,
user: :platformization_partner,
params: -> {{id: @level.id}}
)
test_user_gets_response_for(
:edit,
response: :success,
user: :platformization_partner,
params: -> {{id: @partner_level.id}}
)
test_user_gets_response_for(
:update,
method: :patch,
response: :forbidden,
user: :platformization_partner,
params: -> {{id: @level.id, level: {name: 'new partner name'}}}
)
test_user_gets_response_for(
:update,
method: :patch,
response: :success,
user: :platformization_partner,
params: -> {{id: @partner_level.id, level: {name: 'new partner name'}}}
)
private
# Assert that the url is a real S3 url, and not a placeholder.
def assert_s3_image_url(url)
assert(
%r{#{LevelSourceImage::S3_URL}.*\.png}.match(url),
"expected #{url.inspect} to be an S3 URL"
)
end
# Allow our update_blocks tests to verify that real S3 urls are being
# generated when solution images are uploaded. We don't want to actually
# upload any S3 images in our tests, so just enable the codepath where an
# existing LevelSourceImage is found based on the program contents.
def enable_level_source_image_s3_urls
# Allow LevelSourceImage to return real S3 urls.
CDO.stubs(:disable_s3_image_uploads).returns(false)
# Make sure there is a LevelSourceImage associated with the program.
create(:level_source, :with_image, level: @level, data: @program)
# Because we cleared disable_s3_image_uploads, there's a chance we'll
# accidentally try to upload an image to S3. Make sure this never happens.
LevelSourceImage.any_instance.expects(:save_to_s3).never
end
end
| 32.014015 | 375 | 0.665671 |
28d7ad61825f3c00db4096c0d2f5f5dfa916f339
| 870 |
# typed: false
# frozen_string_literal: true
require File.expand_path("../Abstract/abstract-php-extension", __dir__)
# Class for GRPC Extension
class GrpcAT73 < AbstractPhp73Extension
init
desc "gRPC PHP extension"
homepage "https://github.com/grpc/grpc"
url "https://pecl.php.net/get/grpc-1.34.0.tgz"
sha256 "70a0f34ac30608e52d83bba9639b2cf6878942813f4aee6d6e842e689ea27485"
head "https://github.com/grpc/grpc.git"
license "Apache-2.0"
bottle do
root_url "https://dl.bintray.com/shivammathur/extensions"
cellar :any_skip_relocation
sha256 "2769a35b65008e336121ccbcf24dd72d8703d46125de80329a04c5a6c9160172" => :catalina
end
depends_on "grpc"
def install
Dir.chdir "grpc-#{version}"
safe_phpize
system "./configure", "--enable-grpc"
system "make"
prefix.install "modules/grpc.so"
write_config_file
end
end
| 26.363636 | 90 | 0.743678 |
4a14c5a2d38e8d10eb16ed169512548f86065fa0
| 14,027 |
require 'rails_admin/config/model'
require 'rails_admin/config/sections/list'
require 'active_support/core_ext/module/attribute_accessors'
module RailsAdmin
module Config
# RailsAdmin is setup to try and authenticate with warden
# If warden is found, then it will try to authenticate
#
# This is valid for custom warden setups, and also devise
# If you're using the admin setup for devise, you should set RailsAdmin to use the admin
#
# @see RailsAdmin::Config.authenticate_with
# @see RailsAdmin::Config.authorize_with
DEFAULT_AUTHENTICATION = proc {}
DEFAULT_AUTHORIZE = proc {}
DEFAULT_AUDIT = proc {}
DEFAULT_CURRENT_USER = proc {}
# Variables to track initialization process
@initialized = false
@deferred_blocks = []
class << self
# Application title, can be an array of two elements
attr_accessor :main_app_name
# Configuration option to specify which models you want to exclude.
attr_accessor :excluded_models
# Configuration option to specify a allowlist of models you want to RailsAdmin to work with.
# The excluded_models list applies against the allowlist as well and further reduces the models
# RailsAdmin will use.
# If included_models is left empty ([]), then RailsAdmin will automatically use all the models
# in your application (less any excluded_models you may have specified).
attr_accessor :included_models
# Fields to be hidden in show, create and update views
attr_accessor :default_hidden_fields
# Default items per page value used if a model level option has not
# been configured
attr_accessor :default_items_per_page
# Default association limit
attr_accessor :default_associated_collection_limit
attr_reader :default_search_operator
# Configuration option to specify which method names will be searched for
# to be used as a label for object records. This defaults to [:name, :title]
attr_accessor :label_methods
# hide blank fields in show view if true
attr_accessor :compact_show_view
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
attr_accessor :browser_validations
# Set the max width of columns in list view before a new set is created
attr_accessor :total_columns_width
# Enable horizontal-scrolling table in list view, ignore total_columns_width
attr_accessor :sidescroll
# set parent controller
attr_reader :parent_controller
# set settings for `protect_from_forgery` method
# By default, it raises exception upon invalid CSRF tokens
attr_accessor :forgery_protection_settings
# Stores model configuration objects in a hash identified by model's class
# name.
#
# @see RailsAdmin.config
attr_reader :registry
# show Gravatar in Navigation bar
attr_accessor :show_gravatar
# accepts a hash of static links to be shown below the main navigation
attr_accessor :navigation_static_links
attr_accessor :navigation_static_label
# Set where RailsAdmin fetches JS/CSS from, defaults to :sprockets
attr_accessor :asset_source
# Finish initialization by executing deferred configuration blocks
def initialize!
@deferred_blocks.each { |block| block.call(self) }
@deferred_blocks.clear
@initialized = true
end
# Evaluate the given block either immediately or lazily, based on initialization status.
def apply(&block)
if @initialized
yield(self)
else
@deferred_blocks << block
end
end
# Setup authentication to be run as a before filter
# This is run inside the controller instance so you can setup any authentication you need to
#
# By default, the authentication will run via warden if available
# and will run the default.
#
# If you use devise, this will authenticate the same as _authenticate_user!_
#
# @example Devise admin
# RailsAdmin.config do |config|
# config.authenticate_with do
# authenticate_admin!
# end
# end
#
# @example Custom Warden
# RailsAdmin.config do |config|
# config.authenticate_with do
# warden.authenticate! scope: :paranoid
# end
# end
#
# @see RailsAdmin::Config::DEFAULT_AUTHENTICATION
def authenticate_with(&blk)
@authenticate = blk if blk
@authenticate || DEFAULT_AUTHENTICATION
end
# Setup auditing/versioning provider that observe objects lifecycle
def audit_with(*args, &block)
extension = args.shift
if extension
klass = RailsAdmin::AUDITING_ADAPTERS[extension]
klass.setup if klass.respond_to? :setup
@audit = proc do
@auditing_adapter = klass.new(*([self] + args).compact)
end
elsif block
@audit = block
end
@audit || DEFAULT_AUDIT
end
# Setup authorization to be run as a before filter
# This is run inside the controller instance so you can setup any authorization you need to.
#
# By default, there is no authorization.
#
# @example Custom
# RailsAdmin.config do |config|
# config.authorize_with do
# redirect_to root_path unless warden.user.is_admin?
# end
# end
#
# To use an authorization adapter, pass the name of the adapter. For example,
# to use with CanCanCan[https://github.com/CanCanCommunity/cancancan/], pass it like this.
#
# @example CanCanCan
# RailsAdmin.config do |config|
# config.authorize_with :cancancan
# end
#
# See the wiki[https://github.com/railsadminteam/rails_admin/wiki] for more on authorization.
#
# @see RailsAdmin::Config::DEFAULT_AUTHORIZE
def authorize_with(*args, &block)
extension = args.shift
if extension
klass = RailsAdmin::AUTHORIZATION_ADAPTERS[extension]
klass.setup if klass.respond_to? :setup
@authorize = proc do
@authorization_adapter = klass.new(*([self] + args).compact)
end
elsif block
@authorize = block
end
@authorize || DEFAULT_AUTHORIZE
end
# Setup configuration using an extension-provided ConfigurationAdapter
#
# @example Custom configuration for role-based setup.
# RailsAdmin.config do |config|
# config.configure_with(:custom) do |config|
# config.models = ['User', 'Comment']
# config.roles = {
# 'Admin' => :all,
# 'User' => ['User']
# }
# end
# end
def configure_with(extension)
configuration = RailsAdmin::CONFIGURATION_ADAPTERS[extension].new
yield(configuration) if block_given?
end
# Setup a different method to determine the current user or admin logged in.
# This is run inside the controller instance and made available as a helper.
#
# By default, _request.env["warden"].user_ or _current_user_ will be used.
#
# @example Custom
# RailsAdmin.config do |config|
# config.current_user_method do
# current_admin
# end
# end
#
# @see RailsAdmin::Config::DEFAULT_CURRENT_USER
def current_user_method(&block)
@current_user = block if block
@current_user || DEFAULT_CURRENT_USER
end
def default_search_operator=(operator)
if %w[default like not_like starts_with ends_with is =].include? operator
@default_search_operator = operator
else
raise ArgumentError.new("Search operator '#{operator}' not supported")
end
end
# pool of all found model names from the whole application
def models_pool
(viable_models - excluded_models.collect(&:to_s)).uniq.sort
end
# Loads a model configuration instance from the registry or registers
# a new one if one is yet to be added.
#
# First argument can be an instance of requested model, its class object,
# its class name as a string or symbol or a RailsAdmin::AbstractModel
# instance.
#
# If a block is given it is evaluated in the context of configuration instance.
#
# Returns given model's configuration
#
# @see RailsAdmin::Config.registry
def model(entity, &block)
key =
case entity
when RailsAdmin::AbstractModel
entity.model.try(:name).try :to_sym
when Class
entity.name.to_sym
when String, Symbol
entity.to_sym
else
entity.class.name.to_sym
end
@registry[key] ||= RailsAdmin::Config::Model.new(entity)
@registry[key].instance_eval(&block) if block && @registry[key].abstract_model
@registry[key]
end
def default_hidden_fields=(fields)
if fields.is_a?(Array)
@default_hidden_fields = {}
@default_hidden_fields[:edit] = fields
@default_hidden_fields[:show] = fields
else
@default_hidden_fields = fields
end
end
def parent_controller=(name)
@parent_controller = name
if defined?(RailsAdmin::ApplicationController)
RailsAdmin.send(:remove_const, :ApplicationController)
load RailsAdmin::Engine.root.join('app/controllers/rails_admin/application_controller.rb')
end
end
# Returns action configuration object
def actions(&block)
RailsAdmin::Config::Actions.instance_eval(&block) if block
end
# Returns all model configurations
#
# @see RailsAdmin::Config.registry
def models
RailsAdmin::AbstractModel.all.collect { |m| model(m) }
end
# Reset all configurations to defaults.
#
# @see RailsAdmin::Config.registry
def reset
@compact_show_view = true
@browser_validations = true
@authenticate = nil
@authorize = nil
@audit = nil
@current_user = nil
@default_hidden_fields = {}
@default_hidden_fields[:base] = [:_type]
@default_hidden_fields[:edit] = %i[id _id created_at created_on deleted_at updated_at updated_on deleted_on]
@default_hidden_fields[:show] = %i[id _id created_at created_on deleted_at updated_at updated_on deleted_on]
@default_items_per_page = 20
@default_associated_collection_limit = 100
@default_search_operator = 'default'
@excluded_models = []
@included_models = []
@total_columns_width = 697
@sidescroll = nil
@label_methods = %i[name title]
@main_app_name = proc { [Rails.application.engine_name.titleize.chomp(' Application'), 'Admin'] }
@registry = {}
@show_gravatar = true
@navigation_static_links = {}
@navigation_static_label = nil
@asset_source = (defined?(Webpacker) ? :webpacker : :sprockets)
@parent_controller = '::ActionController::Base'
@forgery_protection_settings = {with: :exception}
RailsAdmin::Config::Actions.reset
RailsAdmin::AbstractModel.reset
end
# Reset a provided model's configuration.
#
# @see RailsAdmin::Config.registry
def reset_model(model)
key = model.is_a?(Class) ? model.name.to_sym : model.to_sym
@registry.delete(key)
end
# Reset all models configuration
# Used to clear all configurations when reloading code in development.
# @see RailsAdmin::Engine
# @see RailsAdmin::Config.registry
def reset_all_models
@registry = {}
end
# Perform reset, then load RailsAdmin initializer again
def reload!
@initialized = false
reset
load RailsAdmin::Engine.config.initializer_path
initialize!
end
# Get all models that are configured as visible sorted by their weight and label.
#
# @see RailsAdmin::Config::Hideable
def visible_models(bindings)
visible_models_with_bindings(bindings).sort do |a, b|
if (weight_order = a.weight <=> b.weight) == 0
a.label.casecmp(b.label)
else
weight_order
end
end
end
private
def lchomp(base, arg)
base.to_s.reverse.chomp(arg.to_s.reverse).reverse
end
def viable_models
included_models.collect(&:to_s).presence || begin
@@system_models ||= # memoization for tests
([Rails.application] + Rails::Engine.subclasses.collect(&:instance)).flat_map do |app|
(app.paths['app/models'].to_a + app.config.eager_load_paths).collect do |load_path|
Dir.glob(app.root.join(load_path)).collect do |load_dir|
Dir.glob("#{load_dir}/**/*.rb").collect do |filename|
# app/models/module/class.rb => module/class.rb => module/class => Module::Class
lchomp(filename, "#{app.root.join(load_dir)}/").chomp('.rb').camelize
end
end
end
end.flatten.reject { |m| m.starts_with?('Concerns::') } # rubocop:disable Style/MultilineBlockChain
end
end
def visible_models_with_bindings(bindings)
models.collect { |m| m.with(bindings) }.select do |m|
m.visible? &&
RailsAdmin::Config::Actions.find(:index, bindings.merge(abstract_model: m.abstract_model)).try(:authorized?) &&
(!m.abstract_model.embedded? || m.abstract_model.cyclic?)
end
end
end
# Set default values for configuration options on load
reset
end
end
| 34.893035 | 123 | 0.637271 |
7abf7658f13af1cbf51e0c8b6d2da51321e7613a
| 46 |
ActiveRecord::Base.send :include, RelatedNews
| 23 | 45 | 0.826087 |
288c6bf60ea2179659266c58e998f17cc3d33822
| 11,531 |
# frozen_string_literal: true
require 'spec_helper'
describe "Promotion Adjustments", type: :feature, js: true do
stub_authorization!
context "creating a new promotion", js: true do
before(:each) do
visit spree.new_admin_promotion_path
expect(page).to have_title("New Promotion - Promotions")
end
it "should allow an admin to create a flat rate discount coupon promo" do
fill_in "Name", with: "SAVE SAVE SAVE"
fill_in "Promotion Code", with: "order"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Item Total", from: "Discount Rules"
within('#rule_fields') { click_button "Add" }
find('[id$=_preferred_amount]').set(30)
within('#rule_fields') { click_button "Update" }
select "Create whole-order adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
fill_in "Amount", with: 5
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.codes.first.value).to eq("order")
first_rule = promotion.rules.first
expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
expect(first_rule.preferred_amount).to eq(30)
first_action = promotion.actions.first
expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
first_action_calculator = first_action.calculator
expect(first_action_calculator.class).to eq(Spree::Calculator::FlatRate)
expect(first_action_calculator.preferred_amount).to eq(5)
end
it "should allow an admin to create a single user coupon promo with flat rate discount" do
fill_in "Name", with: "SAVE SAVE SAVE"
fill_in "promotion[usage_limit]", with: "1"
fill_in "Promotion Code", with: "single_use"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Create whole-order adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
fill_in "Amount", with: "5"
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.usage_limit).to eq(1)
expect(promotion.codes.first.value).to eq("single_use")
first_action = promotion.actions.first
expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
first_action_calculator = first_action.calculator
expect(first_action_calculator.class).to eq(Spree::Calculator::FlatRate)
expect(first_action_calculator.preferred_amount).to eq(5)
end
it "should allow an admin to create an automatic promo with flat percent discount" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Item Total", from: "Discount Rules"
within('#rule_fields') { click_button "Add" }
find('[id$=_preferred_amount]').set(30)
within('#rule_fields') { click_button "Update" }
select "Create whole-order adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Flat Percent", from: I18n.t('spree.admin.promotions.actions.calculator_label')
fill_in "Flat Percent", with: "10"
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.codes.first).to be_nil
first_rule = promotion.rules.first
expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
expect(first_rule.preferred_amount).to eq(30)
first_action = promotion.actions.first
expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
first_action_calculator = first_action.calculator
expect(first_action_calculator.class).to eq(Spree::Calculator::FlatPercentItemTotal)
expect(first_action_calculator.preferred_flat_percent).to eq(10)
end
it "should allow an admin to create an product promo with percent per item discount" do
create(:product, name: "RoR Mug")
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Product(s)", from: "Discount Rules"
within("#rule_fields") { click_button "Add" }
select2_search "RoR Mug", from: "Choose products"
within('#rule_fields') { click_button "Update" }
select "Create per-line-item adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Percent Per Item", from: I18n.t('spree.admin.promotions.actions.calculator_label')
fill_in "Percent", with: "10"
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.codes.first).to be_nil
first_rule = promotion.rules.first
expect(first_rule.class).to eq(Spree::Promotion::Rules::Product)
expect(first_rule.products.map(&:name)).to include("RoR Mug")
first_action = promotion.actions.first
expect(first_action.class).to eq(Spree::Promotion::Actions::CreateItemAdjustments)
first_action_calculator = first_action.calculator
expect(first_action_calculator.class).to eq(Spree::Calculator::PercentOnLineItem)
expect(first_action_calculator.preferred_percent).to eq(10)
end
it "should allow an admin to create an automatic promotion with free shipping (no code)" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Item Total", from: "Discount Rules"
within('#rule_fields') { click_button "Add" }
find('[id$=_preferred_amount]').set(30)
within('#rule_fields') { click_button "Update" }
select "Free Shipping", from: "Adjustment type"
within('#action_fields') { click_button "Add" }
expect(page).to have_content('Makes all shipments for the order free')
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.codes).to be_empty
expect(promotion.rules.first).to be_a(Spree::Promotion::Rules::ItemTotal)
expect(promotion.actions.first).to be_a(Spree::Promotion::Actions::FreeShipping)
end
it "disables the button at submit", :js do
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_button("Create", disabled: true)
end
it "should allow an admin to create an automatic promotion" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion).to be_apply_automatically
expect(promotion.path).to be_nil
expect(promotion.codes).to be_empty
expect(promotion.rules).to be_blank
end
it "should allow an admin to create a promo with generated codes" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Multiple promotion codes"
fill_in "Base code", with: "testing"
fill_in "Number of codes", with: "10"
perform_enqueued_jobs {
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
}
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
expect(promotion.path).to be_nil
expect(promotion).not_to be_apply_automatically
expect(promotion.rules).to be_blank
expect(promotion.codes.count).to eq(10)
end
it "ceasing to be eligible for a promotion with item total rule then becoming eligible again" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Item Total", from: "Discount Rules"
within('#rule_fields') { click_button "Add" }
find('[id$=_preferred_amount]').set(50)
within('#rule_fields') { click_button "Update" }
select "Create whole-order adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
fill_in "Amount", with: "5"
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
promotion = Spree::Promotion.find_by(name: "SAVE SAVE SAVE")
first_rule = promotion.rules.first
expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
expect(first_rule.preferred_amount).to eq(50)
first_action = promotion.actions.first
expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
expect(first_action.calculator.class).to eq(Spree::Calculator::FlatRate)
expect(first_action.calculator.preferred_amount).to eq(5)
end
context 'creating a promotion with promotion action that has a calculator with complex preferences' do
before do
class ComplexCalculator < Spree::Calculator
preference :amount, :decimal
preference :currency, :string
preference :mapping, :hash
preference :list, :array
def self.description
"Complex Calculator"
end
end
@calculators = Rails.application.config.spree.calculators.promotion_actions_create_item_adjustments
Rails.application.config.spree.calculators.promotion_actions_create_item_adjustments = [ComplexCalculator]
end
after do
Rails.application.config.spree.calculators.promotion_actions_create_item_adjustments = @calculators
end
it "does not show array and hash form fields" do
fill_in "Name", with: "SAVE SAVE SAVE"
choose "Apply to all orders"
click_button "Create"
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
select "Create per-line-item adjustment", from: "Adjustment type"
within('#action_fields') do
click_button "Add"
select "Complex Calculator", from: I18n.t('spree.admin.promotions.actions.calculator_label')
end
within('#actions_container') { click_button "Update" }
expect(page).to have_text 'successfully updated'
within('#action_fields') do
expect(page).to have_field('Amount')
expect(page).to have_field('Currency')
expect(page).to_not have_field('Mapping')
expect(page).to_not have_field('List')
end
end
end
end
end
| 40.1777 | 114 | 0.682942 |
b918566aee1fc1c8523dc0965eb28d31553fe45e
| 1,238 |
class Cask::Download
attr_reader :cask
def initialize(cask)
@cask = cask
end
def perform(force=false)
require 'software_spec'
cask = @cask
if cask.url.using == :svn
downloader = Cask::SubversionDownloadStrategy.new(cask)
else
downloader = Cask::CurlDownloadStrategy.new(cask)
end
downloader.clear_cache if force
downloaded_path = downloader.fetch
begin
# this symlink helps track which downloads are ours
File.symlink downloaded_path,
HOMEBREW_CACHE_CASKS.join(downloaded_path.basename)
rescue
end
_check_sums(downloaded_path, cask.sums) unless cask.sums === :no_check
downloaded_path
end
private
def _check_sums(path, sums)
has_sum = false
sums.each do |sum|
unless sum.empty?
computed = Checksum.new(sum.hash_type, Digest.const_get(sum.hash_type.to_s.upcase).file(path).hexdigest)
if sum == computed
odebug "Checksums match"
else
raise ChecksumMismatchError.new(path, sum, computed)
end
has_sum = true
end
end
raise ChecksumMissingError.new("Checksum required: sha256 '#{Digest::SHA256.file(path).hexdigest}'") unless has_sum
end
end
| 27.511111 | 119 | 0.672859 |
1cceb7b9337ab08995262e055c1056f429ab8f30
| 1,736 |
# -*- encoding : utf-8 -*-
class FolderController < ApplicationController
include Blacklight::Configurable
include Blacklight::SolrHelper
copy_blacklight_config_from(CatalogController)
helper CatalogHelper
# fetch the documents that match the ids in the folder
def index
@response, @documents = get_solr_response_for_field_values("id",session[:folder_document_ids] || [])
end
# add a document_id to the folder. :id of action is solr doc id
def update
session[:folder_document_ids] = session[:folder_document_ids] || []
session[:folder_document_ids] << params[:id]
# Rails 3 uses a one line notation for setting the flash notice.
# flash[:notice] = "#{params[:title] || "Item"} successfully added to Folder"
respond_to do |format|
format.html { redirect_to :back, :notice => I18n.t('blacklight.folder.add.success', :title => params[:title] || 'Item') }
format.js { render :json => session[:folder_document_ids] }
end
end
# remove a document_id from the folder. :id of action is solr_doc_id
def destroy
session[:folder_document_ids].delete(params[:id])
respond_to do |format|
format.html do
flash[:notice] = I18n.t('blacklight.folder.remove.success', :title => params[:title] || 'Item')
redirect_to :back
end
format.js do
render :json => {"OK" => "OK"}
end
end
end
# get rid of the items in the folder
def clear
flash[:notice] = I18n.t('blacklight.folder.clear.success')
session[:folder_document_ids] = []
respond_to do |format|
format.html { redirect_to :back }
format.js { render :json => session[:folder_document_ids] }
end
end
end
| 31.563636 | 128 | 0.662442 |
5da0b4081b5ca0292f305b50ab360df012abe9ee
| 1,045 |
# frozen_string_literal: true
namespace :yarn do
desc "Install all JavaScript dependencies as specified via Yarn"
task :install do
# Install only production deps when for not usual envs.
valid_node_envs = %w[test development production]
node_env = ENV.fetch("NODE_ENV") do
valid_node_envs.include?(Rails.env) ? Rails.env : "production"
end
yarn_flags =
if `"#{Rails.root}/bin/yarn" --version`.start_with?("1")
"--no-progress --frozen-lockfile"
else
"--immutable"
end
system({ "NODE_ENV" => node_env }, "\"#{Rails.root}/bin/yarn\" install #{yarn_flags}")
rescue Errno::ENOENT
$stderr.puts "bin/yarn was not found."
$stderr.puts "Please run `bundle exec rails app:update:bin` to create it."
exit 1
end
end
# Run Yarn prior to Sprockets assets precompilation, so dependencies are available for use.
if Rake::Task.task_defined?("assets:precompile") && File.exist?(Rails.root.join("bin", "yarn"))
Rake::Task["assets:precompile"].enhance [ "yarn:install" ]
end
| 33.709677 | 95 | 0.678469 |
e9fb7d316bdca61aef28252551043512588b4338
| 1,726 |
require File.expand_path('../../../spec_helper', __FILE__)
with_feature :encoding do
describe "String#force_encoding" do
it "requires exactly one argument" do
lambda {
"glark".force_encoding
}.should raise_error(ArgumentError)
lambda {
"glark".force_encoding('h','d')
}.should raise_error(ArgumentError)
end
it "accepts the encoding name as a String" do
lambda {
str.force_encoding('shift_jis')
}.should_not raise_error(ArgumentError)
end
it "accepts the encoding name as an Encoding object" do
lambda {
str.force_encoding(Encoding::SHIFT_JIS)
}.should_not raise_error(ArgumentError)
end
it "tags the String with the given encoding" do
str = "a"
str.encoding.should == Encoding::US_ASCII
str.force_encoding(Encoding::SHIFT_JIS)
str.encoding.should == Encoding::SHIFT_JIS
end
it "returns self" do
str = "glark"
id = str.object_id
str.force_encoding('utf-8').object_id.should == id
end
it "does not care if self would be invalid in given encoding" do
str = "\u{9765}"
str.force_encoding('euc-jp')
str.encoding.should == Encoding::EUC_JP
str.valid_encoding?.should be_false
end
it "does not care if self is already tagged with the given encoding" do
str = "\u{9765}"
str.encoding.should == Encoding::UTF_8
lambda {
str.force_encoding('utf-8')
}.should_not raise_error(ArgumentError)
str.encoding.should == Encoding::UTF_8
end
it "does not transcode self" do
"\u{8612}".force_encoding('utf-16le').should_not ==
"\u{8612}".encode('utf-16le')
end
end
end
| 27.83871 | 75 | 0.640788 |
21a4fcfff740092ac1ee60a9beb996dd23272dc1
| 1,393 |
# frozen_string_literal: true
module EE
module Types
module Ci
module PipelineType
extend ActiveSupport::Concern
prepended do
field :security_report_summary,
::Types::SecurityReportSummaryType,
null: true,
extras: [:lookahead],
description: 'Vulnerability and scanned resource counts for each security scanner of the pipeline.',
resolver: ::Resolvers::SecurityReportSummaryResolver
field :security_report_findings,
::Types::PipelineSecurityReportFindingType.connection_type,
null: true,
description: 'Vulnerability findings reported on the pipeline.',
resolver: ::Resolvers::PipelineSecurityReportFindingsResolver
field :code_quality_reports,
::Types::Ci::CodeQualityDegradationType.connection_type,
null: true,
description: 'Code Quality degradations reported on the pipeline.'
field :dast_profile,
::Types::Dast::ProfileType,
null: true,
description: 'DAST profile associated with the pipeline.'
def code_quality_reports
pipeline.codequality_reports.sort_degradations!.values.presence
end
def dast_profile
pipeline.dast_profile
end
end
end
end
end
end
| 30.955556 | 112 | 0.63173 |
f8cc021fccb5772381ff0023259060f88651802a
| 29,299 |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2018_12_01
#
# VirtualNetworkPeerings
#
class VirtualNetworkPeerings
include MsRestAzure
#
# Creates and initializes a new instance of the VirtualNetworkPeerings class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end
# @return [NetworkManagementClient] reference to the NetworkManagementClient
attr_reader :client
#
# Deletes the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
def delete(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
response = delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
nil
end
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Concurrent::Promise] promise which provides async access to http
# response.
#
def delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
# Send request
promise = begin_delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end
#
# Gets the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [VirtualNetworkPeering] operation results.
#
def get(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
response = get_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
get_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
end
#
# Gets the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'virtual_network_name is nil' if virtual_network_name.nil?
fail ArgumentError, 'virtual_network_peering_name is nil' if virtual_network_peering_name.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkName' => virtual_network_name,'virtualNetworkPeeringName' => virtual_network_peering_name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeering.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Creates or updates a peering in the specified virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the peering.
# @param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
# supplied to the create or update virtual network peering operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [VirtualNetworkPeering] operation results.
#
def create_or_update(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the peering.
# @param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
# supplied to the create or update virtual network peering operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Concurrent::Promise] promise which provides async access to http
# response.
#
def create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeering.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<VirtualNetworkPeering>] operation results.
#
def list(resource_group_name, virtual_network_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, virtual_network_name, custom_headers:custom_headers)
first_page.get_all_items
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_with_http_info(resource_group_name, virtual_network_name, custom_headers:nil)
list_async(resource_group_name, virtual_network_name, custom_headers:custom_headers).value!
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_async(resource_group_name, virtual_network_name, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'virtual_network_name is nil' if virtual_network_name.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkName' => virtual_network_name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeeringListResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Deletes the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def begin_delete(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
nil
end
#
# Deletes the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def begin_delete_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
begin_delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
end
#
# Deletes the specified virtual network peering.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the virtual network
# peering.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def begin_delete_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'virtual_network_name is nil' if virtual_network_name.nil?
fail ArgumentError, 'virtual_network_peering_name is nil' if virtual_network_peering_name.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkName' => virtual_network_name,'virtualNetworkPeeringName' => virtual_network_peering_name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:delete, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200 || status_code == 204 || status_code == 202
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end
#
# Creates or updates a peering in the specified virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the peering.
# @param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
# supplied to the create or update virtual network peering operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [VirtualNetworkPeering] operation results.
#
def begin_create_or_update(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Creates or updates a peering in the specified virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the peering.
# @param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
# supplied to the create or update virtual network peering operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def begin_create_or_update_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
end
#
# Creates or updates a peering in the specified virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param virtual_network_peering_name [String] The name of the peering.
# @param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
# supplied to the create or update virtual network peering operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'virtual_network_name is nil' if virtual_network_name.nil?
fail ArgumentError, 'virtual_network_peering_name is nil' if virtual_network_peering_name.nil?
fail ArgumentError, 'virtual_network_peering_parameters is nil' if virtual_network_peering_parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeering.mapper()
request_content = @client.serialize(request_mapper, virtual_network_peering_parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkName' => virtual_network_name,'virtualNetworkPeeringName' => virtual_network_peering_name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:put, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200 || status_code == 201
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeering.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
# Deserialize Response
if status_code == 201
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeering.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [VirtualNetworkPeeringListResult] operation results.
#
def list_next(next_page_link, custom_headers:nil)
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_next_with_http_info(next_page_link, custom_headers:nil)
list_next_async(next_page_link, custom_headers:custom_headers).value!
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_next_async(next_page_link, custom_headers:nil)
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{nextLink}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
skip_encoding_path_params: {'nextLink' => next_page_link},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VirtualNetworkPeeringListResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets all virtual network peerings in a virtual network.
#
# @param resource_group_name [String] The name of the resource group.
# @param virtual_network_name [String] The name of the virtual network.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [VirtualNetworkPeeringListResult] which provide lazy access to pages
# of the response.
#
def list_as_lazy(resource_group_name, virtual_network_name, custom_headers:nil)
response = list_async(resource_group_name, virtual_network_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end
end
end
| 46.8784 | 217 | 0.722107 |
1a58811fed2a3cee2ee2431edc2a0e5549617dd5
| 2,477 |
require 'webrick'
require 'drb/drb'
require 'drb/http0'
module DRb
module HTTP0
def self.open_server(uri, config)
unless /^http:/ =~ uri
raise(DRbBadScheme, uri) unless uri =~ /^http:/
raise(DRbBadURI, 'can\'t parse uri:' + uri)
end
Server.new(uri, config)
end
class Callback < WEBrick::HTTPServlet::AbstractServlet
def initialize(config, drb)
@config = config
@drb = drb
@queue = Thread::Queue.new
end
def do_POST(req, res)
@req = req
@res = res
@drb.push(self)
@res.body = @queue.pop
@res['content-type'] = 'application/octet-stream;'
end
def req_body
@req.body
end
def reply(body)
@queue.push(body)
end
def close
@queue.push('')
end
end
class Server
def initialize(uri, config)
@uri = uri
@config = config
@queue = Thread::Queue.new
setup_webrick(uri)
end
attr_reader :uri
def close
@server.shutdown if @server
@server = nil
end
def push(callback)
@queue.push(callback)
end
def accept
client = @queue.pop
ServerSide.new(client, @config)
end
def setup_webrick(uri)
logger = WEBrick::Log::new($stderr, WEBrick::Log::FATAL)
u = URI.parse(uri)
s = WEBrick::HTTPServer.new(:Port => u.port,
:AddressFamily => Socket::AF_INET,
:BindAddress => u.host,
:Logger => logger,
:ServerType => Thread)
s.mount(u.path, Callback, self)
@server = s
s.start
end
end
class ServerSide
def initialize(callback, config)
@callback = callback
@config = config
@msg = DRbMessage.new(@config)
@req_stream = StrStream.new(@callback.req_body)
end
def close
@callback.close if @callback
@callback = nil
end
def alive?; false; end
def recv_request
begin
@msg.recv_request(@req_stream)
rescue
close
raise $!
end
end
def send_reply(succ, result)
begin
return unless @callback
stream = StrStream.new
@msg.send_reply(stream, succ, result)
@callback.reply(stream.buf)
rescue
close
raise $!
end
end
end
end
end
| 20.815126 | 64 | 0.53048 |
0370300b57fa7ac86701153146ce205a855ab6a6
| 1,327 |
require_relative '../test_app/pet'
describe 'Gateway with implicit definitions' do
before(:each) do
Gateway.opts[:app_dir] = 'spec/test_app'
Modulator.register(Pet)
end
it 'POST to Pet.create' do
payload = {id: 1, name: 'Bubi'}
post '/pet/create', payload
expect(status).to eq(200)
expect(response).to eq(payload.stringify_keys)
end
it 'POST to Pet.create for custom 422' do
post '/pet/create', {id: 1, no_name: 'Bubi'}
expect(status).to eq(422)
expect(response).to eq({error: 'Missing name'}.stringify_keys)
end
it 'POST to Pet.update' do
payload = {id: 1, name: 'Cleo'}
post '/pet/1/update', payload
expect(status).to eq(200)
expect(response).to eq(payload.stringify_keys)
end
it 'GET to Pet.list' do
get '/pet/list'
expect(status).to eq(200)
expect(response).to eq(Pet::PETS.stringify_keys)
end
it 'GET to Pet.show' do
get '/pet/1/show'
expect(status).to eq(200)
expect(response).to eq(Pet::PETS[1].stringify_keys)
end
it 'DELETE to Pet.delete' do
delete '/pet/1/delete'
expect(status).to eq(200)
expect(response).to eq({id: 1, name: 'Cleo'}.stringify_keys)
end
it 'DELETE to Pet.delete for 404' do
delete '/pet/1/delete'
expect(status).to eq(404)
expect(response).to eq(nil)
end
end
| 25.037736 | 66 | 0.651093 |
1a8fa8556c1ce9ddffd6c055cf67b9aa3437d67e
| 1,184 |
require File.dirname(__FILE__) + '/../test_helper'
class ControllerExtensionsTest < Test::Unit::TestCase
def setup
@controller = DummyController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@request.session[:opensocial_params] = {
:owner_id => consumer_key,
:viewer_id => consumer_key,
:consumer_key => consumer_key,
:view_type => view_type
}
end
def test_index
OpenSocial::FetchPersonRequest.any_instance.expects(:send).returns(get_person)
get :index
assert_equal OpenSocialGadget::Config.prefs, @controller.opensocial_prefs
assert_equal @request.session[:opensocial_params], @controller.opensocial_params
assert_equal OpenSocialGadget::Config.views[@request.session[:opensocial_params][:view_type]], @controller.opensocial_view
assert_response :success
end
end
class DummyController < ActionController::Base
include OpenSocialGadget::ControllerExtensions
def index
me = opensocial_connection.get_person
render :text => "viewing index"
end
def rescue_action(e)
raise e
end
end
| 30.358974 | 127 | 0.713682 |
6111ec847860c15662cfcf89c1f3bedb75e6e169
| 3,274 |
# frozen_string_literal: true
# require 'data_importable'
class DataImportMeetingTeamScore < ApplicationRecord
include DataImportable
belongs_to :user # [Steve, 20120212] Do not validate associated user!
belongs_to :meeting_team_score, foreign_key: 'conflicting_id', optional: true
belongs_to :data_import_team, optional: true
belongs_to :team, optional: true
belongs_to :team_affiliation, optional: true
belongs_to :data_import_meeting, optional: true
belongs_to :meeting, optional: true
belongs_to :season
validates_associated :season
validates :rank, presence: true
validates :sum_individual_points, presence: true
validates :sum_relay_points, presence: true
validates :sum_team_points, presence: true
validates :meeting_individual_points, presence: true
validates :meeting_relay_points, presence: true
validates :meeting_team_points, presence: true
validates :season_individual_points, presence: true
validates :season_relay_points, presence: true
validates :season_team_points, presence: true
validates :rank, numericality: true
validates :sum_individual_points, numericality: true
validates :sum_relay_points, numericality: true
validates :sum_team_points, numericality: true
validates :meeting_individual_points, numericality: true
validates :meeting_relay_points, numericality: true
validates :meeting_team_points, numericality: true
validates :season_individual_points, numericality: true
validates :season_relay_points, numericality: true
validates :season_team_points, numericality: true
# attr_accessible :data_import_session_id, :import_text, :conflicting_id,
# :user, :user_id,
# :sum_individual_points, :sum_relay_points, :sum_team_points,
# :data_import_team_id, :data_import_meeting_id,
# :team_id, :meeting_id, :season_id, :team_affiliation_id,
# :rank,
# :meeting_individual_points, :meeting_relay_points, :meeting_team_points,
# :season_individual_points, :season_relay_points, :season_team_points,
# ----------------------------------------------------------------------------
# Base methods:
# ----------------------------------------------------------------------------
# Computes a shorter description for the name associated with this data
def get_full_name
"#{get_team_name}: #{total_individual_points} + #{total_relay_points}"
end
# Computes a verbose or formal description for the name associated with this data
def get_verbose_name
"#{get_meeting_name}: #{get_team_name} = #{total_individual_points} + #{total_relay_points}"
end
# Retrieves the user name associated with this instance
def user_name
user ? user.name : ''
end
# ----------------------------------------------------------------------------
# Retrieves the team name
def get_team_name
team ? team.get_full_name : (data_import_team ? data_import_team.get_full_name : '?')
end
# Retrieves the Meeting name
def get_meeting_name
meeting ? meeting.get_full_name : (data_import_meeting ? data_import_meeting.get_full_name : '?')
end
# ----------------------------------------------------------------------------
end
| 38.97619 | 101 | 0.677153 |
2693f9520493047227fa1c369acd4f945cb7e7bb
| 1,405 |
module Zuora::Objects
class Account < Base
has_many :contacts
has_many :payment_methods
has_many :subscriptions
has_many :invoices
belongs_to :bill_to, :class_name => 'Contact'
belongs_to :sold_to, :class_name => 'Contact'
validates_presence_of :account_number, :name, :status, :payment_term, :batch, :currency
validates_length_of :name, :maximum => 50
validates_length_of :purchase_order_number, :maximum => 100, :allow_nil => true
validates_inclusion_of :payment_term, :in => ['Due Upon Receipt','Net 30','Net 45','Net 90']
validates_inclusion_of :batch, :in => (1..20).map{|n| "Batch#{n}" }
validates_inclusion_of :bcd_setting_option, :in => ['AutoSet','ManualSet'], :allow_nil => true
validates_inclusion_of :bill_cycle_day, :in => (1..31).to_a + (1..31).map(&:to_s)
validates_inclusion_of :status, :in => ['Draft','Active','Canceled'], :allow_nil => true
define_attributes do
read_only :balance, :created_date, :credit_balance, :last_invoice_date,
:parent_id, :total_invoice_balance, :updated_date,
:created_by_id, :last_invoice_date, :updated_by_id
defaults :auto_pay => false,
:currency => 'USD',
:batch => 'Batch1',
:bill_cycle_day => 1,
:status => 'Draft',
:payment_term => 'Due Upon Receipt'
end
end
end
| 41.323529 | 98 | 0.644128 |
f8450ae4d1d00ac31f1c0b16271cb75ba8845f20
| 1,567 |
# frozen_string_literal: true
require_relative 'lib/deepl_srt/version'
Gem::Specification.new do |spec|
spec.name = 'deepl-srt'
spec.version = DeeplSrt::VERSION
spec.authors = ['Łukasz Fuszara']
spec.email = ['[email protected]']
spec.summary = 'Subtitles translator with DeepL engine'
spec.description = 'deepl_srt [api_key] [target_lang] [input_path] [result_path] [from_line]'
spec.homepage = 'https://github.com/lfuszara1/srt-deepl'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/lfuszara1/srt-deepl'
spec.metadata['changelog_uri'] = 'https://github.com/lfuszara1/srt-deepl/blob/main/CHANGELOG.md'
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"
# For more information and examples about making a new gem, checkout our
# guide at: https://bundler.io/guides/creating_gem.html
end
| 41.236842 | 98 | 0.685386 |
ac4b10555581c18d144c19aac7fb5d51df007e87
| 2,660 |
#!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2017, Google Inc. All Rights Reserved.
#
# License:: 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.
#
# This example gets the Marketplace comments for a programmatic proposal.
require 'ad_manager_api'
def get_marketplace_comments(ad_manager, proposal_id)
# Get the ProposalService.
proposal_service = ad_manager.service(:ProposalService, API_VERSION)
# Create a statement to select marketplace comments.
statement = ad_manager.new_statement_builder do |sb|
sb.where = 'proposalId = :proposal_id'
sb.with_bind_variable('proposal_id', proposal_id)
end
# Retrieve comments.
page = proposal_service.get_marketplace_comments_by_statement(
statement.to_statement()
)
# Print out some information for each comment.
unless page[:results].nil?
page[:results].each_with_index do |comment, index|
puts ('%d) Comment Marketplace comment with creation time "%s" and ' +
'comment "%s" was found.') % [index + statement.offset,
comment[:proposal_id], comment[:creation_time], comment[:comment]]
end
end
puts 'Total number of comments: %d' % (page[:total_result_set_size] || 0)
end
if __FILE__ == $0
API_VERSION = :v201802
# Get AdManagerApi instance and load configuration from ~/ad_manager_api.yml.
ad_manager = AdManagerApi::Api.new
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
# the configuration file or provide your own logger:
# ad_manager.logger = Logger.new('ad_manager_xml.log')
begin
proposal_id = 'INSERT_PROPOSAL_ID_HERE'.to_i
get_marketplace_comments(ad_manager, proposal_id)
# HTTP errors.
rescue AdsCommon::Errors::HttpError => e
puts "HTTP Error: %s" % e
# API errors.
rescue AdManagerApi::Errors::ApiException => e
puts "Message: %s" % e.message
puts 'Errors:'
e.errors.each_with_index do |error, index|
puts "\tError [%d]:" % (index + 1)
error.each do |field, value|
puts "\t\t%s: %s" % [field, value]
end
end
end
end
| 33.670886 | 79 | 0.692105 |
1c9cba91c9912409c191318459f3af48e2ffccdc
| 898 |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'css_lint/version'
Gem::Specification.new do |spec|
spec.name = 'css_lint'
spec.version = CssLint::VERSION
spec.authors = ['Jacob Bednarz']
spec.email = ['[email protected]']
spec.summary = %q{CSS linter for the modern day developer}
spec.description = %q{CSS linter for the modern day developer}
spec.homepage = 'http://github.com/jacobbednarz/css-lint'
spec.license = 'MIT'
spec.files = `git ls-files -z`.split('\x0')
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'rake'
end
| 37.416667 | 74 | 0.654788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.