aspera-cli 4.10.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/BUGS.md +19 -0
  4. data/CHANGELOG.md +528 -0
  5. data/CONTRIBUTING.md +143 -0
  6. data/README.md +977 -589
  7. data/bin/ascli +4 -4
  8. data/bin/asession +12 -12
  9. data/docs/test_env.conf +29 -19
  10. data/examples/aoc.rb +6 -6
  11. data/examples/dascli +18 -16
  12. data/examples/faspex4.rb +15 -15
  13. data/examples/node.rb +12 -12
  14. data/examples/proxy.pac +2 -2
  15. data/examples/server.rb +12 -12
  16. data/lib/aspera/aoc.rb +344 -272
  17. data/lib/aspera/ascmd.rb +56 -54
  18. data/lib/aspera/ats_api.rb +4 -4
  19. data/lib/aspera/cli/basic_auth_plugin.rb +15 -12
  20. data/lib/aspera/cli/extended_value.rb +9 -9
  21. data/lib/aspera/cli/{formater.rb → formatter.rb} +69 -69
  22. data/lib/aspera/cli/listener/line_dump.rb +1 -1
  23. data/lib/aspera/cli/listener/logger.rb +1 -1
  24. data/lib/aspera/cli/listener/progress.rb +5 -6
  25. data/lib/aspera/cli/listener/progress_multi.rb +16 -21
  26. data/lib/aspera/cli/main.rb +72 -73
  27. data/lib/aspera/cli/manager.rb +112 -112
  28. data/lib/aspera/cli/plugin.rb +68 -48
  29. data/lib/aspera/cli/plugins/alee.rb +4 -4
  30. data/lib/aspera/cli/plugins/aoc.rb +322 -720
  31. data/lib/aspera/cli/plugins/ats.rb +50 -52
  32. data/lib/aspera/cli/plugins/bss.rb +10 -10
  33. data/lib/aspera/cli/plugins/config.rb +514 -410
  34. data/lib/aspera/cli/plugins/console.rb +12 -12
  35. data/lib/aspera/cli/plugins/cos.rb +18 -20
  36. data/lib/aspera/cli/plugins/faspex.rb +134 -136
  37. data/lib/aspera/cli/plugins/faspex5.rb +235 -70
  38. data/lib/aspera/cli/plugins/node.rb +378 -309
  39. data/lib/aspera/cli/plugins/orchestrator.rb +52 -49
  40. data/lib/aspera/cli/plugins/preview.rb +129 -120
  41. data/lib/aspera/cli/plugins/server.rb +137 -83
  42. data/lib/aspera/cli/plugins/shares.rb +77 -52
  43. data/lib/aspera/cli/plugins/sync.rb +13 -33
  44. data/lib/aspera/cli/transfer_agent.rb +61 -61
  45. data/lib/aspera/cli/version.rb +2 -1
  46. data/lib/aspera/colors.rb +3 -3
  47. data/lib/aspera/command_line_builder.rb +78 -74
  48. data/lib/aspera/cos_node.rb +31 -29
  49. data/lib/aspera/data_repository.rb +1 -1
  50. data/lib/aspera/environment.rb +30 -28
  51. data/lib/aspera/fasp/agent_base.rb +17 -15
  52. data/lib/aspera/fasp/agent_connect.rb +34 -32
  53. data/lib/aspera/fasp/agent_direct.rb +70 -73
  54. data/lib/aspera/fasp/agent_httpgw.rb +79 -74
  55. data/lib/aspera/fasp/agent_node.rb +26 -26
  56. data/lib/aspera/fasp/agent_trsdk.rb +20 -20
  57. data/lib/aspera/fasp/error.rb +3 -2
  58. data/lib/aspera/fasp/error_info.rb +11 -8
  59. data/lib/aspera/fasp/installation.rb +80 -80
  60. data/lib/aspera/fasp/listener.rb +2 -2
  61. data/lib/aspera/fasp/parameters.rb +103 -92
  62. data/lib/aspera/fasp/parameters.yaml +313 -214
  63. data/lib/aspera/fasp/resume_policy.rb +10 -10
  64. data/lib/aspera/fasp/transfer_spec.rb +22 -2
  65. data/lib/aspera/fasp/uri.rb +7 -7
  66. data/lib/aspera/faspex_gw.rb +80 -159
  67. data/lib/aspera/faspex_postproc.rb +77 -0
  68. data/lib/aspera/hash_ext.rb +3 -3
  69. data/lib/aspera/id_generator.rb +5 -5
  70. data/lib/aspera/keychain/encrypted_hash.rb +23 -28
  71. data/lib/aspera/keychain/macos_security.rb +21 -20
  72. data/lib/aspera/log.rb +13 -13
  73. data/lib/aspera/nagios.rb +24 -23
  74. data/lib/aspera/node.rb +217 -38
  75. data/lib/aspera/oauth.rb +78 -74
  76. data/lib/aspera/open_application.rb +19 -11
  77. data/lib/aspera/persistency_action_once.rb +4 -4
  78. data/lib/aspera/persistency_folder.rb +13 -13
  79. data/lib/aspera/preview/file_types.rb +8 -8
  80. data/lib/aspera/preview/generator.rb +67 -67
  81. data/lib/aspera/preview/utils.rb +27 -27
  82. data/lib/aspera/proxy_auto_config.js +63 -63
  83. data/lib/aspera/proxy_auto_config.rb +19 -19
  84. data/lib/aspera/rest.rb +65 -67
  85. data/lib/aspera/rest_call_error.rb +2 -1
  86. data/lib/aspera/rest_error_analyzer.rb +22 -21
  87. data/lib/aspera/rest_errors_aspera.rb +16 -16
  88. data/lib/aspera/secret_hider.rb +17 -14
  89. data/lib/aspera/ssh.rb +15 -14
  90. data/lib/aspera/sync.rb +177 -62
  91. data/lib/aspera/temp_file_manager.rb +2 -2
  92. data/lib/aspera/uri_reader.rb +4 -4
  93. data/lib/aspera/web_auth.rb +13 -64
  94. data/lib/aspera/web_server_simple.rb +76 -0
  95. data.tar.gz.sig +0 -0
  96. metadata +11 -6
  97. metadata.gz.sig +0 -0
