code
stringlengths 26
124k
| docstring
stringlengths 23
125k
| func_name
stringlengths 1
98
| language
stringclasses 1
value | repo
stringlengths 5
53
| path
stringlengths 7
151
| url
stringlengths 50
211
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
def put(key, value, options = {})
key = normalize_key_for_uri(key)
@options = options
custom_params = []
custom_params << use_cas(@options)
custom_params << dc(@options)
custom_params << acquire(@options)
@raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, value, custom_params,
'application/x-www-form-urlencoded')
if @raw.body.chomp == 'true'
@key = key
@value = value
end
@raw.body.chomp == 'true'
end
|
rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength, Layout/LineLength, Metrics/CyclomaticComplexity
Associate a value with a key
@param key [String] the key
@param value [String] the value
@param options [Hash] the query params
@option options [Integer] :cas The modify index
@option options [String] :dc Target datacenter
@option options [String] :acquire Session to attach to key
@return [Bool] Success or failure of the write (can fail in c-a-s mode)
|
put
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/kv.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/kv.rb
|
BSD-3-Clause
|
def delete(key, options = {})
key = normalize_key_for_uri(key)
@key = key
@options = options
custom_params = []
custom_params << recurse_get(@options)
custom_params << dc(@options)
@raw = send_delete_request(@conn, ["/v1/kv/#{@key}"], options, custom_params)
end
|
Delete a value by its key
@param key [String] the key
@param options [Hash] the query params
@option options [String] :dc Target datacenter
@option options [Boolean] :recurse If to make recursive get or not
@return [OpenStruct]
|
delete
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/kv.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/kv.rb
|
BSD-3-Clause
|
def txn(value, options = {})
# Verify the given value for the transaction
transaction_verification(value)
# Will return 409 if transaction was rolled back
custom_params = []
custom_params << dc(options)
custom_params << transaction_consistency(options)
raw = send_put_request(@conn_no_err, ['/v1/txn'], options, value, custom_params)
transaction_return JSON.parse(raw.body), options
end
|
Perform a key/value store transaction.
@since 1.3.0
@see https://www.consul.io/docs/agent/http/kv.html#txn Transaction key/value store API documentation
@example Valid key/value store transaction format
[
{
'KV' => {
'Verb' => 'get',
'Key' => 'hello/world'
}
}
]
@raise [Diplomat::InvalidTransaction] if transaction format is invalid
@param value [Array] an array of transaction hashes
@param [Hash] options transaction params
@option options [Boolean] :decode_values of any GET requests, default: true
@option options [String] :dc Target datacenter
@option options [String] :consistency the accepted staleness level of the transaction.
Can be 'stale' or 'consistent'
@return [OpenStruct] result of the transaction
|
txn
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/kv.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/kv.rb
|
BSD-3-Clause
|
def acquire(key, session, value = nil, options = {})
key = normalize_key_for_uri(key)
custom_params = []
custom_params << use_named_parameter('acquire', session)
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
custom_params << use_named_parameter('flags', options[:flags]) if options && options[:flags]
data = value unless value.nil?
raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, data, custom_params)
raw.body.chomp == 'true'
end
|
Acquire a lock
@param key [String] the key
@param session [String] the session, generated from Diplomat::Session.create
@param value [String] the value for the key
@param options [Hash] options parameter hash
@return [Boolean] If the lock was acquired
|
acquire
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/lock.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/lock.rb
|
BSD-3-Clause
|
def wait_to_acquire(key, session, value = nil, check_interval = 10, options = {})
acquired = false
until acquired
acquired = acquire(key, session, value, options)
sleep(check_interval) unless acquired
return true if acquired
end
end
|
wait to aquire a lock
@param key [String] the key
@param session [String] the session, generated from Diplomat::Session.create
@param value [String] the value for the key
@param check_interval [Integer] number of seconds to wait between retries
@param options [Hash] options parameter hash
@return [Boolean] If the lock was acquired
|
wait_to_acquire
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/lock.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/lock.rb
|
BSD-3-Clause
|
def release(key, session, options = {})
key = normalize_key_for_uri(key)
custom_params = []
custom_params << use_named_parameter('release', session)
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
custom_params << use_named_parameter('flags', options[:flags]) if options && options[:flags]
raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, nil, custom_params)
raw.body
end
|
Release a lock
@param key [String] the key
@param session [String] the session, generated from Diplomat::Session.create
@param options [Hash] :dc string for dc specific query
@return [nil]
rubocop:disable Metrics/AbcSize
|
release
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/lock.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/lock.rb
|
BSD-3-Clause
|
def enabled(n, options = {})
health = Diplomat::Health.new(@conn)
result = health.node(n, options)
.select { |check| check['CheckID'] == '_node_maintenance' }
if result.empty?
{ enabled: false, reason: nil }
else
{ enabled: true, reason: result.first['Notes'] }
end
end
|
Get the maintenance state of a host
@param n [String] the node
@param options [Hash] :dc string for dc specific query
@return [Hash] { :enabled => true, :reason => 'foo' }
|
enabled
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/maintenance.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/maintenance.rb
|
BSD-3-Clause
|
def enable(enable = true, reason = nil, options = {})
custom_params = []
custom_params << use_named_parameter('enable', enable.to_s)
custom_params << use_named_parameter('reason', reason) if reason
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_put_request(@conn, ['/v1/agent/maintenance'], options, nil, custom_params)
return_status = raw.status == 200
raise Diplomat::UnknownStatus, "status #{raw.status}: #{raw.body}" unless return_status
return_status
end
|
Enable or disable maintenance mode. This endpoint only works
on the local agent.
@param enable enable or disable maintenance mode
@param reason [String] the reason for enabling maintenance mode
@param options [Hash] :dc string for dc specific query
@return true if call is successful
|
enable
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/maintenance.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/maintenance.rb
|
BSD-3-Clause
|
def get(options = {})
ret = send_get_request(@conn, ['/v1/agent/members'], options)
JSON.parse(ret.body)
end
|
Get all members
@param options [Hash] options parameter hash
@return [OpenStruct] all data associated with the service
|
get
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/members.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/members.rb
|
BSD-3-Clause
|
def get(key, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ["/v1/catalog/node/#{key}"], options, custom_params)
OpenStruct.new JSON.parse(ret.body)
end
|
Get a node by it's key
@param key [String] the key
@param options [Hash] :dc string for dc specific query
@return [OpenStruct] all data associated with the node
|
get
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/node.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/node.rb
|
BSD-3-Clause
|
def get_all(options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ['/v1/catalog/nodes'], options, custom_params)
JSON.parse(ret.body).map { |service| OpenStruct.new service }
end
|
Get all the nodes
@param options [Hash] :dc string for dc specific query
@return [OpenStruct] the list of all nodes
|
get_all
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/node.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/node.rb
|
BSD-3-Clause
|
def register(definition, options = {})
register = send_put_request(@conn, ['/v1/catalog/register'], options, definition)
register.status == 200
end
|
Register a node
@param definition [Hash] Hash containing definition of a node to register
@param options [Hash] options parameter hash
@return [Boolean]
|
register
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/node.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/node.rb
|
BSD-3-Clause
|
def deregister(definition, options = {})
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
deregister.status == 200
end
|
De-register a node (and all associated services and checks)
@param definition [Hash] Hash containing definition of a node to de-register
@param options [Hash] options parameter hash
@return [Boolean]
|
deregister
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/node.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/node.rb
|
BSD-3-Clause
|
def get(options = {})
ret = send_get_request(@conn, ['/v1/catalog/nodes'], options)
JSON.parse(ret.body)
end
|
Get all nodes
@deprecated Please use Diplomat::Node instead.
@param options [Hash] options parameter hash
@return [OpenStruct] all data associated with the nodes in catalog
|
get
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/nodes.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/nodes.rb
|
BSD-3-Clause
|
def read(id, options = {}, not_found = :reject, found = :return)
@options = options
custom_params = []
custom_params << use_consistency(options)
@raw = send_get_request(@conn_no_err, ["/v1/acl/policy/#{id}"], options, custom_params)
if @raw.status == 200 && @raw.body.chomp != 'null'
case found
when :reject
raise Diplomat::PolicyNotFound, id
when :return
return parse_body
end
elsif @raw.status == 404
case not_found
when :reject
raise Diplomat::PolicyNotFound, id
when :return
return nil
end
elsif @raw.status == 403
case not_found
when :reject
raise Diplomat::AclNotFound, id
when :return
return nil
end
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Read ACL policy with the given UUID
@param id [String] UUID of the ACL policy to read
@param options [Hash] options parameter hash
@return [Hash] existing ACL policy
rubocop:disable Metrics/PerceivedComplexity
|
read
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/policy.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/policy.rb
|
BSD-3-Clause
|
def list(options = {})
@raw = send_get_request(@conn_no_err, ['/v1/acl/policies'], options)
raise Diplomat::AclNotFound if @raw.status == 403
parse_body
end
|
rubocop:enable Metrics/PerceivedComplexity
List all the ACL policies
@param options [Hash] options parameter hash
@return [List] list of [Hash] of ACL policies
|
list
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/policy.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/policy.rb
|
BSD-3-Clause
|
def update(value, options = {})
id = value[:ID] || value['ID']
raise Diplomat::IdParameterRequired if id.nil?
policy_name = value[:Name] || value['Name']
raise Diplomat::NameParameterRequired if policy_name.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ["/v1/acl/policy/#{id}"], options, value, custom_params)
if @raw.status == 200
parse_body
elsif @raw.status == 400
raise Diplomat::PolicyMalformed, @raw.body
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Update an existing ACL policy
@param value [Hash] ACL policy definition, ID and Name fields are mandatory
@param options [Hash] options parameter hash
@return [Hash] result ACL policy
|
update
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/policy.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/policy.rb
|
BSD-3-Clause
|
def create(value, options = {})
blacklist = ['ID', 'iD', 'Id', :ID, :iD, :Id] & value.keys
raise Diplomat::PolicyMalformed, 'ID should not be specified' unless blacklist.empty?
id = value[:Name] || value['Name']
raise Diplomat::NameParameterRequired if id.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ['/v1/acl/policy'], options, value, custom_params)
# rubocop:disable Style/GuardClause
if @raw.status == 200
return parse_body
elsif @raw.status == 500 && @raw.body.chomp.include?('already exists')
raise Diplomat::PolicyAlreadyExists, @raw.body
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Create a new ACL policy
@param value [Hash] ACL policy definition, Name field is mandatory
@param options [Hash] options parameter hash
@return [Hash] new ACL policy
|
create
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/policy.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/policy.rb
|
BSD-3-Clause
|
def delete(id, options = {})
@raw = send_delete_request(@conn, ["/v1/acl/policy/#{id}"], options, nil)
@raw.body.chomp == 'true'
end
|
rubocop:enable Style/GuardClause
Delete an ACL policy by its UUID
@param id [String] UUID of the ACL policy to delete
@param options [Hash] options parameter hash
@return [Bool]
|
delete
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/policy.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/policy.rb
|
BSD-3-Clause
|
def get(key, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ["/v1/query/#{key}"], options, custom_params)
JSON.parse(ret.body).map { |query| OpenStruct.new query }
end
|
Get a prepared query by it's key
@param key [String] the prepared query ID
@param options [Hash] :dc string for dc specific query
@return [OpenStruct] all data associated with the prepared query
|
get
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def get_all(options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ['/v1/query'], options, custom_params)
JSON.parse(ret.body).map { |query| OpenStruct.new query }
end
|
Get all prepared queries
@param options [Hash] :dc Consul datacenter to query
@return [OpenStruct] the list of all prepared queries
|
get_all
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def create(definition, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
@raw = send_post_request(@conn, ['/v1/query'], options, definition, custom_params)
parse_body
rescue Faraday::ClientError
raise Diplomat::QueryAlreadyExists
end
|
Create a prepared query or prepared query template
@param definition [Hash] Hash containing definition of prepared query
@param options [Hash] :dc Consul datacenter to query
@return [String] the ID of the prepared query created
|
create
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def delete(key, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_delete_request(@conn, ["/v1/query/#{key}"], options, custom_params)
ret.status == 200
end
|
Delete a prepared query or prepared query template
@param key [String] the prepared query ID
@param options [Hash] :dc Consul datacenter to query
@return [Boolean]
|
delete
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def update(key, definition, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_put_request(@conn, ["/v1/query/#{key}"], options, definition, custom_params)
ret.status == 200
end
|
Update a prepared query or prepared query template
@param key [String] the prepared query ID
@param definition [Hash] Hash containing updated definition of prepared query
@param options [Hash] :dc Consul datacenter to query
@return [Boolean]
|
update
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def explain(key, options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ["/v1/query/#{key}/explain"], options, custom_params)
OpenStruct.new JSON.parse(ret.body)
end
|
rubocop:enable Metrics/PerceivedComplexity
Get the fully rendered query template
@param key [String] the prepared query ID or name
@param options [Hash] :dc Consul datacenter to query
@return [OpenStruct] the list of results from the prepared query or prepared query template
|
explain
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/query.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/query.rb
|
BSD-3-Clause
|
def get_configuration(options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
ret = send_get_request(@conn, ['/v1/operator/raft/configuration'], options, custom_params)
JSON.parse(ret.body)
end
|
Get raft configuration
@param options [Hash] options parameter hash
@return [OpenStruct] all data associated with the raft configuration
|
get_configuration
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/raft.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/raft.rb
|
BSD-3-Clause
|
def transfer_leader(options = {})
custom_params = options[:id] ? use_named_parameter('id', options[:id]) : nil
@raw = send_post_request(@conn, ['/v1/operator/raft/transfer-leader'], options, nil, custom_params)
JSON.parse(@raw.body)
end
|
Transfer raft leadership
@param options [Hash] options parameter hash
@return [OpenStruct] all data associated with the transfer status
with format {"Success": ["true"|"false"]}
|
transfer_leader
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/raft.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/raft.rb
|
BSD-3-Clause
|
def initialize(api_connection = nil, configuration: nil)
@configuration = configuration
start_connection api_connection
end
|
Initialize the fadaray connection
@param api_connection [Faraday::Connection,nil] supply mock API Connection
@param configuration [Diplomat::Configuration] a dedicated config to use
|
initialize
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def configuration
@configuration || ::Diplomat.configuration
end
|
Get client configuration or global one if not specified via initialize.
@return [Diplomat::Configuration] used by this client
|
configuration
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def use_named_parameter(name, value)
value ? ["#{name}=#{value}"] : []
end
|
Format url parameters into strings correctly
@param name [String] the name of the parameter
@param value [String] the value of the parameter
@return [Array] the resultant parameter string inside an array.
|
use_named_parameter
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def concat_url(parts)
parts.reject!(&:empty?)
if parts.length > 1
parts.first + '?' + parts.drop(1).join('&')
else
parts.first
end
end
|
Assemble a url from an array of parts.
@param parts [Array] the url chunks to be assembled
@return [String] the resultant url string
|
concat_url
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def method_missing(meth_id, *args)
if access_method?(meth_id)
new.send(meth_id, *args)
else
# See https://bugs.ruby-lang.org/issues/10969
begin
super
rescue NameError => e
raise NoMethodError, e
end
end
end
|
Allow certain methods to be accessed
without defining "new".
@param meth_id [Symbol] symbol defining method requested
@param *args Arguments list
@return [Boolean]
|
method_missing
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def respond_to?(meth_id, with_private = false)
access_method?(meth_id) || super
end
|
Make `respond_to?` aware of method short-cuts.
@param meth_id [Symbol] the tested method
@oaram with_private if private methods should be tested too
|
respond_to?
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def respond_to_missing?(meth_id, with_private = false)
access_method?(meth_id) || super
end
|
Make `respond_to_missing` aware of method short-cuts. This is needed for
{#method} to work on these, which is helpful for testing purposes.
@param meth_id [Symbol] the tested method
@oaram with_private if private methods should be tested too
|
respond_to_missing?
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def normalize_key_for_uri(key)
# The Consul docs suggest using slashes to organise keys
# (https://www.consul.io/docs/agent/kv.html#using-consul-kv).
#
# However, Consul (like many servers) does strange things with slashes,
# presumably to "paper over" users' errors in typing URLs.
# E.g. the key "/my/path" will end up in the URI path component
# "/v1/kv//my/path", which Consul will redirect (HTTP 301) to
# "/v1/kv/my/path" -- a very different URI!
#
# One solution might be to simply always URI-encode slashes
# (and all other non-URI-safe characters), but that appears to
# result in some other weirdness, e.g., keys being returned with
# URI-encoding in them in contexts totally unrelated to URIs.
# For examples, see these issues and follow the links:
#
# - https://github.com/hashicorp/consul/issues/889
# - https://github.com/hashicorp/consul/issues/1277
#
# For now it seems safest to simply assume that leading literal
# slashes on keys are benign mistakes, and strip them off.
# Hopefully the expected behaviour will be formalised/clarified
# in future versions of Consul, and we can introduce some stricter
# and more predictable handling of keys on this side.
if key.start_with? '/'
key[1..-1]
else
key.freeze
end
end
|
Turn the given key into something that the Consul API
will consider its canonical form. If we don't do this,
then the Consul API will return a HTTP 301 response directing
us to the same action with a canonicalized key, and we'd
have to waste time following that redirect.
|
normalize_key_for_uri
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def start_connection(api_connection = nil)
@conn = build_connection(api_connection)
@conn_no_err = build_connection(api_connection, true)
end
|
Build the API Client
@param api_connection [Faraday::Connection,nil] supply mock API Connection
|
start_connection
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def parse_body
return JSON.parse(@raw.body) if @raw.status == 200
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
|
Parse the body, apply it to the raw attribute
|
parse_body
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def decode_values
return @raw if @raw.first.is_a? String
@raw.each_with_object([]) do |acc, el|
begin
acc['Value'] = Base64.decode64(acc['Value'])
rescue StandardError
nil
end
el << acc
el
end
end
|
Return @raw with Value fields decoded
|
decode_values
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def return_value(nil_values = false, transformation = nil, return_hash = false)
@value = decode_values
return @value if @value.first.is_a? String
if @value.count == 1 && !return_hash
@value = @value.first['Value']
@value = transformation.call(@value) if transformation && [email protected]?
return @value
else
@value = @value.map do |el|
el['Value'] = transformation.call(el['Value']) if transformation && !el['Value'].nil?
{ key: el['Key'], value: el['Value'] } if el['Value'] || nil_values
end.compact
end
end
|
Get the key/value(s) from the raw output
rubocop:disable Metrics/PerceivedComplexity
|
return_value
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def return_payload
@value = @raw.map do |e|
{ name: e['Name'],
payload: (Base64.decode64(e['Payload']) unless e['Payload'].nil?) }
end
end
|
rubocop:enable Metrics/PerceivedComplexity
Get the name and payload(s) from the raw output
|
return_payload
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def parse_options(options)
headers = nil
query_params = []
url_prefix = nil
consistency = []
# Parse options used as header
headers = { 'X-Consul-Token' => configuration.acl_token } if configuration.acl_token
headers = { 'X-Consul-Token' => options[:token] } if options[:token]
# Parse consistency options used as query params
consistency = 'stale' if options[:stale]
consistency = 'leader' if options[:leader]
consistency = 'consistent' if options[:consistent]
query_params << consistency
query_params << 'cached' if options[:cached]
# Parse url host
url_prefix = options[:http_addr] if options[:http_addr]
{ query_params: query_params, headers: headers, url_prefix: url_prefix }
end
|
rubocop:disable Metrics/PerceivedComplexity
TODO: Migrate all custom params in options
|
parse_options
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def valid_transaction_verbs
{
'set' => %w[Key Value],
'cas' => %w[Key Value Index],
'lock' => %w[Key Value Session],
'unlock' => %w[Key Value Session],
'get' => %w[Key],
'get-tree' => %w[Key],
'check-index' => %w[Key Index],
'check-session' => %w[Key Session],
'delete' => %w[Key],
'delete-tree' => %w[Key],
'delete-cas' => %w[Key Index]
}
end
|
Mapping for valid key/value store transaction verbs and required parameters
@return [Hash] valid key/store transaction verbs and required parameters
|
valid_transaction_verbs
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def valid_value_transactions
@valid_value_transactions ||= valid_transaction_verbs.select do |verb, requires|
verb if requires.include? 'Value'
end
end
|
Key/value store transactions that require that a value be set
@return [Array<String>] verbs that require a value be set
|
valid_value_transactions
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/rest_client.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb
|
BSD-3-Clause
|
def read(id, options = {}, not_found = :reject, found = :return)
@options = options
custom_params = []
custom_params << use_consistency(options)
@raw = send_get_request(@conn_no_err, ["/v1/acl/role/#{id}"], options, custom_params)
if @raw.status == 200 && @raw.body.chomp != 'null'
case found
when :reject
raise Diplomat::RoleNotFound, id
when :return
return parse_body
end
elsif @raw.status == 404
case not_found
when :reject
raise Diplomat::RoleNotFound, id
when :return
return nil
end
elsif @raw.status == 403
case not_found
when :reject
raise Diplomat::AclNotFound, id
when :return
return nil
end
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Read ACL role with the given UUID
@param id [String] UUID or name of the ACL role to read
@param options [Hash] options parameter hash
@return [Hash] existing ACL role
rubocop:disable Metrics/PerceivedComplexity
|
read
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def read_name(name, options = {}, not_found = :reject, found = :return)
@options = options
custom_params = []
custom_params << use_consistency(options)
@raw = send_get_request(@conn_no_err, ["/v1/acl/role/name/#{name}"], options, custom_params)
if @raw.status == 200 && @raw.body.chomp != 'null'
case found
when :reject
raise Diplomat::RoleNotFound, name
when :return
return parse_body
end
elsif @raw.status == 404
case not_found
when :reject
raise Diplomat::RoleNotFound, name
when :return
return nil
end
elsif @raw.status == 403
case not_found
when :reject
raise Diplomat::AclNotFound, name
when :return
return nil
end
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
rubocop:enable Metrics/PerceivedComplexity
Read ACL role with the given name
@param name [String] name of the ACL role to read
@param options [Hash] options parameter hash
@return [Hash] existing ACL role
rubocop:disable Metrics/PerceivedComplexity
|
read_name
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def list(options = {})
@raw = send_get_request(@conn_no_err, ['/v1/acl/roles'], options)
raise Diplomat::AclNotFound if @raw.status == 403
parse_body
end
|
rubocop:enable Metrics/PerceivedComplexity
List all the ACL roles
@param options [Hash] options parameter hash
@return [List] list of [Hash] of ACL roles
|
list
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def update(value, options = {})
id = value[:ID] || value['ID']
raise Diplomat::IdParameterRequired if id.nil?
role_name = value[:Name] || value['Name']
raise Diplomat::NameParameterRequired if role_name.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ["/v1/acl/role/#{id}"], options, value, custom_params)
if @raw.status == 200
parse_body
elsif @raw.status == 400
raise Diplomat::RoleMalformed, @raw.body
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Update an existing ACL role
@param value [Hash] ACL role definition, ID and Name fields are mandatory
@param options [Hash] options parameter hash
@return [Hash] result ACL role
|
update
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def create(value, options = {})
blacklist = ['ID', 'iD', 'Id', :ID, :iD, :Id] & value.keys
raise Diplomat::RoleMalformed, 'ID should not be specified' unless blacklist.empty?
id = value[:Name] || value['Name']
raise Diplomat::NameParameterRequired if id.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ['/v1/acl/role'], options, value, custom_params)
# rubocop:disable Style/GuardClause
if @raw.status == 200
return parse_body
elsif @raw.status == 500 && @raw.body.chomp.include?('already exists')
raise Diplomat::RoleAlreadyExists, @raw.body
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Create a new ACL role
@param value [Hash] ACL role definition, Name field is mandatory
@param options [Hash] options parameter hash
@return [Hash] new ACL role
|
create
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def delete(id, options = {})
@raw = send_delete_request(@conn, ["/v1/acl/role/#{id}"], options, nil)
@raw.body.chomp == 'true'
end
|
rubocop:enable Style/GuardClause
Delete an ACL role by its UUID
@param id [String] UUID of the ACL role to delete
@param options [Hash] options parameter hash
@return [Bool]
|
delete
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/role.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/role.rb
|
BSD-3-Clause
|
def get(key, scope = :first, options = {}, meta = nil)
custom_params = []
custom_params << use_named_parameter('wait', options[:wait]) if options[:wait]
custom_params << use_named_parameter('index', options[:index]) if options[:index]
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
custom_params << use_named_parameter('filter', options[:filter]) if options[:filter]
custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
ret = send_get_request(@conn, ["/v1/catalog/service/#{key}"], options, custom_params)
if meta && ret.headers
meta[:index] = ret.headers['x-consul-index'] if ret.headers['x-consul-index']
meta[:knownleader] = ret.headers['x-consul-knownleader'] if ret.headers['x-consul-knownleader']
meta[:lastcontact] = ret.headers['x-consul-lastcontact'] if ret.headers['x-consul-lastcontact']
end
if scope == :all
JSON.parse(ret.body).map { |service| OpenStruct.new service }
else
OpenStruct.new JSON.parse(ret.body).first
end
end
|
Get a service by it's key
@param key [String] the key
@param scope [Symbol] :first or :all results
@param options [Hash] options parameter hash
@param meta [Hash] output structure containing header information about the request (index)
@return [OpenStruct] all data associated with the service
rubocop:disable Metrics/PerceivedComplexity
|
get
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def get_all(options = {})
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
ret = send_get_request(@conn, ['/v1/catalog/services'], options, custom_params)
OpenStruct.new JSON.parse(ret.body)
end
|
rubocop:enable Metrics/PerceivedComplexity
Get all the services
@param options [Hash] :dc Consul datacenter to query
@return [OpenStruct] the list of all services
|
get_all
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def register(definition, options = {})
url = options[:path] || ['/v1/agent/service/register']
register = send_put_request(@conn, url, options, definition)
register.status == 200
end
|
Register a service
@param definition [Hash] Hash containing definition of service
@param options [Hash] options parameter hash
@return [Boolean]
|
register
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def deregister(service_name, options = {})
deregister = send_put_request(@conn, ["/v1/agent/service/deregister/#{service_name}"], options, nil)
deregister.status == 200
end
|
De-register a service
@param service_name [String] Service name to de-register
@param options [Hash] options parameter hash
@return [Boolean]
|
deregister
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def register_external(definition, options = {})
register = send_put_request(@conn, ['/v1/catalog/register'], options, definition)
register.status == 200
end
|
Register an external service
@param definition [Hash] Hash containing definition of service
@param options [Hash] options parameter hash
@return [Boolean]
|
register_external
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def deregister_external(definition, options = {})
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
deregister.status == 200
end
|
Deregister an external service
@param definition [Hash] Hash containing definition of service
@param options [Hash] options parameter hash
@return [Boolean]
|
deregister_external
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def maintenance(service_id, options = { enable: true })
custom_params = []
custom_params << ["enable=#{options[:enable]}"]
custom_params << ["reason=#{options[:reason].split(' ').join('+')}"] if options[:reason]
maintenance = send_put_request(@conn, ["/v1/agent/service/maintenance/#{service_id}"],
options, nil, custom_params)
maintenance.status == 200
end
|
Enable or disable maintenance for a service
@param service_id [String] id of the service
@param options [Hash] opts the options for enabling or disabling maintenance for a service
@options opts [Boolean] :enable (true) whether to enable or disable maintenance
@options opts [String] :reason reason for the service maintenance
@raise [Diplomat::PathNotFound] if the request fails
@return [Boolean] if the request was successful or not
|
maintenance
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/service.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/service.rb
|
BSD-3-Clause
|
def create(value = nil, options = {})
# TODO: only certain keys are recognised in a session create request,
# should raise an error on others.
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
data = value.is_a?(String) ? value : JSON.generate(value) unless value.nil?
raw = send_put_request(@conn, ['/v1/session/create'], options, data, custom_params)
body = JSON.parse(raw.body)
body['ID']
end
|
Create a new session
@param value [Object] hash or json representation of the session arguments
@param options [Hash] session options
@return [String] The sesssion id
|
create
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def destroy(id, options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_put_request(@conn, ["/v1/session/destroy/#{id}"], options, nil, custom_params)
raw.body
end
|
Destroy a session
@param id [String] session id
@param options [Hash] session options
@return [String] Success or failure of the session destruction
|
destroy
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def list(options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_get_request(@conn, ['/v1/session/list'], options, custom_params)
JSON.parse(raw.body).map { |session| OpenStruct.new session }
end
|
List sessions
@param options [Hash] session options
@return [OpenStruct]
|
list
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def renew(id, options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_put_request(@conn, ["/v1/session/renew/#{id}"], options, nil, custom_params)
JSON.parse(raw.body).map { |session| OpenStruct.new session }
end
|
Renew session
@param id [String] session id
@param options [Hash] session options
@return [OpenStruct]
|
renew
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def info(id, options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_get_request(@conn, ["/v1/session/info/#{id}"], options, custom_params)
JSON.parse(raw.body).map { |session| OpenStruct.new session }
end
|
Session information
@param id [String] session id
@param options [Hash] session options
@return [OpenStruct]
|
info
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def node(name, options = {})
custom_params = []
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
raw = send_get_request(@conn, ["/v1/session/node/#{name}"], options, custom_params)
JSON.parse(raw.body).map { |session| OpenStruct.new session }
end
|
Session information for a given node
@param name [String] node name
@param options [Hash] session options
@return [OpenStruct]
|
node
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/session.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/session.rb
|
BSD-3-Clause
|
def leader(options = {})
ret = send_get_request(@conn, ['/v1/status/leader'], options)
JSON.parse(ret.body)
end
|
Get the raft leader for the datacenter in which the local consul agent is running
@param options [Hash] options parameter hash
@return [OpenStruct] the address of the leader
|
leader
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/status.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/status.rb
|
BSD-3-Clause
|
def peers(options = {})
ret = send_get_request(@conn, ['/v1/status/peers'], options)
JSON.parse(ret.body)
end
|
Get an array of Raft peers for the datacenter in which the agent is running
@param options [Hash] options parameter hash
@return [OpenStruct] an array of peers
|
peers
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/status.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/status.rb
|
BSD-3-Clause
|
def read(id, options = {}, not_found = :reject, found = :return)
@options = options
custom_params = []
custom_params << use_consistency(options)
@raw = send_get_request(@conn_no_err, ["/v1/acl/token/#{id}"], options, custom_params)
if @raw.status == 200 && @raw.body.chomp != 'null'
case found
when :reject
raise Diplomat::AclNotFound, id
when :return
return parse_body
end
elsif @raw.status == 403
case not_found
when :reject
raise Diplomat::AclNotFound, id
when :return
return nil
end
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Read ACL token with the given Accessor ID
@param id [String] accessor ID of the ACL token to read
@param options [Hash] options parameter hash
@return [Hash] existing ACL token
rubocop:disable Metrics/PerceivedComplexity
|
read
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def list(policy = nil, role = nil, authmethod = nil, options = {})
custom_params = []
custom_params << use_named_parameter('policy', policy) if policy
custom_params << use_named_parameter('role', policy) if role
custom_params << use_named_parameter('authmethod', policy) if authmethod
@raw = send_get_request(@conn_no_err, ['/v1/acl/tokens'], options, custom_params)
raise Diplomat::AclNotFound if @raw.status == 403
parse_body
end
|
rubocop:enable Metrics/PerceivedComplexity
List all the ACL tokens
@param policy [String] filters the token list matching the specific policy ID
@param role [String] filters the token list matching the specific role ID
@param authmethod [String] the token list matching the specific named auth method
@param options [Hash] options parameter hash
@return [List] list of [Hash] of ACL tokens
|
list
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def update(value, options = {})
id = value[:AccessorID] || value['AccessorID']
raise Diplomat::AccessorIdParameterRequired if id.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ["/v1/acl/token/#{id}"], options, value, custom_params)
if @raw.status == 200
parse_body
elsif @raw.status == 403
raise Diplomat::AclNotFound, id
elsif @raw.status == 400
raise Diplomat::TokenMalformed, @raw.body
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Update an existing ACL token
@param value [Hash] ACL token definition, AccessorID is mandatory
@param options [Hash] options parameter hash
@return [Hash] result ACL token
|
update
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def create(value, options = {})
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ['/v1/acl/token'], options, value, custom_params)
return parse_body if @raw.status == 200
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
|
Create a new ACL token
@param value [Hash] ACL token definition
@param options [Hash] options parameter hash
@return [Hash] new ACL token
|
create
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def delete(id, options = {})
anonymous_token = '00000000-0000-0000-0000-000000000002'
raise Diplomat::NotPermitted, "status #{@raw.status}: #{@raw.body}" if id == anonymous_token
@raw = send_delete_request(@conn, ["/v1/acl/token/#{id}"], options, nil)
@raw.body.chomp == 'true'
end
|
Delete an existing ACL token
@param id [String] UUID of the ACL token to delete
@param options [Hash] options parameter hash
@return [Bool]
|
delete
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def clone(value, options = {})
id = value[:AccessorID] || value['AccessorID']
raise Diplomat::AccessorIdParameterRequired if id.nil?
custom_params = use_cas(@options)
@raw = send_put_request(@conn, ["/v1/acl/token/#{id}/clone"], options, value, custom_params)
if @raw.status == 200
parse_body
elsif @raw.status == 403
raise Diplomat::AclNotFound, id
else
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
end
end
|
Clone an existing ACL token
@param value [Hash] ACL token definition, AccessorID is mandatory
@param options [Hash] options parameter hash
@return [Hash] cloned ACL token
|
clone
|
ruby
|
WeAreFarmGeek/diplomat
|
lib/diplomat/token.rb
|
https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/token.rb
|
BSD-3-Clause
|
def install
# Work around "error: no member named 'signbit' in the global namespace"
ENV["SDKROOT"] = MacOS.sdk_path if OS.mac? && MacOS.version == :high_sierra
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
]
if OS.mac?
args += %w[
--system-zlib
--system-bzip2
--system-curl
]
end
system "./bootstrap", *args, "--", *std_cmake_args,
"-DCMake_INSTALL_BASH_COMP_DIR=#{bash_completion}",
"-DCMake_INSTALL_EMACS_DIR=#{elisp}",
"-DCMake_BUILD_LTO=ON"
system "make"
system "make", "install"
end
|
The completions were removed because of problems with system bash
The `with-qt` GUI option was removed due to circular dependencies if
CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
For the GUI application please instead use `brew install --cask cmake`.
|
install
|
ruby
|
Homebrew/homebrew-core
|
Formula/c/cmake.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/cmake.rb
|
BSD-2-Clause
|
def breaks_macos_users
%w[dir dircolors vdir]
end
|
https://github.com/Homebrew/homebrew-core/pull/36494
|
breaks_macos_users
|
ruby
|
Homebrew/homebrew-core
|
Formula/c/coreutils.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/coreutils.rb
|
BSD-2-Clause
|
def install_new_dmd_conf
conf = etc/"dmd.conf"
# If the new file differs from conf, etc.install drops it here:
new_conf = etc/"dmd.conf.default"
# Else, we're already using the latest version:
return unless new_conf.exist?
backup = etc/"dmd.conf.old"
opoo "An old dmd.conf was found and will be moved to #{backup}."
mv conf, backup
mv new_conf, conf
end
|
Previous versions of this formula may have left in place an incorrect
dmd.conf. If it differs from the newly generated one, move it out of place
and warn the user.
|
install_new_dmd_conf
|
ruby
|
Homebrew/homebrew-core
|
Formula/d/dmd.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/d/dmd.rb
|
BSD-2-Clause
|
def startup_script
<<~EOS
#!/bin/sh
PID=#{var}/spool/exim/exim-daemon.pid
case "$1" in
start)
echo "starting exim mail transfer agent"
#{bin}/exim -bd -q30m
;;
restart)
echo "restarting exim mail transfer agent"
/bin/kill -15 `/bin/cat $PID` && sleep 1 && #{bin}/exim -bd -q30m
;;
stop)
echo "stopping exim mail transfer agent"
/bin/kill -15 `/bin/cat $PID`
;;
*)
echo "Usage: #{bin}/exim_ctl {start|stop|restart}"
exit 1
;;
esac
EOS
end
|
Inspired by MacPorts startup script. Fixes restart issue due to missing setuid.
|
startup_script
|
ruby
|
Homebrew/homebrew-core
|
Formula/e/exim.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/e/exim.rb
|
BSD-2-Clause
|
def conf_example(port = 8080)
<<~EOS
listen: #{port}
hosts:
"127.0.0.1.xip.io:#{port}":
paths:
/:
file.dir: #{var}/h2o/
EOS
end
|
This is simplified from examples/h2o/h2o.conf upstream.
|
conf_example
|
ruby
|
Homebrew/homebrew-core
|
Formula/h/h2o.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/h/h2o.rb
|
BSD-2-Clause
|
def write_config_files(macos_version, kernel_version, arch)
clang_config_file_dir.mkpath
arches = Set.new([:arm64, :x86_64, :aarch64])
arches << arch
sysroot = if macos_version.blank? || (MacOS.version > macos_version && MacOS::CLT.separate_header_package?)
"#{MacOS::CLT::PKG_PATH}/SDKs/MacOSX.sdk"
elsif macos_version >= "10.14"
"#{MacOS::CLT::PKG_PATH}/SDKs/MacOSX#{macos_version}.sdk"
else
"/"
end
{
darwin: kernel_version,
macosx: macos_version,
}.each do |system, version|
arches.each do |target_arch|
config_file = "#{target_arch}-apple-#{system}#{version}.cfg"
(clang_config_file_dir/config_file).atomic_write <<~CONFIG
-isysroot #{sysroot}
CONFIG
end
end
end
|
We use the extra layer of indirection in `arch` because the FormulaAudit/OnSystemConditionals
doesn't want to let us use `Hardware::CPU.arch` outside of `install` or `post_install` blocks.
|
write_config_files
|
ruby
|
Homebrew/homebrew-core
|
Formula/l/llvm.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/l/llvm.rb
|
BSD-2-Clause
|
def write_config_files(macos_version, kernel_version, arch)
clang_config_file_dir.mkpath
arches = Set.new([:arm64, :x86_64, :aarch64])
arches << arch
sysroot = if macos_version.blank? || (MacOS.version > macos_version && MacOS::CLT.separate_header_package?)
"#{MacOS::CLT::PKG_PATH}/SDKs/MacOSX.sdk"
elsif macos_version >= "10.14"
"#{MacOS::CLT::PKG_PATH}/SDKs/MacOSX#{macos_version}.sdk"
else
"/"
end
{
darwin: kernel_version,
macosx: macos_version,
}.each do |system, version|
arches.each do |target_arch|
config_file = "#{target_arch}-apple-#{system}#{version}.cfg"
(clang_config_file_dir/config_file).atomic_write <<~CONFIG
-isysroot #{sysroot}
CONFIG
end
end
end
|
We use the extra layer of indirection in `arch` because the FormulaAudit/OnSystemConditionals
doesn't want to let us use `Hardware::CPU.arch` outside of `install` or `post_install` blocks.
|
write_config_files
|
ruby
|
Homebrew/homebrew-core
|
Formula/l/[email protected]
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/l/[email protected]
|
BSD-2-Clause
|
def gemfile_remove_test!
gemfile_lines = []
test_group = false
File.read("Gemfile").each_line do |line|
line.chomp!
# If this is the closing part of the test group,
# swallow this line and then allow writing the test of the file.
if test_group && line == "end"
test_group = false
next
# If we're still inside the test group, skip writing.
elsif test_group
next
end
# If this is the start of the test group, skip writing it and mark
# this as part of the group.
if line.include?("group :test")
test_group = true
else
gemfile_lines << line
end
end
File.open("Gemfile", "w") do |gemfile|
gemfile.puts gemfile_lines.join("\n")
# Unmarked dependency of atk
gemfile.puts "gem 'rake','>= 13.0.1'"
end
end
|
This is annoying - if the gemfile lists test group gems at all,
even if we've explicitly requested to install without them,
bundle install --cache will fail because it can't find those gems.
Handle this by modifying the gemfile to remove these gems.
|
gemfile_remove_test!
|
ruby
|
Homebrew/homebrew-core
|
Formula/m/mikutter.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/mikutter.rb
|
BSD-2-Clause
|
def config_file
<<~EOS
#!/bin/sh
for opt; do :; done
case "$opt" in
--version) opt="--modversion";;
--cflags|--libs) ;;
*) exit 1;;
esac
pkg-config "$opt" nss
EOS
end
|
A very minimal nss-config for configuring firefox etc. with this nss,
see https://bugzil.la/530672 for the progress of upstream inclusion.
|
config_file
|
ruby
|
Homebrew/homebrew-core
|
Formula/n/nss.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/n/nss.rb
|
BSD-2-Clause
|
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
|
SSLv2 died with 1.1.0, so no-ssl2 no longer required.
SSLv3 & zlib are off by default with 1.1.0 but this may not
be obvious to everyone, so explicitly state it for now to
help debug inevitable breakage.
|
configure_args
|
ruby
|
Homebrew/homebrew-core
|
Formula/o/[email protected]
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/o/[email protected]
|
BSD-2-Clause
|
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
--libdir=#{lib}
no-ssl3
no-ssl3-method
no-zlib
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
end
args
end
|
SSLv2 died with 1.1.0, so no-ssl2 no longer required.
SSLv3 & zlib are off by default with 1.1.0 but this may not
be obvious to everyone, so explicitly state it for now to
help debug inevitable breakage.
|
configure_args
|
ruby
|
Homebrew/homebrew-core
|
Formula/o/[email protected]
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/o/[email protected]
|
BSD-2-Clause
|
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
--libdir=lib
no-ssl3
no-ssl3-method
no-zlib
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
end
args
end
|
SSLv2 died with 1.1.0, so no-ssl2 no longer required.
SSLv3 & zlib are off by default with 1.1.0 but this may not
be obvious to everyone, so explicitly state it for now to
help debug inevitable breakage.
|
configure_args
|
ruby
|
Homebrew/homebrew-core
|
Formula/o/[email protected]
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/o/[email protected]
|
BSD-2-Clause
|
def install
protobuf_flags = Utils.safe_popen_read("pkgconf", "--cflags", "--libs", "protobuf").chomp.split.uniq
system ENV.cxx, "-std=c++17", *Dir["generator/*.cc"], "-o", "protoc-gen-js", "-I.", *protobuf_flags, "-lprotoc"
bin.install "protoc-gen-js"
end
|
We manually build rather than use Bazel as Bazel will build its own copy of Abseil
and Protobuf that get statically linked into binary. Check for any upstream changes at
https://github.com/protocolbuffers/protobuf-javascript/blob/main/generator/BUILD.bazel
|
install
|
ruby
|
Homebrew/homebrew-core
|
Formula/p/protoc-gen-js.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/p/protoc-gen-js.rb
|
BSD-2-Clause
|
def caveats
<<~EOS
This formula provides only the `vcpkg` executable. To use vcpkg:
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
export VCPKG_ROOT="$HOME/vcpkg"
EOS
end
|
This is specific to the way we install only the `vcpkg` tool.
|
caveats
|
ruby
|
Homebrew/homebrew-core
|
Formula/v/vcpkg.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/v/vcpkg.rb
|
BSD-2-Clause
|
def post_install
ENV["GDK_PIXBUF_MODULEDIR"] = "#{HOMEBREW_PREFIX}/#{module_subdir}"
system Formula["gdk-pixbuf"].opt_bin/"gdk-pixbuf-query-loaders", "--update-cache"
end
|
After the loader is linked in, update the global cache of pixbuf loaders
|
post_install
|
ruby
|
Homebrew/homebrew-core
|
Formula/w/webp-pixbuf-loader.rb
|
https://github.com/Homebrew/homebrew-core/blob/master/Formula/w/webp-pixbuf-loader.rb
|
BSD-2-Clause
|
def amd_with_template_namespace
@amd_with_template_namespace || false
end
|
indicate whether the template should
be added to the global template namespace
|
amd_with_template_namespace
|
ruby
|
leshill/handlebars_assets
|
lib/handlebars_assets/config.rb
|
https://github.com/leshill/handlebars_assets/blob/master/lib/handlebars_assets/config.rb
|
MIT
|
def handlebars_amd_path
@handlebars_amd_path || 'handlebars'
end
|
path specified by the require.js paths
during configuration for the handlebars
|
handlebars_amd_path
|
ruby
|
leshill/handlebars_assets
|
lib/handlebars_assets/config.rb
|
https://github.com/leshill/handlebars_assets/blob/master/lib/handlebars_assets/config.rb
|
MIT
|
def chomp_underscore_for_partials?
@chomp_underscore_for_partials || false
end
|
Indicate if leading underscore should be allowed
when creating partial definition.
Allows compatibility with handlebars-rails
https://github.com/cowboyd/handlebars-rails/blob/f73a2d11df8aa2c21d335b8f04a8c5b59ae6a790/lib/handlebars-rails/tilt.rb#L18
|
chomp_underscore_for_partials?
|
ruby
|
leshill/handlebars_assets
|
lib/handlebars_assets/config.rb
|
https://github.com/leshill/handlebars_assets/blob/master/lib/handlebars_assets/config.rb
|
MIT
|
def unindent(heredoc)
heredoc.gsub(/^#{heredoc[/\A\s*/]}/, '')
end
|
http://bit.ly/aze9FV
Strip leading whitespace from each line that is the same as the
amount of whitespace on the first line of the string.
Leaves _additional_ indentation on later lines intact.
|
unindent
|
ruby
|
leshill/handlebars_assets
|
lib/handlebars_assets/handlebars_template.rb
|
https://github.com/leshill/handlebars_assets/blob/master/lib/handlebars_assets/handlebars_template.rb
|
MIT
|
def test_template_misnaming
root = '/myapp/app/assets/javascripts'
file = 'templates/test_template_misnaming.hbs'
scope = make_scope root, file
source = "This is {{handlebars}}"
assert_equal hbs_compiled('test_template_misnaming', source), render_it(scope, source)
end
|
Sprockets does not add nested root paths (i.e.
app/assets/javascripts/templates is rooted at app/assets/javascripts)
|
test_template_misnaming
|
ruby
|
leshill/handlebars_assets
|
test/handlebars_assets/shared/adapter_tests.rb
|
https://github.com/leshill/handlebars_assets/blob/master/test/handlebars_assets/shared/adapter_tests.rb
|
MIT
|
def write_pages_directory(pages_directory_path)
tmp_dir_path = '/var/tmp/um/' + Etc.getlogin
FileUtils.mkdir_p tmp_dir_path
tmp_file_path = tmp_dir_path + '/current.pagedir'
unless File.exist?(tmp_file_path)
File.write(tmp_file_path, pages_directory_path)
end
end
|
Cache the current pages directory in a file. This is used by the bash
completion script to avoid spinning up Ruby.
|
write_pages_directory
|
ruby
|
sinclairtarget/um
|
lib/um/umconfig.rb
|
https://github.com/sinclairtarget/um/blob/master/lib/um/umconfig.rb
|
MIT
|
def _directory(src, *args)
# Insert exclusion of macOS and Windows preview junk files if an exclude pattern is not present
# Thor's use of args is an array of call arguments, some of which can be single key/value hash options
if !args.any? {|h| h.class != Hash ? false : !h[:exclude_pattern].nil?}
args << {:exclude_pattern => /(\.DS_Store)|(thumbs\.db)/}
end
directory( src, *args )
end
|
Most important mixin method is Thor::Actions class method `source_root()` we call externally
|
_directory
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/actions_wrapper.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/actions_wrapper.rb
|
MIT
|
def start(args, config={})
begin
# Copy args as Thor changes them within the call chain of dispatch()
_args = args.clone()
# Call Thor's handlers as it does in start()
config[:shell] ||= Thor::Base.shell.new
dispatch(nil, args, nil, config)
# Handle undefined commands at top-level and for `help <command>`
rescue Thor::UndefinedCommandError => ex
# Handle `help` for an argument that is not an application command such as `new` or `build`
if _args[0].downcase() == 'help'
# Raise fatal StandardError to differentiate from UndefinedCommandError
msg = "Argument '#{_args[1]}' is not a recognized application command with detailed help. " +
"It may be a build / plugin task without detailed help or simply a goof."
raise( msg )
# Otherwise, eat unhandled command errors
else
# - No error message
# - No `exit()`
# - Re-raise to allow special, external CLI handling logic
raise ex
end
end
end
|
Redefine the Thor CLI entrypoint and exception handling
|
start
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/cli.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/cli.rb
|
MIT
|
def initialize(args, config, options)
super(args, config, options)
@app_cfg = options[:app_cfg]
@handler = options[:objects][:cli_handler]
@loginator = options[:objects][:loginator]
# Set the name for labelling CLI interactions
CLI::package_name( @loginator.decorate( 'Ceedling application', LogLabels::TITLE ) )
end
|
Intercept construction to extract configuration and injected dependencies
|
initialize
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/cli.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/cli.rb
|
MIT
|
def inspect
return this.class.name
end
|
Override to prevent exception handling from walking & stringifying the object variables.
Object variables are lengthy and produce a flood of output.
|
inspect
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/cli_handler.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/cli_handler.rb
|
MIT
|
def app_help(env, app_cfg, options, command, &thor_help)
verbosity = @helper.set_verbosity( options[:verbosity] )
# If help requested for a command, show it and skip listing build tasks
if !command.nil?
# Block handler
thor_help.call( command ) if block_given?
return
end
# Display Thor-generated help listing
thor_help.call( command ) if block_given?
# If it was help for a specific command, we're done
return if !command.nil?
# If project configuration is available, also display Rake tasks
@path_validator.standardize_paths( options[:project], *options[:mixin], )
return if [email protected]_available?( filepath:options[:project], env:env )
list_rake_tasks(
env:env,
app_cfg: app_cfg,
filepath: options[:project],
mixins: options[:mixin],
# Silent Ceedling loading unless debug verbosity
silent: !(verbosity == Verbosity::DEBUG)
)
end
|
Thor application help + Rake help (if available)
|
app_help
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/cli_handler.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/cli_handler.rb
|
MIT
|
def rake_help(env:, app_cfg:)
@helper.set_verbosity() # Default to normal
list_rake_tasks( env:env, app_cfg:app_cfg )
end
|
Public to be used by `-T` ARGV hack handling
|
rake_help
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/cli_handler.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/cli_handler.rb
|
MIT
|
def standardize_paths( *paths )
paths.each do |path|
next if path.nil? or path.empty?
path.gsub!( "\\", '/' )
end
end
|
Ensure any Windows backslashes are converted to Ruby path forward slashes
Santization happens inline
|
standardize_paths
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/path_validator.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/path_validator.rb
|
MIT
|
def load(filepath:nil, env:{}, silent:false)
# Highest priority: command line argument
if filepath
@path_validator.standardize_paths( filepath )
_filepath = File.expand_path( filepath )
config = load_and_log( _filepath, 'from command line argument', silent )
return _filepath, config
# Next priority: environment variable
elsif env[PROJECT_FILEPATH_ENV_VAR]
# ENV lookup is frozen so dup() to operate on the string
filepath = env[PROJECT_FILEPATH_ENV_VAR].dup()
@path_validator.standardize_paths( filepath )
_filepath = File.expand_path( filepath )
config = load_and_log(
_filepath,
"from environment variable `#{PROJECT_FILEPATH_ENV_VAR}`",
silent
)
return _filepath, config
# Final option: default filepath
elsif @file_wrapper.exist?( DEFAULT_PROJECT_FILEPATH )
filepath = DEFAULT_PROJECT_FILEPATH
_filepath = File.expand_path( filepath )
config = load_and_log( _filepath, "from working directory", silent )
return _filepath, config
# If no user provided filepath and the default filepath does not exist,
# we have a big problem
else
raise "No project filepath provided and default #{DEFAULT_PROJECT_FILEPATH} not found"
end
# We'll never get here but return nil/empty for completeness
return nil, {}
end
|
Discovers project file path and loads configuration.
Precendence of attempts:
1. Explcit flepath from argument
2. Environment variable
3. Default filename in working directory
Returns:
- Absolute path of project file found and used
- Config hash loaded from project file
|
load
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/projectinator.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/projectinator.rb
|
MIT
|
def config_available?(filepath:nil, env:{}, silent:true)
available = true
begin
load(filepath:filepath, env:env, silent:silent)
rescue
available = false
end
return available
end
|
Determine if project configuration is available.
- Simplest, default case simply tries to load default project file location.
- Otherwise, attempts to load a filepath, the default environment variable,
or both can be specified.
|
config_available?
|
ruby
|
ThrowTheSwitch/Ceedling
|
bin/projectinator.rb
|
https://github.com/ThrowTheSwitch/Ceedling/blob/master/bin/projectinator.rb
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.