Module: Fezzik

Defined in:
lib/fezzik/dsl.rb,
lib/fezzik/base.rb,
lib/fezzik/util.rb,
lib/fezzik/version.rb,
lib/fezzik/environment.rb

Defined Under Namespace

Modules: DSL, Util

Constant Summary collapse

VERSION =
"0.6.1"

Class Method Summary collapse

Class Method Details

.destination(name, &block) ⇒ Object

TODO: add domain override (through environment variable?)



12
13
14
# File 'lib/fezzik/base.rb', line 12

def self.destination(name, &block)
  block.call if name == @target_destination
end

.env(key, value, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/fezzik/environment.rb', line 2

def self.env(key, value, options={})
  options = {
    :hosts => domain
  }.merge(options)
  options[:hosts] = Array(options[:hosts])
  @environments ||= Hash.new { |h, k| h[k] = {} }
  options[:hosts].each { |host| @environments[host][key] = value }
end

.environmentsObject



11
12
13
# File 'lib/fezzik/environment.rb', line 11

def self.environments
  @environments ||= Hash.new { |h, k| h[k] = {} }
end

.init(options = {}) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/fezzik/base.rb', line 2

def self.init(options={})
  @options = options
  @target_destination = ENV["fezzik_destination"].to_sym rescue nil
  unless options[:tasks].nil?
    puts "Loading Fezzik tasks from #{@options[:tasks]}"
    Dir[File.join(Dir.pwd, "#{@options[:tasks]}/**/*.rake")].sort.each { |lib| import lib }
  end
end

.target_destinationObject



16
17
18
# File 'lib/fezzik/base.rb', line 16

def self.target_destination
  @target_destination ||= nil
end