mumukit-platform 7.0.1 → 7.2.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: eb5d76b949c6a3bf9e613c382503b7498efaa2a28d7c54004c54804d81fcd7b5
4
+ data.tar.gz: 6d287d84490cb7fd9455ab69e3ba9c3fc4645d4cba844ae1f8c38d9f5e4eb4c3
5
5
  SHA512:
6
- metadata.gz: 85d2db7b9590924e59650eb4ccea66f83b3081a56556472ff511bd5f83dba44d68b3341e100befe511712111ed1493646dae07672a3b5348de448265df01da5a
7
- data.tar.gz: a2acb72616d62179c9ba4c6da847eb7b51962fa64748d01e310305b5483cc4bd9ce7f61cc13d893fd599254b3bf26fe99a7b6ef88548e4a8bc30151bf3c5caef
6
+ metadata.gz: ea590bd093f0c227bba3b17094660117bc43b1f7a49845e950e746214d8686bac8962843702b6b34b46d2d2302cb348692e67395945b92f135130abd431e4096
7
+ data.tar.gz: c51a5246a797b5ac674f9926b393d98dd63ce25c60066ed3dcae3b7ee4f1c7858b0bfe418d549d8d0238c9e3b9339f83b8b52d8d251329f749ebce476ff76953
@@ -6,16 +6,15 @@ on:
6
6
 
7
7
  jobs:
8
8
  test_and_deploy:
9
- runs-on: ubuntu-latest
9
+ runs-on: ubuntu-22.04
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
16
- bundler: 2.1.4
17
- - name: Install dependencies
18
- run: bundle install
15
+ ruby-version: 3.2.2
16
+ bundler: 2.4.7
17
+ bundler-cache: true
19
18
  - name: Run tests
20
19
  run: bundle exec rake
21
20
  - name: Deploy
@@ -29,4 +28,3 @@ jobs:
29
28
  gem push *.gem
30
29
  env:
31
30
  GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
32
-
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.3
1
+ 3.2.2
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Franco Leonardo Bulgarelli
3
+ Copyright (c) 2017 - 2023 Franco Leonardo Bulgarelli
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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.2.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
@@ -22,12 +22,14 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ['lib']
23
23
 
24
24
  spec.add_dependency 'mumukit-nuntius', '~> 6.0'
25
- spec.add_dependency 'mumukit-core', '~> 1.2'
25
+ spec.add_dependency 'mumukit-core', '~> 1.20'
26
26
  spec.add_dependency 'mumukit-auth', '~> 7.6'
27
- spec.add_dependency 'mumukit-bridge', '>= 3.5', '< 5'
28
- spec.add_dependency 'activemodel', '>= 4.0'
27
+ spec.add_dependency 'mumukit-bridge', '~> 4.2'
28
+ spec.add_dependency 'activemodel', '>= 6.0', '< 8'
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 2.0', '< 2.2'
31
- spec.add_development_dependency 'rake', '~> 12.3'
30
+ spec.add_development_dependency 'bundler', '>= 1.7', '< 3'
31
+ spec.add_development_dependency 'rake', '~> 13.0'
32
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
+
34
+ spec.required_ruby_version = '>= 3.0'
33
35
  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.2.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-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-nuntius
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '1.20'
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
- version: '1.2'
40
+ version: '1.20'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mumukit-auth
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,70 +56,70 @@ dependencies:
56
56
  name: mumukit-bridge
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '3.5'
62
- - - "<"
59
+ - - "~>"
63
60
  - !ruby/object:Gem::Version
64
- version: '5'
61
+ version: '4.2'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: '3.5'
72
- - - "<"
66
+ - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '5'
68
+ version: '4.2'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: activemodel
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '4.0'
75
+ version: '6.0'
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '8'
82
79
  type: :runtime
83
80
  prerelease: false
84
81
  version_requirements: !ruby/object:Gem::Requirement
85
82
  requirements:
86
83
  - - ">="
87
84
  - !ruby/object:Gem::Version
88
- version: '4.0'
85
+ version: '6.0'
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '8'
89
89
  - !ruby/object:Gem::Dependency
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
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: '12.3'
115
+ version: '13.0'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '12.3'
122
+ version: '13.0'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: rspec
125
125
  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
@@ -184,14 +184,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: '3.0'
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 3.0.3
194
+ rubygems_version: 3.4.10
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