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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ceea0a25894aaab70d6c56aa1b1103ffb601af71a82c528c48d6fbbc13ead9f
4
- data.tar.gz: c3ad6e6823687a1cbd706516ffb9b817859f4c2ec821dbdfbb454512702066cf
3
+ metadata.gz: 574f72c7c3ab80aef56cad27a205efae2e8c04ecd09de31ff4ba995985874b93
4
+ data.tar.gz: 0de57daef5785a7dc75c67792c31d42d274a281516287bf03c8ef9f49330b732
5
5
  SHA512:
6
- metadata.gz: 85d2db7b9590924e59650eb4ccea66f83b3081a56556472ff511bd5f83dba44d68b3341e100befe511712111ed1493646dae07672a3b5348de448265df01da5a
7
- data.tar.gz: a2acb72616d62179c9ba4c6da847eb7b51962fa64748d01e310305b5483cc4bd9ce7f61cc13d893fd599254b3bf26fe99a7b6ef88548e4a8bc30151bf3c5caef
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@21351ecc0a7c196081abca5dc55b08f085efe09a
13
+ uses: ruby/setup-ruby@v1
14
14
  with:
15
- ruby-version: 2.6.3
15
+ ruby-version: 2.7.7
16
16
  bundler: 2.1.4
17
- - name: Install dependencies
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.6.3
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
- attr_reader :organization_mapping
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
- organization_mapping.organic_uri(uri, organization)
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
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Platform
3
- VERSION = '7.0.1'
3
+ VERSION = '7.1.0'
4
4
  end
5
5
  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, organization_mapping
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, organization_mapping
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, organization_mapping
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
@@ -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/organization_mapping'
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/with_organization_mapping'
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::WithOrganizationMapping
76
+ extend Mumukit::Platform::WithPathMapping
78
77
  extend Mumukit::Platform::WithWebFramework
79
78
  end
@@ -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', '~> 2.0', '< 2.2'
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.1
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: 2021-03-08 00:00:00.000000000 Z
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: '2.0'
95
+ version: '1.7'
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
- version: '2.2'
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: '2.0'
105
+ version: '1.7'
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
- version: '2.2'
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/organization_mapping.rb
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/with_organization_mapping.rb
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.0.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