Class: YMDP::Compiler::Domains
- Defined in:
- lib/ymdp/compiler/domains.rb
Overview
Covers all the domains and the actions that are taken on all domains at once.
Instance Attribute Summary collapse
-
#domains ⇒ Object
Returns the value of attribute domains.
-
#git ⇒ Object
Returns the value of attribute git.
-
#git_hash ⇒ Object
Returns the value of attribute git_hash.
-
#message ⇒ Object
Returns the value of attribute message.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#all_domains ⇒ Object
Returns all domains.
-
#clean_tmp_dir ⇒ Object
Perform a block, starting with a clean ‘tmp’ directory and ending with one.
-
#commit ⇒ Object
Commit to git and store the hash of the commit.
-
#compile ⇒ Object
Compile the source code for all domains into their usable destination files.
-
#initialize(options = nil) ⇒ Domains
constructor
A new instance of Domains.
-
#process_domains ⇒ Object
Process source code for each domain in turn.
Methods inherited from Base
#base_path, base_path, #configuration, configuration, configure, #content_variables, display_path, #display_path, #paths, #servers
Constructor Details
#initialize(options = nil) ⇒ Domains
Returns a new instance of Domains.
20 21 22 23 24 25 26 27 28 |
# File 'lib/ymdp/compiler/domains.rb', line 20 def initialize(=nil) @options = @servers = @options[:servers] @domains = @options[:domain] || all_domains @domains = Array(@domains) @message = @options[:message] commit if @options[:commit] end |
Instance Attribute Details
#domains ⇒ Object
Returns the value of attribute domains.
18 19 20 |
# File 'lib/ymdp/compiler/domains.rb', line 18 def domains @domains end |
#git ⇒ Object
Returns the value of attribute git.
18 19 20 |
# File 'lib/ymdp/compiler/domains.rb', line 18 def git @git end |
#git_hash ⇒ Object
Returns the value of attribute git_hash.
18 19 20 |
# File 'lib/ymdp/compiler/domains.rb', line 18 def git_hash @git_hash end |
#message ⇒ Object
Returns the value of attribute message.
18 19 20 |
# File 'lib/ymdp/compiler/domains.rb', line 18 def @message end |
#options ⇒ Object
Returns the value of attribute options.
18 19 20 |
# File 'lib/ymdp/compiler/domains.rb', line 18 def @options end |
Instance Method Details
#all_domains ⇒ Object
Returns all domains.
42 43 44 |
# File 'lib/ymdp/compiler/domains.rb', line 42 def all_domains servers.servers.keys end |
#clean_tmp_dir ⇒ Object
Perform a block, starting with a clean ‘tmp’ directory and ending with one.
69 70 71 72 73 74 75 |
# File 'lib/ymdp/compiler/domains.rb', line 69 def clean_tmp_dir system "rm -rf #{TMP_PATH}" system "mkdir #{TMP_PATH}" yield system "rm -rf #{TMP_PATH}" system "mkdir #{TMP_PATH}" end |
#commit ⇒ Object
Commit to git and store the hash of the commit.
48 49 50 51 52 |
# File 'lib/ymdp/compiler/domains.rb', line 48 def commit @git = YMDP::GitHelper.new @git.do_commit(@message) @git_hash = git.get_hash([:branch]) end |
#compile ⇒ Object
Compile the source code for all domains into their usable destination files.
32 33 34 35 36 37 38 |
# File 'lib/ymdp/compiler/domains.rb', line 32 def compile Timer.new(:title => "YMDP").time do clean_tmp_dir do process_domains end end end |
#process_domains ⇒ Object
Process source code for each domain in turn.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ymdp/compiler/domains.rb', line 56 def process_domains domains.each do |domain| params = params[:host] = configuration.host params[:server] = servers[domain]["server"] compiler = YMDP::Compiler::Base.new(domain, git_hash, params) compiler.process_all end end |