mistiq 0.0.91 → 0.0.92

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/mistiq/init.rb +45 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmFhOTQ3NDUyZjBlYzBjMzBlMjNlZjNmOGUxYWUwMTA0ZGVlNTJiNQ==
4
+ NzgzNGFiZDUzNzFkOWJiMDk5MjMxZDIyZjI5ZDQxY2Y4NWQ3ZGNlMQ==
5
5
  data.tar.gz: !binary |-
6
- NDI0NjAyYTEyZjA1YjA3NGFiMGI1N2NmYWNkMTFlNDI4YjQzMDY0NQ==
6
+ MmZiMGE5MDExNzkyZDBhYzZkZmM0YmI0NDM3MTkwNDZjMmI0NTAyYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDc3ZWU0ZDQyZTkyMDdmNzFmZjk5NzM1YTgzYjI5MmVhY2NiYTAyM2E1OWM2
10
- Njc5NjE5NDc3ZGE0MGZlZDY1NWYwZmE0OTEwMTlhNDJhNTI1M2UzNzE2ODVl
11
- NjRjMWMxNmQ2MGNhOWFlZDY2NGQ4NWFiMTJlYjBhNTc1OGQ3MTM=
9
+ NWVhZGEzMTJjMzY2ZGEwY2QwNDczZTgyNGQ2YTQ0NTE4MjQ3M2E2NmIzOWEx
10
+ MGJiNzBiNDg1OTg0OWJhZjZlM2IzNmI3NTE3OTBkMGVlNGJlOTg2YmMyOWFh
11
+ ZTUzNjljMzAyNTQxNWU1NGQ3MTVkNDI1ZWMyNzE4Y2NhZjUyZDM=
12
12
  data.tar.gz: !binary |-
13
- NDVkMjk2MDc4MGY0OTU4YzVjOWQyYjkxZmMwZjJkNWMzZTU5Y2VlMjE3ZjEx
14
- OTIxNDVjODcwMTc5Nzc5NzE4MjZiZmNiY2ZiYzZlYTYzNjhlYmJmODAxMmY0
15
- N2Y1NzRkZTdiMmQ0ODVlZWJkYjM1NTk0ODEzMWEzNzQ3OWU2ZWQ=
13
+ NWZiMDg4ZWZkMGE3OTZjNjIxNWY5Mzc3ZWQ4YWNhMDQ4MGFiZDJmZTllNTkx
14
+ NGIxZDQxYTNmMGJkYTEzZTY2ZGJhNmQ2ZmY2Y2UxZTA4M2QwZDYzOTQxMDM5
15
+ ZTlkNTkzNjkzZjUxOTdhODIzYmRlODRlN2E0MWRjMjk1OWI0MzY=
data/lib/mistiq/init.rb CHANGED
@@ -47,6 +47,47 @@ module Mistiq
47
47
  end
48
48
  }
49
49
 
50
+ engine_routes = inspector.get_engine_routes
51
+
52
+ if engine_routes != nil
53
+ engine_routes.each {
54
+ |name, routes|
55
+
56
+ routes.each {
57
+ |r|
58
+
59
+ reqs = r[:reqs].split('#')
60
+
61
+ controller = reqs[0]
62
+ action = reqs[1]
63
+
64
+ route = r[:path]
65
+ verb = r[:verb]
66
+
67
+ #get regex-ed route
68
+ regex_len = r[:regexp].length
69
+ regex = r[:regexp].slice(1..regex_len-2)
70
+
71
+ #if action#controller's data method is not GET and not POST
72
+ if verb != "GET" && verb != "POST" && verb != ""
73
+ method_regex = "data-method=(\"|')#{verb.downcase}(\"|')";
74
+ pattern = "<a.*#{method_regex}.*href=(\"|')#{regex}(\"|').*>.*<\/a>"
75
+
76
+ #also check if method_regex occurs after the href attribute
77
+ pattern = pattern+"@@@<a.*href=(\"|')#{regex}(\"|').*#{method_regex}.*>.*<\/a>"
78
+ elsif verb == "GET"
79
+ #if action#controller's data method is GET
80
+ #pattern = "<a(.*href=(\"|')#{pattern}(\"|'))(?!.*data\-method)[^<]*<\/a>"
81
+ pattern = "<a(?!.*data\-method)(.*href=(\"|')#{regex}(\"|'))[^<]*<\/a>"
82
+ end
83
+
84
+ if verb == "GET" || (verb != "POST" && verb != "")
85
+ @LINK_REGEX_HASH["#{controller}##{action}"] = pattern
86
+ end
87
+ }
88
+ }
89
+ end
90
+
50
91
  puts "Link REGEX hash has been computed. #{@LINK_REGEX_HASH.size} routes were hashed."
51
92
  end
52
93
  end
@@ -142,6 +183,10 @@ module Mistiq
142
183
  return routes
143
184
  end
144
185
 
186
+ def get_engine_routes
187
+ return @engines
188
+ end
189
+
145
190
  private
146
191
 
147
192
  def filter_routes(filter)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mistiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.91
4
+ version: 0.0.92
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Papancea