MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +10 -0
  3. data/MuranoCLI.gemspec +37 -6
  4. data/Rakefile +38 -11
  5. data/lib/MrMurano/commands/business.rb +0 -4
  6. data/lib/MrMurano/version.rb +1 -1
  7. metadata +2 -251
  8. data/dockers/Dockerfile.2.2.9 +0 -40
  9. data/dockers/Dockerfile.2.3.6 +0 -40
  10. data/dockers/Dockerfile.2.4.3 +0 -40
  11. data/dockers/Dockerfile.2.5.0 +0 -40
  12. data/dockers/Dockerfile.GemRelease +0 -49
  13. data/dockers/Dockerfile.m4 +0 -122
  14. data/dockers/README.rst +0 -362
  15. data/dockers/RELEASE.rst +0 -135
  16. data/dockers/docker-test.sh +0 -163
  17. data/dockers/gem-release.sh +0 -4
  18. data/docs/basic_example.rst +0 -436
  19. data/docs/ci/.trustme.plugin +0 -140
  20. data/docs/ci/.trustme.sh +0 -516
  21. data/docs/ci/.trustme.vim +0 -55
  22. data/docs/completions/murano_completion-bash +0 -4484
  23. data/docs/demo.md +0 -109
  24. data/docs/develop.rst +0 -392
  25. data/docs/release.rst +0 -295
  26. data/spec/Account-Passwords_spec.rb +0 -245
  27. data/spec/Account_spec.rb +0 -256
  28. data/spec/Business_spec.rb +0 -307
  29. data/spec/ConfigFile_spec.rb +0 -55
  30. data/spec/ConfigMigrate_spec.rb +0 -108
  31. data/spec/Config_spec.rb +0 -440
  32. data/spec/Content_spec.rb +0 -422
  33. data/spec/GatewayBase_spec.rb +0 -65
  34. data/spec/GatewayDevice_spec.rb +0 -403
  35. data/spec/GatewayResource_spec.rb +0 -283
  36. data/spec/GatewaySettings_spec.rb +0 -130
  37. data/spec/HttpAuthed_spec.rb +0 -87
  38. data/spec/Http_spec.rb +0 -220
  39. data/spec/MakePretties_spec.rb +0 -127
  40. data/spec/Mock_spec.rb +0 -62
  41. data/spec/ProjectFile_spec.rb +0 -381
  42. data/spec/Setting_spec.rb +0 -120
  43. data/spec/Solution-ServiceConfig_spec.rb +0 -272
  44. data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
  45. data/spec/Solution-ServiceModules_spec.rb +0 -562
  46. data/spec/Solution-UsersRoles_spec.rb +0 -269
  47. data/spec/Solution_spec.rb +0 -140
  48. data/spec/SyncRoot_spec.rb +0 -111
  49. data/spec/SyncUpDown_spec.rb +0 -868
  50. data/spec/Verbosing_spec.rb +0 -332
  51. data/spec/Webservice-Cors_spec.rb +0 -225
  52. data/spec/Webservice-Endpoint_spec.rb +0 -650
  53. data/spec/Webservice-File_spec.rb +0 -282
  54. data/spec/Webservice-Setting_spec.rb +0 -105
  55. data/spec/_workspace.rb +0 -43
  56. data/spec/cmd_business_spec.rb +0 -64
  57. data/spec/cmd_common.rb +0 -507
  58. data/spec/cmd_config_spec.rb +0 -73
  59. data/spec/cmd_content_spec.rb +0 -109
  60. data/spec/cmd_cors_spec.rb +0 -54
  61. data/spec/cmd_device_spec.rb +0 -130
  62. data/spec/cmd_domain_spec.rb +0 -62
  63. data/spec/cmd_element_spec.rb +0 -401
  64. data/spec/cmd_exchange_spec.rb +0 -114
  65. data/spec/cmd_help_spec.rb +0 -72
  66. data/spec/cmd_init_spec.rb +0 -475
  67. data/spec/cmd_keystore_spec.rb +0 -97
  68. data/spec/cmd_link_spec.rb +0 -105
  69. data/spec/cmd_logs_spec.rb +0 -162
  70. data/spec/cmd_password_spec.rb +0 -64
  71. data/spec/cmd_setting_application_spec.rb +0 -300
  72. data/spec/cmd_setting_product_spec.rb +0 -246
  73. data/spec/cmd_status_spec.rb +0 -300
  74. data/spec/cmd_syncdown_application_spec.rb +0 -128
  75. data/spec/cmd_syncdown_both_spec.rb +0 -178
  76. data/spec/cmd_syncdown_unit_spec.rb +0 -861
  77. data/spec/cmd_syncup_spec.rb +0 -148
  78. data/spec/cmd_token_spec.rb +0 -53
  79. data/spec/cmd_usage_spec.rb +0 -79
  80. data/spec/dry_run_formatter.rb +0 -28
  81. data/spec/fixtures/.mrmuranorc +0 -9
  82. data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
  83. data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
  84. data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
  85. data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
  86. data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
  87. data/spec/fixtures/SolutionFiles/0.2.json +0 -21
  88. data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
  89. data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
  90. data/spec/fixtures/SolutionFiles/0.3.json +0 -20
  91. data/spec/fixtures/SolutionFiles/basic.json +0 -20
  92. data/spec/fixtures/SolutionFiles/secret.json +0 -6
  93. data/spec/fixtures/configfile +0 -9
  94. data/spec/fixtures/dumped_config +0 -57
  95. data/spec/fixtures/exchange_element/element-show.json +0 -1
  96. data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
  97. data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
  98. data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
  99. data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
  100. data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
  101. data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
  102. data/spec/fixtures/mrmuranorc_tool_bob +0 -3
  103. data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
  104. data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
  105. data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
  106. data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
  107. data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
  108. data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
  109. data/spec/fixtures/roles-three.yaml +0 -11
  110. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
  111. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
  112. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
  113. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
  114. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
  115. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
  116. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
  117. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
  118. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
  119. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
  120. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
  121. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
  122. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
  123. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
  124. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
  125. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
  126. data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
  127. data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
  128. data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
  129. data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
  130. data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
  131. data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
  132. data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
  133. data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
  134. data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
  135. data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
  136. data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
  137. data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
  138. data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
  139. data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
  140. data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
  141. data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
  142. data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
  143. data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
  144. data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
  145. data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
  146. data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
  147. data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
  148. data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
  149. data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
  150. data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
  151. data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
  152. data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
  153. data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
  154. data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
  155. data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
  156. data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
  157. data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
  158. data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
  159. data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
  160. data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
  161. data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
  162. data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
  163. data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
  164. data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
  165. data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
  166. data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
  167. data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
  168. data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
  169. data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
  170. data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
  171. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
  172. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
  173. data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
  174. data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
  175. data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
  176. data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
  177. data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
  178. data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
  179. data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
  180. data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
  181. data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
  182. data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
  183. data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
  184. data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
  185. data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
  186. data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
  187. data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
  188. data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
  189. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
  190. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
  191. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
  192. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
  193. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
  194. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
  195. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
  196. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
  197. data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
  198. data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
  199. data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
  200. data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
  201. data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
  202. data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
  203. data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
  204. data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
  205. data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
  206. data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
  207. data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
  208. data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
  209. data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
  210. data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
  211. data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
  212. data/spec/fixtures/syncable_content/assets/icon.png +0 -0
  213. data/spec/fixtures/syncable_content/assets/index.html +0 -0
  214. data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
  215. data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
  216. data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
  217. data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
  218. data/spec/fixtures/websocket/README.rst +0 -110
  219. data/spec/fixtures/websocket/logs_blather.rb +0 -27
  220. data/spec/fixtures/websocket/logs_faker.rb +0 -153
  221. data/spec/fixtures/websocket/simple_connection.rb +0 -45
  222. data/spec/fixtures/websocket/simple_options.rb +0 -77
  223. data/spec/fixtures/websocket/simple_server.rb +0 -69
  224. data/spec/fixtures/websocket/wss-echo.rb +0 -48
  225. data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
  226. data/spec/spec_helper.rb +0 -131
  227. data/spec/variegated_TruthyFalsey_spec.rb +0 -29
  228. data/spec/webmock_snapshot.rb +0 -296
