mumukit-platform 6.1.0 → 7.0.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: 1aa8d319e6390b781d8da0e7d33f720cf6b093c0d43ba432ca27666da514191d
4
- data.tar.gz: d124ebd5601c68dcdb97a51de9a0a42319a3f0d83a92a88ab1aa2b8198d8d514
3
+ metadata.gz: 39a52de81a0b2c6efb83bcc9a7e23b8e59715c42f83cd667813ea00c34fe1880
4
+ data.tar.gz: 6ba950cc3889ca4aedae2f48ad94c3011ebb8196bd57f8aed9ef48509a5f947c
5
5
  SHA512:
6
- metadata.gz: 97fd564e02205ec571c81b12560fa1939dd03bd5cd651ecd17b09c670602ca4a06e8564ee171f6042219fd8f5327974988155611a85c6791b447a3d4536a81d4
7
- data.tar.gz: 99c5f0bed18cad1bb402e47371a16ab9b4e9e641471ffaa8414901b55702771df1239f47ab809b0b0333caa40b5e6b071e118301e9e15f67b49a0a3b7e1444fe
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
+
@@ -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"] ||= config["#{klass}_class_name"].constantize
45
- rescue
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).url_for(relative_path path)
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)
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Platform
3
- VERSION = '6.1.0'
3
+ VERSION = '7.0.0'
4
4
  end
5
5
  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'
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: 6.1.0
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: 2020-11-26 00:00:00.000000000 Z
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.8
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