Module: Rigup::Base

Included in:
DeployBase
Defined in:
lib/rigup/base.rb

Class Method Summary collapse

Class Method Details

.included(aClass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rigup/base.rb', line 4

def self.included(aClass)
   aClass.class_eval do
    no_commands do

	    def logger
		    @logger ||= ::Logger.new(STDOUT)
	    end

	    def config
		    unless @config
			    @config = {}
					if File.exists?(f=File.join(release_path,'rigup.yml'))
						file_config = YAML.load(String.from_file(f))
						@config.merge!(file_config)
						@config = Rigup::Config.new(@config)
					end
			  end
		    @config
	    end

	    def context
		    @context ||= Rigup::Context.new(
					config: config,
					logger: logger,
					pwd: Dir.pwd,
				)
	    end

	    def release_path
		    @release_path ||= File.expand_path('.')
	    end

	    def site_dir
		    @site_dir ||= File.expand_path('../..',release_path)
	    end

	    def shared_path
	      @shared_path ||= File.expand_path('shared',site_dir)
	    end
	  end
   end

end