data/bin/ascli CHANGED
@@ -3,9 +3,9 @@
3
3
 
4
4
  require 'rubygems'
5
5
  require 'securerandom'
6
- GEM_ROOT=File.realpath(File.join(File.dirname(File.realpath(__FILE__)),'..'))
6
+ GEM_ROOT = File.realpath(File.join(File.dirname(File.realpath(__FILE__)), '..'))
7
7
  # coverage for tests
8
- if ENV.has_key?('ENABLE_COVERAGE')
8
+ if ENV.key?('ENABLE_COVERAGE')
9
9
  require 'simplecov'
10
10
  SimpleCov.root(GEM_ROOT)
11
11
  SimpleCov.enable_for_subprocesses if SimpleCov.respond_to?(:enable_for_subprocesses)
@@ -14,13 +14,13 @@ if ENV.has_key?('ENABLE_COVERAGE')
14
14
  SimpleCov.command_name(SecureRandom.uuid)
15
15
  SimpleCov.at_exit do
16
16
  original_file_descriptor = $stdout
17
- $stdout.reopen(File.join(GEM_ROOT,'simplecov.log'))
17
+ $stdout.reopen(File.join(GEM_ROOT, 'simplecov.log'))
18
18
  SimpleCov.result.format!
19
19
  $stdout.reopen(original_file_descriptor)
20
20
  end
21
21
  SimpleCov.start
22
22
  end
23
- $LOAD_PATH.unshift(File.join(GEM_ROOT,'lib'))
23
+ $LOAD_PATH.unshift(File.join(GEM_ROOT, 'lib'))
24
24
  require 'aspera/cli/main'
25
25
  require 'aspera/environment'
26
26
  Encoding.default_internal = Encoding::UTF_8
data/bin/asession CHANGED
@@ -13,11 +13,11 @@ TS_LOGLEVEL = 'EX_loglevel'
13
13
  # by default go to /tmp/username.filelist
14
14
  TS_TMP_FILELIST_FOLDER = 'EX_file_list_folder'
15
15
 
