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,77 +0,0 @@
1
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
- # frozen_string_literal: true
3
-
4
- # License: PROPRIETARY. See LICENSE.txt.
5
- # Unauthorized copying of this file is strictly prohibited.
6
- # vim:tw=0:ts=2:sw=2:et:ai
7
-
8
- require 'optparse'
9
-
10
- require_relative 'simple_server'
11
-
12
- module SimpleWebSocket
13
- class Options
14
- def initialize
15
- reset_opts
16
- end
17
-
18
- def reset_opts
19
- @options = {
20
- behave: '',
21
- timeout: 0,
22
- }
23
- @options[:port] = SimpleWebSocket::Server::DEFAULT_WS_PORT
24
- end
25
-
26
- def setup_and_parse_opts
27
- opt_parser = OptionParser.new do |parser|
28
- parser.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options]"
29
- opt_setup_help(parser)
30
- opt_setup_behavior(parser)
31
- opt_setup_timeout(parser)
32
- end
33
- opt_parser.parse!
34
- # The optparse library pulls values out of ARGV, so if we wanted to
35
- # use positional parameters, we could inspect ARGV. But we don't.
36
- @options
37
- end
38
-
39
- def opt_setup_help(parser)
40
- parser.on('-h', '--help', 'Show this help message') do
41
- puts parser
42
- end
43
- end
44
-
45
- def opt_setup_behavior(parser)
46
- parser.on(
47
- '-b',
48
- '--behavior FLAVOR',
49
- "[reserved] How to behave. We probably don't need this..."
50
- ) do |flavor|
51
- @options[:behave] = flavor
52
- end
53
- end
54
-
55
- def opt_setup_port(parser)
56
- def_port = SimpleWebSocket::Server::DEFAULT_WS_PORT
57
- parser.on(
58
- '-p',
59
- '--port PORT',
60
- "Port on which to run server. Default: #{def_port}"
61
- ) do |msecs|
62
- @options[:timeout] = msecs.to_i / 1000.0
63
- end
64
- end
65
-
66
- def opt_setup_timeout(parser)
67
- parser.on(
68
- '-t',
69
- '--timeout MSECS',
70
- 'How long to run before exiting. O to run forever.'
71
- ) do |msecs|
72
- @options[:timeout] = msecs.to_i / 1000.0
73
- end
74
- end
75
- end
76
- end
77
-
@@ -1,69 +0,0 @@
1
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
- # frozen_string_literal: true
3
-
4
- # License: PROPRIETARY. See LICENSE.txt.
5
- # Unauthorized copying of this file is strictly prohibited.
6
- # vim:tw=0:ts=2:sw=2:et:ai
7
-
8
- require 'eventmachine'
9
- require 'faye/websocket'
10
- require 'websocket/driver'
11
-
12
- begin
13
- # From RSpec.
14
- require 'fixtures/websocket/simple_connection'
15
- rescue LoadError
16
- # From invocation.
17
- require_relative 'simple_connection'
18
- end
19
-
20
- module SimpleWebSocket
21
- class Server
22
- DEFAULT_WS_PORT = 4180
23
-
24
- attr_writer :connection
25
-
26
- def initialize(options={}, connection=SimpleWebSocket::SimpleConnection)
27
- @options = options
28
- @connection = connection
29
- end
30
-
31
- def start_timer
32
- return if !@options[:timeout] || @options[:timeout] <= 0
33
- _timer = EventMachine::Timer.new(@options[:timeout]) do
34
- EM.stop_event_loop
35
- end
36
- end
37
-
38
- def start_server
39
- trap_interrupt
40
- trap_termination
41
- start_event_loop
42
- end
43
-
44
- def trap_interrupt
45
- Signal.trap('INT') do
46
- EM.stop_event_loop
47
- end
48
- end
49
-
50
- def trap_termination
51
- Signal.trap('TERM') do
52
- EM.stop_event_loop
53
- end
54
- end
55
-
56
- def start_event_loop
57
- EM.run do
58
- start_timer
59
- EM.start_server(
60
- '127.0.0.1',
61
- @options[:port],
62
- @connection
63
- )
64
- end
65
- # EM event loop runs until we tell it to stop.
66
- end
67
- end
68
- end
69
-
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
3
- # frozen_string_literal: true
4
-
5
- # License: PROPRIETARY. See LICENSE.txt.
6
- # Unauthorized copying of this file is strictly prohibited.
7
- # vim:tw=0:ts=2:sw=2:et:ai
8
-
9
- require 'json'
10
-
11
- require 'eventmachine'
12
-
13
- require_relative 'simple_connection'
14
- require_relative 'simple_options'
15
-
16
- module EchoReceiver
17
- def initialize(driver)
18
- @driver = driver
19
- end
20
-
21
- def receive_data(data)
22
- # If we don't encode correctly, websocket-driver barfs. E.g., if we
23
- # tried to transmit "something with ‘curly quotes’", we'd get:
24
- # `encode': "\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
25
- msg = data.chomp.force_encoding('UTF-8')
26
- puts "receive_data: #{msg}"
27
- # (landonb): What does the parse method do? I don't think we care.
28
- # @driver.parse(data)
29
- EM.stop_event_loop if msg == 'EXIT'
30
- @driver.text(msg)
31
- end
32
- end
33
-
34
- class WSStdinPassthru < SimpleWebSocket::SimpleConnection
35
- def conn_on_open(event)
36
- super(event)
37
- EM.attach $stdin, EchoReceiver, @driver
38
- end
39
- end
40
-
41
- def main
42
- options = SimpleWebSocket::Options.new.setup_and_parse_opts
43
- ws_svr = SimpleWebSocket::Server.new(options, WSStdinPassthru)
44
- ws_svr.start_server
45
- end
46
-
47
- main
48
-
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
3
- # frozen_string_literal: true
4
-
5
- # License: PROPRIETARY. See LICENSE.txt.
6
- # Unauthorized copying of this file is strictly prohibited.
7
- # vim:tw=0:ts=2:sw=2:et:ai
8
-
9
- require_relative 'logs_blather'
10
- require_relative 'simple_options'
11
-
12
- def main
13
- options = SimpleWebSocket::Options.new.setup_and_parse_opts
14
- ws_svr = SimpleWebSocket::Server.new(options)
15
- ws_svr.connection = LogsBlatherConnection
16
- ws_svr.start_server
17
- end
18
-
19
- main
20
-
data/spec/spec_helper.rb DELETED
@@ -1,131 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause
4
- # this file to always be loaded, without a need to explicitly require it in any
5
- # files.
6
- #
7
- # Given that it is always loaded, you are encouraged to keep this file as
8
- # light-weight as possible. Requiring heavyweight dependencies from this file
9
- # will add to the boot time of your test suite on EVERY test run, even for an
10
- # individual file that may not need all of that loaded. Instead, consider making
11
- # a separate helper file that requires the additional dependencies and performs
12
- # the additional setup, and require it from the spec files that actually need
13
- # it.
14
- #
15
- # The `.rspec` file also contains a few flags that are not defaults but that
16
- # users commonly want.
17
-
18
- require 'simplecov'
19
- require 'webmock/rspec'
20
-
21
- require 'webmock_snapshot'
22
-
23
- SimpleCov.start do
24
- if ENV['CI_MR_EXE'].nil?
25
- coverage_dir "coverage/cov-#{RUBY_VERSION.tr('.', '_')}"
26
- else
27
- coverage_dir "coverage/cov-#{RUBY_VERSION.tr('.', '_')}-exe"
28
- end
29
- add_group 'Specs', 'spec/.*'
30
- add_group 'Solution', 'lib/MrMurano/Solution.*'
31
- add_group 'Product', 'lib/MrMurano/Product.*'
32
-
33
- track_files 'lib/MrMurano/*.rb'
34
- end
35
-
36
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
37
- RSpec.configure do |config|
38
- config.filter_run_excluding :needs_password if ENV['MURANO_PASSWORD'].nil?
39
- config.filter_run_excluding :broken_on_windows if Gem.win_platform?
40
-
41
- # FIXME/2018-07-12: (lb): Make test acct. with element. 'til then: disabled.
42
- config.filter_run_excluding :needs_exchange_element
43
-
44
- # rspec-expectations config goes here. You can use an alternate
45
- # assertion/expectation library such as wrong or the stdlib/minitest
46
- # assertions if you prefer.
47
- config.expect_with :rspec do |expectations|
48
- # This option will default to `true` in RSpec 4. It makes the `description`
49
- # and `failure_message` of custom matchers include text for helper methods
50
- # defined using `chain`, e.g.:
51
- # be_bigger_than(2).and_smaller_than(4).description
52
- # # => "be bigger than 2 and smaller than 4"
53
- # ...rather than:
54
- # # => "be bigger than 2"
55
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
56
- end
57
-
58
- # rspec-mocks config goes here. You can use an alternate test double
59
- # library (such as bogus or mocha) by changing the `mock_with` option here.
60
- config.mock_with :rspec do |mocks|
61
- # Prevents you from mocking or stubbing a method that does not exist on
62
- # a real object. This is generally recommended, and will default to
63
- # `true` in RSpec 4.
64
- mocks.verify_partial_doubles = true
65
- end
66
-
67
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
68
- # have no way to turn it off -- the option exists only for backwards
69
- # compatibility in RSpec 3). It causes shared context metadata to be
70
- # inherited by the metadata hash of host groups and examples, rather than
71
- # triggering implicit auto-inclusion in groups with matching metadata.
72
- config.shared_context_metadata_behavior = :apply_to_host_groups
73
-
74
- # The settings below are suggested to provide a good initial experience
75
- # with RSpec, but feel free to customize to your heart's content.
76
-
77
- # This allows you to limit a spec run to individual examples or groups
78
- # you care about by tagging them with `:focus` metadata. When nothing
79
- # is tagged with `:focus`, all examples get run. RSpec also provides
80
- # aliases for `it`, `describe`, and `context` that include `:focus`
81
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
82
- #config.filter_run_when_matching :focus
83
-
84
- # Allows RSpec to persist some state between runs in order to support
85
- # the `--only-failures` and `--next-failure` CLI options. We recommend
86
- # you configure your source control system to ignore this file.
87
- config.example_status_persistence_file_path = '.rspec_examples.txt'
88
-
89
- # Limits the available syntax to the non-monkey patched syntax that is
90
- # recommended. For more details, see:
91
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
92
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
93
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
94
- config.disable_monkey_patching!
95
-
96
- # This setting enables warnings. It's recommended, but in some cases may
97
- # be too noisy due to issues in dependencies.
98
- config.warnings = true
99
-
100
- # Many RSpec users commonly either run the entire suite or an individual
101
- # file, and it's useful to allow more verbose output when running an
102
- # individual spec file.
103
- if config.files_to_run.one?
104
- # Use the documentation formatter for detailed output,
105
- # unless a formatter has already been configured
106
- # (e.g. via a command-line flag).
107
- config.default_formatter = 'doc'
108
- end
109
-
110
- # Print the 10 slowest examples and example groups at the
111
- # end of the spec run, to help surface which specs are running
112
- # particularly slow.
113
- config.profile_examples = 10
114
-
115
- # Run specs in random order to surface order dependencies. If you find an
116
- # order dependency and want to debug it, you can fix the order by providing
117
- # the seed, which is printed after each run.
118
- # --seed 1234
119
- config.order = :random
120
-
121
- # Seed global randomization in this process using the `--seed` CLI option.
122
- # Setting this allows you to use `--seed` to deterministically reproduce
123
- # test failures related to randomization by passing the same `--seed` value
124
- # as the one that triggered the failure.
125
- Kernel.srand config.seed
126
-
127
- # For murano-cli-rspec-snapshot package: the default snapshot_dir is `:relative`,
128
- # meaning snapshots will be stored relative to the path of the spec file.
129
- config.snapshot_dir = File.join(Dir.pwd, "spec/fixtures/snapshots")
130
- end
131
-
@@ -1,29 +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 'MrMurano/variegated/TruthyFalsey'
9
-
10
- RSpec.describe 'variegated/TruthyFalsey' do
11
- it %(knows what's true) do
12
- tfy = TruthyFalsey.new('TruE')
13
- expect(tfy.truthy?).to be(true)
14
- expect(tfy.falsey?).to be(false)
15
- end
16
-
17
- it %(knows what's false) do
18
- tfy = TruthyFalsey.new('No')
19
- expect(tfy.truthy?).to be(false)
20
- expect(tfy.falsey?).to be(true)
21
- end
22
-
23
- it %(doesn't know what it doesn't know) do
24
- tfy = TruthyFalsey.new('FALS')
25
- expect(tfy.truthy?).to be(false)
26
- expect(tfy.falsey?).to be(false)
27
- end
28
- end
29
-
@@ -1,296 +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 'json'
9
- require 'net/http'
10
- require 'singleton'
11
- require 'webmock'
12
-
13
- require 'MrMurano/verbosing'
14
- require 'MrMurano/Config'
15
- require 'MrMurano/HttpAuthed'
16
-
17
- module Net
18
- class HTTP
19
- alias old_request request
20
- def request(request, body=nil, &block)
21
- response = old_request(request, body, &block)
22
-
23
- # If we loaded the request and response from a snapshot already, return
24
- # now; otherwise, continue along and add the request-response to our list
25
- # of mocks for this example.
26
- return response unless MrMurano::Snapshot::WebMock.instance.rebuilding
27
-
28
- req_body = body || ''
29
-
30
- begin
31
- resp_status = response.code.to_i
32
- if response.body.class == Net::ReadAdapter
33
- # See note in read_body monkey patch (below) why we do this.
34
- resp_body = response.was_body
35
- else
36
- resp_body = response.body || ''
37
- end
38
- rescue NoMethodError
39
- resp_status = 200
40
- resp_body = response || ''
41
- end
42
-
43
- MrMurano::Snapshot::WebMock.instance.record_mock(
44
- request.method.downcase.to_sym,
45
- request.uri.to_s,
46
- req_body,
47
- resp_status,
48
- resp_body,
49
- )
50
-
51
- response
52
- end
53
- end
54
- end
55
-
56
- module Net
57
- module WebMockHTTPResponse
58
- attr_reader :was_body
59
- # (lb): This feels like more of a hack then these monkey patches already are!
60
- # - On read_body() (using a &block to process an HTTP stream), WebMockHTTPResponse
61
- # translates the body from a String into a Net::ReadAdapter -- and it doesn't seem
62
- # like we can read the body after the block processes it! So here we grab the body
63
- # before it's converted into a ReadAdapter. Amazingly, this code appears to work!!
64
- alias old_read_body read_body
65
- def read_body(dest=nil, &block)
66
- @was_body = @body if block_given?
67
- old_read_body(dest, &block)
68
- end
69
- end
70
- end
71
-
72
- module MrMurano
73
- class Config
74
- alias old_load load
75
- def load
76
- old_load
77
- snapshotter = MrMurano::Snapshot::WebMock.instance
78
- return unless snapshotter.snapshot_ready
79
- snapshotter.load_example_meta_to_cfg
80
- end
81
- end
82
- end
83
-
84
- module MrMurano
85
- module Snapshot
86
- class WebMock
87
- include Singleton
88
-
89
- attr_reader :rebuilding
90
- attr_reader :snapshot_ready
91
-
92
- def reset(example)
93
- @example = example
94
- @rebuilding = false
95
- @snapshot_name = @example.full_description
96
- @snapshot_ready = File.exist?(snapshot_path)
97
- ::WebMock.reset!
98
- MrMurano::HttpAuthed.instance.credentials_reset
99
- MrMurano::HttpAuthed.instance.http_reset
100
- ENV.delete('MURANO_TOKEN')
101
- end
102
-
103
- # ***
104
-
105
- def establish_mocks
106
- @did_allow_net_connect = ::WebMock::Config.instance.allow_net_connect != false
107
- snap_path = ensure_snapshot_dirs
108
- if @snapshot_ready
109
- ::WebMock.disable_net_connect!
110
- load_web_mocks(snap_path)
111
- @rebuilding = false
112
- else
113
- # (lb) Note that there's something funky with WebMock and
114
- # Net::HTTP.new ... http.start, but I don't think we need
115
- # to worry. If we did, look at this WebMock option:
116
- # ::WebMock.allow_net_connect!(net_http_connect_on_start: true)
117
- ::WebMock.allow_net_connect!
118
- ready_to_sniff
119
- @rebuilding = true
120
- end
121
- end
122
-
123
- def terminate_mocks
124
- @example = nil
125
- @rebuilding = false
126
- if @snapshot_ready
127
- ::WebMock.reset!
128
- else
129
- write_mocks_file
130
- end
131
- @snapshot_name = nil
132
- @snapshot_ready = false
133
- restore_allow_net_connect
134
- end
135
-
136
- def restore_allow_net_connect
137
- if @did_allow_net_connect
138
- ::WebMock.allow_net_connect!
139
- else
140
- ::WebMock.disable_net_connect!
141
- end
142
- remove_instance_variable(:@did_allow_net_connect)
143
- end
144
-
145
- # ***
146
-
147
- def load_web_mocks(snap_path)
148
- mock_meta = load_snapshot_json(snap_path)
149
- setup_mocks(mock_meta)
150
- end
151
-
152
- def load_snapshot_json(snap_path)
153
- JSON.parse(File.read(snap_path), symbolize_names: false)
154
- rescue JSON::ParserError => err
155
- RSpec.configuration.reporter.message(
156
- %(ERROR: Invalid JSON for snapshot found at: ‘#{snap_path}’)
157
- )
158
- RSpec.configuration.reporter.message err.to_s
159
- exit 2
160
- end
161
-
162
- def setup_mocks(mock_meta)
163
- mock_meta.reject { |k, _v| k == 'ex_meta' }.each do |method, requests|
164
- requests.each do |req_uri, req_body_and_resp|
165
- req_body_and_resp.each do |req_body, resp_metas|
166
- setup_web_mock(method, req_uri, req_body, resp_metas)
167
- end
168
- end
169
- end
170
-
171
- @example_meta = mock_meta['ex_meta']
172
- load_example_meta_to_cfg
173
- end
174
-
175
- def load_example_meta_to_cfg
176
- ENV['MURANO_TOKEN'] = @example_meta['MURANO_TOKEN']
177
- $cfg.set('net.protocol', @example_meta['net.protocol'], :internal)
178
- $cfg.set('net.host', @example_meta['net.host'], :internal)
179
- $cfg.set('user.name', @example_meta['user.name'], :internal)
180
- $cfg.set('business.id', @example_meta['business.id'], :internal)
181
- end
182
-
183
- def setup_web_mock(method, uri, _req_body, resp_metas)
184
- responses = []
185
- resp_metas.each do |resp_meta|
186
- responses.push(
187
- status: resp_meta['resp_status'],
188
- # Unpack Base64. See pack('m') for comment.
189
- body: resp_meta['resp_body'].unpack('m')[0],
190
- headers: {}
191
- )
192
- end
193
- @example.example_group_instance.stub_request(
194
- method.to_sym,
195
- uri,
196
- # (lb): We might eventually need to add the request body to the mock,
197
- # but as of 2018-08-09 I've yet to see a non-empty request body.
198
- # ).with(
199
- # body: req_body,
200
- ).to_return(
201
- *responses
202
- )
203
- end
204
-
205
- # ***
206
-
207
- def ready_to_sniff
208
- @curr_meta = {}
209
- @curr_meta['ex_meta'] = {}
210
- end
211
-
212
- def record_mock(method, uri, req_body, resp_status, resp_body)
213
- encoded_body = encode_for_json(resp_body)
214
- mock_response = {
215
- 'resp_body': encoded_body,
216
- 'resp_status': resp_status,
217
- }
218
- @curr_meta[method] ||= {}
219
- @curr_meta[method][uri] ||= {}
220
- @curr_meta[method][uri][req_body] ||= []
221
- @curr_meta[method][uri][req_body].push(mock_response)
222
- end
223
-
224
- def encode_for_json(resp_body)
225
- # Avoid problems encoding to JSON by encoding the response body now.
226
- # NOTE: 'm' packs as Base64. See:
227
- # https://ruby-doc.org/core-2.3.3/Array.html#method-i-pack
228
- encoded_body = [resp_body].pack('m')
229
- # DEVS: Uncomment this to see the difference between the raw and encoded value:
230
- # require 'byebug' ; byebug if encoded_body != resp_body
231
- encoded_body
232
- end
233
-
234
- # ***
235
-
236
- def write_mocks_file
237
- RSpec.configuration.reporter.message "Saving mock sniff to: #{snapshot_path}"
238
-
239
- @curr_meta['ex_meta']['MURANO_TOKEN'] = MrMurano::HttpAuthed.instance.token_biz
240
- @curr_meta['ex_meta']['net.protocol'] = $cfg['net.protocol']
241
- @curr_meta['ex_meta']['net.host'] = $cfg['net.host']
242
- @curr_meta['ex_meta']['user.name'] = $cfg['user.name']
243
- @curr_meta['ex_meta']['business.id'] = $cfg['business.id']
244
-
245
- mocks_file = File.new(snapshot_path, 'w+')
246
- MrMurano::Verbose.dump_file_json(@curr_meta, mocks_file, pretty: true)
247
- mocks_file.close
248
-
249
- @curr_meta = nil
250
- end
251
-
252
- # ***
253
-
254
- def resolve_var(ex_meta_key, ex_meta_value)
255
- if @rebuilding
256
- @curr_meta['ex_meta'][ex_meta_key] = ex_meta_value
257
- ex_meta_value
258
- else
259
- @example_meta[ex_meta_key]
260
- end
261
- end
262
-
263
- # ***
264
-
265
- def ensure_snapshot_dirs
266
- snap_path = snapshot_path
267
- basedir = File.dirname(snap_path)
268
- FileUtils.mkdir_p(basedir) unless File.directory?(basedir)
269
- snap_path
270
- end
271
-
272
- def snapshot_dir
273
- if RSpec.configuration.snapshot_dir == :relative
274
- # (lb): This path is pretty useless: We generally make a
275
- # Murano CLI project under /tmp and chdir there before
276
- # this method is called, so the snapshot directory would
277
- # be created under /tmp!
278
- File.dirname(@example.file_path) << '/__snapshots__'
279
- else
280
- RSpec.configuration.snapshot_dir
281
- end
282
- end
283
-
284
- def snapshot_file
285
- "#{@snapshot_name}.webmock"
286
- end
287
-
288
- def snapshot_path
289
- File.join(snapshot_dir, snapshot_file)
290
- end
291
- end
292
-
293
- RSpec.configuration.add_setting(:snapshot_dir, default: :relative)
294
- end
295
- end
296
-