mumukit-platform 7.0.1 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test_and_deploy.yml +3 -4
- data/.ruby-version +1 -1
- data/lib/mumukit/platform/application.rb +2 -5
- data/lib/mumukit/platform/path_mapping.rb +36 -0
- data/lib/mumukit/platform/version.rb +1 -1
- data/lib/mumukit/platform/with_applications.rb +3 -3
- data/lib/mumukit/platform/with_path_mapping.rb +13 -0
- data/lib/mumukit/platform.rb +3 -4
- data/mumukit-platform.gemspec +1 -1
- metadata +11 -11
- data/lib/mumukit/platform/organization_mapping.rb +0 -89
- data/lib/mumukit/platform/with_organization_mapping.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574f72c7c3ab80aef56cad27a205efae2e8c04ecd09de31ff4ba995985874b93
|
4
|
+
data.tar.gz: 0de57daef5785a7dc75c67792c31d42d274a281516287bf03c8ef9f49330b732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde7ce902fb18d86863fe2248702d600c061e58cb92c773db206dc08f0bb665f59f9678a34bd237ab8e565d319407d2fffe5dc6e6e9bcef37587a0bc60c291ff
|
7
|
+
data.tar.gz: fa02fa95a47b817f168397a277359026c950e5727bc9c5c4d661c71c13027b27be9bc3894dc652afd3fc5b1a405d46a18c0f1c809a52b63de66b847a45f2eb76
|
@@ -10,12 +10,11 @@ jobs:
|
|
10
10
|
steps:
|
11
11
|
- uses: actions/checkout@v2
|
12
12
|
- name: Set up Ruby
|
13
|
-
uses: ruby/setup-ruby@
|
13
|
+
uses: ruby/setup-ruby@v1
|
14
14
|
with:
|
15
|
-
ruby-version: 2.
|
15
|
+
ruby-version: 2.7.7
|
16
16
|
bundler: 2.1.4
|
17
|
-
|
18
|
-
run: bundle install
|
17
|
+
bundler-cache: true
|
19
18
|
- name: Run tests
|
20
19
|
run: bundle exec rake
|
21
20
|
- name: Deploy
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.7
|
@@ -50,15 +50,12 @@ class Mumukit::Platform::Application
|
|
50
50
|
end
|
51
51
|
|
52
52
|
class Organic < Mumukit::Platform::Application
|
53
|
-
|
54
|
-
|
55
|
-
def initialize(url, organization_mapping)
|
53
|
+
def initialize(url)
|
56
54
|
super(url)
|
57
|
-
@organization_mapping = organization_mapping
|
58
55
|
end
|
59
56
|
|
60
57
|
def organic_uri(organization)
|
61
|
-
|
58
|
+
Mumukit::Platform::PathMapping.organic_uri(uri, organization)
|
62
59
|
end
|
63
60
|
end
|
64
61
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Mumukit::Platform::PathMapping
|
4
|
+
def self.path_for(request)
|
5
|
+
request.path_info
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.implicit_organization?(_request, _domain)
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.map_organization_routes!(native, framework, &block)
|
13
|
+
framework.configure_tenant_path_routes! native, &block
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.path_composition_for(request)
|
17
|
+
organization, *path_parts = Pathname(path_for(request)).each_filename.to_a
|
18
|
+
[organization, path_parts.join('/')]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.organization_name(request, _domain)
|
22
|
+
path_composition_for(request).first
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.inorganic_path_for(request)
|
26
|
+
path_composition_for(request).second
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.organic_uri(uri, organization)
|
30
|
+
uri.tenantize organization, fragmented: true
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.path_under_namespace?(organization_name, path, namespace)
|
34
|
+
path.start_with? "/#{organization_name}/#{namespace}/"
|
35
|
+
end
|
36
|
+
end
|
@@ -2,15 +2,15 @@ module Mumukit::Platform::WithApplications
|
|
2
2
|
delegate :application, to: :config
|
3
3
|
|
4
4
|
def laboratory
|
5
|
-
Mumukit::Platform::Application::Organic.new config.laboratory_url
|
5
|
+
Mumukit::Platform::Application::Organic.new config.laboratory_url
|
6
6
|
end
|
7
7
|
|
8
8
|
def classroom_ui
|
9
|
-
Mumukit::Platform::Application::Organic.new config.classroom_ui_url
|
9
|
+
Mumukit::Platform::Application::Organic.new config.classroom_ui_url
|
10
10
|
end
|
11
11
|
|
12
12
|
def classroom_api
|
13
|
-
Mumukit::Platform::Application::Organic.new config.classroom_api_url
|
13
|
+
Mumukit::Platform::Application::Organic.new config.classroom_api_url
|
14
14
|
end
|
15
15
|
|
16
16
|
def bibliotheca_ui
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Mumukit::Platform::WithPathMapping
|
2
|
+
def implicit_organization?(request)
|
3
|
+
Mumukit::Platform::PathMapping.implicit_organization? request, application.domain
|
4
|
+
end
|
5
|
+
|
6
|
+
def organization_name(request)
|
7
|
+
Mumukit::Platform::PathMapping.organization_name(request, application.domain)
|
8
|
+
end
|
9
|
+
|
10
|
+
def map_organization_routes!(native_mapper, &block)
|
11
|
+
Mumukit::Platform::PathMapping.map_organization_routes!(native_mapper, web_framework, &block)
|
12
|
+
end
|
13
|
+
end
|
data/lib/mumukit/platform.rb
CHANGED
@@ -21,7 +21,6 @@ module Mumukit::Platform
|
|
21
21
|
config.bibliotheca_api_url = ENV['MUMUKI_BIBLIOTHECA_API_URL'] || "http://bibliotheca-api.#{domain}"
|
22
22
|
config.classroom_ui_url = ENV['MUMUKI_CLASSROOM_UI_URL'] || "http://classroom.#{domain}/#/"
|
23
23
|
config.classroom_api_url = ENV['MUMUKI_CLASSROOM_API_URL'] || "http://classroom-api.#{domain}"
|
24
|
-
config.organization_mapping = Mumukit::Platform::OrganizationMapping.from_env
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -61,19 +60,19 @@ require_relative './platform/locale'
|
|
61
60
|
require_relative './platform/course'
|
62
61
|
require_relative './platform/organization'
|
63
62
|
require_relative './platform/user'
|
64
|
-
require_relative './platform/
|
63
|
+
require_relative './platform/path_mapping'
|
65
64
|
require_relative './platform/application'
|
66
65
|
require_relative './platform/web_framework'
|
67
66
|
require_relative './platform/bridge'
|
68
67
|
|
69
68
|
require_relative './platform/with_organization'
|
70
69
|
require_relative './platform/with_applications'
|
71
|
-
require_relative './platform/
|
70
|
+
require_relative './platform/with_path_mapping'
|
72
71
|
require_relative './platform/with_web_framework'
|
73
72
|
|
74
73
|
module Mumukit::Platform
|
75
74
|
extend Mumukit::Platform::WithApplications
|
76
75
|
extend Mumukit::Platform::WithOrganization
|
77
|
-
extend Mumukit::Platform::
|
76
|
+
extend Mumukit::Platform::WithPathMapping
|
78
77
|
extend Mumukit::Platform::WithWebFramework
|
79
78
|
end
|
data/mumukit-platform.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'mumukit-bridge', '>= 3.5', '< 5'
|
28
28
|
spec.add_dependency 'activemodel', '>= 4.0'
|
29
29
|
|
30
|
-
spec.add_development_dependency 'bundler', '
|
30
|
+
spec.add_development_dependency 'bundler', '>= 1.7', '< 3'
|
31
31
|
spec.add_development_dependency 'rake', '~> 12.3'
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
33
|
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: 7.0
|
4
|
+
version: 7.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:
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-nuntius
|
@@ -90,22 +90,22 @@ dependencies:
|
|
90
90
|
name: bundler
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '1.7'
|
96
96
|
- - "<"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '3'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- - "
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: '
|
105
|
+
version: '1.7'
|
106
106
|
- - "<"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
108
|
+
version: '3'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: rake
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +162,14 @@ files:
|
|
162
162
|
- lib/mumukit/platform/model.rb
|
163
163
|
- lib/mumukit/platform/notifiable.rb
|
164
164
|
- lib/mumukit/platform/organization.rb
|
165
|
-
- lib/mumukit/platform/
|
165
|
+
- lib/mumukit/platform/path_mapping.rb
|
166
166
|
- lib/mumukit/platform/uri.rb
|
167
167
|
- lib/mumukit/platform/user.rb
|
168
168
|
- lib/mumukit/platform/version.rb
|
169
169
|
- lib/mumukit/platform/web_framework.rb
|
170
170
|
- lib/mumukit/platform/with_applications.rb
|
171
171
|
- lib/mumukit/platform/with_organization.rb
|
172
|
-
- lib/mumukit/platform/
|
172
|
+
- lib/mumukit/platform/with_path_mapping.rb
|
173
173
|
- lib/mumukit/platform/with_web_framework.rb
|
174
174
|
- mumukit-platform.gemspec
|
175
175
|
homepage: https://mumuki.io
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
194
|
+
rubygems_version: 3.1.6
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: Shared Mumuki Platform Components
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
module Mumukit::Platform::OrganizationMapping
|
4
|
-
def self.from_env
|
5
|
-
if ENV['RACK_ENV'] == 'test' || ENV['RAILS_ENV'] == 'test'
|
6
|
-
Subdomain
|
7
|
-
else
|
8
|
-
parse ENV['MUMUKI_ORGANIZATION_MAPPING']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.parse(name)
|
13
|
-
mapping = name.try { |it| it.strip.downcase }
|
14
|
-
if mapping.blank? || mapping == 'path'
|
15
|
-
Path
|
16
|
-
elsif mapping == 'subdomain'
|
17
|
-
Subdomain
|
18
|
-
else
|
19
|
-
raise "Unrecognized organization mapping #{mapping}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module Base
|
24
|
-
def path_for(request)
|
25
|
-
request.path_info
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
module Subdomain
|
30
|
-
extend Base
|
31
|
-
|
32
|
-
def self.implicit_organization?(request, domain)
|
33
|
-
request.empty_subdomain_after?(domain)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.map_organization_routes!(native, _framework, &block)
|
37
|
-
native.instance_eval(&block)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.organization_name(request, domain)
|
41
|
-
request.subdomain_after(domain) || 'central'
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.organic_uri(uri, organization)
|
45
|
-
uri.subdominate(organization, fragmented: true)
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.path_under_namespace?(_organization_name, path, namespace)
|
49
|
-
path.start_with? "/#{namespace}/"
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.inorganic_path_for(request)
|
53
|
-
path_for(request)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
module Path
|
58
|
-
extend Base
|
59
|
-
|
60
|
-
def self.implicit_organization?(_request, _domain)
|
61
|
-
false
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.map_organization_routes!(native, framework, &block)
|
65
|
-
framework.configure_tenant_path_routes! native, &block
|
66
|
-
end
|
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
|
-
|
73
|
-
def self.organization_name(request, _domain)
|
74
|
-
path_composition_for(request).first
|
75
|
-
end
|
76
|
-
|
77
|
-
def self.inorganic_path_for(request)
|
78
|
-
path_composition_for(request).second
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.organic_uri(uri, organization)
|
82
|
-
uri.tenantize organization, fragmented: true
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.path_under_namespace?(organization_name, path, namespace)
|
86
|
-
path.start_with? "/#{organization_name}/#{namespace}/"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Mumukit::Platform::WithOrganizationMapping
|
2
|
-
delegate :organization_mapping, to: :config
|
3
|
-
|
4
|
-
def implicit_organization?(request)
|
5
|
-
organization_mapping.implicit_organization? request, application.domain
|
6
|
-
end
|
7
|
-
|
8
|
-
def organization_name(request)
|
9
|
-
organization_mapping.organization_name(request, application.domain)
|
10
|
-
end
|
11
|
-
|
12
|
-
def map_organization_routes!(native_mapper, &block)
|
13
|
-
organization_mapping.map_organization_routes!(native_mapper, web_framework, &block)
|
14
|
-
end
|
15
|
-
end
|