MuranoCLI 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.ignore +1 -1
  4. data/.rubocop.yml +10 -5
  5. data/.trustme.sh +272 -106
  6. data/.trustme.vim +20 -1
  7. data/Gemfile +7 -5
  8. data/LICENSE.txt +14 -15
  9. data/MuranoCLI.gemspec +7 -5
  10. data/Rakefile +5 -5
  11. data/bin/murano +4 -4
  12. data/lib/MrMurano/Account.rb +13 -8
  13. data/lib/MrMurano/Business.rb +6 -7
  14. data/lib/MrMurano/Commander-Entry.rb +5 -5
  15. data/lib/MrMurano/Config-Migrate.rb +4 -4
  16. data/lib/MrMurano/Config.rb +27 -6
  17. data/lib/MrMurano/Content.rb +5 -5
  18. data/lib/MrMurano/Exchange-Element.rb +4 -4
  19. data/lib/MrMurano/Exchange.rb +4 -4
  20. data/lib/MrMurano/Gateway.rb +22 -11
  21. data/lib/MrMurano/Keystore.rb +4 -4
  22. data/lib/MrMurano/Logs.rb +87 -0
  23. data/lib/MrMurano/Mock.rb +5 -4
  24. data/lib/MrMurano/Passwords.rb +4 -5
  25. data/lib/MrMurano/ProjectFile.rb +4 -4
  26. data/lib/MrMurano/ReCommander.rb +4 -4
  27. data/lib/MrMurano/Setting.rb +5 -5
  28. data/lib/MrMurano/Settings-HttpService.rb +9 -6
  29. data/lib/MrMurano/Solution-ServiceConfig.rb +5 -5
  30. data/lib/MrMurano/Solution-Services.rb +76 -50
  31. data/lib/MrMurano/Solution-Users.rb +5 -4
  32. data/lib/MrMurano/Solution.rb +6 -6
  33. data/lib/MrMurano/SolutionId.rb +4 -4
  34. data/lib/MrMurano/SubCmdGroupContext.rb +4 -4
  35. data/lib/MrMurano/SyncAllowed.rb +4 -4
  36. data/lib/MrMurano/SyncRoot.rb +5 -5
  37. data/lib/MrMurano/SyncUpDown-Core.rb +515 -0
  38. data/lib/MrMurano/SyncUpDown-Item.rb +159 -0
  39. data/lib/MrMurano/SyncUpDown.rb +120 -688
  40. data/lib/MrMurano/Webservice-Cors.rb +4 -4
  41. data/lib/MrMurano/Webservice-Endpoint.rb +9 -6
  42. data/lib/MrMurano/Webservice-File.rb +5 -4
  43. data/lib/MrMurano/Webservice.rb +5 -5
  44. data/lib/MrMurano/commands/business.rb +4 -4
  45. data/lib/MrMurano/commands/completion.rb +6 -6
  46. data/lib/MrMurano/commands/config.rb +7 -5
  47. data/lib/MrMurano/commands/content.rb +5 -4
  48. data/lib/MrMurano/commands/cors.rb +4 -4
  49. data/lib/MrMurano/commands/devices.rb +6 -6
  50. data/lib/MrMurano/commands/domain.rb +4 -4
  51. data/lib/MrMurano/commands/exchange.rb +4 -4
  52. data/lib/MrMurano/commands/gb.rb +4 -4
  53. data/lib/MrMurano/commands/globals.rb +12 -4
  54. data/lib/MrMurano/commands/init.rb +5 -4
  55. data/lib/MrMurano/commands/keystore.rb +4 -4
  56. data/lib/MrMurano/commands/link.rb +4 -4
  57. data/lib/MrMurano/commands/login.rb +4 -4
  58. data/lib/MrMurano/commands/logs.rb +229 -76
  59. data/lib/MrMurano/commands/mock.rb +4 -4
  60. data/lib/MrMurano/commands/password.rb +4 -4
  61. data/lib/MrMurano/commands/postgresql.rb +4 -4
  62. data/lib/MrMurano/commands/settings.rb +4 -4
  63. data/lib/MrMurano/commands/show.rb +4 -4
  64. data/lib/MrMurano/commands/solution.rb +4 -4
  65. data/lib/MrMurano/commands/solution_picker.rb +4 -4
  66. data/lib/MrMurano/commands/status.rb +12 -4
  67. data/lib/MrMurano/commands/sync.rb +4 -4
  68. data/lib/MrMurano/commands/timeseries.rb +4 -4
  69. data/lib/MrMurano/commands/tsdb.rb +6 -7
  70. data/lib/MrMurano/commands/usage.rb +4 -4
  71. data/lib/MrMurano/commands.rb +4 -4
  72. data/lib/MrMurano/hash.rb +5 -5
  73. data/lib/MrMurano/http.rb +26 -22
  74. data/lib/MrMurano/makePretty.rb +194 -10
  75. data/lib/MrMurano/optparse.rb +1 -1
  76. data/lib/MrMurano/orderedhash.rb +1 -1
  77. data/lib/MrMurano/progress.rb +4 -4
  78. data/lib/MrMurano/verbosing.rb +6 -6
  79. data/lib/MrMurano/version.rb +5 -5
  80. data/lib/MrMurano.rb +7 -4
  81. data/spec/Account-Passwords_spec.rb +4 -4
  82. data/spec/Account_spec.rb +4 -4
  83. data/spec/Business_spec.rb +4 -4
  84. data/spec/ConfigFile_spec.rb +4 -4
  85. data/spec/ConfigMigrate_spec.rb +5 -4
  86. data/spec/Config_spec.rb +5 -4
  87. data/spec/Content_spec.rb +5 -4
  88. data/spec/GatewayBase_spec.rb +4 -4
  89. data/spec/GatewayDevice_spec.rb +4 -4
  90. data/spec/GatewayResource_spec.rb +5 -4
  91. data/spec/GatewaySettings_spec.rb +4 -4
  92. data/spec/Http_spec.rb +4 -4
  93. data/spec/MakePretties_spec.rb +20 -20
  94. data/spec/Mock_spec.rb +4 -4
  95. data/spec/ProjectFile_spec.rb +4 -4
  96. data/spec/Setting_spec.rb +4 -4
  97. data/spec/Solution-ServiceConfig_spec.rb +4 -4
  98. data/spec/Solution-ServiceEventHandler_spec.rb +5 -4
  99. data/spec/Solution-ServiceModules_spec.rb +5 -4
  100. data/spec/Solution-UsersRoles_spec.rb +5 -4
  101. data/spec/Solution_spec.rb +4 -4
  102. data/spec/SyncRoot_spec.rb +4 -4
  103. data/spec/SyncUpDown_spec.rb +67 -21
  104. data/spec/Verbosing_spec.rb +12 -10
  105. data/spec/Webservice-Cors_spec.rb +4 -4
  106. data/spec/Webservice-Endpoint_spec.rb +5 -4
  107. data/spec/Webservice-File_spec.rb +5 -4
  108. data/spec/Webservice-Setting_spec.rb +4 -4
  109. data/spec/_workspace.rb +4 -4
  110. data/spec/cmd_business_spec.rb +4 -5
  111. data/spec/cmd_common.rb +51 -20
  112. data/spec/cmd_config_spec.rb +4 -5
  113. data/spec/cmd_content_spec.rb +4 -5
  114. data/spec/cmd_cors_spec.rb +4 -5
  115. data/spec/cmd_device_spec.rb +5 -6
  116. data/spec/cmd_domain_spec.rb +4 -5
  117. data/spec/cmd_exchange_spec.rb +4 -5
  118. data/spec/cmd_help_spec.rb +4 -5
  119. data/spec/cmd_init_spec.rb +16 -35
  120. data/spec/cmd_keystore_spec.rb +4 -5
  121. data/spec/cmd_link_spec.rb +11 -12
  122. data/spec/cmd_logs_spec.rb +162 -0
  123. data/spec/cmd_password_spec.rb +4 -5
  124. data/spec/cmd_setting_application_spec.rb +4 -5
  125. data/spec/cmd_setting_product_spec.rb +4 -5
  126. data/spec/cmd_status_spec.rb +44 -81
  127. data/spec/cmd_syncdown_application_spec.rb +7 -10
  128. data/spec/cmd_syncdown_both_spec.rb +10 -25
  129. data/spec/cmd_syncup_spec.rb +31 -37
  130. data/spec/cmd_usage_spec.rb +4 -5
  131. data/spec/fixtures/dumped_config +1 -0
  132. data/spec/fixtures/websocket/logs_blather.rb +27 -0
  133. data/spec/fixtures/websocket/logs_faker.rb +153 -0
  134. data/spec/fixtures/websocket/simple_connection.rb +45 -0
  135. data/spec/fixtures/websocket/simple_options.rb +77 -0
  136. data/spec/fixtures/websocket/simple_server.rb +69 -0
  137. data/spec/fixtures/websocket/wss-echo.rb +48 -0
  138. data/spec/fixtures/websocket/wss-fake-logs.rb +20 -0
  139. metadata +55 -2
