Class: Aspera::Products::Transferd
- Inherits:
-
Object
- Object
- Aspera::Products::Transferd
- Defined in:
- lib/aspera/products/transferd.rb
Constant Summary collapse
- APP_NAME =
'IBM Aspera Transfer Daemon'
- V1_DAEMON_NAME =
'asperatransferd'
- V2_DAEMON_NAME =
from 1.1.5
'transferd'
- RUNTIME_FOLDERS =
folders to extract from SDK archive
%w[bin lib sbin aspera].freeze
Class Method Summary collapse
-
.daemon_port_from_log(log_file) ⇒ Object
Well, the port number is only in log file.
-
.locations ⇒ Object
standard folder locations.
-
.sdk_directory ⇒ Object
The path to folder where SDK is installed.
-
.sdk_directory=(v) ⇒ Object
location of SDK files.
- .transferd_path ⇒ Object
Class Method Details
.daemon_port_from_log(log_file) ⇒ Object
Well, the port number is only in log file
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aspera/products/transferd.rb', line 42 def daemon_port_from_log(log_file) result = nil # if port is zero, a dynamic port was created, get it File.open(log_file, 'r') do |file| file.each_line do |line| # Well, it's tricky to depend on log if (m = line.match(/Info: API Server: Listening on ([^:]+):(\d+) /)) result = m[2].to_i # no "break" , need to read last matching log line end end end raise 'Port not found in daemon logs' if result.nil? Log.log.debug{"Got port #{result} from log"} return result end |
.locations ⇒ Object
standard folder locations
14 15 16 17 18 19 |
# File 'lib/aspera/products/transferd.rb', line 14 def locations [{ app_root: sdk_directory, sub_bin: '' }].map { |i| i.merge({ expected: APP_NAME }) } end |
.sdk_directory ⇒ Object
Returns the path to folder where SDK is installed.
29 30 31 32 33 |
# File 'lib/aspera/products/transferd.rb', line 29 def sdk_directory Aspera.assert(!@sdk_dir.nil?){'SDK path was not initialized'} FileUtils.mkdir_p(@sdk_dir) @sdk_dir end |
.sdk_directory=(v) ⇒ Object
location of SDK files
22 23 24 25 26 |
# File 'lib/aspera/products/transferd.rb', line 22 def sdk_directory=(v) Log.log.debug{"sdk_directory=#{v}"} @sdk_dir = v sdk_directory end |
.transferd_path ⇒ Object
35 36 37 38 39 |
# File 'lib/aspera/products/transferd.rb', line 35 def transferd_path v1_path = File.join(sdk_directory, Environment.exe_file(V1_DAEMON_NAME)) return v1_path if File.exist?(v1_path) return File.join(sdk_directory, Environment.exe_file(V2_DAEMON_NAME)) end |