Class: Vagabund::Settler::Projects::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagabund/settler/projects/config.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



34
35
36
# File 'lib/vagabund/settler/projects/config.rb', line 34

def method_missing(meth, *args, &block)
  projects.send meth, *args, &block
end

Instance Method Details

#add_project(*args, &block) ⇒ Object Also known as: project, project=



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagabund/settler/projects/config.rb', line 20

def add_project(*args, &block)
  if args.first.is_a?(Projects::Base)
    prj = args.shift
    prj.config.projects_path ||= projects_path
    prj.configure &block if block_given?
    projects << prj
  else
    args.push({projects_path: projects_path}.merge(args.extract_options!))
    add_project Project.new(*args, &block)
  end
end

#projectsObject



16
17
18
# File 'lib/vagabund/settler/projects/config.rb', line 16

def projects
  @projects ||= []
end

#projects_pathObject Also known as: path



6
7
8
# File 'lib/vagabund/settler/projects/config.rb', line 6

def projects_path
  @projects_path ||= '/vagrant'
end

#projects_path=(path) ⇒ Object Also known as: path=



11
12
13
# File 'lib/vagabund/settler/projects/config.rb', line 11

def projects_path=(path)
  @projects_path = path
end

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/vagabund/settler/projects/config.rb', line 38

def respond_to_missing?(meth, include_private=false)
  projects.respond_to? meth, include_private
end