data/spec/Setting_spec.rb CHANGED
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'tempfile'
9
9
  require 'yaml'
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'tempfile'
9
9
  require 'MrMurano/version'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'tempfile'
9
10
  require 'MrMurano/version'
10
11
  require 'MrMurano/ProjectFile'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'tempfile'
9
10
  require 'MrMurano/version'
10
11
  require 'MrMurano/ProjectFile'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'tempfile'
9
10
  require 'MrMurano/hash'
10
11
  require 'MrMurano/version'
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'tempfile'
9
9
  require 'yaml'
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'MrMurano/version'
9
9
  require 'MrMurano/Config'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'MrMurano/verbosing'
9
10
  require 'MrMurano/version'
10
11
  require 'MrMurano/Config'
@@ -299,37 +300,82 @@ RSpec.describe MrMurano::SyncUpDown do
299
300
  @t = TSUD.new
300
301
  expect(@t).to receive(:list).once.and_return(
301
302
  [
302
- MrMurano::SyncUpDown::Item.new(name: 'eight.lua', updated_at: ITEM_UPDATED_AT), # todel
303
- MrMurano::SyncUpDown::Item.new(name: 'four.lua', updated_at: ITEM_UPDATED_AT), # unchg
304
- MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT), # tomod
305
- MrMurano::SyncUpDown::Item.new(name: 'seven.lua', updated_at: ITEM_UPDATED_AT), # todel
306
- MrMurano::SyncUpDown::Item.new(name: 'three.lua', updated_at: ITEM_UPDATED_AT), # unchg
307
- MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT), # tomod
303
+ MrMurano::SyncUpDown::Item.new(
304
+ name: 'eight.lua', updated_at: ITEM_UPDATED_AT
305
+ ), # todel
306
+ MrMurano::SyncUpDown::Item.new(
307
+ name: 'four.lua', updated_at: ITEM_UPDATED_AT
308
+ ), # unchg
309
+ MrMurano::SyncUpDown::Item.new(
310
+ name: 'one.lua', updated_at: ITEM_UPDATED_AT
311
+ ), # tomod
312
+ MrMurano::SyncUpDown::Item.new(
313
+ name: 'seven.lua', updated_at: ITEM_UPDATED_AT
314
+ ), # todel
315
+ MrMurano::SyncUpDown::Item.new(
316
+ name: 'three.lua', updated_at: ITEM_UPDATED_AT
317
+ ), # unchg
318
+ MrMurano::SyncUpDown::Item.new(
319
+ name: 'two.lua', updated_at: ITEM_UPDATED_AT
320
+ ), # tomod
308
321
  ]
