rfbeam 0.5.1 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.pre-commit-config.yaml +8 -0
  3. data/.tool-versions +1 -1
  4. data/CHANGELOG.md +39 -46
  5. data/Gemfile +10 -7
  6. data/Gemfile.lock +47 -44
  7. data/README.md +71 -113
  8. data/Rakefile +5 -9
  9. data/cliff.toml +74 -0
  10. data/cog.toml +7 -3
  11. data/exe/rfbeam +0 -1
  12. data/lib/rfbeam/cli.rb +37 -29
  13. data/lib/rfbeam/kld7/constants.rb +5 -4
  14. data/lib/rfbeam/kld7/detection_params.rb +149 -0
  15. data/lib/rfbeam/kld7/module_params.rb +96 -0
  16. data/lib/rfbeam/kld7/operation_params.rb +162 -0
  17. data/lib/rfbeam/kld7/radar_messages.rb +23 -39
  18. data/lib/rfbeam/kld7/serial_connection.rb +13 -14
  19. data/lib/rfbeam/kld7/streamer.rb +15 -14
  20. data/lib/rfbeam/version.rb +1 -1
  21. data/lib/rfbeam.rb +8 -7
  22. data/output.csv +257 -0
  23. data/rfbeam.gemspec +3 -8
  24. data/yarn.lock +221 -12
  25. metadata +12 -167
  26. data/.rubocop.yml +0 -25
  27. data/.streerc~1f4cd14e3c0a9afdf972aa5f3982d36a89869b72 +0 -2
  28. data/lib/rfbeam/kld7/cli_formatter.rb +0 -61
  29. data/lib/rfbeam/kld7/cli_output.rb +0 -141
  30. data/lib/rfbeam/kld7/radar_parameters.rb +0 -441
  31. data/node_modules/.bin/prettier +0 -1
  32. data/node_modules/.yarn-integrity +0 -19
  33. data/node_modules/@prettier/plugin-ruby/CHANGELOG.md +0 -1351
  34. data/node_modules/@prettier/plugin-ruby/CODE_OF_CONDUCT.md +0 -76
  35. data/node_modules/@prettier/plugin-ruby/CONTRIBUTING.md +0 -185
  36. data/node_modules/@prettier/plugin-ruby/LICENSE +0 -21
  37. data/node_modules/@prettier/plugin-ruby/README.md +0 -226
  38. data/node_modules/@prettier/plugin-ruby/docs/logo.png +0 -0
  39. data/node_modules/@prettier/plugin-ruby/node_modules/.bin/prettier +0 -1
  40. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/LICENSE +0 -5945
  41. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/README.md +0 -109
  42. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/bin-prettier.js +0 -62
  43. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/cli.js +0 -15136
  44. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/doc.js +0 -1473
  45. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-angular.mjs +0 -2
  46. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-babel.mjs +0 -29
  47. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-espree.mjs +0 -26
  48. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-flow.mjs +0 -35
  49. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-glimmer.mjs +0 -27
  50. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-graphql.mjs +0 -15
  51. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-html.mjs +0 -36
  52. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-markdown.mjs +0 -76
  53. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-meriyah.mjs +0 -19
  54. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-postcss.mjs +0 -76
  55. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-typescript.mjs +0 -257
  56. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-yaml.mjs +0 -150
  57. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/standalone.mjs +0 -116
  58. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/index.js +0 -37885
  59. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/package.json +0 -21
  60. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-angular.js +0 -2
  61. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-babel.js +0 -29
  62. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-espree.js +0 -26
  63. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-flow.js +0 -35
  64. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-glimmer.js +0 -27
  65. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-graphql.js +0 -15
  66. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-html.js +0 -36
  67. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-markdown.js +0 -76
  68. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-meriyah.js +0 -19
  69. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-postcss.js +0 -76
  70. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-typescript.js +0 -257
  71. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-yaml.js +0 -150
  72. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/standalone.js +0 -116
  73. data/node_modules/@prettier/plugin-ruby/node_modules/prettier/third-party.js +0 -8978
  74. data/node_modules/@prettier/plugin-ruby/package.json +0 -64
  75. data/node_modules/@prettier/plugin-ruby/prettier.gemspec +0 -36
  76. data/node_modules/@prettier/plugin-ruby/rubocop.yml +0 -64
  77. data/node_modules/@prettier/plugin-ruby/src/getInfo.js +0 -23
  78. data/node_modules/@prettier/plugin-ruby/src/netcat.js +0 -13
  79. data/node_modules/@prettier/plugin-ruby/src/parseSync.js +0 -236
  80. data/node_modules/@prettier/plugin-ruby/src/plugin.js +0 -172
  81. data/node_modules/@prettier/plugin-ruby/src/server.rb +0 -199
  82. data/node_modules/prettier/LICENSE +0 -5970
  83. data/node_modules/prettier/README.md +0 -109
  84. data/node_modules/prettier/bin-prettier.js +0 -64
  85. data/node_modules/prettier/cli.js +0 -15364
  86. data/node_modules/prettier/doc.js +0 -1473
  87. data/node_modules/prettier/esm/parser-angular.mjs +0 -2
  88. data/node_modules/prettier/esm/parser-babel.mjs +0 -29
  89. data/node_modules/prettier/esm/parser-espree.mjs +0 -26
  90. data/node_modules/prettier/esm/parser-flow.mjs +0 -35
  91. data/node_modules/prettier/esm/parser-glimmer.mjs +0 -27
  92. data/node_modules/prettier/esm/parser-graphql.mjs +0 -15
  93. data/node_modules/prettier/esm/parser-html.mjs +0 -36
  94. data/node_modules/prettier/esm/parser-markdown.mjs +0 -76
  95. data/node_modules/prettier/esm/parser-meriyah.mjs +0 -19
  96. data/node_modules/prettier/esm/parser-postcss.mjs +0 -76
  97. data/node_modules/prettier/esm/parser-typescript.mjs +0 -49
  98. data/node_modules/prettier/esm/parser-yaml.mjs +0 -150
  99. data/node_modules/prettier/esm/standalone.mjs +0 -116
  100. data/node_modules/prettier/index.js +0 -38236
  101. data/node_modules/prettier/package.json +0 -21
  102. data/node_modules/prettier/parser-angular.js +0 -2
  103. data/node_modules/prettier/parser-babel.js +0 -29
  104. data/node_modules/prettier/parser-espree.js +0 -26
  105. data/node_modules/prettier/parser-flow.js +0 -35
  106. data/node_modules/prettier/parser-glimmer.js +0 -27
  107. data/node_modules/prettier/parser-graphql.js +0 -15
  108. data/node_modules/prettier/parser-html.js +0 -36
  109. data/node_modules/prettier/parser-markdown.js +0 -76
  110. data/node_modules/prettier/parser-meriyah.js +0 -19
  111. data/node_modules/prettier/parser-postcss.js +0 -76
  112. data/node_modules/prettier/parser-typescript.js +0 -49
  113. data/node_modules/prettier/parser-yaml.js +0 -150
  114. data/node_modules/prettier/standalone.js +0 -116
  115. data/node_modules/prettier/third-party.js +0 -8978
  116. data/package.json +0 -6
@@ -1,199 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/setup"
4
- require "socket"
5
- require "json"
6
- require "fileutils"
7
- require "open3"
8
-
9
- require "prettier_print"
10
- require "syntax_tree"
11
- require "syntax_tree/haml"
12
- require "syntax_tree/rbs"
13
-
14
- # First, require all of the plugins that the user specified.
15
- ARGV.shift[/^--plugins=(.*)$/, 1]
16
- .split(",")
17
- .each { |plugin| require "syntax_tree/#{plugin}" }
18
-
19
- # Make sure we trap these signals to be sure we get the quit command coming from
20
- # the parent node process
21
- quit = false
22
- trap(:INT) { quit = true }
23
- trap(:TERM) { quit = true }
24
-
25
- if Signal.list.key?("QUIT") && RUBY_ENGINE != "jruby"
26
- trap(:QUIT) { quit = true }
27
- end
28
-
29
- # The information variable stores the actual connection information, which will
30
- # either be an IP address and port or a path to a unix socket file.
31
- information = ""
32
-
33
- # The candidates array is a list of potential programs that could be used to
34
- # connect to our server. We'll run through them after the server starts to find
35
- # the best one to use.
36
- candidates = []
37
-
38
- if Gem.win_platform?
39
- # If we're on windows, we're going to start up a TCP server. The 0 here means
40
- # to bind to some available port.
41
- server = TCPServer.new("127.0.0.1", 0)
42
- address = server.local_address
43
-
44
- # Ensure that we close the server when this process exits.
45
- at_exit { server.close }
46
-
47
- information = "#{address.ip_address} #{address.ip_port}"
48
- candidates = %w[nc telnet]
49
- else
50
- # If we're not on windows, then we're going to assume we can use unix socket
51
- # files (since they're faster than a TCP server).
52
- filepath = "/tmp/prettier-ruby-parser-#{Process.pid}.sock"
53
- server = UNIXServer.new(filepath)
54
-
55
- # Ensure that we close the server and delete the socket file when this
56
- # process exits.
57
- at_exit do
58
- server.close
59
- File.unlink(filepath)
60
- end
61
-
62
- information = server.local_address.unix_path
63
- candidates = ["nc -w 3 -U", "ncat -w 3 -U"]
64
- end
65
-
66
- # This is the actual listening thread that will be acting as our server. We have
67
- # to start it in another thread to begin with so that we can run through our
68
- # candidate connection programs. Eventually we'll just join into this thread
69
- # though and it will act as a daemon.
70
- listener =
71
- Thread.new do
72
- loop do
73
- break if quit
74
-
75
- # Start up a new thread that will handle each successive connection.
76
- Thread.new(server.accept_nonblock) do |socket|
77
- parser, maxwidth_string, tabwidth_string, source =
78
- socket.read.force_encoding("UTF-8").split("|", 4)
79
-
80
- source.each_line do |line|
81
- case line
82
- when /^\s*#.+?coding/
83
- # If we've found an encoding comment, then we're going to take that
84
- # into account and reclassify the encoding for the source.
85
- encoding = Ripper.new(line).tap(&:parse).encoding
86
- source = source.force_encoding(encoding)
87
- break
88
- when /^\s*#/
89
- # continue
90
- else
91
- break
92
- end
93
- end
94
-
95
- # At the moment, we're not going to support odd tabwidths. It's going to
96
- # have to be a multiple of 2, because of the way that the prettyprint
97
- # gem functions. So we're going to just use integer division here.
98
- scalar = tabwidth_string.to_i / 2
99
- genspace = ->(n) { " " * n * scalar }
100
-
101
- maxwidth = maxwidth_string.to_i
102
- response =
103
- case parser
104
- when "ping"
105
- "pong"
106
- when "ruby"
107
- formatter =
108
- SyntaxTree::Formatter.new(source, [], maxwidth, "\n", &genspace)
109
- SyntaxTree.parse(source).format(formatter)
110
- formatter.flush
111
- formatter.output.join
112
- when "rbs"
113
- formatter =
114
- SyntaxTree::RBS::Formatter.new(
115
- source,
116
- [],
117
- maxwidth,
118
- "\n",
119
- &genspace
120
- )
121
- SyntaxTree::RBS.parse(source).format(formatter)
122
- formatter.flush
123
- formatter.output.join
124
- when "haml"
125
- formatter_class =
126
- if defined?(SyntaxTree::Haml::Format::Formatter)
127
- SyntaxTree::Haml::Format::Formatter
128
- else
129
- PrettierPrint
130
- end
131
-
132
- formatter =
133
- formatter_class.new(source, +"", maxwidth, "\n", &genspace)
134
-
135
- SyntaxTree::Haml.parse(source).format(formatter)
136
- formatter.flush
137
- formatter.output
138
- end
139
-
140
- if response
141
- socket.write(JSON.fast_generate(response.force_encoding("UTF-8")))
142
- else
143
- socket.write("{ \"error\": true }")
144
- end
145
- rescue SyntaxTree::Parser::ParseError => error
146
- loc = { start: { line: error.lineno, column: error.column } }
147
- socket.write(JSON.fast_generate(error: error.message, loc: loc))
148
- rescue StandardError => error
149
- begin
150
- socket.write(JSON.fast_generate(error: error.message))
151
- rescue Errno::EPIPE
152
- # Do nothing, the pipe has been closed by the parent process so we don't
153
- # actually care about writing to it anymore.
154
- end
155
- ensure
156
- socket.close
157
- end
158
- rescue IO::WaitReadable, Errno::EINTR
159
- # Wait for select(2) to give us a connection that has content for 1
160
- # second. Otherwise timeout and continue on (so that we hit our
161
- # "break if quit" pretty often).
162
- IO.select([server], nil, nil, 1)
163
-
164
- retry unless quit
165
- end
166
- end
167
-
168
- # Map each candidate connection method to a thread that will check if it works.
169
- candidates.map! do |candidate|
170
- Thread.new do
171
- Thread.current.report_on_exception = false
172
-
173
- # We do not care about stderr here, so throw it away
174
- stdout, _stderr, status =
175
- Open3.capture3("#{candidate} #{information}", stdin_data: "ping")
176
-
177
- candidate if JSON.parse(stdout) == "pong" && status.exitstatus == 0
178
- rescue StandardError
179
- # We don't actually care if this fails, because we'll just skip that
180
- # connection option.
181
- end
182
- end
183
-
184
- # Find the first one prefix that successfully returned the correct value.
185
- prefix =
186
- candidates.detect do |candidate|
187
- value = candidate.value
188
- break value if value
189
- end
190
-
191
- # Default to running the netcat.js script that we ship with the plugin. It's a
192
- # good fallback as it will always work, but it is slower than the other options.
193
- prefix ||= "node #{File.expand_path("netcat.js", __dir__)}"
194
-
195
- # Write out our connection information to the file given as the first argument
196
- # to this script.
197
- File.write(ARGV[0], "#{prefix} #{information}")
198
-
199
- listener.join