Class: Teleport::Config::DSL
- Inherits:
-
Object
- Object
- Teleport::Config::DSL
- Defined in:
- lib/teleport/config.rb
Overview
DSL used when parsing Telfile.
Instance Method Summary collapse
- #apt(line, options = {}) ⇒ Object
-
#initialize(config) ⇒ DSL
constructor
A new instance of DSL.
- #packages(*list) ⇒ Object
- #recipes(*list) ⇒ Object
- #role(name, options = {}) ⇒ Object
- #ruby(v) ⇒ Object
- #server(name, options = {}) ⇒ Object
- #ssh_key(v) ⇒ Object
- #ssh_options(v) ⇒ Object
- #user(v) ⇒ Object
Constructor Details
#initialize(config) ⇒ DSL
Returns a new instance of DSL.
112 113 114 |
# File 'lib/teleport/config.rb', line 112 def initialize(config) @config = config end |
Instance Method Details
#apt(line, options = {}) ⇒ Object
145 146 147 |
# File 'lib/teleport/config.rb', line 145 def apt(line, = {}) @config.apt << Apt.new(line, ) end |
#packages(*list) ⇒ Object
149 150 151 |
# File 'lib/teleport/config.rb', line 149 def packages(*list) @config.packages += list.flatten end |
#recipes(*list) ⇒ Object
153 154 155 |
# File 'lib/teleport/config.rb', line 153 def recipes(*list) @config.recipes += list.flatten end |
#role(name, options = {}) ⇒ Object
135 136 137 138 |
# File 'lib/teleport/config.rb', line 135 def role(name, = {}) raise "role #{name.inspect} defined twice" if @config.roles.any? { |i| i.name == name } @config.roles << Role.new(name, ) end |
#ruby(v) ⇒ Object
116 117 118 119 120 121 |
# File 'lib/teleport/config.rb', line 116 def ruby(v) raise "ruby called twice" if @config.ruby raise "ruby must be a string" if !v.is_a?(String) raise "don't recognize ruby #{v.inspect}." if !Config::RUBIES.include?(v) @config.ruby = v end |
#server(name, options = {}) ⇒ Object
140 141 142 143 |
# File 'lib/teleport/config.rb', line 140 def server(name, = {}) raise "server #{name.inspect} defined twice" if @config.servers.any? { |i| i.name == name } @config.servers << Server.new(name, ) end |
#ssh_key(v) ⇒ Object
157 158 159 |
# File 'lib/teleport/config.rb', line 157 def ssh_key(v) @config.ssh_key = v end |
#ssh_options(v) ⇒ Object
129 130 131 132 133 |
# File 'lib/teleport/config.rb', line 129 def (v) raise "ssh_options called twice" if @config. raise "ssh_options must be an Array" if !v.is_a?(Array) @config. = v end |
#user(v) ⇒ Object
123 124 125 126 127 |
# File 'lib/teleport/config.rb', line 123 def user(v) raise "user called twice" if @config.user raise "user must be a string" if !v.is_a?(String) @config.user = v end |