lib/ymdp/compiler/domains.rb in ymdp-0.1.4 vs lib/ymdp/compiler/domains.rb in ymdp-0.1.6
- old
+ new
@@ -12,11 +12,11 @@
#
module YMDP
module Compiler
# Covers all the domains and the actions that are taken on all domains at once.
#
- class Domains
+ class Domains < YMDP::Base
attr_accessor :git, :git_hash, :message, :domains, :options
def initialize(options=nil)
@options = options
@servers = @options[:servers]
@@ -24,39 +24,11 @@
@domains = @domains.to_a
@message = @options[:message]
commit if @options[:commit]
end
-
- # Class Methods to handle global stuff like base path and server settings
-
- def self.base_path= base_path
- @@base_path = base_path
- end
-
- def self.base_path
- @@base_path
- end
-
- def self.servers= servers
- @@servers = servers
- end
-
- def self.servers
- @@servers
- end
-
- # Instance Methods to access global stuff like base path and server settings
-
- def servers
- @@servers
- end
-
- def base_path
- @@base_path
- 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
@@ -81,23 +53,25 @@
# 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_DIR}"
- system "mkdir #{TMP_DIR}"
+ system "rm -rf #{TMP_PATH}"
+ system "mkdir #{TMP_PATH}"
yield
- system "rm -rf #{TMP_DIR}"
- system "mkdir #{TMP_DIR}"
+ system "rm -rf #{TMP_PATH}"
+ system "mkdir #{TMP_PATH}"
end
end
end
end
\ No newline at end of file