mumukit-platform 6.1.0 → 7.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 +4 -4
- data/.github/workflows/test_and_deploy.yml +32 -0
- data/lib/mumukit/platform.rb +7 -4
- data/lib/mumukit/platform/application.rb +9 -1
- data/lib/mumukit/platform/organization_mapping.rb +2 -2
- data/lib/mumukit/platform/uri.rb +13 -6
- data/lib/mumukit/platform/version.rb +1 -1
- data/mumukit-platform.gemspec +1 -1
- metadata +10 -4
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a52de81a0b2c6efb83bcc9a7e23b8e59715c42f83cd667813ea00c34fe1880
|
4
|
+
data.tar.gz: 6ba950cc3889ca4aedae2f48ad94c3011ebb8196bd57f8aed9ef48509a5f947c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c434715414edfa1af06bafe9a92e6c1a5fd23435e7c7408bc70005c84f90a7bc5512597c8f0aaa2188bb71aa12f60c5b1f610fdf59d21e2447e598184eb4d58
|
7
|
+
data.tar.gz: f4142a30260afa2b54d7addb7fd48ffd4a523e71948f4243c4088043cad49851cdfe8549b1abc06ba9253701c4c7a54eb03e54e66dc501551116de4ae762682d
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Test and deploy
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- workflow_dispatch
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test_and_deploy:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- name: Set up Ruby
|
13
|
+
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.3
|
16
|
+
bundler: 2.1.4
|
17
|
+
- name: Install dependencies
|
18
|
+
run: bundle install
|
19
|
+
- name: Run tests
|
20
|
+
run: bundle exec rake
|
21
|
+
- name: Deploy
|
22
|
+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
32
|
+
|
data/lib/mumukit/platform.rb
CHANGED
@@ -17,9 +17,9 @@ module Mumukit::Platform
|
|
17
17
|
|
18
18
|
config.laboratory_url = ENV['MUMUKI_LABORATORY_URL'] || "http://#{domain}"
|
19
19
|
config.thesaurus_url = ENV['MUMUKI_THESAURUS_URL'] || "http://thesaurus.#{domain}"
|
20
|
-
config.bibliotheca_ui_url = ENV['MUMUKI_BIBLIOTHECA_UI_URL'] || "http://bibliotheca.#{domain}"
|
20
|
+
config.bibliotheca_ui_url = ENV['MUMUKI_BIBLIOTHECA_UI_URL'] || "http://bibliotheca.#{domain}/#/"
|
21
21
|
config.bibliotheca_api_url = ENV['MUMUKI_BIBLIOTHECA_API_URL'] || "http://bibliotheca-api.#{domain}"
|
22
|
-
config.classroom_ui_url = ENV['MUMUKI_CLASSROOM_UI_URL'] || "http://classroom.#{domain}"
|
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
24
|
config.organization_mapping = Mumukit::Platform::OrganizationMapping.from_env
|
25
25
|
end
|
@@ -41,8 +41,11 @@ module Mumukit::Platform
|
|
41
41
|
#
|
42
42
|
define_singleton_method("#{klass}_class") do
|
43
43
|
begin
|
44
|
-
config["#{klass}_class"]
|
45
|
-
|
44
|
+
return config["#{klass}_class"] if config["#{klass}_class"].present?
|
45
|
+
config["#{klass}_class_name"].to_s.constantize.tap do |klass_instance|
|
46
|
+
config["#{klass}_class"] = klass_instance unless %w(RACK_ENV RAILS_ENV).any? { |it| ENV[it] == 'development' }
|
47
|
+
end
|
48
|
+
rescue NameError => e
|
46
49
|
raise "You must configure your #{klass} class first"
|
47
50
|
end
|
48
51
|
end
|
@@ -28,7 +28,15 @@ class Mumukit::Platform::Application
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def organic_url_for(organization, path)
|
31
|
-
organic_uri(organization)
|
31
|
+
uri = organic_uri(organization)
|
32
|
+
# warning: this code is tightly
|
33
|
+
# coupled to the fact that applications can only rebuild urls
|
34
|
+
# in fragmented-mode
|
35
|
+
if uri.fragment
|
36
|
+
uri.to_s + relative_path(path)
|
37
|
+
else
|
38
|
+
uri.url_for(relative_path path)
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
def relative_path(path)
|
@@ -42,7 +42,7 @@ module Mumukit::Platform::OrganizationMapping
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.organic_uri(uri, organization)
|
45
|
-
uri.subdominate(organization)
|
45
|
+
uri.subdominate(organization, fragmented: true)
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.path_under_namespace?(_organization_name, path, namespace)
|
@@ -79,7 +79,7 @@ module Mumukit::Platform::OrganizationMapping
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def self.organic_uri(uri, organization)
|
82
|
-
uri.tenantize organization
|
82
|
+
uri.tenantize organization, fragmented: true
|
83
83
|
end
|
84
84
|
|
85
85
|
def self.path_under_namespace?(organization_name, path, namespace)
|
data/lib/mumukit/platform/uri.rb
CHANGED
@@ -1,23 +1,30 @@
|
|
1
1
|
class URI::HTTP
|
2
|
-
def subdominate(subdomain)
|
2
|
+
def subdominate(subdomain, **options)
|
3
3
|
if host.start_with? 'www.'
|
4
4
|
new_host = host.gsub('www.', "www.#{subdomain}.")
|
5
5
|
else
|
6
6
|
new_host = "#{subdomain}.#{host}"
|
7
7
|
end
|
8
|
-
rebuild(host: new_host)
|
8
|
+
rebuild({host: new_host}, **options)
|
9
9
|
end
|
10
10
|
|
11
|
-
def tenantize(route)
|
11
|
+
def tenantize(route, **options)
|
12
12
|
if path.end_with? '/'
|
13
13
|
new_path = "#{path}#{route}/"
|
14
14
|
else
|
15
15
|
new_path = "#{path}/#{route}/"
|
16
16
|
end
|
17
|
-
rebuild(path: new_path)
|
17
|
+
rebuild({path: new_path}, **options)
|
18
18
|
end
|
19
19
|
|
20
|
-
def rebuild(updates)
|
20
|
+
def rebuild(updates, fragmented: false)
|
21
|
+
if fragmented && fragment
|
22
|
+
fragment = "#{self.fragment}/#{updates[:path]}/".squeeze('/')
|
23
|
+
updates = updates.except(:path)
|
24
|
+
else
|
25
|
+
fragment = self.fragment
|
26
|
+
end
|
27
|
+
|
21
28
|
self.class.build({
|
22
29
|
scheme: scheme,
|
23
30
|
host: host,
|
@@ -30,4 +37,4 @@ class URI::HTTP
|
|
30
37
|
def url_for(path)
|
31
38
|
URI.join(self, path).to_s
|
32
39
|
end
|
33
|
-
end
|
40
|
+
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', '~> 2.0'
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0', '< 2.2'
|
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:
|
4
|
+
version: 7.0.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: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-nuntius
|
@@ -93,6 +93,9 @@ dependencies:
|
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '2.0'
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.2'
|
96
99
|
type: :development
|
97
100
|
prerelease: false
|
98
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -100,6 +103,9 @@ dependencies:
|
|
100
103
|
- - "~>"
|
101
104
|
- !ruby/object:Gem::Version
|
102
105
|
version: '2.0'
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2.2'
|
103
109
|
- !ruby/object:Gem::Dependency
|
104
110
|
name: rake
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,10 +141,10 @@ executables: []
|
|
135
141
|
extensions: []
|
136
142
|
extra_rdoc_files: []
|
137
143
|
files:
|
144
|
+
- ".github/workflows/test_and_deploy.yml"
|
138
145
|
- ".gitignore"
|
139
146
|
- ".rspec"
|
140
147
|
- ".ruby-version"
|
141
|
-
- ".travis.yml"
|
142
148
|
- CODE_OF_CONDUCT.md
|
143
149
|
- Gemfile
|
144
150
|
- LICENSE.txt
|
@@ -185,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
191
|
- !ruby/object:Gem::Version
|
186
192
|
version: '0'
|
187
193
|
requirements: []
|
188
|
-
rubygems_version: 3.0.
|
194
|
+
rubygems_version: 3.0.3
|
189
195
|
signing_key:
|
190
196
|
specification_version: 4
|
191
197
|
summary: Shared Mumuki Platform Components
|
data/.travis.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.6.3
|
5
|
-
before_install: gem install bundler -v 2.0.2
|
6
|
-
deploy:
|
7
|
-
provider: rubygems
|
8
|
-
api_key:
|
9
|
-
secure: peqcsnX2NXwCvy20HfitFl7Dhhi4jrkeu2ZuJz6eEVml5xkkGOuTiAXiSFMvysuV1uCueWNKvQJzNl6u82cwM/InYjFj1kG3SRLIZCkEKks2tOxtJmky7CpIh9jI5SZKOL/DKuMRIuYJwhN0WURi58aCybqyhAsh0XQYGN0EFo6jwnJHehe1KEwgxaTFFB1Q1bn41o+7LWw4r39j7mj28x+WTnl11iM/CRndrQj/YSB8Xk92il8W2vfEWbn4xY2rK/joQ9Doi+rbrW90J7ArGkiMbbsofKkt2snOjrO5UDqqDGWi1/iQmBwtf2qgqB+TmTELrqd4ehRraq4P7dgW3uWGQe/0gR5xoYDusimcBQ5N+JDZbac/YKMRYG0+Ce09ggIaGjq2iEyn9zus00aaaoEGixqVtTwMtkvApmlM/c7CaeSmKSUhYdYE8ayOuCqHgIhCKoZPhADylTc3NL5qizk3/3/wrCyAf9Slq/Oa04Wa4NRXfC5yDkdJggaIzYwq03mc1diechM1ZrovZHNOWznbtjq1JrbEDQk95A29BsrTRLCk98QnChaTHrGmwvlk7g40iUurDplfg5IpUHnSc9BBQg+hcKd5IjKVkrHH5cUHq+U8pXIXgf4vs8cYFX8B1asIO7ApiSABxnC8bsjBZx4ccu303LWILiFBurQQn7w=
|
10
|
-
gem: mumukit-platform
|
11
|
-
on:
|
12
|
-
tags: true
|
13
|
-
repo: mumuki/mumukit-platform
|