Class: Escort::Setup::Dsl::Global
- Inherits:
-
Object
- Object
- Escort::Setup::Dsl::Global
- Defined in:
- lib/escort/setup/dsl/global.rb
Instance Method Summary collapse
- #action(&block) ⇒ Object
- #command(name, options = {}, &block) ⇒ Object
- #config_file(name, options = {}) ⇒ Object
- #conflicting_options(*command_names) ⇒ Object
- #description(description) ⇒ Object
-
#initialize(&block) ⇒ Global
constructor
A new instance of Global.
- #options(&block) ⇒ Object
- #requires_arguments(boolean = true) ⇒ Object
- #summary(summary) ⇒ Object
- #version(version) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Global
Returns a new instance of Global.
5 6 7 8 9 10 |
# File 'lib/escort/setup/dsl/global.rb', line 5 def initialize(&block) reset block.call(self) rescue => e raise Escort::ClientError.new("Problem with syntax of global configuration", e) end |
Instance Method Details
#action(&block) ⇒ Object
16 17 18 |
# File 'lib/escort/setup/dsl/global.rb', line 16 def action(&block) Action.action(:global, @action, &block) end |
#command(name, options = {}, &block) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/escort/setup/dsl/global.rb', line 20 def command(name, = {}, &block) [:requires_arguments] = @requires_arguments command = Command.new(name.to_sym, , &block) aliases = [[:aliases] || []].flatten + [name] aliases.each do |name| @commands[name.to_sym] = command end end |
#config_file(name, options = {}) ⇒ Object
37 38 39 |
# File 'lib/escort/setup/dsl/global.rb', line 37 def config_file(name, = {}) @config_file = ConfigFile.new(name, ) end |
#conflicting_options(*command_names) ⇒ Object
53 54 55 |
# File 'lib/escort/setup/dsl/global.rb', line 53 def (*command_names) raise Escort::ClientError.new("This interface for specifying conflicting options is no longer supported, please use 'opts.conflict' in the options block") end |
#description(description) ⇒ Object
49 50 51 |
# File 'lib/escort/setup/dsl/global.rb', line 49 def description(description) @description = description end |
#options(&block) ⇒ Object
12 13 14 |
# File 'lib/escort/setup/dsl/global.rb', line 12 def (&block) Options.(:global, @options, &block) end |
#requires_arguments(boolean = true) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/escort/setup/dsl/global.rb', line 29 def requires_arguments(boolean = true) raise Escort::ClientError.new("Parameter to 'requires_arguments' must be a boolean") unless [true, false].include?(boolean) @requires_arguments = boolean @commands.each do |command| command.requires_arguments(boolean) end end |
#summary(summary) ⇒ Object
45 46 47 |
# File 'lib/escort/setup/dsl/global.rb', line 45 def summary(summary) @summary = summary end |
#version(version) ⇒ Object
41 42 43 |
# File 'lib/escort/setup/dsl/global.rb', line 41 def version(version) @version = version end |