16
- SAMPLE_DEMO='"remote_host":"demo.asperasoft.com","remote_user":"asperaweb","ssh_port":33001,"remote_password":"demoaspera"'
17
- SAMPLE_DEMO2='"direction":"receive","destination_root":"./test.dir"'
18
- def assert_usage(assertion,errmsg)
16
+ SAMPLE_DEMO = '"remote_host":"demo.asperasoft.com","remote_user":"asperaweb","ssh_port":33001,"remote_password":"demoaspera"'
17
+ SAMPLE_DEMO2 = '"direction":"receive","destination_root":"./test.dir"'
18
+ def assert_usage(assertion, error_message)
19
19
  return if assertion
20
- $stderr.puts('ERROR: '.red.blink + errmsg) if errmsg
20
+ $stderr.puts('ERROR: '.red.blink + error_message) if error_message
21
21
  $stderr.puts('USAGE')
22
22
  $stderr.puts(' asession')
23
23
  $stderr.puts(' asession -h|--help')
@@ -48,24 +48,24 @@ if ARGV.empty?
48
48
  parameter_source_err_msg = ' (JSON on stdin)'
49
49
  end
50
50
  # anyway expect only one argument: session information
51
- assert_usage(ARGV.length.eql?(1),'exactly one argument is expected')
52
- assert_usage(!['-h','--help'].include?(ARGV.first),nil)
51
+ assert_usage(ARGV.length.eql?(1), 'exactly one argument is expected')
52
+ assert_usage(!['-h', '--help'].include?(ARGV.first), nil)
53
53
  # parse transfer spec
54
54
  begin
55
55
  transfer_spec_arg = ARGV.pop
56
56
  transfer_spec = Aspera::Cli::ExtendedValue.instance.evaluate(transfer_spec_arg)
57
57
  rescue
58
- assert_usage(false,"Cannot extract transfer spec from: #{transfer_spec_arg}")
58
+ assert_usage(false, "Cannot extract transfer spec from: #{transfer_spec_arg}")
59
59
  end
60
60
  # ensure right type
61
- assert_usage(transfer_spec.is_a?(Hash),"the value must be a hash table#{parameter_source_err_msg}")
61
+ assert_usage(transfer_spec.is_a?(Hash), "the value must be a hash table#{parameter_source_err_msg}")
62
62
  # additional debug capability
63
- if transfer_spec.has_key?(TS_LOGLEVEL)
63
+ if transfer_spec.key?(TS_LOGLEVEL)
64
64
  Aspera::Log.instance.level = transfer_spec[TS_LOGLEVEL]
65
65
  transfer_spec.delete(TS_LOGLEVEL)
66
66
  end
67
67
  # possibly override temp folder
68
- if transfer_spec.has_key?(TS_TMP_FILELIST_FOLDER)
68
+ if transfer_spec.key?(TS_TMP_FILELIST_FOLDER)
69
69
  Aspera::Fasp::Parameters.file_list_folder = transfer_spec[TS_TMP_FILELIST_FOLDER]
70
70
  transfer_spec.delete(TS_TMP_FILELIST_FOLDER)
71
71
  end
@@ -77,10 +77,10 @@ client.add_listener(Aspera::Cli::Listener::LineDump.new)
77
77
  job_id = client.start_transfer(transfer_spec)
78
78
  # async commands
79
79
  Thread.new do
80
- begin
80
+ begin # rubocop:disable Style/RedundantBegin
81
81
  loop do
82
82
  data = JSON.parse($stdin.gets)
83
- client.send_command(job_id,0,data)
83
+ client.send_command(job_id, 0, data)
84
84
  end
85
85
  rescue
86
86
  Process.exit(1)
data/docs/test_env.conf CHANGED
@@ -3,11 +3,11 @@ config:
3
3
  version: 4.0.0
4
4
  default:
5
5
  config: cli_default
6
- aoc: tst_aoc1
6
+ aoc: tst_aoc_jwt
7
7
  faspex: tst_faspex
8
- faspex5: tst_faspex5
8
+ faspex5: tst_faspex5_jwt
9
9
  shares: tst_shares
10
- node: tst_node
10
+ node: tst_node_simple
11
11
  server: tst_server
12
12
  orchestrator: tst_orch
13
13
  console: tst_console
@@ -18,7 +18,6 @@ default:
18
18
  cli_default:
19
19
  interactive: your value here
20
20
  smtp: your value here
21
- secrets: your value here
22
21
  local_user:
23
22
  ssh_keys: your value here
