Class: Mimas::Site
- Inherits:
-
Object
- Object
- Mimas::Site
- Includes:
- Archive
- Defined in:
- lib/mimas/site.rb,
lib/mimas/site/archive.rb
Defined Under Namespace
Modules: Archive
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#files ⇒ Object
Placeholder, will be overwritten by the config file if defined.
-
#glob ⇒ Object
Placeholder, will be overwritten by the config file if defined.
-
#initialize(name, args) ⇒ Site
constructor
A new instance of Site.
- #ruby_app? ⇒ Boolean
- #static? ⇒ Boolean
- #validate! ⇒ Object
Methods included from Archive
Constructor Details
#initialize(name, args) ⇒ Site
Returns a new instance of Site.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mimas/site.rb', line 6 def initialize(name, args) @name = name args[:services] ||= [] args[:deploy] ||= "bundle install" args[:env] ||= "" args[:healthcheck_path] ||= "/" args.each do |key, value| define_singleton_method(key) { value } end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/mimas/site.rb', line 5 def name @name end |
Instance Method Details
#files ⇒ Object
Placeholder, will be overwritten by the config file if defined
32 33 34 |
# File 'lib/mimas/site.rb', line 32 def files nil end |
#glob ⇒ Object
Placeholder, will be overwritten by the config file if defined
27 28 29 |
# File 'lib/mimas/site.rb', line 27 def glob nil end |
#ruby_app? ⇒ Boolean
22 23 24 |
# File 'lib/mimas/site.rb', line 22 def ruby_app? services.any? end |
#static? ⇒ Boolean
18 19 20 |
# File 'lib/mimas/site.rb', line 18 def static? !ruby_app? end |
#validate! ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/mimas/site.rb', line 36 def validate! raise Config::InvalidConfiguration.new("`site` requires a `domain`") \ unless self.respond_to?(:domain) if ruby_app? raise Config::InvalidConfiguration.new("`site` requires a `files` directive") \ unless self.files != nil services.values.each do |service| raise Config::InvalidConfiguration.new("#{service[:name]} service requires a `command` directive") \ unless service[:command] end else raise Config::InvalidConfiguration.new("`site` requires a `root_dir` directive") \ unless self.respond_to?(:root_dir) raise Config::InvalidConfiguration.new("`site` requires a `files` or `glob` directive") \ unless self.glob != nil || self.files != nil end true end |