lib/aptible/cli/subcommands/config.rb in aptible-cli-0.6.0 vs lib/aptible/cli/subcommands/config.rb in aptible-cli-0.6.1
- old
+ new
@@ -8,52 +8,47 @@
thor.class_eval do
include Helpers::Operation
include Helpers::App
desc 'config', "Print an app's current configuration"
- option :app
- option :remote, aliases: '-r'
+ app_options
def config
app = ensure_app(options)
config = app.current_configuration
env = config ? config.env : nil
puts formatted_config(env || {})
end
desc 'config:add', 'Add an ENV variable to an app'
- option :app
- option :remote, aliases: '-r'
+ app_options
define_method 'config:add' do |*args|
# FIXME: define_method - ?! Seriously, WTF Thor.
app = ensure_app(options)
env = Hash[args.map { |arg| arg.split('=', 2) }]
operation = app.create_operation(type: 'configure', env: env)
puts 'Updating configuration and restarting app...'
attach_to_operation_logs(operation)
end
desc 'config:set', 'Alias for config:add'
- option :app
- option :remote, aliases: '-r'
+ app_options
define_method 'config:set' do |*args|
send('config:add', *args)
end
desc 'config:rm', 'Remove an ENV variable from an app'
- option :app
- option :remote, aliases: '-r'
+ app_options
define_method 'config:rm' do |*args|
# FIXME: define_method - ?! Seriously, WTF Thor.
app = ensure_app(options)
env = Hash[args.map { |arg| [arg, ''] }]
operation = app.create_operation(type: 'configure', env: env)
puts 'Updating configuration and restarting app...'
attach_to_operation_logs(operation)
end
desc 'config:unset', 'Alias for config:rm'
- option :app
- option :remote, aliases: '-r'
+ app_options
define_method 'config:unset' do |*args|
send('config:add', *args)
end
private