mumukit-core 0.6.0 → 1.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
  SHA1:
3
- metadata.gz: 459b882c7343daa4f6ece17d17c8abd10652175b
4
- data.tar.gz: 46a7cfe283f42c3a4a82d121854db4314377a9ac
3
+ metadata.gz: 37c1a7df3904ad04532d27dabcf82d24d55d6b04
4
+ data.tar.gz: 6dc1c171303662458b7f22cf6e1d91b91cd98676
5
5
  SHA512:
6
- metadata.gz: 1e38d096b2c8b8091b90dd564613b3df1d702dca5ee94628d1b2a761ea52269d0a4ec099b2bc4330d37322e7f9bd8fdf189901f3884b59654711245f8b1b5c88
7
- data.tar.gz: ea762c144cea08da88508f1f681c678b564bb2cebd5189f155ee0ff0f816135ea53900d269f0b9f5df602ab5849f36d20a9a39384ae30f7a4eede60e836a746e
6
+ metadata.gz: a4bbb152e184016120e14569f268a91276d73492482aea937bc962e5b03d9900496647e3bd8148cc8c0d761d423aa0c27c7abb4b8b9ee33cf41b314cd901af5c
7
+ data.tar.gz: 8a6609ba61a584d1ff8f21732296a45208502aaba697b80fc1b050e13a18c5285a7e9c5d50a31cff54eee429e03f2b56f0fe0b787262b9682ee75d6a993ba403
@@ -1,22 +1,22 @@
1
+ require 'rack'
1
2
  require 'rack/request'
2
3
 
3
4
  module Rack
4
5
  class Request
5
- def first_subdomain
6
- @env['rack.env.subdomains'] ||= extract_subdomains
6
+ def first_subdomain_after(domain)
7
+ subdomain_after(domain)&.first
7
8
  end
8
9
 
9
- def organization_name
10
- first_subdomain || 'central'
11
- end
12
-
13
- private
14
-
15
- def extract_subdomains
10
+ def subdomain_after(domain)
16
11
  raise 'no host set' unless host
17
12
  raise 'set hostname first!' if /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host)
18
13
  return nil if host == 'localhost'
19
- (host.split('.') - ['mumuki', 'io'])[0]
14
+ domain_parts = domain.split('.')
15
+ (host.split('.') - domain_parts)
16
+ end
17
+
18
+ def empty_subdomain_after?(domain)
19
+ first_subdomain_after(domain).blank?
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Core
3
- VERSION = '0.6.0'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler