belt 0.2.14 → 0.2.15

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: 45b24007aa3cc00eb76d188f6958cf3db681c0a5365aff6419183064b36af8c8
4
- data.tar.gz: 9dc9e908e5c46be7ec2ee2b835fd08be862de554a6c1ccafe04c9003d5245274
3
+ metadata.gz: d0a1075ea8085b2214af4991dd2288fec5decd5f0f6d92b6ed12fe135ff152b9
4
+ data.tar.gz: bb8db7d0b4a9a39f9cc5e58a77a411f1c78cf885ab5e0ed6353772e386653f95
5
5
  SHA512:
6
- metadata.gz: 017ed10dec340386b86ed3f398225c53764f70845c3938c878bfa9033c0b81d53fb34797aca786258097a692fcaf7a7a72bbf22b8ba0a8e111982bd2d847b18a
7
- data.tar.gz: ad9e69adcda08161b2992b3899822931c7144cba29ea5d3ef7e12d175c13d8572d9d0de50491959e2280cd3fb2509e814d85d2e9ed36ddf6964fff431f3b4d20
6
+ metadata.gz: 0f77fe7616521e842fe0836ccb9ab7df6c4306dffc58838c647ce217de2616b967d9b80fccf5ca8708613e112dc771c22eeee091d652a25e0a19290319a8d8d4
7
+ data.tar.gz: 3c06dd06c7352f6590cf833361dfd2886abb42445989fa5c30e8307cebc63c35db49b646e1768b85e4a40c4c7c71005d78caef1a642393cf5c76e5dc6bd58fe0
@@ -123,8 +123,26 @@ module Belt
123
123
  end
124
124
 
125
125
  def extract_resources_from_routes(routes_file)
126
+ require 'ripper'
126
127
  content = File.read(routes_file)
127
- content.scan(/resources\s+:(\w+)/).flatten.uniq
128
+ tokens = Ripper.lex(content)
129
+ resources = []
130
+
131
+ tokens.each_cons(3) do |a, b, c|
132
+ # Match: identifier "resources" followed by optional whitespace, then symbol ":name"
133
+ next unless a[1] == :on_ident && a[2] == 'resources'
134
+
135
+ # b might be a space or directly the symbol prefix
136
+ sym_token = b[1] == :on_sp ? c : b
137
+ next unless sym_token[1] == :on_symbeg && sym_token[2] == ':'
138
+
139
+ # The symbol name is the next token
140
+ sym_idx = tokens.index(sym_token)
141
+ name_token = tokens[sym_idx + 1]
142
+ resources << name_token[2] if name_token && name_token[1] == :on_ident
143
+ end
144
+
145
+ resources.uniq
128
146
  end
129
147
 
130
148
  def copy_template(src_dir, dest_dir)
data/lib/belt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Belt
4
- VERSION = '0.2.14'
4
+ VERSION = '0.2.15'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla