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
@@ -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 password', :cmd do
@@ -1,14 +1,13 @@
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 'json'
10
10
  require 'open3'
11
- require 'pathname'
12
11
  require 'vine'
13
12
  require 'cmd_common'
14
13
 
@@ -1,14 +1,13 @@
1
- # Last Modified: 2017.09.13 /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 'json'
10
10
  require 'open3'
11
- require 'pathname'
12
11
  require 'vine'
13
12
  require 'cmd_common'
14
13
 
@@ -1,15 +1,14 @@
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 'json'
10
10
  require 'open3'
11
11
  require 'os'
12
- require 'pathname'
13
12
  require 'rbconfig'
14
13
 
15
14
  require 'cmd_common'
@@ -19,37 +18,34 @@ RSpec.describe 'murano status', :cmd, :needs_password do
19
18
 
20
19
  before(:example) do
21
20
  @product_name = rname('statusTest')
22
- out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @product_name, '--save'))
21
+ out, err, status = Open3.capture3(
22
+ capcmd('murano', 'product', 'create', @product_name, '--save')
23
+ )
23
24
  expect(err).to eq('')
24
25
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
25
26
  expect(status.exitstatus).to eq(0)
26
27
 
27
28
  @applctn_name = rname('statusTest')
28
- out, err, status = Open3.capture3(capcmd('murano', 'application', 'create', @applctn_name, '--save'))
29
+ out, err, status = Open3.capture3(
30
+ capcmd('murano', 'application', 'create', @applctn_name, '--save')
31
+ )
29
32
  expect(err).to eq('')
30
33
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
31
34
  expect(status.exitstatus).to eq(0)
32
35
 
33
- #out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
34
- #olines = out.lines
35
- #expect(olines[0]).to eq("Linked ‘#{@product_name}’ to ‘#{@applctn_name}’\n")
36
- #expect(olines[1]).to eq("Created default event handler\n")
37
- #expect(err).to eq('')
38
- #expect(status.exitstatus).to eq(0)
39
-
40
36
  out, err, status = Open3.capture3(
41
- #capcmd('murano', 'syncdown', '--eventhandlers', '--no-delete', '--no-update')
42
- capcmd('murano', 'syncdown', '--eventhandlers', '--no-delete', '--no-create')
37
+ capcmd('murano', 'syncdown', '--services', '--no-delete', '--no-update')
43
38
  )
44
- # E.g.,
45
- # "Adding item timer_timer\nAdding item tsdb_exportJob\nAdding item user_account\n"
39
+ # NOTE: 2017-12-14: (landonb): The new behavior is that MurCLI will treat
40
+ # platform scripts that are simply empty strings as not being in conflict
41
+ # if the script does not exist locally, in addition to the script existing
42
+ # locally but also just being an empty string.
43
+ # Currently, on a fresh solution, only user_account has script contents.
44
+ # You'll see timer_timer and tsdb_export also existing, but empty.
45
+ # Search eventhandler.undeletable for more on this issue.
46
46
  olines = out.lines
47
- # 2017-08-08: Because of eventhandler.undeletable, the boilerplate items
48
- # pre-exist, in a sense, and are therefore described as being updated,
49
- # not added.
50
- (0..2).each do |ln|
51
- #expect(olines[ln].to_s).to a_string_starting_with('Adding item ')
52
- expect(olines[ln].to_s).to a_string_starting_with('Updating item ')
47
+ (0..0).each do |ln|
48
+ expect(olines[ln].to_s).to a_string_starting_with('Adding item ')
53
49
  end
54
50
 
55
51
  expect(err).to eq('')
@@ -57,12 +53,16 @@ RSpec.describe 'murano status', :cmd, :needs_password do
57
53
  end
58
54
 
59
55
  after(:example) do
60
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @applctn_name, '-y'))
56
+ out, err, status = Open3.capture3(
57
+ capcmd('murano', 'solution', 'delete', @applctn_name, '-y')
58
+ )
61
59
  expect(out).to eq('')
