arkaan 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/concerns.rb +2 -1
- data/lib/arkaan/concerns/diagnosticable.rb +26 -0
- data/lib/arkaan/concerns/sluggable.rb +15 -5
- data/lib/arkaan/monitoring/gateway.rb +5 -0
- data/lib/arkaan/monitoring/instance.rb +1 -1
- data/lib/arkaan/monitoring/service.rb +3 -0
- data/lib/arkaan/permissions/category.rb +2 -0
- data/lib/arkaan/permissions/group.rb +2 -0
- data/lib/arkaan/permissions/right.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a717f0bef44b378a3208b435b394af28bbbc9e8a
|
4
|
+
data.tar.gz: bbbe7049150eb2ec195cb3af5f343bdc5862f005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19dc0d167af5df2e6812117b0bb34cc611a03bec1f0a1e5299dbf42fc6ef7f40e9b7f233d2b4534b764c1fbe614b070969d388ff3d151c451d24f0dc63e99371
|
7
|
+
data.tar.gz: 289875757787eb1a8c4c15e0fc7a50a86b5eb90085f9460aadf213cf3ce2fc37baf80137b78e471f1c43192c30517f84d5a17f4088ded45ff40232154cc92fff
|
data/lib/arkaan/concerns.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Arkaan
|
2
2
|
# This module holds the shared concerns to include in the desired models.
|
3
|
-
# @
|
3
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
4
|
module Concerns
|
5
5
|
autoload :Sluggable, 'arkaan/concerns/sluggable'
|
6
6
|
autoload :Activable, 'arkaan/concerns/activable'
|
7
|
+
autoload :Diagnosticable, 'arkaan/concerns/diagnosticable'
|
7
8
|
end
|
8
9
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Arkaan
|
2
|
+
module Concerns
|
3
|
+
# Includes the diagnostic URL field, and the related validations.
|
4
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
+
module Diagnosticable
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
# Module holding the class methods for the classes including this concern.
|
9
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
10
|
+
module ClassMethods
|
11
|
+
# Add the field and its validations in the model including it.
|
12
|
+
# @param entity_type [String,Symbol] the name of the model including it, to be included in the error messages.
|
13
|
+
def make_diagnosticable(entity_type)
|
14
|
+
# @!attribute [rw] diagnostic
|
15
|
+
# @return [String] the diagnostic URL to know the status of an entity (usually a gateway, or an instance of a service).
|
16
|
+
field :diagnostic, type: String, default: '/status'
|
17
|
+
|
18
|
+
validates :diagnostic,
|
19
|
+
presence: {message: "#{entity_type}.diagnostic.blank"},
|
20
|
+
length: {minimum: 4, message: "#{entity_type}.diagnostic.short"},
|
21
|
+
format: {with: /\A(\/[a-z]+)+\z/, message: "#{entity_type}.diagnostic.format"}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -5,12 +5,22 @@ module Arkaan
|
|
5
5
|
module Sluggable
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
field
|
8
|
+
# Module holding the class methods for the classes including this concern.
|
9
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
10
|
+
module ClassMethods
|
11
|
+
# Add the field and its validations in the model including it.
|
12
|
+
# @param entity_type [String,Symbol] the name of the model including it, to be included in the error messages.
|
13
|
+
def make_sluggable(entity_type)
|
14
|
+
# @!attribute [rw] slug
|
15
|
+
# @return [String] the slug of the current entity ; it must be snake-cased, longer than four characters, unique for the entity and given.
|
16
|
+
field :slug, type: String
|
12
17
|
|
13
|
-
|
18
|
+
validates :slug,
|
19
|
+
length: {minimum: 4, message: "#{entity_type}.slug.short"},
|
20
|
+
format: {with: /\A[a-z]+(_[a-z]+)*\z/, message: "#{entity_type}.slug.format"},
|
21
|
+
uniqueness: {message: "#{entity_type}.slug.uniq"},
|
22
|
+
presence: {message: "#{entity_type}.slug.blank"}
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
16
26
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Arkaan
|
2
2
|
module Monitoring
|
3
|
+
# A gateway is a portal by which you access the different web services of the application suite.
|
4
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
3
5
|
class Gateway
|
4
6
|
include Mongoid::Document
|
5
7
|
include Mongoid::Timestamps
|
6
8
|
include Arkaan::Concerns::Activable
|
9
|
+
include Arkaan::Concerns::Diagnosticable
|
7
10
|
|
8
11
|
# @!attribute [rw] url
|
9
12
|
# @return [String] the URL of the gateway, where the requests will be issued.
|
@@ -14,6 +17,8 @@ module Arkaan
|
|
14
17
|
|
15
18
|
scope :running , ->{ where(running: true) }
|
16
19
|
|
20
|
+
make_diagnosticable 'gateway'
|
21
|
+
|
17
22
|
validates :url,
|
18
23
|
presence: {message: 'gateway.url.blank'},
|
19
24
|
format: {with: /\A(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\z/, message: 'gateway.url.format', if: :url?}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Arkaan
|
2
2
|
module Monitoring
|
3
3
|
# An instance is one of the services, deployed on one server. A service may have many instances to balance the load between them all.
|
4
|
-
# @
|
4
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
5
|
class Instance
|
6
6
|
include Mongoid::Document
|
7
7
|
include Mongoid::Timestamps
|
@@ -6,6 +6,7 @@ module Arkaan
|
|
6
6
|
include Mongoid::Document
|
7
7
|
include Mongoid::Timestamps
|
8
8
|
include Arkaan::Concerns::Activable
|
9
|
+
include Arkaan::Concerns::Diagnosticable
|
9
10
|
|
10
11
|
# @!attribute [rw] key
|
11
12
|
# @return [String] the name, or title of the service, optionally given to identify it more easily.
|
@@ -13,6 +14,8 @@ module Arkaan
|
|
13
14
|
# @!attribute [rw] path
|
14
15
|
# @return [String] the path the service will be mapped on in the API.
|
15
16
|
field :path, type: String, default: '/'
|
17
|
+
|
18
|
+
make_diagnosticable 'service'
|
16
19
|
|
17
20
|
# @!attribute [rw] creator
|
18
21
|
# @return [Arkaan::Account] the creator of this service.
|
@@ -13,6 +13,8 @@ module Arkaan
|
|
13
13
|
# @!attribute [rw] rights
|
14
14
|
# @return [Array<Arkaan::Permissions::Right>] the rights granted by belonging to this group.
|
15
15
|
has_and_belongs_to_many :rights, class_name: 'Arkaan::Permissions::Right', inverse_of: :groups
|
16
|
+
|
17
|
+
make_sluggable 'group'
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -10,6 +10,8 @@ module Arkaan
|
|
10
10
|
# @!attribute [rw] groups
|
11
11
|
# @return [Array<Arkaan::Permissions::Group>] the groups granted with the permission to access features opened by this right.
|
12
12
|
has_and_belongs_to_many :groups, class_name: 'Arkaan::Permissions::Group', inverse_of: :rights
|
13
|
+
|
14
|
+
make_sluggable 'right'
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/arkaan/account.rb
|
161
161
|
- lib/arkaan/concerns.rb
|
162
162
|
- lib/arkaan/concerns/activable.rb
|
163
|
+
- lib/arkaan/concerns/diagnosticable.rb
|
163
164
|
- lib/arkaan/concerns/sluggable.rb
|
164
165
|
- lib/arkaan/monitoring.rb
|
165
166
|
- lib/arkaan/monitoring/gateway.rb
|