class YMDP::Compiler::Domains

Covers all the domains and the actions that are taken on all domains at once.

Attributes

domains[RW]
git[RW]
git_hash[RW]
message[RW]
options[RW]

Public Class Methods

new(options=nil) click to toggle source
# File lib/ymdp/compiler/domains.rb, line 20
def initialize(options=nil)
  @options = options
  @servers = @options[:servers]
  @domains = @options[:domain] || all_domains
  @domains = @domains.to_a
  @message = @options[:message]

  commit if @options[:commit]
end

Public Instance Methods

all_domains() click to toggle source

Returns all domains.

# File lib/ymdp/compiler/domains.rb, line 42
def all_domains
  servers.servers.keys
end
clean_tmp_dir() { || ... } click to toggle source

Perform a block, starting with a clean ‘tmp’ directory and ending with one.

# 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() click to toggle source

Commit to git and store the hash of the commit.

# File lib/ymdp/compiler/domains.rb, line 48
def commit
  @git = YMDP::GitHelper.new
  @git.do_commit(@message)
  @git_hash = git.get_hash(options[:branch])    
end
compile() click to toggle source

Compile the source code for all domains into their usable destination files.

# 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() click to toggle source

Process source code for each domain in turn.

# File lib/ymdp/compiler/domains.rb, line 56
def process_domains
  domains.each do |domain|
    params = options
    params[:host] = configuration.host
    params[:server] = servers[domain]["server"]
    compiler = YMDP::Compiler::Base.new(domain, git_hash, params)
    
    compiler.process_all
  end
end