MuranoCLI 3.2.0.beta.9 → 3.2.1.pre.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/Rakefile +5 -0
  4. data/dockers/README.rst +7 -0
  5. data/dockers/RELEASE.rst +6 -3
  6. data/dockers/docker-test.sh +45 -17
  7. data/docs/completions/murano_completion-bash +211 -86
  8. data/lib/MrMurano/Account.rb +72 -4
  9. data/lib/MrMurano/Business.rb +163 -2
  10. data/lib/MrMurano/Commander-Entry.rb +1 -2
  11. data/lib/MrMurano/Config.rb +19 -18
  12. data/lib/MrMurano/Content.rb +26 -19
  13. data/lib/MrMurano/Gateway.rb +51 -10
  14. data/lib/MrMurano/ReCommander.rb +1 -1
  15. data/lib/MrMurano/Solution-Services.rb +80 -35
  16. data/lib/MrMurano/Solution-Users.rb +1 -0
  17. data/lib/MrMurano/SyncRoot.rb +10 -3
  18. data/lib/MrMurano/SyncUpDown-Core.rb +47 -36
  19. data/lib/MrMurano/SyncUpDown-Item.rb +46 -14
  20. data/lib/MrMurano/SyncUpDown.rb +22 -20
  21. data/lib/MrMurano/Webservice-Endpoint.rb +20 -18
  22. data/lib/MrMurano/Webservice-File.rb +63 -20
  23. data/lib/MrMurano/commands/business.rb +14 -1
  24. data/lib/MrMurano/commands/child.rb +148 -0
  25. data/lib/MrMurano/commands/devices.rb +298 -149
  26. data/lib/MrMurano/commands/element.rb +2 -1
  27. data/lib/MrMurano/commands/globals.rb +3 -0
  28. data/lib/MrMurano/commands/network.rb +152 -33
  29. data/lib/MrMurano/commands/sync.rb +2 -2
  30. data/lib/MrMurano/commands.rb +1 -0
  31. data/lib/MrMurano/verbosing.rb +13 -2
  32. data/lib/MrMurano/version.rb +1 -1
  33. data/spec/Account_spec.rb +43 -11
  34. data/spec/Content_spec.rb +5 -3
  35. data/spec/GatewayBase_spec.rb +1 -1
  36. data/spec/GatewayDevice_spec.rb +47 -8
  37. data/spec/GatewayResource_spec.rb +1 -1
  38. data/spec/GatewaySettings_spec.rb +1 -1
  39. data/spec/HttpAuthed_spec.rb +17 -3
  40. data/spec/ProjectFile_spec.rb +59 -23
  41. data/spec/Setting_spec.rb +2 -1
  42. data/spec/Solution-ServiceConfig_spec.rb +1 -1
  43. data/spec/Solution-ServiceEventHandler_spec.rb +27 -20
  44. data/spec/Solution-ServiceModules_spec.rb +7 -5
  45. data/spec/Solution-UsersRoles_spec.rb +7 -1
  46. data/spec/Solution_spec.rb +9 -1
  47. data/spec/SyncRoot_spec.rb +5 -5
  48. data/spec/SyncUpDown_spec.rb +262 -211
  49. data/spec/Verbosing_spec.rb +49 -8
  50. data/spec/Webservice-Cors_spec.rb +10 -1
  51. data/spec/Webservice-Endpoint_spec.rb +84 -65
  52. data/spec/Webservice-File_spec.rb +16 -11
  53. data/spec/Webservice-Setting_spec.rb +7 -1
  54. data/spec/_workspace.rb +9 -0
  55. data/spec/cmd_business_spec.rb +5 -10
  56. data/spec/cmd_common.rb +67 -32
  57. data/spec/cmd_config_spec.rb +9 -14
  58. data/spec/cmd_content_spec.rb +15 -26
  59. data/spec/cmd_cors_spec.rb +9 -12
  60. data/spec/cmd_device_spec.rb +31 -45
  61. data/spec/cmd_domain_spec.rb +12 -10
  62. data/spec/cmd_element_spec.rb +18 -17
  63. data/spec/cmd_exchange_spec.rb +1 -4
  64. data/spec/cmd_init_spec.rb +56 -72
  65. data/spec/cmd_keystore_spec.rb +17 -26
  66. data/spec/cmd_link_spec.rb +13 -17
  67. data/spec/cmd_password_spec.rb +9 -10
  68. data/spec/cmd_setting_application_spec.rb +95 -68
  69. data/spec/cmd_setting_product_spec.rb +59 -37
  70. data/spec/cmd_status_spec.rb +46 -84
  71. data/spec/cmd_syncdown_application_spec.rb +28 -50
  72. data/spec/cmd_syncdown_both_spec.rb +44 -93
  73. data/spec/cmd_syncdown_unit_spec.rb +858 -0
  74. data/spec/cmd_syncup_spec.rb +21 -56
  75. data/spec/cmd_token_spec.rb +0 -3
  76. data/spec/cmd_usage_spec.rb +15 -10
  77. data/spec/dry_run_formatter.rb +1 -0
  78. data/spec/fixtures/dumped_config +4 -4
  79. data/spec/spec_helper.rb +3 -0
  80. metadata +4 -2
