mumukit-platform 6.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ae45d9ce60a16c9d6b9cf2dc0284d02bd81832a40c0ed1a158495c4c00b849b
4
- data.tar.gz: 603939ae2583641c628a0800a242bb33b9e6b21c5b4cf9ce6457b8e9eb1c5af1
3
+ metadata.gz: 1aa8d319e6390b781d8da0e7d33f720cf6b093c0d43ba432ca27666da514191d
4
+ data.tar.gz: d124ebd5601c68dcdb97a51de9a0a42319a3f0d83a92a88ab1aa2b8198d8d514
5
5
  SHA512:
6
- metadata.gz: 13726c3f29e85f3ab7ad93dec1d16845e1e51260c0412863d4be209058d9eeab79ee88bf696edc6237e584a46595ac102073244bea93f59d6f71884db630421f
7
- data.tar.gz: f8ba4d912df7db4f502a5193f547b0e96be9222ac81801eb6e03e20a370d3c177adb208fcc8df0063445a570ddc21ab141a0bc53430e7e26638cce524135161a
6
+ metadata.gz: 97fd564e02205ec571c81b12560fa1939dd03bd5cd651ecd17b09c670602ca4a06e8564ee171f6042219fd8f5327974988155611a85c6791b447a3d4536a81d4
7
+ data.tar.gz: 99c5f0bed18cad1bb402e47371a16ab9b4e9e641471ffaa8414901b55702771df1239f47ab809b0b0333caa40b5e6b071e118301e9e15f67b49a0a3b7e1444fe
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module Mumukit::Platform::OrganizationMapping
2
4
  def self.from_env
3
5
  if ENV['RACK_ENV'] == 'test' || ENV['RAILS_ENV'] == 'test'
@@ -18,7 +20,15 @@ module Mumukit::Platform::OrganizationMapping
18
20
  end
19
21
  end
20
22
 
23
+ module Base
24
+ def path_for(request)
25
+ request.path_info
26
+ end
27
+ end
28
+
21
29
  module Subdomain
30
+ extend Base
31
+
22
32
  def self.implicit_organization?(request, domain)
23
33
  request.empty_subdomain_after?(domain)
24
34
  end
@@ -38,9 +48,15 @@ module Mumukit::Platform::OrganizationMapping
38
48
  def self.path_under_namespace?(_organization_name, path, namespace)
39
49
  path.start_with? "/#{namespace}/"
40
50
  end
51
+
52
+ def self.inorganic_path_for(request)
53
+ path_for(request)
54
+ end
41
55
  end
42
56
 
43
57
  module Path
58
+ extend Base
59
+
44
60
  def self.implicit_organization?(_request, _domain)
45
61
  false
46
62
  end
@@ -49,8 +65,17 @@ module Mumukit::Platform::OrganizationMapping
49
65
  framework.configure_tenant_path_routes! native, &block
50
66
  end
51
67
 
68
+ def self.path_composition_for(request)
69
+ organization, *path_parts = Pathname(path_for(request)).each_filename.to_a
70
+ [organization, path_parts.join('/')]
71
+ end
72
+
52
73
  def self.organization_name(request, _domain)
53
- request.path_info.split('/')[1]
74
+ path_composition_for(request).first
75
+ end
76
+
77
+ def self.inorganic_path_for(request)
78
+ path_composition_for(request).second
54
79
  end
55
80
 
56
81
  def self.organic_uri(uri, organization)
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Platform
3
- VERSION = '6.0.0'
3
+ VERSION = '6.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-platform
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-19 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-nuntius