309
322
  )
323
+
310
324
  expect(@t).to receive(:to_remote_item)
311
325
  .with(anything, pathname_globs('**/one.lua'))
312
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT))
326
+ .and_return(
327
+ MrMurano::SyncUpDown::Item.new(
328
+ name: 'one.lua', updated_at: ITEM_UPDATED_AT
329
+ )
330
+ )
313
331
  expect(@t).to receive(:to_remote_item)
314
332
  .with(anything, pathname_globs('**/two.lua'))
315
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT))
333
+ .and_return(
334
+ MrMurano::SyncUpDown::Item.new(
335
+ name: 'two.lua', updated_at: ITEM_UPDATED_AT
336
+ )
337
+ )
316
338
  expect(@t).to receive(:to_remote_item)
317
339
  .with(anything, pathname_globs('**/three.lua'))
318
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'three.lua', updated_at: ITEM_UPDATED_AT))
340
+ .and_return(
341
+ MrMurano::SyncUpDown::Item.new(
342
+ name: 'three.lua', updated_at: ITEM_UPDATED_AT
343
+ )
344
+ )
319
345
  expect(@t).to receive(:to_remote_item)
320
346
  .with(anything, pathname_globs('**/four.lua'))
321
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'four.lua', updated_at: ITEM_UPDATED_AT))
347
+ .and_return(
348
+ MrMurano::SyncUpDown::Item.new(
349
+ name: 'four.lua', updated_at: ITEM_UPDATED_AT
350
+ )
351
+ )
322
352
  expect(@t).to receive(:to_remote_item)
