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
data/spec/Mock_spec.rb DELETED
@@ -1,62 +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 'tempfile'
9
- require 'MrMurano/Config'
10
- require 'MrMurano/Mock'
11
- require '_workspace'
12
-
13
- RSpec.describe MrMurano::Mock, '#mock' do
14
- include_context 'WORKSPACE'
15
- before(:example) do
16
- FileUtils.mkpath(@project_dir + '/routes')
17
- $cfg = MrMurano::Config.new
18
- $cfg.load
19
-
20
- @mock = MrMurano::Mock.new
21
- end
22
-
23
- it 'can create the testpoint file' do
24
- uuid = @mock.create_testpoint
25
- # rubocop:disable Performance/FixedSize
26
- # "Do not compute the size of statically sized objects."
27
- expect(uuid.length).to be('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'.length)
28
- path = @mock.testpoint_path
29
- testpoint = File.read(path)
30
- expect(testpoint.include?(uuid)).to be(true)
31
- end
32
-
33
- it 'can show the UUID from the testpoint file' do
34
- uuid = @mock.create_testpoint
35
- retrieved_uuid = @mock.show
36
- expect(uuid).to eq(retrieved_uuid)
37
- end
38
-
39
- it 'can remove the testpoint file' do
40
- @mock.create_testpoint
41
- path = @mock.testpoint_path
42
- removed = @mock.remove_testpoint
43
- expect(removed).to be(true)
44
- expect(File.exist?(path)).to be(false)
45
- end
46
-
47
- it 'can remove the missing testpoint file' do
48
- path = @mock.testpoint_path
49
- removed = @mock.remove_testpoint
50
- expect(removed).to be(false)
51
- expect(File.exist?(path)).to be(false)
52
- end
53
-
54
- it "cannot show the UUID if there's no testpoint file" do
55
- @mock.create_testpoint
56
- @mock.show
57
- @mock.remove_testpoint
58
- retrieved_uuid = @mock.show
59
- expect(retrieved_uuid).to be(false)
60
- end
61
- end
62
-
@@ -1,381 +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 'MrMurano/version'
10
- require 'MrMurano/Config'
11
- require 'MrMurano/ProjectFile'
12
- require '_workspace'
13
-
14
- RSpec.describe MrMurano::ProjectFile do
15
- context 'Basics' do
16
- include_context 'WORKSPACE'
17
- before(:example) do
18
- $cfg = MrMurano::Config.new
19
- $cfg.load
20
- $cfg['user.name'] = 'bob@builder.co'
21
- $project = nil
22
- end
23
-
24
- context 'No files to load' do
25
- context 'Defaults' do
26
- before(:example) do
27
- @pjf = MrMurano::ProjectFile.new
28
- #@pjf.load
29
- end
30
- it 'Info' do
31
- expect(@pjf.get('info.name')).to eq('project')
32
- expect(@pjf.get('info.summary')).to eq('One line summary of project')
33
- expect(@pjf.get('info.description')).to eq(
34
- "In depth description of project\n\nWith lots of details."
35
- )
36
- expect(@pjf.get('info.authors')).to eq(['bob@builder.co'])
37
- expect(@pjf.get('info.version')).to eq('1.0.0')
38
- end
39
-
40
- it 'Assets' do
41
- # Because defaults before load() are all nil, the default_value_for method
42
- # is called.
43
- expect(@pjf).to receive(
44
- :default_value_for
45
- ).with('assets.location').and_return('here')
46
- expect(@pjf.get('assets.location')).to eq('here')
47
-
48
- expect(@pjf).to receive(
49
- :default_value_for
50
- ).with('assets.include').and_return(['here'])
51
- expect(@pjf.get('assets.include')).to eq(['here'])
52
-
53
- expect(@pjf).to receive(
54
- :default_value_for
55
- ).with('assets.exclude').and_return(['here'])
56
- expect(@pjf.get('assets.exclude')).to eq(['here'])
57
-
58
- expect(@pjf).to receive(
59
- :default_value_for
60
- ).with('assets.default_page').and_return('here')
61
- expect(@pjf.get('assets.default_page')).to eq('here')
62
- end
63
-
64
- it 'Modules' do
65
- # Because defaults before load() are all nil, the default_value_for method
66
- # is called.
67
- expect(@pjf).to receive(
68
- :default_value_for
69
- ).with('modules.location').and_return('here')
70
- expect(@pjf.get('modules.location')).to eq('here')
71
-
72
- expect(@pjf).to receive(
73
- :default_value_for
74
- ).with('modules.include').and_return(['here'])
75
- expect(@pjf.get('modules.include')).to eq(['here'])
76
-
77
- expect(@pjf).to receive(
78
- :default_value_for
79
- ).with('modules.exclude').and_return(['here'])
80
- expect(@pjf.get('modules.exclude')).to eq(['here'])
81
- end
82
-
83
- it 'Routes' do
84
- # Because defaults before load() are all nil, the default_value_for method
85
- # is called.
86
- expect(@pjf).to receive(
87
- :default_value_for
88
- ).with('routes.location').and_return('here')
89
- expect(@pjf.get('routes.location')).to eq('here')
90
-
91
- expect(@pjf).to receive(
92
- :default_value_for
93
- ).with('routes.include').and_return(['here'])
94
- expect(@pjf.get('routes.include')).to eq(['here'])
95
-
96
- expect(@pjf).to receive(
97
- :default_value_for
98
- ).with('routes.exclude').and_return(['here'])
99
- expect(@pjf.get('routes.exclude')).to eq(['here'])
100
- end
101
-
102
- it 'Services' do
103
- # Because defaults before load() are all nil, the default_value_for method
104
- # is called.
105
- expect(@pjf).to receive(
106
- :default_value_for
107
- ).with('services.location').and_return('here')
108
- expect(@pjf.get('services.location')).to eq('here')
109
-
110
- expect(@pjf).to receive(
111
- :default_value_for
112
- ).with('services.include').and_return(['here'])
113
- expect(@pjf.get('services.include')).to eq(['here'])
114
-
115
- expect(@pjf).to receive(
116
- :default_value_for
117
- ).with('services.exclude').and_return(['here'])
118
- expect(@pjf.get('services.exclude')).to eq(['here'])
119
- end
120
- end
121
-
122
- context 'Bad Keys' do
123
- before(:example) do
124
- @pjf = MrMurano::ProjectFile.new
125
- end
126
- it 'Empty' do
127
- expect { @pjf.get('') }.to raise_error('Empty key')
128
- end
129
- it 'No dot' do
130
- expect { @pjf.get('info') }.to raise_error('Missing dot')
131
- end
132
- it 'Undefined key' do
133
- expect { @pjf.get('info.bob') }.to raise_error("no member 'bob' in struct")
134
- end
135
- it 'Undefined section' do
136
- expect { @pjf.get('sob.include') }.to raise_error(NameError)
137
- end
138
- it 'Missing key' do
139
- expect { @pjf.get('info.') }.to raise_error('Missing key')
140
- end
141
- it 'Missing section' do
142
- expect { @pjf.get('.include') }.to raise_error("no member '' in struct")
143
- end
144
- end
145
-
146
- context 'default_value_for mapping' do
147
- before(:example) do
148
- @pjf = MrMurano::ProjectFile.new
149
- end
150
-
151
- it 'returns nil for unmapped key.' do
152
- expect(@pjf.default_value_for('foooood')).to be_nil
153
- end
154
-
155
- it 'hits $cfg if mapped key' do
156
- expect($cfg).to receive(:get).with('location.endpoints').and_return('beef')
157
- expect(@pjf.default_value_for('routes.location')).to eq('beef')
158
- end
159
-
160
- it 'returns array for split values' do
161
- expect($cfg).to receive(:get).with('endpoints.searchFor').and_return('beef')
162
- expect(@pjf.default_value_for('routes.include')).to eq(['beef'])
163
-
164
- expect($cfg).to receive(:get).with(
165
- 'endpoints.searchFor'
166
- ).and_return('beef and potatoes')
167
- expect(
168
- @pjf.default_value_for(
169
- 'routes.include'
170
- )
171
- ).to eq(%w[beef and potatoes])
172
- end
173
- end
174
- end
175
-
176
- context 'Calling load' do
177
- before(:example) do
178
- @pjf = MrMurano::ProjectFile.new
179
- end
180
-
181
- context 'load just meta' do
182
- before(:example) do
183
- src = File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml')
184
- dst = File.join(@project_dir, 'meta.murano')
185
- FileUtils.copy(src, dst)
186
- @pjf.load
187
- end
188
- it 'has the name' do
189
- expect(@pjf.get('info.name')).to eq('tested')
190
- end
191
- it 'has version' do
192
- expect(@pjf.get('info.version')).to eq('1.56.12')
193
- end
194
-
195
- it 'fails back to $cfg' do
196
- expect(@pjf).to receive(
197
- :default_value_for
198
- ).with('routes.include').and_return(['here'])
199
- expect(@pjf.get('routes.include')).to eq(['here'])
200
- end
201
- end
202
-
203
- context 'load custom routes' do
204
- before(:example) do
205
- src = File.join(@testdir, 'spec/fixtures/ProjectFiles/with_routes.yaml')
206
- dst = File.join(@project_dir, 'meta.murano')
207
- FileUtils.copy(src, dst)
208
- @pjf.load
209
- end
210
- it 'has the name' do
211
- expect(@pjf.get('info.name')).to eq('tested')
212
- end
213
- it 'has version' do
214
- expect(@pjf.get('info.version')).to eq('1.56.12')
215
- end
216
- it 'does not fail back to $cfg' do
217
- expect(@pjf).to_not receive(:default_value_for)
218
- expect(@pjf.get('routes.include')).to eq(['custom_api.lua'])
219
- end
220
- end
221
-
222
- it 'reports validation errors' do
223
- src = File.join(@testdir, 'spec/fixtures/ProjectFiles/invalid.yaml')
224
- dst = File.join(@project_dir, 'meta.murano')
225
- FileUtils.copy(src, dst)
226
-
227
- saved = $stderr
228
- $stderr = StringIO.new
229
- expect(@pjf.load).to eq(-5)
230
- expect($stderr.string).to match(
231
- %r{The property '#/info' did not contain a required property of 'description'}
232
- )
233
- $stderr = saved
234
- end
235
- end
236
- end
237
-
238
- context 'Solutionfile 0.2.0' do
239
- include_context 'WORKSPACE'
240
- before(:example) do
241
- $cfg = MrMurano::Config.new
242
- $cfg.load
243
- $cfg['user.name'] = 'bob@builder.co'
244
- $project = nil
245
- @pjf = MrMurano::ProjectFile.new
246
- end
247
-
248
- it 'Reports validation errors' do
249
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.0_invalid.json')
250
- dst = File.join(@project_dir, 'Solutionfile.json')
251
- FileUtils.copy(src, dst)
252
- saved = $stderr
253
- $stderr = StringIO.new
254
- @pjf.load
255
- expect($stderr.string).to match(
256
- %r{The property '#/' did not contain a required property of 'custom_api'}
257
- )
258
- $stderr = saved
259
- end
260
-
261
- it 'loads with truncated version' do
262
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.json')
263
- dst = File.join(@project_dir, 'Solutionfile.json')
264
- FileUtils.copy(src, dst)
265
- saved = $stderr
266
- $stderr = StringIO.new
267
- @pjf.load
268
- expect($stderr.string).to eq('')
269
- $stderr = saved
270
- end
271
-
272
- context 'loads' do
273
- before(:example) do
274
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.0.json')
275
- dst = File.join(@project_dir, 'Solutionfile.json')
276
- FileUtils.copy(src, dst)
277
- @pjf.load
278
- end
279
- it 'defines assets' do
280
- expect(@pjf.get('assets.default_page')).to eq('index.html')
281
- expect(@pjf.get('assets.location')).to eq('public')
282
- expect(@pjf.get('assets.include')).to eq(['**/*'])
283
- end
284
-
285
- it 'defines routes' do
286
- expect(@pjf['routes.location']).to eq('.')
287
- expect(@pjf.get('routes.include')).to eq(['sample_api.lua'])
288
- end
289
-
290
- it 'defines modules' do
291
- expect(@pjf['modules.location']).to eq('.')
292
- expect(@pjf['modules.include']).to match_array(
293
- ['modules/debug.lua', 'modules/listen.lua', 'modules/util.lua']
294
- )
295
- end
296
-
297
- it 'defines services' do
298
- expect(@pjf['services.location']).to eq('.')
299
- expect(@pjf['services.include']).to match_array(
300
- ['event_handler/product.lua', 'event_handler/timer.lua']
301
- )
302
- end
303
- end
304
- end
305
-
306
- context 'Solutionfile 0.3.0' do
307
- include_context 'WORKSPACE'
308
- before(:example) do
309
- $cfg = MrMurano::Config.new
310
- $cfg.load
311
- $cfg['user.name'] = 'bob@builder.co'
312
- $project = nil
313
- @pjf = MrMurano::ProjectFile.new
314
- end
315
-
316
- it 'Reports validation errors' do
317
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.0_invalid.json')
318
- dst = File.join(@project_dir, 'Solutionfile.json')
319
- FileUtils.copy(src, dst)
320
- saved = $stderr
321
- $stderr = StringIO.new
322
- @pjf.load
323
- expect($stderr.string).to match(
324
- %r{The property '#/' did not contain a required property of 'routes'}
325
- )
326
- $stderr = saved
327
- end
328
-
329
- it 'loads with truncated version' do
330
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.json')
331
- dst = File.join(@project_dir, 'Solutionfile.json')
332
- FileUtils.copy(src, dst)
333
- saved = $stderr
334
- $stderr = StringIO.new
335
- @pjf.load
336
- expect($stderr.string).to eq('')
337
- $stderr = saved
338
- end
339
-
340
- context 'loads' do
341
- before(:example) do
342
- src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.0.json')
343
- dst = File.join(@project_dir, 'Solutionfile.json')
344
- FileUtils.copy(src, dst)
345
- @pjf.load
346
- end
347
- it 'defines assets' do
348
- expect(@pjf.get('assets.default_page')).to eq('index.html')
349
- expect(@pjf.get('assets.location')).to eq('public')
350
- expect(@pjf.get('assets.include')).to eq(['**/*'])
351
- end
352
-
353
- it 'defines routes' do
354
- expect(@pjf['routes.location']).to eq('.')
355
- expect(@pjf.get('routes.include')).to eq(['sample_api.lua'])
356
- end
357
-
358
- it 'defines modules' do
359
- expect(@pjf['modules.location']).to eq('.')
360
- expect(@pjf['modules.include']).to match_array(
361
- [
362
- 'modules/debug.lua',
363
- 'modules/listen.lua',
364
- 'modules/util.lua',
365
- ]
366
- )
367
- end
368
-
369
- it 'defines services' do
370
- expect(@pjf['services.location']).to eq('.')
371
- expect(@pjf['services.include']).to match_array(
372
- [
373
- 'event_handler/product.lua',
374
- 'event_handler/timer.lua',
375
- ]
376
- )
377
- end
378
- end
379
- end
380
- end
381
-
data/spec/Setting_spec.rb DELETED
@@ -1,120 +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 'tempfile'
9
- require 'yaml'
10
- require 'MrMurano/version'
11
- require 'MrMurano/ProjectFile'
12
- require 'MrMurano/Setting'
13
- require 'MrMurano/SyncRoot'
14
- require 'MrMurano/SyncUpDown'
15
- require '_workspace'
16
-
17
- # rubocop:disable Style/ClassAndModuleChildren
18
- # "Use nested module/class definitions instead of compact style."
19
- module ::MrMurano
20
- module Testset
21
- class Settings
22
- def specific
23
- end
24
-
25
- def specific=(x)
26
- end
27
- end
28
- end
29
-
30
- module Testsettwo
31
- end
32
- end
33
-
34
- RSpec.describe MrMurano::Setting do
35
- include_context 'WORKSPACE'
36
-
37
- before(:example) do
38
- $cfg = MrMurano::Config.new
39
- $cfg.load
40
- $cfg['net.host'] = 'bizapi.hosted.exosite.io'
41
- $cfg['product.id'] = 'XYZ'
42
-
43
- @srv = MrMurano::Setting.new
44
- end
45
-
46
- context 'maps service name' do
47
- it 'device2 into Gateway' do
48
- ret = @srv.mapservice('device2')
49
- expect(ret).to eq('Gateway')
50
- end
51
-
52
- it 'gaTeWaY into Gateway' do
53
- ret = @srv.mapservice('gaTeWaY')
54
- expect(ret).to eq('Gateway')
55
- end
56
-
57
- it 'WeBServICe into Webservice' do
58
- ret = @srv.mapservice('WeBServICe')
59
- expect(ret).to eq('Webservice')
60
- end
61
-
62
- it 'bob into Bob' do
63
- ret = @srv.mapservice('bob')
64
- expect(ret).to eq('Bob')
65
- end
66
- end
67
-
68
- context 'read' do
69
- it "displays error when Service doesn't exist" do
70
- expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
71
- ret = @srv.read('Fiddlingsticks', 'specific')
72
- expect(ret).to be_nil
73
- end
74
-
75
- it "displays error when Service doesn't have any Settings" do
76
- expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
77
- ret = @srv.read('Testsettwo', 'specific')
78
- expect(ret).to be_nil
79
- end
80
-
81
- it "displays error when Service doesn't have this Setting" do
82
- expect(@srv).to receive(:error).with("Unknown setting 'flipit' on 'Testset'")
83
- ret = @srv.read('Testset', 'flipit')
84
- expect(ret).to be_nil
85
- end
86
-
87
- it 'the settings' do
88
- expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific).and_return(4)
89
- ret = @srv.read('Testset', 'specific')
90
- expect(ret).to eq(4)
91
- end
92
- end
93
-
94
- context 'writes' do
95
- it "displays error when Service doesn't exist" do
96
- expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
97
- ret = @srv.write('Fiddlingsticks', 'specific', 4)
98
- expect(ret).to be_nil
99
- end
100
-
101
- it "displays error when Service doesn't have any Settings" do
102
- expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
103
- ret = @srv.write('Testsettwo', 'specific', 4)
104
- expect(ret).to be_nil
105
- end
106
-
107
- it "displays error when Service doesn't have this Setting" do
108
- expect(@srv).to receive(:error).with("Unknown setting 'flipit' on 'Testset'")
109
- ret = @srv.write('Testset', 'flipit', 4)
110
- expect(ret).to be_nil
111
- end
112
-
113
- it 'the settings' do
114
- expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific=).with(4).and_return(4)
115
- ret = @srv.write('Testset', 'specific', 4)
116
- expect(ret).to eq(4)
117
- end
118
- end
119
- end
120
-