24
23
  smtp_config:
@@ -30,11 +29,17 @@ smtp_config:
30
29
  from_name: your value here
31
30
  username: your value here
32
31
  password: your value here
33
- tst_aoc1:
32
+ tst_aoc_jwt:
34
33
  url: your value here
35
34
  username: your value here
36
35
  auth: your value here
37
36
  private_key: your value here
37
+ tst_aoc_web:
38
+ url: your value here
39
+ auth: your value here
40
+ redirect_uri: your value here
41
+ client_id: your value here
42
+ client_secret: your value here
38
43
  tst_faspex:
39
44
  url: your value here
40
45
  username: your value here
@@ -43,10 +48,6 @@ tst_faspex:
43
48
  tst_hstsfaspex_ssh:
44
49
  url: your value here
45
50
  username: your value here
46
- tst_node_faspex:
47
- url: your value here
48
- username: your value here
49
- password: your value here
50
51
  tst_faspex5_boot:
51
52
  url: your value here
52
53
  auth: your value here
@@ -57,8 +58,7 @@ tst_faspex5_web:
57
58
  auth: your value here
58
59
  redirect_uri: your value here
59
60
  client_id: your value here
60
- client_secret: your value here
61
- tst_faspex5:
61
+ tst_faspex5_jwt:
62
62
  url: your value here
63
63
  auth: your value here
64
64
  client_id: your value here
@@ -73,11 +73,23 @@ tst_shares_1:
73
73
  url: your value here
74
74
  username: your value here
75
75
  password: your value here
76
- tst_node:
76
+ tst_node_simple:
77
77
  url: your value here
78
78
  username: your value here
79
79
  password: your value here
80
- node_srv:
80
+ tst_node_ak:
81
+ url: your value here
82
+ username: your value here
83
+ password: your value here
84
+ tst_node_faspex:
85
+ url: your value here
86
+ username: your value here
87
+ password: your value here
88
+ tst_node_admak:
89
+ url: your value here
90
+ username: your value here
91
+ password: your value here
92
+ tst_node_preview:
81
93
  url: your value here
82
94
  username: your value here
83
95
  password: your value here
@@ -108,10 +120,6 @@ tst_ak_preview:
108
120
  username: your value here
109
121
  password: your value here
110
122
  mimemagic: your value here
111
- tst_node_preview:
112
- url: your value here
113
- username: your value here
114
- password: your value here
115
123
  tst_cos:
116
124
  apikey: your value here
117
125
  crn: your value here
@@ -120,6 +128,8 @@ tst_cos:
120
128
  sync:
121
129
  local_path: your value here
122
130
  remote_path: your value here
131
+ nowss:
132
+ ts: your value here
123
133
  misc:
124
134
  upload_folder: your value here
125
135
  syncuser: your value here
@@ -129,6 +139,7 @@ misc:
129
139
  faspex_dbx: your value here
130
140
  faspex_wkg: your value here
131
141
  faspex_src: your value here
142
+ faspex5_shinbox: your value here
132
143
  faspex5_meta: your value here
133
144
  shares_upload: your value here
134
145
  console_smart_id: your value here
@@ -152,6 +163,7 @@ misc:
152
163
  aoc_shbx_meta: your value here
153
164
  aoc_ak_name: your value here
154
165
  aoc_ak_secret: your value here
166
+ aoc_test_folder: your value here
155
167
  icos_bucket_key: your value here
156
168
  icos_bucket_secret: your value here
157
169
  icos_bucket_name: your value here
@@ -165,5 +177,3 @@ misc:
165
177
  aoc_user_email: your value here
166
178
  aoc_workspace2: your value here
167
179
  http_gw_fqdn_port: your value here
168
- tst_secrets:
169
- eudemo-sedemo: your value here
data/examples/aoc.rb CHANGED
@@ -7,9 +7,9 @@ require 'aspera/log'
7
7
  Aspera::Log.instance.level = :debug
8
8
 
9
9
  if !ARGV.length.eql?(3)
