1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Use def_delegators instead of tedious delegation

This commit is contained in:
Matt Brictson 2016-01-22 19:38:39 -08:00
parent 4f56f6914c
commit 8c379b9312

View file

@ -1,14 +1,12 @@
require "forwardable"
module Capistrano module Capistrano
module DSL module DSL
module Env module Env
extend Forwardable
def configure_backend def_delegators :env,
env.configure_backend :configure_backend, :fetch, :set, :set_if_empty, :delete,
end :ask, :role, :server, :primary, :validate
def fetch(key, default=nil, &block)
env.fetch(key, default, &block)
end
def any?(key) def any?(key)
value = fetch(key) value = fetch(key)
@ -19,30 +17,6 @@ module Capistrano
end end
end end
def set(key, value=nil, &block)
env.set(key, value, &block)
end
def set_if_empty(key, value=nil, &block)
env.set_if_empty(key, value, &block)
end
def delete(key)
env.delete(key)
end
def ask(key, value, options={})
env.ask(key, value, options)
end
def role(name, servers, options={})
env.role(name, servers, options)
end
def server(name, properties={})
env.server(name, properties)
end
def roles(*names) def roles(*names)
env.roles_for(names.flatten) env.roles_for(names.flatten)
end end
@ -60,14 +34,6 @@ module Capistrano
roles(*names) roles(*names)
end end
def primary(role)
env.primary(role)
end
def validate(key, &validator)
env.validate(key, &validator)
end
def env def env
Configuration.env Configuration.env
end end
@ -79,7 +45,6 @@ module Capistrano
def asset_timestamp def asset_timestamp
env.timestamp.strftime("%Y%m%d%H%M.%S") env.timestamp.strftime("%Y%m%d%H%M.%S")
end end
end end
end end
end end