Module: Aspera
- Defined in:
- lib/aspera/environment.rb,
lib/aspera/log.rb,
lib/aspera/ssh.rb,
lib/aspera/ascmd.rb,
lib/aspera/assert.rb,
lib/aspera/nagios.rb,
lib/aspera/api/aoc.rb,
lib/aspera/api/ats.rb,
lib/aspera/api/alee.rb,
lib/aspera/api/node.rb,
lib/aspera/cli/info.rb,
lib/aspera/cli/main.rb,
lib/aspera/json_rpc.rb,
lib/aspera/web_auth.rb,
lib/aspera/cli/error.rb,
lib/aspera/cli/hints.rb,
lib/aspera/faspex_gw.rb,
lib/aspera/oauth/jwt.rb,
lib/aspera/oauth/web.rb,
lib/aspera/agent/base.rb,
lib/aspera/agent/node.rb,
lib/aspera/api/faspex.rb,
lib/aspera/api/httpgw.rb,
lib/aspera/cli/wizard.rb,
lib/aspera/oauth/base.rb,
lib/aspera/uri_reader.rb,
lib/aspera/cli/manager.rb,
lib/aspera/cli/version.rb,
lib/aspera/line_logger.rb,
lib/aspera/agent/direct.rb,
lib/aspera/agent/httpgw.rb,
lib/aspera/api/cos_node.rb,
lib/aspera/id_generator.rb,
lib/aspera/secret_hider.rb,
lib/aspera/transfer/uri.rb,
lib/aspera/agent/connect.rb,
lib/aspera/agent/desktop.rb,
lib/aspera/agent/factory.rb,
lib/aspera/cli/formatter.rb,
lib/aspera/keychain/base.rb,
lib/aspera/oauth/factory.rb,
lib/aspera/oauth/generic.rb,
lib/aspera/preview/utils.rb,
lib/aspera/sync/database.rb,
lib/aspera/timer_limiter.rb,
lib/aspera/transfer/spec.rb,
lib/aspera/node_simulator.rb,
lib/aspera/oauth/url_json.rb,
lib/aspera/products/other.rb,
lib/aspera/transfer/error.rb,
lib/aspera/agent/transferd.rb,
lib/aspera/ascp/management.rb,
lib/aspera/cli/plugins/aoc.rb,
lib/aspera/cli/plugins/ats.rb,
lib/aspera/cli/plugins/cos.rb,
lib/aspera/data_repository.rb,
lib/aspera/faspex_postproc.rb,
lib/aspera/preview/options.rb,
lib/aspera/rest_call_error.rb,
lib/aspera/sync/operations.rb,
lib/aspera/cli/plugins/alee.rb,
lib/aspera/cli/plugins/base.rb,
lib/aspera/cli/plugins/node.rb,
lib/aspera/cli/sync_actions.rb,
lib/aspera/keychain/factory.rb,
lib/aspera/preview/terminal.rb,
lib/aspera/products/connect.rb,
lib/aspera/products/desktop.rb,
lib/aspera/transfer/resumer.rb,
lib/aspera/ascp/installation.rb,
lib/aspera/cli/plugins/oauth.rb,
lib/aspera/preview/generator.rb,
lib/aspera/proxy_auto_config.rb,
lib/aspera/temp_file_manager.rb,
lib/aspera/transfer/spec_doc.rb,
lib/aspera/web_server_simple.rb,
lib/aspera/cli/extended_value.rb,
lib/aspera/cli/plugins/config.rb,
lib/aspera/cli/plugins/faspex.rb,
lib/aspera/cli/plugins/faspio.rb,
lib/aspera/cli/plugins/httpgw.rb,
lib/aspera/cli/plugins/server.rb,
lib/aspera/cli/plugins/shares.rb,
lib/aspera/cli/special_values.rb,
lib/aspera/cli/transfer_agent.rb,
lib/aspera/persistency_folder.rb,
lib/aspera/preview/file_types.rb,
lib/aspera/products/transferd.rb,
lib/aspera/rest_errors_aspera.rb,
lib/aspera/transfer/faux_file.rb,
lib/aspera/cli/plugins/console.rb,
lib/aspera/cli/plugins/factory.rb,
lib/aspera/cli/plugins/faspex5.rb,
lib/aspera/cli/plugins/preview.rb,
lib/aspera/rest_error_analyzer.rb,
lib/aspera/transfer/parameters.rb,
lib/aspera/command_line_builder.rb,
lib/aspera/cli/transfer_progress.rb,
lib/aspera/cli/plugins/basic_auth.rb,
lib/aspera/command_line_converter.rb,
lib/aspera/keychain/encrypted_hash.rb,
lib/aspera/keychain/macos_security.rb,
lib/aspera/persistency_action_once.rb,
lib/aspera/cli/plugins/orchestrator.rb,
lib/aspera/keychain/hashicorp_vault.rb,
lib/aspera/rest.rb
Overview
enhance the gem to support other key chains
Defined Under Namespace
Modules: Agent, Api, Ascp, Cli, Keychain, OAuth, Preview, Products, Sync, Transfer, UriReader Classes: AsCmd, AssertError, CommandLineBuilder, CommandLineConverter, DataRepository, Environment, Error, Faspex4GWServlet, Faspex4PostProcServlet, FaspexPubLink, IdGenerator, InternalError, JsonRpcClient, LineLogger, Log, Nagios, NodeSimulator, NodeSimulatorServlet, ParameterError, PersistencyActionOnce, PersistencyFolder, ProxyAutoConfig, Rest, RestCallError, RestErrorAnalyzer, RestErrorsAspera, RestParameters, SecretHider, Ssh, TempFileManager, TimerLimiter, WebAuth, WebAuthServlet, WebServerSimple
Class Method Summary collapse
-
.assert(assertion, info = nil, type: AssertError) ⇒ Object
Assert that a condition is true, else raise exception The block is executed in the context of the Aspera module.
-
.assert_type(value, *classes, type: AssertError) ⇒ Object
Assert that value has the given type.
-
.assert_values(value, values, type: AssertError) ⇒ Object
Assert that value is one of the given values.
-
.error_not_implemented ⇒ Object
Not implemented error.
-
.error_unexpected_value(value, type: InternalError) ⇒ Object
The value is not one of the expected values.
-
.error_unreachable_line ⇒ Object
The line with this shall never be reached.
-
.report_error(type, message) ⇒ Object
Replaces ‘raise` in assertion Allows sending exception, or just error log, when type is `:error`.
-
.require_method!(name) ⇒ Object
Use in superclass to require the given method in subclass.
Class Method Details
.assert(assertion, info = nil, type: AssertError) ⇒ Object
Assert that a condition is true, else raise exception The block is executed in the context of the Aspera module
39 40 41 42 43 44 45 46 47 |
# File 'lib/aspera/assert.rb', line 39 def assert(assertion, info = nil, type: AssertError) raise InternalError, 'bad assert: both info and block given' unless info.nil? || !block_given? return if assertion = 'assertion failed' info = yield if block_given? = "#{}: #{info}" if info = "#{}: #{caller.find{ |call| !call.start_with?(__FILE__)}}" report_error(type, ) end |
.assert_type(value, *classes, type: AssertError) ⇒ Object
Assert that value has the given type
54 55 56 |
# File 'lib/aspera/assert.rb', line 54 def assert_type(value, *classes, type: AssertError) assert(classes.any?{ |k| value.is_a?(k)}, type: type){"#{"#{yield}: " if block_given?}expecting #{classes.join(', ')}, but have #{value.inspect}"} end |
.assert_values(value, values, type: AssertError) ⇒ Object
Assert that value is one of the given values
63 64 65 66 67 68 69 |
# File 'lib/aspera/assert.rb', line 63 def assert_values(value, values, type: AssertError) assert(values.include?(value), type: type) do val_list = values.inspect val_list = "one of #{val_list}" if values.is_a?(Array) "#{"#{yield}: " if block_given?}expecting #{val_list}, but have #{value.inspect}" end end |
.error_not_implemented ⇒ Object
Not implemented error
85 86 87 |
# File 'lib/aspera/assert.rb', line 85 def error_not_implemented raise Error, 'Feature not yet implemented' end |
.error_unexpected_value(value, type: InternalError) ⇒ Object
The value is not one of the expected values
75 76 77 |
# File 'lib/aspera/assert.rb', line 75 def error_unexpected_value(value, type: InternalError) report_error(type, "#{"#{yield}: " if block_given?}unexpected value: #{value.inspect}") end |
.error_unreachable_line ⇒ Object
The line with this shall never be reached
80 81 82 |
# File 'lib/aspera/assert.rb', line 80 def error_unreachable_line raise InternalError, "unreachable line reached: #{caller(2..2).first}" end |
.report_error(type, message) ⇒ Object
Replaces ‘raise` in assertion Allows sending exception, or just error log, when type is `:error`
25 26 27 28 29 30 31 |
# File 'lib/aspera/assert.rb', line 25 def report_error(type, ) if type.is_a?(Symbol) Log.log.send(type, ) else raise type, end end |
.require_method!(name) ⇒ Object
Use in superclass to require the given method in subclass.
90 91 92 93 94 |
# File 'lib/aspera/assert.rb', line 90 def require_method!(name) define_method(name) do |*_args| raise NotImplementedError, "#{self.class} must implement the #{name} method" end end |