323
353
  .with(anything, pathname_globs('**/five.lua'))
324
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'five.lua', updated_at: ITEM_UPDATED_AT))
354
+ .and_return(
355
+ MrMurano::SyncUpDown::Item.new(
356
+ name: 'five.lua', updated_at: ITEM_UPDATED_AT
357
+ )
358
+ )
325
359
  expect(@t).to receive(:to_remote_item)
326
360
  .with(anything, pathname_globs('**/six.lua'))
327
- .and_return(MrMurano::SyncUpDown::Item.new(name: 'six.lua', updated_at: ITEM_UPDATED_AT))
328
-
329
- expect(@t).to receive(:docmp).with(have_attributes(name: 'one.lua'), anything).and_return(true)
330
- expect(@t).to receive(:docmp).with(have_attributes(name: 'two.lua'), anything).and_return(true)
331
- expect(@t).to receive(:docmp).with(have_attributes(name: 'three.lua'), anything).and_return(false)
332
- expect(@t).to receive(:docmp).with(have_attributes(name: 'four.lua'), anything).and_return(false)
361
+ .and_return(
362
+ MrMurano::SyncUpDown::Item.new(
363
+ name: 'six.lua', updated_at: ITEM_UPDATED_AT
364
+ )
365
+ )
366
+
367
+ expect(@t).to receive(:docmp)
368
+ .with(have_attributes(name: 'one.lua'), anything)
369
+ .and_return(true)
370
+ expect(@t).to receive(:docmp)
371
+ .with(have_attributes(name: 'two.lua'), anything)
372
+ .and_return(true)
373
+ expect(@t).to receive(:docmp)
374
+ .with(have_attributes(name: 'three.lua'), anything)
375
+ .and_return(false)
376
+ expect(@t).to receive(:docmp)
377
+ .with(have_attributes(name: 'four.lua'), anything)
378
+ .and_return(false)
333
379
  end
334
380
 
335
381
  it 'Returns all with no filter' do
@@ -1,11 +1,9 @@
1
- # Last Modified: 2017.07.03 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # frozen_string_literal: probably not yet
5
-
6
- # Copyright © 2016-2017 Exosite LLC.
7
- # License: MIT. See LICENSE.txt.
8
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
9
7
 
10
8
  require 'highline/import'
11
9
  require 'MrMurano/hash'
@@ -20,6 +18,7 @@ class VTst
20
18
  @token = nil
21
19
  end
22
20
  end