@@ -16,46 +16,41 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
16
16
  murano_solutions_expunge_yes
17
17
 
18
18
  @product_name = rname('syncupTestPrd')
19
- out, err, status = Open3.capture3(
20
- capcmd('murano', 'product', 'create', @product_name, '--save')
19
+ out, err = murano_command_run(
20
+ 'solution create', '--type', 'product', @product_name, '--save',
21
21
  )
22
22
  expect(err).to eq('')
23
23
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
24
- expect(status.exitstatus).to eq(0)
25
24
 
26
25
  @applctn_name = rname('syncupTestApp')
27
- out, err, status = Open3.capture3(
28
- capcmd('murano', 'application', 'create', @applctn_name, '--save')
26
+ out, err = murano_command_run(
27
+ 'solution create', '--type', 'application', @applctn_name, '--save',
29
28
  )
30
29
  expect(err).to eq('')
31
30
  soln_id = out
32
31
  expect(soln_id.chomp).to match(/^[a-zA-Z0-9]+$/)
33
- expect(status.exitstatus).to eq(0)
34
32
 
35
- out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
33
+ out, err = murano_command_run('assign set')
36
34
  #expect(out).to a_string_starting_with("Linked product #{@product_name}")
37
35
  olines = out.lines
38
36
  expect(strip_fancy(olines[0]))
39
37
  .to eq("Linked '#{@product_name}' to '#{@applctn_name}'\n")
40
38
  expect(olines[1]).to eq("Created default event handler\n")
41
39
  expect(err).to eq('')
42
- expect(status.exitstatus).to eq(0)
43
40
  end
44
41
 
45
42
  after(:example) do
46
- out, err, status = Open3.capture3(
47
- capcmd('murano', 'solution', 'delete', @applctn_name, '-y')
43
+ out, err, status = murano_command_run(
44
+ 'solution delete', @applctn_name, '-y',
48
45
  )
49
46
  expect(out).to eq('')
50
47
  expect(err).to eq('')
51
- expect(status.exitstatus).to eq(0)
52
48
 
53
- out, err, status = Open3.capture3(
54
- capcmd('murano', 'solution', 'delete', @product_name, '-y')
49
+ out, err, status = murano_command_run(
50
+ 'solution delete', @product_name, '-y',
55
51
  )
56
52
  expect(out).to eq('')
57
53
  expect(err).to eq('')
58
- expect(status.exitstatus).to eq(0)
59
54
  end
60
55
 
61
56
  context 'without ProjectFile' do
@@ -78,12 +73,12 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
78
73
  # ‘/tmp/d20170809-7670-z315jn/project/services’ (Interfaces)
79
74
  expect(elines).to(satisfy { |_v| elines.length == 2 })
80
75
  elines.each do |line|
81
- expect(strip_fancy(line)).to start_with("\e[33mSkipping missing location '")
76
+ expect(strip_fancy(line)).to start_with("Skipping missing location '")
82
77
  end
83
78
  end
84
79
 
85
80
  it 'syncup', :club_40s, :club_30s, :club_20s, :club_10s do
86
- out, err, status = Open3.capture3(capcmd('murano', 'syncup'))
81
+ out, err = murano_command_run('syncup')
87
82
  outl = out.lines
88
83
  # The spec tests set --no-progress, so each sync action gets reported.
89
84
  # You'll see:
@@ -101,13 +96,9 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
101
96
  # expect(outl[5]).to eq("Adding item table_util\n")
102
97
  expect(outl[5]).to start_with('Adding item ')
103
98
  expect(outl[5]).to end_with("table_util\n")
104
- # => "Removing item config_service\n",
105
- # => "Removing item config_status\n",
106
- # => "Removing item user_account\n",
107
- # => "Removing item k58sn37r6qz800000_event\n",
108
- # => "Removing item config_service\n",
109
- # => "Removing item config_status\n",
110
- (6..11).each { |ln| expect(outl[ln]).to start_with('Removing item ') }
99
+ expect(outl[6]).to eq("Clearing item user_account\n")
100
+ # => "Clearing item k58sn37r6qz800000_event\n",
101
+ expect(outl[7]).to start_with('Clearing item ')
111
102
  # => "Adding item POST_/api/fire\n",
112
103
  # => "Adding item PUT_/api/fire/{code}\n",
113
104
  # => "Adding item DELETE_/api/fire/{code}\n",
@@ -115,11 +106,10 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
115
106
  # => "Adding item /icon.png\n",
116
107
  # => "Adding item /\n",
117
108
  # => "Adding item /js/script.js\n",
118
- (12..18).each { |ln| expect(outl[ln]).to start_with('Adding item ') }
109
+ (8..14).each { |ln| expect(outl[ln]).to start_with('Adding item ') }
119
110
  verify_err_missing_location(err)
120
- expect(status.exitstatus).to eq(0)
121
111
 
122
- out, err, status = Open3.capture3(capcmd('murano', 'status'))
112
+ out, err = murano_command_run('status')
123
113
  # MUR-6477/MUR-6479: Uploading empty files broken. There's a fix in
124
114
  # the pipeline, but until then, disable the original expect.
125
115
  # FIXME: Why is files/icon.png showing up as different?
@@ -134,41 +124,16 @@ RSpec.describe 'murano syncup', :cmd, :needs_password do
134
124
  expect(out.lines).to match(
135
125
  [
136
126
  "Nothing new locally\n",
137
- "Only on remote server:\n",
138
- " - S config_service\n",
139
- " - S config_status\n",
140
- " - I config_service\n",
141
- " - I config_status\n",
142
- "Items that differ:\n",
143
- # FIXME/MUR-6477/MUR-6479: Remove these two lines after fix released.
144
- " M A files/index.html\n",
145
- " M A files/js/script.js\n",
127
+ "Nothing new remotely\n",
128
+ "Nothing that differs\n",
146
129
  ]
147
130
  )
148
131
  end
149
132
  verify_err_missing_location(err)
150
- expect(status.exitstatus).to eq(0)
151
-
152
- out, err, status = Open3.capture3(capcmd('murano', 'diff'))
153
- expect(out.lines).to match(
154
- [
155
- " - S config_service\n",
156
- " - S config_status\n",
157
- " - I config_service\n",
158
- " - I config_status\n",
159
- # FIXME/MUR-6477/MUR-6479: Uploading empty files is currently broken.
160
- # So these two diffs show the newline kludge. Change this when fixed.
161
- # 2018-04-23 16:30: ???: Happening on Jenkins server:
162
- #" M A files/index.html\n",
163
- #"@@ -1 +0,0 @@\n",
164
- #"-\n",
165
- #" M A files/js/script.js\n",
166
- #"@@ -1 +0,0 @@\n",
167
- #"-\n",
168
- ]
169
- )
133
+
134
+ out, err = murano_command_run('status', '--diff', '--no-grouped')
135
+ expect(out).to eq('')
170
136
  verify_err_missing_location(err)
171
- expect(status.exitstatus).to eq(0)
172
137
  end
173
138
  end
174
139
 
@@ -22,9 +22,6 @@ RSpec.describe 'murano token', :cmd, :needs_password, :nondeterministic do
22
22
  end
23
23
 
24
24
  context 'with project' do
25
- #before(:example) { project_up }
26
- #after(:example) { project_down }
27
-
28
25
  def expect_token_host_user_table(stdout, stderr, num_cols: nil)
29
26
  expect(stderr).to eq('')
30
27
  lines = stdout.lines
@@ -16,27 +16,33 @@ RSpec.describe 'murano usage', :cmd, :needs_password do
16
16
  # NOTE: The usage command works on one or more solutions of any type.
17
17
  @product_name = rname('usageTest')
18
18
 
19
- out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @product_name, '--save'))
19
+ out, err = murano_command_run(
20
+ 'solution create', '--type', 'product', @product_name, '--save',
21
+ )
20
22
  expect(err).to eq('')
21
23
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
22
- expect(status.exitstatus).to eq(0)
23
24
 
24
- out, err, status = Open3.capture3(capcmd('murano', 'application', 'create', @product_name, '--save'))
25
+ out, err = murano_command_run(
26
+ 'solution create', '--type', 'application', @product_name, '--save',
27
+ )
25
28
  expect(err).to eq('')
26
29
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
27
- expect(status.exitstatus).to eq(0)
28
30
  end
31
+
29
32
  after(:example) do
30
- out, err, status = Open3.capture3(capcmd('murano', 'solutions', 'expunge', '--yes'))
33
+ out, err = murano_command_run('solutions expunge', '--yes')
31
34
  expect(out).to eq("Deleted 2 solutions\n")
32
35
  expect(err).to eq('')
33
- expect(status.exitstatus).to eq(0)
34
36
  end
35
37
 
36
38
  def confirm_usage_table(olines, ix)
37
- expect(olines[ix + 0]).to match(%r{^(Product|Application): usage[tT]est[a-z0-9]+ <[a-z0-9]+> https://[.\-a-z0-9]+$})
39
+ expect(olines[ix + 0]).to match(
40
+ %r{^(Product|Application): usage[tT]est[a-z0-9]+ <[a-z0-9]+> https://[.\-a-z0-9]+$}
41
+ )
38
42
  expect(olines[ix + 1]).to match(/^(\+-+){5}\+$/)
39
- expect(olines[ix + 2]).to match(/^\|\s+\| Quota\s+\| Daily\s+\| Monthly\s+\| Total\s+\|$/)
43
+ expect(olines[ix + 2]).to match(
44
+ /^\|\s+\| Quota\s+\| Daily\s+\| Monthly\s+\| Total\s+\|$/
45
+ )
40
46
  # Beneath the header row is a splitter line.
41
47
  expect(olines[ix + 3]).to match(/^(\+-+){5}\+$/)
42
48
  ix += 4
@@ -54,13 +60,12 @@ RSpec.describe 'murano usage', :cmd, :needs_password do
54
60
  end
55
61
 
56
62
  it 'show usage', :club_10s do
57
- out, err, status = Open3.capture3(capcmd('murano', 'usage'))
63
+ out, err = murano_command_run('usage')
58
64
  expect(err).to eq('')
59
65
  olines = out.lines
60
66
  ix = 0
61
67
  ix = confirm_usage_table(olines, ix)
62
68
  _ix = confirm_usage_table(olines, ix)
63
- expect(status.exitstatus).to eq(0)
64
69
  end
65
70
  end
66
71
 
@@ -20,6 +20,7 @@ class DryRunFormatter < RSpec::Core::Formatters::BaseFormatter
20
20
  RSpec::Core::Formatters.register self, :example_started
21
21
 
22
22
  def start(example_count)
23
+ # 2018-07-26: (lb): "Running 538 specs."
23
24
  output << "Running #{example_count.count} specs\n"
24
25
  exit(0)
25
26
  end
@@ -20,8 +20,8 @@ protocol = https
20
20
 
21
21
  [location]
22
22
  base = <%= File.realpath(@project_dir) %>
23
- files = files
24
- endpoints = routes
23
+ files = assets
24
+ endpoints = endpoints
25
25
  modules = modules
26
26
  eventhandlers = services
27
27
  resources = specs/resources.yaml
@@ -36,14 +36,14 @@ searchFor = **/*
36
36
  ignoring =
37
37
 
38
38
  [endpoints]
39
- searchFor = {,../endpoints}/*.lua {,../endpoints}s/*/*.lua
39
+ searchFor = {,../endpoints}/*.lua {,../endpoints}/*/*.lua
40
40
  ignoring = *_test.lua *_spec.lua .*
41
41
 
42
42
  [eventhandler]
43
43
  searchFor = *.lua */*.lua {../eventhandlers,../event_handler}/*.lua {../eventhandlers,../event_handler}/*/*.lua
44
44
  ignoring = *_test.lua *_spec.lua .*
45
45
  skiplist = device.service_call device2.event interface webservice websocket
46
- undeletable = *.event timer.timer tsdb.exportJob user.account
46
+ undeletable = *.event timer.timer tsdb.exportJob user.account config.service config.status
47
47
 
48
48
  [modules]
49
49
  searchFor = *.lua **/*.lua
data/spec/spec_helper.rb CHANGED
@@ -36,6 +36,9 @@ RSpec.configure do |config|
36
36
  config.filter_run_excluding :needs_password if ENV['MURANO_PASSWORD'].nil?
37
37
  config.filter_run_excluding :broken_on_windows if Gem.win_platform?
38
38
 
39
+ # FIXME/2018-07-12: (lb): Make test acct. with element. 'til then: disabled.
40
+ config.filter_run_excluding :needs_exchange_element
41
+
39
42
  # rspec-expectations config goes here. You can use an alternate
40
43
  # assertion/expectation library such as wrong or the stdlib/minitest
41
44
  # assertions if you prefer.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MuranoCLI
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0.beta.9
4
+ version: 3.2.1.pre.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: certified
@@ -528,6 +528,7 @@ files:
528
528
  - lib/MrMurano/Webservice.rb
529
529
  - lib/MrMurano/commands.rb
530
530
  - lib/MrMurano/commands/business.rb
531
+ - lib/MrMurano/commands/child.rb
531
532
  - lib/MrMurano/commands/completion-bash.erb
532
533
  - lib/MrMurano/commands/completion-zsh.erb
533
534
  - lib/MrMurano/commands/completion.rb
@@ -626,6 +627,7 @@ files:
626
627
  - spec/cmd_status_spec.rb
627
628
  - spec/cmd_syncdown_application_spec.rb
628
629
  - spec/cmd_syncdown_both_spec.rb
630
+ - spec/cmd_syncdown_unit_spec.rb
629
631
  - spec/cmd_syncup_spec.rb
630
632
  - spec/cmd_token_spec.rb
631
633
  - spec/cmd_usage_spec.rb