10
- Aspera::Log.log.error("wrong number of args: #{ARGV.length}")
11
- Aspera::Log.log.error("Usage: #{$PROGRAM_NAME} <aoc URL> <aoc username> <aoc private key content>")
12
- Aspera::Log.log.error("Example: #{$PROGRAM_NAME} https://myorg.ibmaspera.com john@example.com $(cat /home/john/my_key.pem)")
10
+ Aspera::Log.log.error{"wrong number of args: #{ARGV.length}"}
11
+ Aspera::Log.log.error{"Usage: #{$PROGRAM_NAME} <aoc URL> <aoc username> <aoc private key content>"}
12
+ Aspera::Log.log.error{"Example: #{$PROGRAM_NAME} https://myorg.ibmaspera.com john@example.com $(cat /home/john/my_key.pem)"}
13
13
  Process.exit(1)
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ aoc_url = ARGV[0]
17
17
  aoc_user = ARGV[1]
18
18
  aoc_key_value = ARGV[2]
19
19
 
20
- aocapi = Aspera::AoC.new(
20
+ aoc_api = Aspera::AoC.new(
21
21
  url: aoc_url,
22
22
  auth: :jwt,
23
23
  private_key: aoc_key_value,
@@ -25,6 +25,6 @@ aocapi = Aspera::AoC.new(
25
25
  scope: 'user:all',
26
26
  subpath: 'api/v1')
27
27
 
28
- self_user_data = aocapi.read('self')
28
+ self_user_data = aoc_api.read('self')
29
29
 
30
- Aspera::Log.dump('self',self_user_data)
30
+ Aspera::Log.dump('self', self_user_data)
data/examples/dascli CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env bash
2
2
  # set env var image to specify another docker image
3
- # set env var version to specify another image version
4
- # set env var docker_args to add options to docker run
5
- : ${image:=martinlaurent/ascli}
6
- # by default take latest version
7
- : ${version:=latest}
8
- : ${docker:=docker}
9
- : ${imgtag=$image:$version}
10
- # transform var into array
11
- add_dock_args=( $docker_args )
12
- # same location as in Dockerfile: main config folder for ascli in container
3
+ : "${image:=martinlaurent/ascli}"
4
+ # set env var version to specify another image version (default: latest version)
5
+ : "${version:=latest}"
6
+ # set env var imgtag to specify a specific image/version
7
+ : "${imgtag=$image:$version}"
8
+ # set env var `docker` to podman, to use podman
9
+ : "${docker:=docker}"
10
+ # set env var docker_args to add options to docker run (transform var into array) # spellcheck disable=SC2086
11
+ read -a add_dock_args <<< $docker_args
12
+ # set env var ASCLI_HOME to set the config folder on host
13
+ : "${ASCLI_HOME:=$HOME/.aspera/ascli}"
14
+ # main config folder for ascli in container (same value as in `Dockerfile`)
13
15
  ascli_home_container=/home/cliuser/.aspera/ascli
14
- # set default location for config folder on host if necessary
15
- : ${ASCLI_HOME:=$HOME/.aspera/ascli}
16
- if test ! -d $ASCLI_HOME;then
17
- echo "creating foder: $ASCLI_HOME"
16
+ if test ! -d "$ASCLI_HOME";then
17
+ echo "creating folder: $ASCLI_HOME"
18
18
  # create it if necessary to allow mounting the volume in container
19
19
  mkdir -p "$ASCLI_HOME"
20
20
  fi
@@ -22,7 +22,9 @@ exec $docker run \
22
22
  --rm \
23
23
  --tty \
24
24
  --interactive \
25
+ --user root \
26
+ --env ASCLI_HOME="$ascli_home_container" \
25
27
  --volume "$ASCLI_HOME:$ascli_home_container" \
26
28
  "${add_dock_args[@]}" \
27
- $imgtag \
28
- ascli "$@"
29
+ "$imgtag" \
30
+ "$@"
data/examples/faspex4.rb CHANGED
@@ -20,9 +20,9 @@ Aspera::Log.instance.level = :debug
20
20
  Aspera::Fasp::Installation.instance.folder = tmpdir
21
21
 
22
22
  if !ARGV.length.eql?(3)
23
- Aspera::Log.log.error("Wrong number of args: #{ARGV.length}")
24
- Aspera::Log.log.error("Usage: #{$PROGRAM_NAME} <faspex URL> <faspex username> <faspex password>")
25
- Aspera::Log.log.error("Example: #{$PROGRAM_NAME} https://faspex.com/aspera/faspex john p@sSw0rd")
23
+ Aspera::Log.log.error{"Wrong number of args: #{ARGV.length}"}
24
+ Aspera::Log.log.error{"Usage: #{$PROGRAM_NAME} <faspex URL> <faspex username> <faspex password>"}
25
+ Aspera::Log.log.error{"Example: #{$PROGRAM_NAME} https://faspex.com/aspera/faspex john p@sSw0rd"}
26
26
  Process.exit(1)
27
27
  end
28
28
 
@@ -52,7 +52,7 @@ api_v3.read('me')
52
52
  #---------------
53
53
 
54
54
  # create a sample file to send
55
- file_to_send = File.join(tmpdir,'myfile.bin')
55
+ file_to_send = File.join(tmpdir, 'myfile.bin')
56
56
  File.write(file_to_send, 'sample data')
57
57
  # package creation parameters
58
58
  package_create_params = {'delivery' => {
@@ -60,7 +60,7 @@ package_create_params = {'delivery' => {
60
60
  'recipients' => ['aspera.user1@gmail.com'],
61
61
  'sources' => [{'paths' => [file_to_send]}]
62
62
  }}
63
- pkg_created = api_v3.create('send',package_create_params)[:data]
63
+ pkg_created = api_v3.create('send', package_create_params)[:data]
64
64
  # get transfer specification (normally: only one)
65
65
  transfer_spec = pkg_created['xfer_sessions'].first
66
66
  # set paths of files to send
@@ -69,12 +69,12 @@ transfer_spec['paths'] = [{'source' => file_to_send}]
69
69
  transfer_client = Aspera::Fasp::AgentDirect.new({quiet: true})
70
70
  # start transfer (asynchronous)
71
71
  job_id = transfer_client.start_transfer(transfer_spec)
72
- Aspera::Log.dump('job_id',job_id)
72
+ Aspera::Log.dump('job_id', job_id)
73
73
  # wait for all transfer completion (for the example)
74
74
  result = transfer_client.wait_for_transfers_completion
75
75
  # notify of any transfer error
76
76
  result.reject{|i|i.eql?(:success)}.each do |e|
77
- Aspera::Log.log.error("A transfer error occurred: #{e.message}")
77
+ Aspera::Log.log.error{"A transfer error occurred: #{e.message}"}
78
78
  end
79
79
 
80
80
  # 3: Faspex 4 API v4
@@ -82,13 +82,13 @@ end
82
82
  api_v4 = Aspera::Rest.new({
83
83
  base_url: faspex_url + '/api',
84
84
  auth: {
85
- type: :oauth2,
86
- base_url: faspex_url + '/auth/oauth2',
87
- auth: {type: :basic, username: faspex_user, password: faspex_pass},
88
- crtype: :generic,
89
- generic: {grant_type: 'password'},
90
- scope: 'admin'
85
+ type: :oauth2,
86
+ base_url: faspex_url + '/auth/oauth2',
87
+ auth: {type: :basic, username: faspex_user, password: faspex_pass},
88
+ grant_method: :generic,
89
+ generic: {grant_type: 'password'},
90
+ scope: 'admin'
91
91
  }})
92
92
 
93
- # Use it. Note that Faspex 4 API v4 is totally different from Faspex 4 v3 APIs, see ref on line 2
94
- Aspera::Log.dump('users',api_v4.read('users')[:data])
93
+ # Use it. Note that Faspex 4 API v4 is totally different from Faspex 4 v3 APIs, see ref in header
94
+ Aspera::Log.dump('users', api_v4.read('users')[:data])
data/examples/node.rb CHANGED
@@ -15,7 +15,7 @@ require 'tmpdir'
15
15
 
16
16
  tmpdir = ENV['tmp'] || Dir.tmpdir || '.'
17
17
 
18
- raise 'Usage: PASSWORD=<password> $0 https://<address>:<port> <node user>' unless ARGV.length.eql?(2) && ENV.has_key?('PASSWORD')
18
+ raise 'Usage: PASSWORD=<password> $0 https://<address>:<port> <node user>' unless ARGV.length.eql?(2) && ENV.key?('PASSWORD')
19
19
 
20
20
  # example : https://node_asperaweb@eudemo.asperademo.com:9092
21
21
  node_uri = URI.parse(ARGV.shift)
@@ -23,7 +23,7 @@ node_user = ARGV.shift
23
23
  node_pass = ENV['PASSWORD']
24
24
 
25
25
  ##############################################################
26
- # generic initialisation : configuration of FaspManager
26
+ # generic initialization : configuration of FaspManager
27
27
 
28
28
  # set trace level for sample, set to :debug to see complete list of debug information
29
29
  Aspera::Log.instance.level = :debug
@@ -34,10 +34,10 @@ Aspera::RestErrorsAspera.register_handlers
34
34
  # some required files are generated here (keys, certs)
35
35
  Aspera::Fasp::Installation.instance.folder = tmpdir
36
36
  # set path to your copy of ascp binary (else, let the system find)
37
- Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.has_key?('ascp')
37
+ Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.key?('ascp')
38
38
  # another way is to detect installed products and use one of them
39
- #Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
- #Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
39
+ # Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
+ # Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
41
41
  # or install:
42
42
  #
43
43
 
@@ -45,10 +45,10 @@ Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.has_key?('asc
45
45
  transfer_agent = Aspera::Fasp::AgentDirect.new
46
46
 
47
47
  # Note that it would also be possible to start transfers using other agents
48
- #require 'aspera/fasp/connect'
49
- #transfer_agent=Aspera::Fasp::Connect.new
50
- #require 'aspera/fasp/node'
51
- #transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
48
+ # require 'aspera/fasp/connect'
49
+ # transfer_agent=Aspera::Fasp::Connect.new
50
+ # require 'aspera/fasp/node'
51
+ # transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
52
52
 
53
53
  ##############################################################
54
54
  # Optional : register an event listener
@@ -57,7 +57,7 @@ transfer_agent = Aspera::Fasp::AgentDirect.new
57
57
  class MyListener < Aspera::Fasp::Listener
58
58
  # this is the callback called during transfers, here we only display the received information
59
59
  # but it could be used to get detailed error information, check "type" field is "ERROR"
60
- def event_enhanced(data);$stdout.puts(JSON.generate(data));$stdout.flush;end
60
+ def event_enhanced(data); $stdout.puts(JSON.generate(data)); $stdout.flush; end # rubocop:disable Style/Semicolon
61
61
  end
62
62
 
63
63
  # register the sample listener to display events
@@ -78,9 +78,9 @@ node_api = Aspera::Rest.new({
78
78
  sources = ["#{tmpdir}/sample_file.txt"]
79
79
  destination = '/Upload'
80
80
  # create sample file(s)
81
- sources.each{|p|File.write(p,'Hello World!')}
81
+ sources.each{|p|File.write(p, 'Hello World!')}
82
82
  # request transfer authorization to node for a single transfer (This is a node api v3 call)
83
- send_result = node_api.create('files/upload_setup',{ transfer_requests: [{ transfer_request: { paths: [{ destination: destination }] } }] })[:data]
83
+ send_result = node_api.create('files/upload_setup', { transfer_requests: [{ transfer_request: { paths: [{ destination: destination }] } }] })[:data]
84
84
  # we normally have only one transfer spec in list, so just get the first transfer_spec
85
85
  transfer_spec = send_result['transfer_specs'].first['transfer_spec']
86
86
  # add list of files to upload
data/examples/proxy.pac CHANGED
@@ -4,7 +4,7 @@ function FindProxyForURL(url, host) {
4
4
  url = url.toLowerCase();
5
5
  host = host.toLowerCase();
6
6
 
7
- /* Don't proxy local hostnames */
7
+ /* Don't proxy local host names */
8
8
  if (isPlainHostName(host)) {
9
9
  return 'DIRECT';
10
10
  }
@@ -31,7 +31,7 @@ function FindProxyForURL(url, host) {
31
31
  if (isResolvable(host)) {
32
32
  var hostIP = dnsResolve(host);
33
33
 
34
- /* Don't proxy non-routable addresses (RFC 3330) */
34
+ /* Don't proxy private addresses (RFC 3330) */
35
35
  if (isInNet(hostIP, '0.0.0.0', '255.0.0.0')
36
36
  || isInNet(hostIP, '10.0.0.0', '255.0.0.0')
37
37
  || isInNet(hostIP, '127.0.0.0', '255.0.0.0')
data/examples/server.rb CHANGED
@@ -15,7 +15,7 @@ require 'tmpdir'
15
15
 
16
16
  tmpdir = ENV['tmp'] || Dir.tmpdir || '.'
17
17
 
18
- raise 'Usage: PASSWORD=<password> $0 ssh://<address>:<port> <transfer user>' unless ARGV.length.eql?(2) && ENV.has_key?('PASSWORD')
18
+ raise 'Usage: PASSWORD=<password> $0 ssh://<address>:<port> <transfer user>' unless ARGV.length.eql?(2) && ENV.key?('PASSWORD')
19
19
 
20
20
  # example : ssh://asperaweb@eudemo.asperademo.com:33001
21
21
  server_uri = URI.parse(ARGV.shift)
@@ -23,7 +23,7 @@ server_user = ARGV.shift
23
23
  server_pass = ENV['PASSWORD']
24
24
 
25
25
  ##############################################################
26
- # generic initialisation : configuration of FaspManager
26
+ # generic initialization : configuration of FaspManager
27
27
 
28
28
  # set trace level for sample, set to :debug to see complete list of debug information
29
29
  Aspera::Log.instance.level = :debug
@@ -34,10 +34,10 @@ Aspera::RestErrorsAspera.register_handlers
34
34
  # some required files are generated here (keys, certs)
35
35
  Aspera::Fasp::Installation.instance.folder = tmpdir
36
36
  # set path to your copy of ascp binary (else, let the system find)
37
- Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.has_key?('ascp')
37
+ Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.key?('ascp')
38
38
  # another way is to detect installed products and use one of them
39
- #Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
- #Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
39
+ # Aspera::Fasp::Installation.instance.installed_products.each{|p|puts("found: #{p[:name]}")}
40
+ # Aspera::Fasp::Installation.instance.use_ascp_from_product('Aspera Connect')
41
41
  # or install:
42
42
  #
43
43
 
@@ -45,10 +45,10 @@ Aspera::Fasp::Installation.instance.ascp_path = ENV['ascp'] if ENV.has_key?('asc
45
45
  transfer_agent = Aspera::Fasp::AgentDirect.new
46
46
 
47
47
  # Note that it would also be possible to start transfers using other agents
48
- #require 'aspera/fasp/connect'
49
- #transfer_agent=Aspera::Fasp::Connect.new
50
- #require 'aspera/fasp/node'
51
- #transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
48
+ # require 'aspera/fasp/connect'
49
+ # transfer_agent=Aspera::Fasp::Connect.new
50
+ # require 'aspera/fasp/node'
51
+ # transfer_agent=Aspera::Fasp::Node.new(Aspera::Rest.new(...))
52
52
 
53
53
  ##############################################################
54
54
  # Optional : register an event listener
@@ -57,7 +57,7 @@ transfer_agent = Aspera::Fasp::AgentDirect.new
57
57
  class MyListener < Aspera::Fasp::Listener
58
58
  # this is the callback called during transfers, here we only display the received information
59
59
  # but it could be used to get detailed error information, check "type" field is "ERROR"
60
- def event_enhanced(data);$stdout.puts(JSON.generate(data));$stdout.flush;end
60
+ def event_enhanced(data); $stdout.puts(JSON.generate(data)); $stdout.flush; end # rubocop:disable Style/Semicolon
61
61
  end
62
62
 
63
63
  # register the sample listener to display events
@@ -66,7 +66,7 @@ transfer_agent.add_listener(MyListener.new)
66
66
  ##############################################################
67
67
  # first example: download by SSH credentials
68
68
 
69
- # manually build teansfer spec
69
+ # manually build transfer spec
70
70
  transfer_spec = {
71
71
  'remote_host' => server_uri.host,
72
72
  'ssh_port' => server_uri.port,
@@ -82,7 +82,7 @@ transfer_spec = {
82
82
  transfer_agent.start_transfer(transfer_spec)
83
83
 
84
84
  # optional: helper method: wait for completion of transfers
85
- # here we started a single transfer session (no multisession parameter)
85
+ # here we started a single transfer session (no multi session parameter)
86
86
  # get array of status, one for each session (so, a single value array)
87
87
  # each status is either :success or "error message"
88
88
  transfer_result = transfer_agent.wait_for_transfers_completion