@@ -1,114 +0,0 @@
1
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
- # License: PROPRIETARY. See LICENSE.txt.
3
- # frozen_string_literal: true
4
-
5
- # vim:tw=0:ts=2:sw=2:et:ai
6
- # Unauthorized copying of this file is strictly prohibited.
7
-
8
- require 'fileutils'
9
- require 'open3'
10
-
11
- require 'cmd_common'
12
- require 'MrMurano/Config'
13
-
14
- RSpec.describe 'murano exchange', :cmd, :needs_password do
15
- include_context 'CI_CMD'
16
-
17
- context 'without project' do
18
- it 'help' do
19
- cmd_verify_help('exchange')
20
- end
21
- end
22
-
23
- context 'with project' do
24
- def expect_exchange_element_table(stdout, stderr, num_cols: nil)
25
- expect(stderr).to eq('')
26
- lines = stdout.lines
27
- # FIXME/2017-08-29: Is this too much detail??
28
- # What about running test once, dumping output to file,
29
- # and expecting same output next time?
30
- expect(lines[0]).to match(/^Found [\d]+ elements.$/)
31
- # Outline of table. n columns. '+-----+-----+---...----+\n'
32
- expect(lines[1]).to match(/^(\+-+){#{num_cols}}\+$/)
33
- # Header.
34
- expect(lines[2]).to match(/^\| elementId/)
35
- # Separator.
36
- expect(lines[3]).to match(/^(\+-+){#{num_cols}}\+$/)
37
- # Content. Starts with elementId.
38
- (4..(lines.length - 2)).to_a.each do |line|
39
- expect(lines[line]).to match(/^\| [0-9a-f]+ +\| /)
40
- end
41
- expect(lines[-1]).to match(/^(\+-+){#{num_cols}}\+$/)
42
- end
43
-
44
- context 'list' do
45
- it 'as table' do
46
- stdout, stderr = murano_command_run('exchange list')
47
- # 4 columns: elementId, name, status, description.
48
- expect_exchange_element_table(stdout, stderr, num_cols: 4)
49
- end
50
-
51
- it 'only ids', :club_20s, :club_10s do
52
- stdout, stderr = murano_command_run('exchange list', '--idonly')
53
- expect(stderr).to eq('')
54
- stdout.lines.each do |line|
55
- expect(line).to match(/^[0-9a-f]+$/)
56
- end
57
- end
58
-
59
- it 'fewer fields' do
60
- stdout, stderr = murano_command_run('exchange list', '--brief')
61
- # 3 columns: elementId, name, status.
62
- expect_exchange_element_table(stdout, stderr, num_cols: 3)
63
- end
64
-
65
- it 'as json' do
66
- stdout, stderr = murano_command_run('exchange list', '-c', 'outformat=json')
67
- expect(stderr).to eq('')
68
- expect { JSON.parse(stdout) }.to_not raise_error
69
- #expect(status.exitstatus).to eq(0)
70
- end
71
-
72
- it 'output to file' do
73
- stdout, stderr = murano_command_run('exchange list', '--idonly', '-o', 'bob')
74
- expect(stderr).to eq('')
75
- expect(stdout).to eq('')
76
- #expect(status.exitstatus).to eq(0)
77
- expect(File.exist?('bob')).to be true
78
- data = IO.read('bob')
79
- expect(data).to match(/^(\S+\s)*\S+$/)
80
- end
81
-
82
- context 'purchase' do
83
- # MAYBE/TESTME/2017-08-30: Cannot functional test 'exchange purchase'
84
- # of 'available' element because you cannot un-add elements (you'd
85
- # have to create a new business). We could add a unit test of
86
- # MrMurano::Exchange.purchase, though. But it's just 4 statements,
87
- # and the functional test here for adding an already added element
88
- # also tests that same function. So probably no need to add test.
89
-
90
- it 'is ambiguous name' do
91
- # MEH/2017-08-31: This test is dependent on the platform having
92
- # more than one element with the term 'IoT' in its name!
93
- stdout, stderr = murano_command_exits('exchange purchase', 'IoT')
94
- expect(stdout).to eq('')
95
- expect(stderr).to a_string_starting_with(
96
- "Please be more specific: More than one matching element was found:\n "
97
- )
98
- end
99
-
100
- it 'is already added ID' do
101
- element_name = 'Timer Service'
102
- stdout, _stderr = murano_command_run('exchange list', element_name, '--idonly')
103
- element_id = stdout.strip
104
- stdout, stderr = murano_command_exits('exchange purchase', element_id)
105
- expect(stdout).to eq('')
106
- expect(strip_fancy(stderr)).to eq(
107
- "The specified element has already been purchased: '#{element_name}' (#{element_id})\n"
108
- )
109
- end
110
- end
111
- end
112
- end
113
- end
114
-
@@ -1,72 +0,0 @@
1
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
- # License: PROPRIETARY. See LICENSE.txt.
3
- # frozen_string_literal: true
4
-
5
- # vim:tw=0:ts=2:sw=2:et:ai
6
- # Unauthorized copying of this file is strictly prohibited.
7
-
8
- require 'fileutils'
9
- require 'open3'
10
-
11
- require 'highline/import'
12
-
13
- require 'cmd_common'
14
- require 'MrMurano/progress'
15
-
16
- RSpec.describe 'murano help', :cmd do
17
- include_context 'CI_CMD'
18
-
19
- context 'using subshell' do
20
- it 'no args' do
21
- out, err, status = Open3.capture3(capcmd('murano'))
22
- expect(err).to eq('')
23
- expect(out).to_not eq('')
24
- expect(status.exitstatus).to eq(0)
25
- end
26
-
27
- it 'with --help' do
28
- out, err, status = Open3.capture3(capcmd('murano', '--help'))
29
- expect(err).to eq('')
30
- expect(out).to_not eq('')
31
- expect(status.exitstatus).to eq(0)
32
- end
33
- end
34
-
35
- context 'using commander' do
36
- it 'no args' do
37
- # (lb): Note that the bare command is really the `help` command, e.g.,
38
- # So this:
39
- # out, err, status = Open3.capture3(capcmd('murano'))
40
- # Or this:
41
- # $ murano
42
- # Is the same as this:
43
- # out, err = murano_command_run('help')
44
- out, err = murano_command_run('help')
45
- # The :help command gets processed by optparse, since we did
46
- # not call run!, and optparse looks at $0, which is 'rspec'.
47
- expect(MrMurano::Progress.strip_color(out)).to start_with(
48
- " NAME:\n\n #{File.basename $PROGRAM_NAME}\n\n DESCRIPTION:\n\n "
49
- )
50
- expect(err).to eq('')
51
- end
52
-
53
- it 'as --help' do
54
- stdout, stderr = murano_command_wont_parse('help', '--help')
55
- # See comment above; optparse uses $0, or 'rspec'.
56
- expect(MrMurano::Progress.strip_color(stdout)).to start_with(
57
- "Usage: #{File.basename $PROGRAM_NAME} [options]\n"
58
- )
59
- expect(stderr).to eq('')
60
- end
61
-
62
- # The version flag is processed in ::Commander::Runner.instance.run!,
63
- # which we're not calling, and if we try to test it here, optparse
64
- # ends up trying to handle it and barfs when it cannot find parser.ver
65
- #it 'cannot test version' do
66
- # #stdout, stderr = murano_command_run('-v')
67
- # #stdout, stderr = murano_command_run('help', '-v')
68
- # #stdout, stderr = murano_command_run('help', '--version')
69
- #end
70
- end
71
- end
72
-
@@ -1,475 +0,0 @@
1
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
- # License: PROPRIETARY. See LICENSE.txt.
3
- # frozen_string_literal: true
4
-
5
- # vim:tw=0:ts=2:sw=2:et:ai
6
- # Unauthorized copying of this file is strictly prohibited.
7
-
8
- require 'fileutils'
9
- require 'open3'
10
- require 'cmd_common'
11
-
12
- RSpec.describe 'murano init', :cmd do
13
- include_context 'CI_CMD'
14
-
15
- def expected_response_when_ids_found_in_config(
16
- test,
17
- expect_rebasing: false,
18
- has_one_each_soln: false,
19
- has_no_solutions: false,
20
- expect_proj_file_write: true,
21
- creates_some_default_directories: false,
22
- local_files_found: false,
23
- local_files_found_application: false,
24
- local_files_found_product: false
25
- )
26
- expecting = []
27
- expecting += [
28
- "\n", # 0
29
- ]
30
- if !expect_rebasing
31
- expecting += [
32
- test.a_string_starting_with('Creating project at '), # 1
33
- ]
34
- else
35
- expecting += [
36
- test.a_string_starting_with('Rebasing project at '), # 1
37
- ]
38
- end
39
- expecting += [
40
- "\n", # 2
41
- test.a_string_starting_with('Found User '), # 3
42
- "\n", # 4
43
- test.a_string_starting_with('Found Business '), # 5
44
- "\n", # 6
45
- ]
46
- if has_one_each_soln
47
- expecting += [
48
- a_string_starting_with('This business has one Application. Using '), # 7
49
- "\n", # 8
50
- a_string_starting_with('This business has one Product. Using '), # 9
51
- "\n", # 10
52
- ]
53
- elsif has_no_solutions
54
- expecting += [
55
- "This business does not have any applications. Let's create one\n", # 7
56
- "\n", # 8
57
- "Enter the Application name [leave blank to skip]: \n", # 9
58
- a_string_starting_with('Created new Application: '), # 10
59
- "\n", # 11
60
- "This business does not have any products. Let's create one\n", # 12
61
- "\n", # 13
62
- "Enter the Product name [leave blank to skip]: \n", # 14
63
- a_string_starting_with('Created new Product: '), # 15
64
- "\n", # 16
65
- ]
66
- else
67
- expecting += [
68
- test.a_string_starting_with('Found Application '), # 7
69
- "\n", # 8
70
- test.a_string_starting_with('Found Product '), # 9
71
- "\n", # 10
72
- ]
73
- end
74
- expecting += [
75
- test.a_string_matching(/Linked '\w+' to '\w+'\n/),
76
- "\n",
77
- test.a_string_matching(/Created default event handler\n/),
78
- "\n",
79
- ]
80
- if expect_proj_file_write
81
- expecting += [
82
- "Writing Project file to project.murano\n",
83
- "\n",
84
- ]
85
- end
86
- if !creates_some_default_directories
87
- expecting += [
88
- "Created default directories\n",
89
- ]
90
- else
91
- expecting += [
92
- "Created some default directories\n",
93
- ]
94
- end
95
- expecting += [
96
- "\n",
97
- ]
98
- if local_files_found || local_files_found_application
99
- expecting += [
100
- "Skipping Application Event Handlers: local files found\n",
101
- "\n",
102
- ]
103
- end
104
- if local_files_found || local_files_found_product
105
- expecting += [
106
- "Skipping Product Event Handlers: local files found\n",
107
- "\n",
108
- ]
109
- end
110
-
111
- # 2018-07-23: Currently:
112
- # "Updating local product resources\n",
113
- # "Adding item user_account\n",
114
- # "Adding item g3vm2aa9xjfy00000_event\n",
115
- # "Synced 3 items\n",
116
- expecting += [
117
- "Updating local product resources\n",
118
- ]
119
- 2.times { expecting += [test.a_string_starting_with('Adding item ')] }
120
- expecting += [
121
- "Synced 3 items\n",
122
- "\n",
123
- ]
124
-
125
- expecting += [
126
- "Success!\n",
127
- "\n",
128
- test.a_string_matching(/\s+Business ID: \w+\n/),
129
- test.a_string_matching(/(\s+Application ID: \w+\n)?/),
130
- test.a_string_matching(/(\s+Product ID: \w+\n)?/),
131
- "\n",
132
- ]
133
- expecting
134
- end
135
-
136
- it %(Won't init in HOME (gracefully)) do
137
- # this is in the project dir. Want to be in HOME
138
- Dir.chdir(ENV['HOME']) do
139
- out, err = murano_command_exits('init')
140
- expect(out).to eq('')
141
- expect(err).to eq("Cannot init a project in your HOME directory.\n")
142
- end
143
- end
144
-
145
- context 'in empty directory', :needs_password do
146
- context 'with' do
147
- # Setup a product and application to use.
148
- # Doing this in a context with before&after so that after runs even when test
149
- # fails.
150
- before(:example) do
151
- murano_solutions_expunge_yes
152
-
153
- @applctn_name = @snapshotter.resolve_var(
154
- 'application.name', rname('initEmptyApp')
155
- )
156
- out, err = murano_command_run(
157
- 'solution create', '--type', 'application', @applctn_name, '--save',
158
- )
159
- expect(err).to eq('')
160
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
161
-
162
- @product_name = @snapshotter.resolve_var(
163
- 'product.name', rname('initEmptyPrd')
164
- )
165
- out, err = murano_command_run(
166
- 'solution create', '--type', 'product', @product_name, '--save',
167
- )
168
- expect(err).to eq('')
169
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
170
-
171
- # delete all of this so it is a empty directory.
172
- FileUtils.remove_entry('.murano')
173
- end
174
-
175
- after(:example) do
176
- out, err = murano_command_run(
177
- 'solution delete', @product_name, '-y',
178
- )
179
- expect(out).to eq('')
180
- expect(err).to eq('')
181
-
182
- out, err = murano_command_run(
183
- 'solution delete', @applctn_name, '-y',
184
- )
185
- expect(out).to eq('')
186
- expect(err).to eq('')
187
- end
188
-
189
- it 'existing project', :club_20s, :club_10s do
190
- # The test account will have one business, one product, and one application.
191
- # So it won't ask any questions.
192
- out, err = murano_command_run('init')
193
- expecting = expected_response_when_ids_found_in_config(
194
- self,
195
- has_one_each_soln: true,
196
- )
197
- out_lines = out.lines.map { |line| strip_fancy(line) }
198
- expect(out_lines).to match_array(expecting)
199
- expect(err).to eq('')
200
-
201
- expect(File.directory?('.murano')).to be true
202
- expect(File.exist?('.murano/config')).to be true
203
- expect(File.directory?('routes')).to be false
204
- expect(File.directory?('endpoints')).to be true
205
- expect(File.directory?('services')).to be true
206
- expect(File.directory?('files')).to be false
207
- expect(File.directory?('assets')).to be true
208
- expect(File.directory?('modules')).to be true
209
- expect(File.directory?('specs')).to be true
210
- end
211
- end
212
-
213
- context 'without', :needs_password do
214
- before(:example) do
215
- murano_solutions_expunge_yes
216
- @applctn_name = @snapshotter.resolve_var(
217
- 'application.name', rname('initCreatingApp')
218
- )
219
- @product_name = @snapshotter.resolve_var(
220
- 'product.name', rname('initCreatingPrd')
221
- )
222
- end
223
- after(:example) do
224
- out, err = murano_command_run(
225
- 'solution delete', @product_name, '-y',
226
- )
227
- expect(out).to eq('')
228
- expect(err).to eq('')
229
-
230
- out, err = murano_command_run(
231
- 'solution delete', @applctn_name, '-y',
232
- )
233
- expect(out).to eq('')
234
- expect(err).to eq('')
235
- end
236
-
237
- it 'existing project', :club_20s, :club_10s do
238
- # The test account will have one business.
239
- # It will ask to create an application and product.
240
- # MAGIC_NUMBER: !!!! the 8 is hardcoded indention here !!!!
241
- # (removes the leading whitespace from the <<-EOT heredoc)
242
- data = <<-DATA.gsub(/^ {8}/, '')
243
- #{@applctn_name}
244
- #{@product_name}
245
- DATA
246
- out, err = murano_command_run('init', stdin_data: data)
247
- expecting = expected_response_when_ids_found_in_config(
248
- self,
249
- has_no_solutions: true,
250
- expect_proj_file_write: true,
251
- )
252
- out_lines = out.lines.map { |line| strip_fancy(line) }
253
- expect(out_lines).to match_array(expecting)
254
- #expect(out.lines).to match_array([
255
- # "\n", # 0
256
- # a_string_starting_with('Creating project at '), # 1
257
- # "\n", # 2
258
- # a_string_starting_with('Found User '), # 3
259
- # "\n", # 4
260
- # a_string_starting_with('Found Business '), # 5
261
- # "\n", # 6
262
- # "This business does not have any applications. Let's create one\n", # 7
263
- # "\n", # 8
264
- # "Please enter the Application name: \n", # 9
265
- # a_string_starting_with('Created new Application: '), # 10
266
- # "\n", # 11
267
- # "This business does not have any products. Let's create one\n", # 12
268
- # "\n", # 13
269
- # "Please enter the Product name: \n", # 14
270
- # a_string_starting_with('Created new Product: '), # 15
271
- # "\n", # 16
272
- # a_string_starting_with("Linked '"), # 17
273
- # "\n", # 18
274
- # "Created default event handler\n", # 19
275
- # "\n", # 20
276
- # "Writing Project file to project.murano\n", # 21
277
- # "\n", # 22
278
- # "Created default directories\n", # 23
279
- # "\n", # 24
280
- # "Success!\n", # 25
281
- # "\n", # 26
282
- # a_string_starting_with(' Business ID: '), # 27
283
- # a_string_starting_with(' Application ID: '), # 28
284
- # a_string_starting_with(' Product ID: '), # 29
285
- # "\n", # 30
286
- #])
287
- expect(err).to eq('')
288
-
289
- expect(File.directory?('.murano')).to be true
290
- expect(File.exist?('.murano/config')).to be true
291
- expect(File.directory?('routes')).to be false
292
- expect(File.directory?('endpoints')).to be true
293
- expect(File.directory?('services')).to be true
294
- expect(File.directory?('files')).to be false
295
- expect(File.directory?('assets')).to be true
296
- expect(File.directory?('modules')).to be true
297
- expect(File.directory?('specs')).to be true
298
- end
299
- end
300
- end
301
-
302
- context 'in existing project directory', :needs_password do
303
- before(:example) do
304
- murano_solutions_expunge_yes
305
-
306
- FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
307
- FileUtils.move('assets', 'files')
308
-
309
- @applctn_name = @snapshotter.resolve_var(
310
- 'application.name', rname('initEmptyApp')
311
- )
312
- out, err = murano_command_run(
313
- 'solution create', '--type', 'application', @applctn_name, '--save',
314
- )
315
- expect(err).to eq('')
316
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
317
-
318
- @product_name = @snapshotter.resolve_var(
319
- 'product.name', rname('initEmptyPrd')
320
- )
321
- out, err = murano_command_run(
322
- 'solution create', '--type', 'product', @product_name, '--save',
323
- )
324
- expect(err).to eq('')
325
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
326
- end
327
-
328
- after(:example) do
329
- Dir.chdir(ENV['HOME']) do
330
- if defined?(@product_name)
331
- out, err = murano_command_run(
332
- 'solution delete', @product_name, '-y',
333
- )
334
- expect(out).to eq('')
335
- expect(err).to eq('')
336
- end
337
-
338
- if defined?(@applctn_name)
339
- out, err = murano_command_run(
340
- 'solution delete', @applctn_name, '-y',
341
- )
342
- expect(out).to eq('')
343
- expect(err).to eq('')
344
- end
345
- end
346
- end
347
-
348
- it 'without ProjectFile', :club_20s, :club_10s do
349
- # The test account will have one business, one product, and one application.
350
- # So it won't ask any questions.
351
- out, err = murano_command_run('init')
352
- the_expected = expected_response_when_ids_found_in_config(
353
- self,
354
- expect_rebasing: true,
355
- creates_some_default_directories: true,
356
- )
357
- out_lines = out.lines.map { |line| strip_fancy(line) }
358
- expect(out_lines).to match_array(the_expected)
359
- expect(err).to eq('')
360
-
361
- expect(File.directory?('.murano')).to be true
362
- expect(File.exist?('.murano/config')).to be true
363
- expect(File.directory?('routes')).to be true
364
- expect(File.directory?('services')).to be true
365
- expect(File.directory?('files')).to be true
366
- expect(File.directory?('modules')).to be true
367
- expect(File.directory?('specs')).to be true
368
- end
369
-
370
- it 'with ProjectFile', :club_20s, :club_10s do
371
- FileUtils.copy(
372
- File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml',),
373
- 'test.murano',
374
- )
375
- # The test account will have one business, one product, and one application.
376
- # So it won't ask any questions.
377
- out, err = murano_command_run('init')
378
- expected = expected_response_when_ids_found_in_config(
379
- self,
380
- expect_rebasing: true,
381
- expect_proj_file_write: false,
382
- creates_some_default_directories: true,
383
- )
384
- out_lines = out.lines.map { |line| strip_fancy(line) }
385
- expect(out_lines).to match_array(expected)
386
- expect(err).to eq('')
387
-
388
- expect(File.directory?('.murano')).to be true
389
- expect(File.exist?('.murano/config')).to be true
390
- expect(File.directory?('routes')).to be true
391
- expect(File.directory?('services')).to be true
392
- expect(File.directory?('files')).to be true
393
- expect(File.directory?('modules')).to be true
394
- expect(File.directory?('specs')).to be true
395
- end
396
-
397
- it 'with SolutionFile 0.2.0', :club_20s, :club_10s do
398
- File.open('Solutionfile.json', 'wb') do |io|
399
- io << {
400
- default_page: 'index.html',
401
- file_dir: 'files',
402
- custom_api: 'routes/manyRoutes.lua',
403
- modules: {
404
- table_util: 'modules/table_util.lua',
405
- },
406
- event_handler: {
407
- device: {
408
- datapoint: 'services/devdata.lua',
409
- },
410
- },
411
- }.to_json
412
- end
413
- # The test account will have one business, one product, and one application.
414
- # So it won't ask any questions.
415
- # NOTE: This tests uses an old Solutionfile.json, config v0.2.0, and it
416
- # downloads Lua scripts to the root of the project directory. Just FYI.
417
- out, err = murano_command_run('init')
418
- expected = expected_response_when_ids_found_in_config(
419
- self,
420
- expect_rebasing: true,
421
- creates_some_default_directories: true,
422
- )
423
- out_lines = out.lines.map { |line| strip_fancy(line) }
424
- expect(out_lines).to match_array(expected)
425
- expect(err).to eq('')
426
-
427
- expect(File.directory?('.murano')).to be true
428
- expect(File.exist?('.murano/config')).to be true
429
- expect(File.directory?('routes')).to be true
430
- expect(File.directory?('services')).to be true
431
- expect(File.directory?('files')).to be true
432
- expect(File.directory?('modules')).to be true
433
- expect(File.directory?('specs')).to be true
434
- end
435
-
436
- it 'with SolutionFile 0.3.0', :club_20s, :club_10s do
437
- File.open('Solutionfile.json', 'wb') do |io|
438
- io << {
439
- default_page: 'index.html',
440
- assets: 'files',
441
- routes: 'routes/manyRoutes.lua',
442
- modules: {
443
- table_util: 'modules/table_util.lua',
444
- },
445
- services: {
446
- device: {
447
- datapoint: 'services/devdata.lua',
448
- },
449
- },
450
- version: '0.3.0',
451
- }.to_json
452
- end
453
- # The test account will have one business, one product, and one application.
454
- # So it won't ask any questions.
455
- out, err = murano_command_run('init')
456
- expected = expected_response_when_ids_found_in_config(
457
- self,
458
- expect_rebasing: true,
459
- creates_some_default_directories: true,
460
- )
461
- out_lines = out.lines.map { |line| strip_fancy(line) }
462
- expect(out_lines).to match_array(expected)
463
- expect(err).to eq('')
464
-
465
- expect(File.directory?('.murano')).to be true
466
- expect(File.exist?('.murano/config')).to be true
467
- expect(File.directory?('routes')).to be true
468
- expect(File.directory?('services')).to be true
469
- expect(File.directory?('files')).to be true
470
- expect(File.directory?('modules')).to be true
471
- expect(File.directory?('specs')).to be true
472
- end
473
- end
474
- end
475
-