62
60
  expect(err).to eq('')
63
61
  expect(status.exitstatus).to eq(0)
64
62
 
65
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @product_name, '-y'))
63
+ out, err, status = Open3.capture3(
64
+ capcmd('murano', 'solution', 'delete', @product_name, '-y')
65
+ )
66
66
  expect(out).to eq('')
67
67
  expect(err).to eq('')
68
68
  expect(status.exitstatus).to eq(0)
@@ -74,7 +74,6 @@ RSpec.describe 'murano status', :cmd, :needs_password do
74
74
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua}),
75
75
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:4}),
76
76
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:7}),
77
- # singleRoute only appears in some of the tests.
78
77
  a_string_matching(%r{ \+ \w .*routes/singleRoute\.lua}),
79
78
  a_string_matching(%r{ \+ \w .*files/js/script\.js}),
80
79
  a_string_matching(%r{ \+ \w .*files/icon\.png}),
@@ -97,47 +96,15 @@ RSpec.describe 'murano status', :cmd, :needs_password do
97
96
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua}),
98
97
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:4}),
99
98
  a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:7}),
100
- # singleRoute does not appear in old Solutionfile tests
101
- # that don't specify it.
102
- #a_string_matching(%r{ \+ \w .*routes/singleRoute\.lua}),
103
- a_string_matching(%r{ \+ \w .*files/js/script\.js}),
104
99
  a_string_matching(%r{ \+ \w .*files/icon\.png}),
105
100
  a_string_matching(%r{ \+ \w .*files/index\.html}),
101
+ a_string_matching(%r{ \+ \w .*files/js/script\.js}),
106
102
  )
107
103
  end
108
104
 
109
105
  def match_remote_boilerplate_v1_0_0_service(slice)
110
106
  expect(slice).to include(
111
- #a_string_matching(%r{ - \w device2_event}),
112
- #a_string_matching(%r{ - \w interface_addGatewayResource}),
113
- #a_string_matching(%r{ - \w interface_addIdentity}),
114
- #a_string_matching(%r{ - \w interface_clearContent}),
115
- #a_string_matching(%r{ - \w interface_deleteContent}),
116
- #a_string_matching(%r{ - \w interface_downloadContent}),
117
- #a_string_matching(%r{ - \w interface_getGatewayResource}),
118
- #a_string_matching(%r{ - \w interface_getGatewaySettings}),
119
- #a_string_matching(%r{ - \w interface_getIdentity}),
120
- #a_string_matching(%r{ - \w interface_getIdentityState}),
121
- #a_string_matching(%r{ - \w interface_infoContent}),
122
- #a_string_matching(%r{ - \w interface_listContent}),
123
- #a_string_matching(%r{ - \w interface_listIdentities}),
124
- #a_string_matching(%r{ - \w interface_makeIdentity}),
125
- #a_string_matching(%r{ - \w interface_removeGatewayResource}),
126
- #a_string_matching(%r{ - \w interface_removeIdentity}),
127
- #a_string_matching(%r{ - \w interface_setIdentityState}),
128
- #a_string_matching(%r{ - \w interface_updateGatewayResource}),
129
- #a_string_matching(%r{ - \w interface_updateGatewaySettings}),
130
- #a_string_matching(%r{ - \w interface_updateIdentity}),
131
- #a_string_matching(%r{ - \w interface_uploadContent}),
132
- #a_string_matching(%r{ - \w timer_timer (Application Event Handlers)}),
133
- #a_string_matching(%r{ - \w tsdb_exportJob (Application Event Handlers)}),
134
- #a_string_matching(%r{ - \w user_account (Application Event Handlers)}),
135
- #a_string_matching(%r{ - \w timer_timer}),
136
- #a_string_matching(%r{ - \w tsdb_exportJob}),
137
- #a_string_matching(%r{ - \w user_account}),
138
- a_string_matching(/ M \w timer_timer\.lua/),
139
- a_string_matching(/ M \w tsdb_exportJob\.lua/),
140
- a_string_matching(/ M \w user_account\.lua/),
107
+ a_string_matching(/ - \w user_account\.lua/),
141
108
  )
