rails-routes-js-utils 3.0.0 → 4.0.0

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OWU0ZjM1ODU5NjBiMzg0NDUyZDEyZmE5Nzk4MWMwYzE4NGI3YmFlZg==
5
- data.tar.gz: !binary |-
6
- Y2M2NmUyN2U5MGRkYjdjZjNkN2NmYmI0ZjZkNjNiOTQxYzY5OWYxYQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NjRiMDA0MWU1NTg4ZGQ1NzExNGM4YjBkZWZlYjIyOWQzNWIzZGYxNjFmNGU2
10
- NWNlNmQ1Y2NlZDZhZWVlMmNmZmZhN2ViN2M2M2QwMGUwYTUyNDY5NDUzY2Ni
11
- YWNkNTY0MzkxY2U1N2ZjYzAxNmQ1ODllNTUxZWQxMzBlMGY0NGM=
12
- data.tar.gz: !binary |-
13
- MThjMWM2MzA5ZTAyNzY1NGY0MDYwODIxZGJhZmQ3NDRjNmIxYTFmZDhjZTc4
14
- M2I2MjQxNWI5NGFiMGRjNjU2NzExYzM1MjdkNDE3YTU5OTQyN2Q5N2Y2NTFj
15
- NWNkMWZkMjBmZDhkYmViNjNlYjIxZDcxNGE5NWQ3NDA5ZDY1MmE=
2
+ SHA1:
3
+ metadata.gz: 0e58fd907a2cb5053ad1346dc848c753fdc5e6a2
4
+ data.tar.gz: b1299d719269f0b1ca6f7cf68ec9bc4ba78ec786
5
+ SHA512:
6
+ metadata.gz: ad60d3a2440f600d0c046e1e6a17c3b333437665a8bcdbf61f0d147c7c7642efc429a71bb3ad7182e838f4f7c5d5e1c77e0388beea61e0f775784f55d308a5e9
7
+ data.tar.gz: f0744461780e82a98e64821c270419c640c8722436210deedcf3bb07481d74ec8554c1517a2bf0fde43910e92f347cb8cf6efe702785e721db033e92e5fa5a4c
data/README.md CHANGED
@@ -32,9 +32,9 @@ Routes.blog_posts_path()
32
32
 
33
33
  for (var i=0; i<AllRoutes.length; i++){
34
34
  var route = AllRoutes[i];
35
- var subdomain = document.location.hostname.split('.')[0];
35
+ var host = document.location.hostname;
36
36
  var pathname = document.location.pathname;
37
- if (route.path.test(pathname) && route.subdomain.test(subdomain)) {
37
+ if (route.path.test(pathname) && route.host.test(host)) {
38
38
  // Matched route
39
39
  console.log(route);
40
40
  var controller = route.reqs.controller;
@@ -46,9 +46,9 @@ module Rails
46
46
  reqs = route.defaults.merge(parts: route.parts)
47
47
 
48
48
 
49
- subdomain_regex = {}
50
- if route.constraints[:subdomain]
51
- subdomain_regex = route.constraints[:subdomain].to_javascript
49
+ host_regex = {}
50
+ if route.constraints[:host]
51
+ host_regex = route.constraints[:host].to_javascript
52
52
  end
53
53
 
54
54
  js = dig(route.path.spec)
@@ -64,7 +64,7 @@ module Rails
64
64
 
65
65
  if name
66
66
  last_name = name
67
- "addRouteToEnv({name: '#{name}', path: #{compiled_regex}, subdomain: #{subdomain_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; }, verb: #{compiled_verb} });"
67
+ "addRouteToEnv({name: '#{name}', path: #{compiled_regex}, host: #{host_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; }, verb: #{compiled_verb} });"
68
68
  end
69
69
  end.join("\n")
70
70
 
@@ -80,7 +80,7 @@ module Rails
80
80
  reqs = route.defaults.merge(parts: route.parts)
81
81
 
82
82
  if name
83
- parsedRoutes[name] = {path: route.path.to_regexp.to_javascript,subdomain: route.constraints[:subdomain] ? route.constraints[:subdomain].to_javascript: '',reqs: reqs, verb: route.verb.to_javascript,ast:route.ast.to_s}
83
+ parsedRoutes[name] = {path: route.path.to_regexp.to_javascript,host: route.constraints[:host] ? route.constraints[:host].to_javascript: '',reqs: reqs, verb: route.verb.to_javascript,ast:route.ast.to_s}
84
84
  end
85
85
  end
86
86
  parsedRoutes.to_plist
@@ -2,7 +2,7 @@ module Rails
2
2
  module Routes
3
3
  module Js
4
4
  module Utils
5
- VERSION = "3.0.0"
5
+ VERSION = "4.0.0"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-routes-js-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Le Duc Duy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-01 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: plist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Make rails route available via window.Routes
@@ -66,17 +66,17 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ! '>='
69
+ - - '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ! '>='
74
+ - - '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.0.5
79
+ rubygems_version: 2.1.9
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Make rails route available via window.Routes