21
+
23
22
  RSpec.describe MrMurano::Verbose do
24
23
  include_context 'WORKSPACE'
25
24
 
@@ -47,13 +46,16 @@ RSpec.describe MrMurano::Verbose do
47
46
  end
48
47
 
49
48
  it 'warns' do
50
- expect($stderr).to receive(:puts).with("\e[33mhello\e[0m").once
51
- @tst.warning 'hello'
49
+ # 2017-12-14 (landonb): Not sure what changed, but this stopped working:
50
+ # expect($stderr).to receive(:say).with("\e[33mhello\e[0m").once
51
+ # @tst.warning 'hello'
52
+ # I tried receive(:warn), and expect($terminal), but for naught.
53
+ # Wrapping the call in the expect does the trick, though.
54
+ expect { @tst.warning 'hello' }.to output("\e[33mhello\e[0m\n").to_stderr
52
55
  end
53
56
 
54
57
  it 'errors' do
55
- expect($stderr).to receive(:puts).with("\e[31mhello\e[0m").once
56
- @tst.error 'hello'
58
+ expect { @tst.error 'hello' }.to output("\e[31mhello\e[0m\n").to_stderr
57
59
  end
58
60
 
59
61
  context 'tabularize' do
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'tempfile'
9
9
  require 'yaml'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'tempfile'
9
10
  require '_workspace'
10
11
  require 'MrMurano/version'
@@ -1,10 +1,11 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
+ require 'pathname'
8
9
  require 'MrMurano/version'
9
10
  require 'MrMurano/ProjectFile'
10
11
  require 'MrMurano/Webservice-File'
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'tempfile'
9
9
  require 'yaml'
data/spec/_workspace.rb CHANGED
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.08.29 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'fileutils'
9
9
  require 'pathname'
@@ -1,13 +1,12 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'fileutils'
9
9
  require 'open3'
10
- require 'pathname'
11
10
  require 'cmd_common'
12
11
 
13
12
  RSpec.describe 'murano business', :cmd, :needs_password do
data/spec/cmd_common.rb CHANGED
@@ -1,9 +1,9 @@
1
- # Last Modified: 2017.09.12 /coding: utf-8
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
2
3
  # frozen_string_literal: true
3
4
 
4
- # Copyright © 2016-2017 Exosite LLC.
5
- # License: MIT. See LICENSE.txt.
6
- # vim:tw=0:ts=2:sw=2:et:ai
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
7
 
8
8
  require 'highline'
9
9
  # Set HighLine's $terminal global.
@@ -21,14 +21,39 @@ require 'MrMurano/Config'
21
21
  # - Also print warning if spec exits, which rspec doesn't see as wrong.
22
22
  # - Note that this comes before importing Commander.
23
23
  $exited_abnormally = false
24
+
25
+ def capture_stdio
26
+ $murcli_wasout = $stdout
27
+ $murcli_waserr = $stderr
28
+ $murcli_wasterm = $terminal
29
+ end
30
+ capture_stdio
31
+
32
+ def restore_stdio
33
+ $stdout = $murcli_wasout
34
+ $stderr = $murcli_waserr
35
+ $terminal = $murcli_wasterm
36
+ end
37
+
24
38
  at_exit do
25
39
  if $exited_abnormally