142
109
  end
143
110
 
@@ -191,7 +158,10 @@ RSpec.describe 'murano status', :cmd, :needs_password do
191
158
  end
192
159
 
193
160
  it 'matches file path', :broken_on_windows do
194
- out, err, status = Open3.capture3(capcmd('murano', 'status', '**/icon.png'))
161
+ # capcmd calls shellwords, which escapes strings so that Open3 doesn't
162
+ # expand them. E.g., **/ would expand to the local directory name.
163
+ status_cmd = capcmd('murano', 'status', '**/icon.png')
164
+ out, err, status = Open3.capture3(status_cmd)
195
165
  expect(err).to eq('')
196
166
  expect(out.lines).to match(
197
167
  [
@@ -231,7 +201,10 @@ RSpec.describe 'murano status', :cmd, :needs_password do
231
201
  File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
232
202
  'specs/resources.yaml',
233
203
  )
234
- FileUtils.copy(File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml'), 'test.murano')
204
+ FileUtils.copy(
205
+ File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml'),
206
+ 'test.murano'
207
+ )
235
208
  end
236
209
 
237
210
  it 'status' do
@@ -297,16 +270,9 @@ RSpec.describe 'murano status', :cmd, :needs_password do
297
270
  expect(olines[0]).to eq("Only on local machine:\n")
298
271
  match_syncable_contents_resources(olines[1..4])
299
272
  match_syncable_contents_except_single_route(olines[5..11])
300
- #expect(olines[12]).to eq("Only on remote server:\n")
301
- #match_remote_boilerplate_v1_0_0_service(olines[13..15])
302
- expect(olines[12]).to eq("Nothing new remotely\n")
303
- #expect(olines[16]).to eq("Nothing that differs\n")
304
- ##expect(olines[11]).to eq("Items that differ:\n")
305
- ##expect(olines[12..12]).to contain_exactly(
306
- ## a_string_matching(%r{ M \w .*services/devdata\.lua}),
307
- ##)
308
- expect(olines[13]).to eq("Items that differ:\n")
309
- match_remote_boilerplate_v1_0_0_service(olines[14..16])
273
+ expect(olines[12]).to eq("Only on remote server:\n")
274
+ match_remote_boilerplate_v1_0_0_service(olines[13..13])
275
+ expect(olines[14]).to eq("Nothing that differs\n")
310
276
  expect(status.exitstatus).to eq(0)
311
277
  end
312
278
  end
@@ -326,7 +292,8 @@ RSpec.describe 'murano status', :cmd, :needs_password do
326
292
  default_page: 'index.html',
327
293
  assets: 'files',
328
294
  routes: 'routes/manyRoutes.lua',
329
- # Note that singleRoute.lua is not included, so it won't be seen by status command.
295
+ # Note that singleRoute.lua is not included, so it won't be seen
296
+ # by status command.
330
297
  modules: {
331
298
  table_util: 'modules/table_util.lua',
332
299
  },
@@ -342,18 +309,14 @@ RSpec.describe 'murano status', :cmd, :needs_password do
342
309
 
343
310
  it 'status' do
344
311
  out, err, status = Open3.capture3(capcmd('murano', 'status'))
345
- # pp out.split "\n"
346
312
  expect(err).to eq('')
347
313
  olines = out.lines
348
314
  expect(olines[0]).to eq("Only on local machine:\n")
349
315
  match_syncable_contents_resources(olines[1..4])
350
316
  match_syncable_contents_except_single_route(olines[5..11])
351
- #expect(olines[12]).to eq("Only on remote server:\n")
352
- #match_remote_boilerplate_v1_0_0_service(olines[13..15])
353
- expect(olines[12]).to eq("Nothing new remotely\n")
354
- #expect(olines[16]).to eq("Nothing that differs\n")
355
- expect(olines[13]).to eq("Items that differ:\n")
356
- match_remote_boilerplate_v1_0_0_service(olines[14..16])
317
+ expect(olines[12]).to eq("Only on remote server:\n")
318
+ match_remote_boilerplate_v1_0_0_service(olines[13..13])
319
+ expect(olines[14]).to eq("Nothing that differs\n")
357
320
  expect(status.exitstatus).to eq(0)
358
321
  end
359
322
  end
@@ -1,13 +1,12 @@
1
- # Last Modified: 2017.09.28 /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
  # NOTE: This file is a copy of, and subset of, cmd_syncdown_both_spec.rb.
@@ -48,8 +47,8 @@ RSpec.describe 'murano single sync', :cmd, :needs_password do
48
47
  expect(out_lines).to match_array(
49
48
  [
50
49
  "Adding item table_util\n",
51
- a_string_starting_with('Updating item '),
52
- "Updating item user_account\n",
50
+ "Removing item user_account\n",
51
+ "Updating item timer_timer\n",
53
52
  "Adding item POST_/api/fire\n",
54
53
  "Adding item PUT_/api/fire/{code}\n",
55
54
  "Adding item DELETE_/api/fire/{code}\n",
@@ -71,9 +70,7 @@ RSpec.describe 'murano single sync', :cmd, :needs_password do
71
70
  expect(out_lines).to match_array(
72
71
  [
73
72
  "Adding item table_util\n",
74
- # 2017-08-08: This says updating now because timer.timer is undeletable.
75
- #"Adding item timer_timer\n",
76
- "Updating item timer_timer\n",
73
+ "Adding item timer_timer\n",
77
74
  "Adding item POST_/api/fire\n",
78
75
  "Adding item DELETE_/api/fire/{code}\n",
79
76
  "Adding item PUT_/api/fire/{code}\n",
@@ -1,13 +1,12 @@
1
- # Last Modified: 2017.09.25 /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 syncdown', :cmd, :needs_password do
@@ -84,14 +83,11 @@ RSpec.describe 'murano syncdown', :cmd, :needs_password do
84
83
  expect(out_lines).to match_array(
85
84
  [
86
85
  "Adding item table_util\n",
87
- "Updating item timer_timer\n",
88
- # E.g., "Updating item i4kl64nn86xk00000_event\n":
86
+ # Removes: user_account, ijf5pb3juwd40000_event
87
+ a_string_starting_with('Removing item '),
88
+ a_string_starting_with('Removing item '),
89
+ # Updates: timer_timer
89
90
  a_string_starting_with('Updating item '),
90
- "Updating item tsdb_exportJob\n",
91
- "Updating item user_account\n",
92
- # FIXME/2017-08-09: This test includes a fixture with "device2 data_in",
93
- # which is deprecated, AFAIK [lb]. We convert it to "device2.event",
94
- # but I think what we really want is to edit "<solution_id>.event".
95
91
  "Adding item device2_event\n",
96
92
  "Adding item POST_/api/fire\n",
97
93
  "Adding item PUT_/api/fire/{code}\n",
@@ -115,10 +111,9 @@ RSpec.describe 'murano syncdown', :cmd, :needs_password do
115
111
  out_lines = out.lines.map { |line| strip_fancy(line) }
116
112
  expect(out_lines).to match_array(
117
113
  [
114
+ "Updating local product resources\n",
118
115
  "Adding item table_util\n",
119
- # 2017-08-08: This says updating now because timer.timer is undeletable.
120
- #"Adding item timer_timer\n",
121
- "Updating item timer_timer\n",
116
+ "Adding item timer_timer\n",
122
117
  "Adding item POST_/api/fire\n",
123
118
  "Adding item DELETE_/api/fire/{code}\n",
124
119
  "Adding item PUT_/api/fire/{code}\n",
@@ -128,16 +123,6 @@ RSpec.describe 'murano syncdown', :cmd, :needs_password do
128
123
  "Adding item /\n",
129
124
  ]
130
125
  )
131
- # Look for skipping missing location lines, e.g.,
132
- # "\e[33mSkipping missing location /tmp/d20170623-20035-17496y/project/modules\e[0m\n"
133
- # 2017-07-03: Did I [lb] change syncdown not to complain about missing locations?
134
- #expect(err.lines).to include(
135
- # a_string_ending_with("routes\e[0m\n"),
136
- # a_string_ending_with("files\e[0m\n"),
137
- # a_string_ending_with("modules\e[0m\n"),
138
- # a_string_ending_with("services\e[0m\n"),
139
- #)
140
- #expect(err).to eq('')
141
126
  expect(strip_fancy(err)).to start_with("\e[33mSkipping missing location '")
142
127
  expect(status.exitstatus).to eq(0)
143
128
 
@@ -1,13 +1,12 @@
1
- # Last Modified: 2017.09.20 /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 syncup', :cmd, :needs_password do
@@ -15,13 +14,17 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
15
14
 
16
15
  before(:example) do
17
16
  @product_name = rname('syncupTestPrd')
18
- out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @product_name, '--save'))
17
+ out, err, status = Open3.capture3(
18
+ capcmd('murano', 'product', 'create', @product_name, '--save')
19
+ )
19
20
  expect(err).to eq('')
20
21
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
21
22
  expect(status.exitstatus).to eq(0)
22
23
 
23
24
  @applctn_name = rname('syncupTestApp')
24
- out, err, status = Open3.capture3(capcmd('murano', 'application', 'create', @applctn_name, '--save'))
25
+ out, err, status = Open3.capture3(
26
+ capcmd('murano', 'application', 'create', @applctn_name, '--save')
27
+ )
25
28
  expect(err).to eq('')
26
29
  soln_id = out
27
30
  expect(soln_id.chomp).to match(/^[a-zA-Z0-9]+$/)
@@ -30,18 +33,24 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
30
33
  out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
31
34
  #expect(out).to a_string_starting_with("Linked product #{@product_name}")
32
35
  olines = out.lines
33
- expect(strip_fancy(olines[0])).to eq("Linked '#{@product_name}' to '#{@applctn_name}'\n")
36
+ expect(strip_fancy(olines[0]))
37
+ .to eq("Linked '#{@product_name}' to '#{@applctn_name}'\n")
34
38
  expect(olines[1]).to eq("Created default event handler\n")
35
39
  expect(err).to eq('')
36
40
  expect(status.exitstatus).to eq(0)
37
41
  end
42
+
38
43
  after(:example) do
39
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @applctn_name, '-y'))
44
+ out, err, status = Open3.capture3(
45
+ capcmd('murano', 'solution', 'delete', @applctn_name, '-y')
46
+ )
40
47
  expect(out).to eq('')
41
48
  expect(err).to eq('')
42
49
  expect(status.exitstatus).to eq(0)
43
50
 
44
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @product_name, '-y'))
51
+ out, err, status = Open3.capture3(
52
+ capcmd('murano', 'solution', 'delete', @product_name, '-y')
53
+ )
45
54
  expect(out).to eq('')
46
55
  expect(err).to eq('')
47
56
  expect(status.exitstatus).to eq(0)
@@ -61,8 +70,10 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
61
70
  def verify_err_missing_location(err)
62
71
  elines = err.lines
63
72
  # E.g.,
64
- # Skipping missing location ‘/tmp/d20170809-7670-z315jn/project/services’ (Services)
65
- # Skipping missing location ‘/tmp/d20170809-7670-z315jn/project/services’ (Interfaces)
73
+ # Skipping missing location
74
+ # ‘/tmp/d20170809-7670-z315jn/project/services’ (Services)
75
+ # Skipping missing location
76
+ # ‘/tmp/d20170809-7670-z315jn/project/services’ (Interfaces)
66
77
  expect(elines).to(satisfy { |_v| elines.length == 2 })
67
78
  elines.each do |line|
68
79
  expect(strip_fancy(line)).to start_with("\e[33mSkipping missing location '")
@@ -73,40 +84,23 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
73
84
  out, err, status = Open3.capture3(capcmd('murano', 'syncup'))
74
85
  outl = out.lines
75
86
  # The spec tests set --no-progress, so each sync action gets reported.
76
- #expect(outl[0]).to eq("Adding item state\n")
77
- #expect(outl[1]).to eq("Adding item temperature\n")
78
- #expect(outl[2]).to eq("Adding item uptime\n")
79
- #expect(outl[3]).to eq("Adding item humidity\n")
80
87
  (0..3).each { |ln| expect(outl[ln]).to start_with('Adding item ') }
81
- expect(outl[4]).to eq("Updating product resources\n")
88
+ expect(outl[4]).to eq("Updating remote product resources\n")
82
89
  # Windows is insane:
83
90
  # "Adding item ........................Administrator.AppData.Local.Temp.2.d20170913-3860-pgji6g.project.modules.table_util\n"
84
- #expect(outl[5]).to eq("Adding item table_util\n")
91
+ # So we can't do this:
92
+ # expect(outl[5]).to eq("Adding item table_util\n")
85
93
  expect(outl[5]).to start_with('Adding item ')
86
94
  expect(outl[5]).to end_with("table_util\n")
87
- #expect(outl[6]).to eq("Updating item c3juj9vnmec000000_event\n")
88
- # The order isn't always consistent, so just do start_with.
89
- #expect(outl[7]).to eq("Updating item timer_timer\n")
90
- #expect(outl[8]).to eq("Updating item user_account\n")
91
- #expect(outl[9]).to eq("Updating item tsdb_exportJob\n")
92
- (6..9).each { |ln| expect(outl[ln]).to start_with('Updating item ') }
93
- #expect(outl[10]).to eq("Adding item POST_/api/fire\n")
94
- #expect(outl[11]).to eq("Adding item PUT_/api/fire/{code}\n")
95
- #expect(outl[12]).to eq("Adding item DELETE_/api/fire/{code}\n")
96
- #expect(outl[13]).to eq("Adding item GET_/api/onfire\n")
97
- #expect(outl[14]).to eq("Adding item /icon.png\n")
98
- #expect(outl[15]).to eq("Adding item /\n")
99
- #expect(outl[16]).to eq("Adding item /js/script.js\n")
100
- (10..16).each { |ln| expect(outl[ln]).to start_with('Adding item ') }
95
+ (6..7).each { |ln| expect(outl[ln]).to start_with('Removing item ') }
96
+ (8..14).each { |ln| expect(outl[ln]).to start_with('Adding item ') }
101
97
  verify_err_missing_location(err)
102
98
  expect(status.exitstatus).to eq(0)
103
99
 
104
100
  out, err, status = Open3.capture3(capcmd('murano', 'status'))
105
- #expect(out).to start_with(%(Adding:\nDeleting:\nChanging:\n))
106
- #expect(out).to start_with(%(Nothing to add\nNothing to delete\nNothing to change\n))
107
- expect(out).to start_with(%(Nothing new locally\nNothing new remotely\nNothing that differs\n))
108
- # Due to timestamp races, there might be modules or services in Changing.
109
- #expect(err).to eq('')
101
+ expect(out).to start_with(
102
+ %(Nothing new locally\nNothing new remotely\nNothing that differs\n)
103
+ )
110
104
  verify_err_missing_location(err)
111
105
  expect(status.exitstatus).to eq(0)
112
106
  end