Class: Gitload::Config::DSL

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gitload/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ DSL

Returns a new instance of DSL.



69
70
71
72
# File 'lib/gitload/config.rb', line 69

def initialize config
  @config = config
  @repos = RepoChain.new @config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



108
109
110
111
112
113
114
# File 'lib/gitload/config.rb', line 108

def method_missing symbol, *args, &block
  if Sources.sources.key? symbol
    Sources.sources[symbol].source *args.unshift(@config), &block
  else
    super symbol, *args, &block
  end
end

Instance Attribute Details

#reposObject (readonly)

Returns the value of attribute repos.



67
68
69
# File 'lib/gitload/config.rb', line 67

def repos
  @repos
end

Instance Method Details

#cacheObject



78
79
80
# File 'lib/gitload/config.rb', line 78

def cache
  @config.cache = true
end

#chain(repos = [], options = {}) ⇒ Object



74
75
76
# File 'lib/gitload/config.rb', line 74

def chain repos = [], options = {}
  RepoChain.new @config, repos, options
end

#clone_url_type(type, &block) ⇒ Object



93
94
95
96
97
98
99
100
101
102
# File 'lib/gitload/config.rb', line 93

def clone_url_type type, &block

  previous_type = @config.clone_url_type
  @config.clone_url_type = type

  if block
    instance_eval &block
    @config.clone_url_type = previous_type
  end
end

#root(dest, &block) ⇒ Object Also known as: into



82
83
84
85
86
87
88
89
90
91
# File 'lib/gitload/config.rb', line 82

def root dest, &block

  previous_root = @config.root
  @config.root = dest

  if block
    instance_eval &block
    @config.root = previous_root
  end
end