Sha256: d20b65053ec5cca7521503bcd34886aea969986392aac3a23bc4d38c0c20cfee
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
require 'compiler/git_helper' require 'compiler/base' require 'compiler/template' # Covers all the domains and the actions that are taken on all domains at once. # # Usage: # # YMDP::Compiler::Domains.new(:message => "Commit message").compile # # Options are provided by command-line parsing from YMDP::Compiler::Options. # module YMDP module Compiler # Covers all the domains and the actions that are taken on all domains at once. # class Domains < YMDP::Base attr_accessor :git, :git_hash, :message, :domains, :options 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 # Compile the source code for all domains into their usable destination files. # def compile Timer.new(:title => "YMDP").time do clean_tmp_dir do process_domains end end end # Returns all domains. # def all_domains servers.servers.keys end # Commit to git and store the hash of the commit. # def commit @git = GitHelper.new @git.do_commit(@message) @git_hash = git.get_hash(options[:branch]) end # Process source code for each domain in turn. # def process_domains domains.each do |domain| params = options params[:server] = servers[domain]["server"] compiler = YMDP::Compiler::Base.new(domain, git_hash, options) compiler.process_all end end # Perform a block, starting with a clean 'tmp' directory and ending with one. # def clean_tmp_dir system "rm -rf #{TMP_PATH}" system "mkdir #{TMP_PATH}" yield system "rm -rf #{TMP_PATH}" system "mkdir #{TMP_PATH}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ymdp-0.1.6 | lib/ymdp/compiler/domains.rb |