26
- STDERR.puts('¡!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
27
- STDERR.puts('¡Unexpected spec exit killed rspec!')
28
- STDERR.puts('¡!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
40
+ restore_stdio
41
+ warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
42
+ warn(%( ____ ))
43
+ warn(%{ ,%( Y`. })
44
+ warn(%( / \ ))
45
+ warn(%( \ () () / ))
46
+ warn(%{ `. /\ ,%( })
47
+ warn(%( 8====| "" |====8 ))
48
+ warn(%( `LLLU' ))
49
+ warn(%( ))
50
+ warn('¡Unexpected spec exit killed rspec!')
51
+ warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
52
+ # DEVs: If you see this message, the last test exited unexpectedly.
29
53
  end
30
54
  end
31
55
  alias original_at_exit at_exit unless defined?(original_at_exit)
56
+
32
57
  def at_exit(*args, &block)
33
58
  #original_at_exit *args, &block
34
59
  # pass!
@@ -112,7 +137,7 @@ RSpec.shared_context 'CI_CMD' do
112
137
  # RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
113
138
  #)
114
139
  unless OS.windows?
115
- $stderr.puts(
140
+ warn(
116
141
  'Unexpected: ln_s failed on non-Windows machine / ' \
117
142
  "host_os: #{RbConfig::CONFIG['host_os']} / err: #{err}"
118
143
  )
@@ -247,9 +272,7 @@ RSpec.shared_context 'CI_CMD' do
247
272
  # FIXME: Remember the setting and re-enable.
248
273
  WebMock.allow_net_connect!
249
274
 
250
- wasout = $stdout
251
- waserr = $stderr
252
- wasterm = $terminal
275
+ capture_stdio
253
276
  tmpout = StringIO.new
254
277
  tmperr = StringIO.new
255
278
 
@@ -262,15 +285,19 @@ RSpec.shared_context 'CI_CMD' do
262
285
  $stdout = tmpout
263
286
  $stderr = tmperr
264
287
 
288
+ $exited_abnormally = true
289
+
265
290
  # When Commander is loaded, it sets an at_exit hook, which we monkey
266
291
  # patch in ReCommander. Since Config.validate_cmd is called before
267
292
  # at_exit, it uses runner.command_exit to tell ReCommander's at_exit
268
293
  # monkey patch not to call Commander.run!. Via rspec, we don't use the
269
294
  # at_exit hook, or ReCommander.
270
- $cfg = MrMurano::Config.new(::Commander::Runner.instance)
271
- $cfg.load
272
- $cfg.validate_cmd(cmd)
295
+ if $cfg.nil?
296
+ $cfg = MrMurano::Config.new(::Commander::Runner.instance)
297
+ $cfg.load
298
+ end
273
299
  $cfg['tool.no-progress'] = true
300
+ $cfg.validate_cmd(cmd)
274
301
  runner = ::Commander::Runner.instance
275
302
  unless defined?(runner.command_exit) && runner.command_exit
276
303
  # Commander's at_exit hook calls runner.run! which runs the command
@@ -281,7 +308,6 @@ RSpec.shared_context 'CI_CMD' do
281
308
  when_called = the_cmd.peek_when_called.dup
282
309
 
283
310
  runner.force_args(args.dup)
284
- $exited_abnormally = true
285
311
  #runner.parse_global_options
286
312
  if wont_parse
287
313
  expect { runner.old_parse_global_options }.to raise_error(SystemExit)
@@ -291,10 +317,15 @@ RSpec.shared_context 'CI_CMD' do
291
317
  if wont_run
292
318
  expect { the_cmd.run(*args) }.to raise_error(SystemExit)
293
319
  else
294
- the_cmd.run(*args)
320
+ begin
321
+ the_cmd.run(*args)
322
+ rescue StandardError => _err
323
+ # This is unexpected. Leave $exited_abnormally so we warn the user.
324
+ restore_stdio
325
+ raise
326
+ end
295
327
  end
296
328
  end
297
- $exited_abnormally = false
298
329
 
299
330
  # Reset proxy_options otherwise Commander::Command.call
300
331
  # uses them the next time this command is called.
@@ -303,11 +334,11 @@ RSpec.shared_context 'CI_CMD' do
303
334
  end
304
335
  runner.command_exit = nil
305
336
 
337
+ $exited_abnormally = false
306
338
  # Ruby provides std i/o constants, so we could do this:
307
339
  # $stdout, $stderr = STDOUT, STDERR
308
- $stdout = wasout
309
- $stderr = waserr
310
- $terminal = wasterm
340
+ restore_stdio
341
+
311
342
  [strip_color(tmpout.string), strip_color(tmperr.string)]
312
343
  end
313
344