Class: Vidispine::API::Utilities::HTTPServer::CLI
- Defined in:
- lib/vidispine/api/utilities/http_server/cli.rb
Constant Summary
Constants inherited from CLI
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#app ⇒ Object
Returns the value of attribute app.
-
#logger ⇒ Object
Returns the value of attribute logger.
Attributes inherited from CLI
#arguments, #initial_arguments, #initial_options, #options
Class Method Summary collapse
Instance Method Summary collapse
- #after_initialize ⇒ Object
- #initialize_api(args = { }) ⇒ Object
- #initialize_app(args = { }) ⇒ Object
- #run(args = arguments, opts = options) ⇒ Object
Methods inherited from CLI
clear_cached_arguments, default_options_file_path, executable_name, help, help_usage_append, help_usage_default, #initialize, #initialize_logger, log_to_as_string, parse_arguments, parse_arguments_from_command_line, parse_arguments_from_options_file, run
Constructor Details
This class inherits a constructor from Vidispine::CLI
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
45 46 47 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 45 def api @api end |
#app ⇒ Object
Returns the value of attribute app.
45 46 47 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 45 def app @app end |
#logger ⇒ Object
Returns the value of attribute logger.
45 46 47 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 45 def logger @logger end |
Class Method Details
.define_parameters ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 14 def self.define_parameters default_http_host_address = Vidispine::API::Client::HTTPClient::DEFAULT_HTTP_HOST_ADDRESS default_http_host_port = Vidispine::API::Client::HTTPClient::DEFAULT_HTTP_HOST_PORT default_vidispine_username = Vidispine::API::Client::HTTPClient::DEFAULT_USERNAME default_vidispine_password = Vidispine::API::Client::HTTPClient::DEFAULT_PASSWORD default_port = Vidispine::API::Utilities::HTTPServer::DEFAULT_PORT argument_parser.on('--vidispine-http-host-address HOSTADDRESS', 'The address of the server to communicate with.', "\tdefault: #{default_http_host_address}") { |v| arguments[:http_host_address] = v } argument_parser.on('--vidispine-http-host-port HOSTPORT', 'The port to use when communicating with the server.', "\tdefault: #{default_http_host_port}") { |v| arguments[:http_host_port] = v } argument_parser.on('--vidispine-username USERNAME', 'The account username to authenticate with.', "\tdefault: #{default_vidispine_username}") { |v| arguments[:username] = v } argument_parser.on('--vidispine-password PASSWORD', 'The account password to authenticate with.', "\tdefault: #{default_vidispine_password}") { |v| arguments[:password] = v } argument_parser.on('--storage-path-map MAP', 'A path=>storage-id mapping to match incoming file paths to storages.') { |v| arguments[:storage_path_map] = v } argument_parser.on('--metadata-field-map MAP', 'A path=>portal-field-id mapping to match incoming metadata fields to portal metadata fields.') { |v| arguments[:metadata_map] = v } argument_parser.on('--relative-file-path-collection-name-position NUM', 'The relative position from the storage base path in which to select the collection name.', "\tdefault: 0") { |v| arguments[:relative_file_path_collection_name_position] = v } argument_parser.on('--metadata-file-path-field-id ID', 'The Id of the metadata field where the file path is to be stored.' ) { |v| arguments[:metadata_file_path_field_id] = v } argument_parser.on('--bind-to-address ADDRESS', 'The local address to bind the server to.') { |v| arguments[:bind] = v } argument_parser.on('--port PORT', 'The port to bind to.', "\tdefault: #{default_port}") { |v| arguments[:port] = v } argument_parser.on('--log-to FILENAME', 'Log file location.', "\tdefault: #{log_to_as_string}") { |v| arguments[:log_to] = v } argument_parser.on('--log-level LEVEL', LOGGING_LEVELS.keys, "Logging level. Available Options: #{LOGGING_LEVELS.keys.join(', ')}", "\tdefault: #{LOGGING_LEVELS.invert[arguments[:log_level]]}") { |v| arguments[:log_level] = LOGGING_LEVELS[v] } argument_parser.on('--[no-]options-file [FILENAME]', 'Path to a file which contains default command line arguments.', "\tdefault: #{arguments[:options_file_path]}" ) { |v| arguments[:options_file_path] = v} argument_parser.on_tail('-h', '--help', 'Display this message.') { puts help; exit } end |
Instance Method Details
#after_initialize ⇒ Object
47 48 49 50 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 47 def after_initialize initialize_api(arguments) initialize_app(arguments) end |
#initialize_api(args = { }) ⇒ Object
52 53 54 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 52 def initialize_api(args = { }) @api = Vidispine::API::Utilities.new(args) end |
#initialize_app(args = { }) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 56 def initialize_app(args = { }) @app = Vidispine::API::Utilities::HTTPServer args_out = args args_out[:api] = api app.init(args) end |
#run(args = arguments, opts = options) ⇒ Object
63 64 65 66 |
# File 'lib/vidispine/api/utilities/http_server/cli.rb', line 63 def run(args = arguments, opts = ) app.run! self end |