mumukit-core 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mumukit/core.rb +18 -0
- data/lib/mumukit/core/array.rb +7 -0
- data/lib/mumukit/core/class.rb +8 -0
- data/lib/mumukit/core/file.rb +4 -0
- data/lib/mumukit/core/hash.rb +18 -0
- data/lib/mumukit/core/json.rb +9 -0
- data/lib/mumukit/core/nil.rb +5 -0
- data/lib/mumukit/core/object.rb +17 -0
- data/lib/mumukit/core/regexp.rb +5 -0
- data/lib/mumukit/core/request.rb +22 -0
- data/lib/mumukit/core/string.rb +3 -0
- data/lib/mumukit/core/version.rb +5 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDZmYzQyZGE2MzAzM2MxZjhkZjFmZWM2Y2QxMGM1ODgxMjhhZGYzYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTA4NGI5ZWU1MDI0OTFjY2U5ZDljZTg2OTRiMDkyZGZiZmM5ODU3Zg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzhiNWU3YTU1MjhlYzI3OGIwZGIxMjg4YzFmYzM4ZmM4NDlmYzA4NmQ5YTMx
|
10
|
+
Y2IwMzVhYjUzODQ4Mjg3N2M0MTg5MmFjZjlmODU2NWJmNTAzNDFjNmNiMTkz
|
11
|
+
YmZlYWYxNWRhOWI4ZGVlNmIwMDQxMmUyYzcxNzhkNjFlZDhhNzc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTQ1NGY3NDc5YjExMDM1ZmE4MDBmMGQ3YzE5YjY1MTk5NjM4NDZkZmIxYWY3
|
14
|
+
MmI5MDc1YjI2ZjkwMzc0NTllZTY0M2Y1YTA0OTBjZmUxNjY3ZTY5NGEyNDAy
|
15
|
+
NzBhMmU2NGU1MDZlYWNkZmRjY2FmZmZkNGU4YTQwMmE3MWMzZjk=
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mumukit/core"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/mumukit/core.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'mumukit/core/version'
|
2
|
+
require 'active_support/all'
|
3
|
+
|
4
|
+
module Mumukit
|
5
|
+
module Core
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require_relative './core/object'
|
10
|
+
require_relative './core/class'
|
11
|
+
require_relative './core/json'
|
12
|
+
require_relative './core/hash'
|
13
|
+
require_relative './core/string'
|
14
|
+
require_relative './core/nil'
|
15
|
+
require_relative './core/array'
|
16
|
+
require_relative './core/regexp'
|
17
|
+
require_relative './core/request'
|
18
|
+
require_relative './core/file'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Object
|
2
|
+
def ensure_present!(*args)
|
3
|
+
raise 'arguments must be non null' if args.any?(&:blank?)
|
4
|
+
end
|
5
|
+
|
6
|
+
def to_stringified_h
|
7
|
+
to_h.stringify_keys
|
8
|
+
end
|
9
|
+
|
10
|
+
def defaulting(value, &block)
|
11
|
+
try(&block) || value
|
12
|
+
end
|
13
|
+
|
14
|
+
def struct(hash = {})
|
15
|
+
hash.to_struct
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rack/request'
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
class Request
|
5
|
+
def first_subdomain
|
6
|
+
@env['rack.env.subdomains'] ||= extract_subdomains
|
7
|
+
end
|
8
|
+
|
9
|
+
def organization_name
|
10
|
+
first_subdomain || 'central'
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def extract_subdomains
|
16
|
+
raise 'no host set' unless host
|
17
|
+
raise 'set hostname first!' if /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host)
|
18
|
+
return nil if host == 'localhost'
|
19
|
+
(host.split('.') - ['mumuki', 'io'])[0]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mumukit-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Franco Leonardo Bulgarelli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codeclimate-test-reporter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.6'
|
97
|
+
description: Ruby core extensions
|
98
|
+
email:
|
99
|
+
- franco@mumuki.org
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- bin/console
|
105
|
+
- bin/setup
|
106
|
+
- lib/mumukit/core.rb
|
107
|
+
- lib/mumukit/core/array.rb
|
108
|
+
- lib/mumukit/core/class.rb
|
109
|
+
- lib/mumukit/core/file.rb
|
110
|
+
- lib/mumukit/core/hash.rb
|
111
|
+
- lib/mumukit/core/json.rb
|
112
|
+
- lib/mumukit/core/nil.rb
|
113
|
+
- lib/mumukit/core/object.rb
|
114
|
+
- lib/mumukit/core/regexp.rb
|
115
|
+
- lib/mumukit/core/request.rb
|
116
|
+
- lib/mumukit/core/string.rb
|
117
|
+
- lib/mumukit/core/version.rb
|
118
|
+
homepage: https://github.com/mumuki/mumukit-core
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
- bin
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.4.5
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Ruby core extensions for mumuki on top of active support
|
143
|
+
test_files: []
|