bash-merge 7.1.1 → 7.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8c10612883ee3b2218483ddde5232e2facdb105fa9246b97501a186bcff828a
4
- data.tar.gz: '08672c8444e3b98a710ad6fcb7e02c220413abe470deaebad741efe4084baa0d'
3
+ metadata.gz: 3e3f73ff82048635caccf19c960791ce05565f83e3c393b6dc175d4d2d16b417
4
+ data.tar.gz: 96404acb74336004facfe0222183882909c23bc1de2c5ec827769c769de4b6f8
5
5
  SHA512:
6
- metadata.gz: bebbff49479397116a97b31333e815ef906345c3ce1f592716021a9ec842b9110b89932ce5ef236edac43e36bfde1462060477c003a3d4b3d4bc54dda48fe439
7
- data.tar.gz: 1dcbae759052e304d3be6e5709ac4efbbf2120ea985bb5bcff242d4f9ec090b24e0d6d204b00816642ecec9c8c00c1787b667440585b00a4c0e81fc459debb3d
6
+ metadata.gz: 1abeafbfc3c7485a49ca9f4f45853f888f95040dd895b7df7fea1f6584fb08565711abeb41dbd4e4abae9d0b13b6166fb2f973fd6ca531838d6e9865bc1b63d9
7
+ data.tar.gz: 2eab528d0568ae00321490ad534bf41ac3bcbd2aab46355be98b034f6238a869648a03f9c89f5d81990706acec19c12fe3f15cacd29a57bb6292058f60144e18
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -85,7 +85,7 @@ File.write("merged.sh", result.to_bash)
85
85
 
86
86
  ### Compatibility
87
87
 
88
- Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby.
88
+ Compatible with MRI Ruby 4.0.0+, JRuby, and TruffleRuby.
89
89
  CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
90
90
  This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
91
91
  may be higher than the gem's runtime compatibility floor when legacy Rubies are
@@ -258,20 +258,12 @@ See [SECURITY.md][🔐security].
258
258
  ## 🤝 Contributing
259
259
 
260
260
  If you need some ideas of where to help, you could work on adding more code coverage,
261
- or if it is already 💯 (see [below](#code-coverage)) check [issues][🤝gh-issues] or [PRs][🤝gh-pulls],
262
- or use the gem and think about how it could be better.
261
+ check [issues][🤝gh-issues] or [PRs][🤝gh-pulls], or use the gem and think about how it could be better.
263
262
 
264
263
  We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
265
264
 
266
265
  See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
267
266
 
268
- ### Code Coverage
269
-
270
- <details markdown="1">
271
- <summary>Coverage service badges</summary>
272
-
273
- </details>
274
-
275
267
  ## 📌 Versioning
276
268
 
277
269
  This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
@@ -411,7 +403,7 @@ If none of the available licenses suit your use case, please [contact us](mailto
411
403
  [📌gitmoji]: https://gitmoji.dev
412
404
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
413
405
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
414
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.810-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
406
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.305-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
415
407
  [🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
416
408
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
417
409
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -19,6 +19,8 @@ module Bash
19
19
  #
20
20
  # @see Ast::Merge::NodeWrapperBase
21
21
  class NodeWrapper < Ast::Merge::NodeWrapperBase
22
+ attr_reader :node
23
+
22
24
  # Check if this is a function definition
23
25
  # @return [Boolean]
24
26
  def function_definition?
@@ -107,6 +109,18 @@ module Bash
107
109
  nil
108
110
  end
109
111
 
112
+ def start_byte = node.start_byte
113
+ def end_byte = node.end_byte
114
+ def source_text = @source.byteslice(start_byte...end_byte).to_s
115
+
116
+ def semantic_tree
117
+ semantic_node(node)
118
+ end
119
+
120
+ def heredoc?
121
+ descendant_type?(node, %w[heredoc_redirect heredoc_body])
122
+ end
123
+
110
124
  # Find a child by field name
111
125
  # @param field_name [String] Field name to look for
112
126
  # @return [TreeSitter::Node, nil]
@@ -193,6 +207,19 @@ module Bash
193
207
 
194
208
  private
195
209
 
210
+ def semantic_node(value)
211
+ children = value.children
212
+ return [value.type.to_s, @source.byteslice(value.start_byte...value.end_byte).to_s] if children.empty?
213
+
214
+ [value.type.to_s, children.select(&:named?).map { |child| semantic_node(child) }]
215
+ end
216
+
217
+ def descendant_type?(value, types)
218
+ return true if types.include?(value.type.to_s)
219
+
220
+ value.children.any? { |child| descendant_type?(child, types) }
221
+ end
222
+
196
223
  def extract_command_signature_context(node)
197
224
  # Extract additional context like redirections
198
225
  redirections = []