Class: Guard::CLI
- Inherits:
-
Thor
- Object
- Thor
- Guard::CLI
- Defined in:
- lib/guard/cli.rb
Overview
Facade for the Guard command line interface managed by [Thor](github.com/wycats/thor).
This is the main interface to Guard that is called by the Guard binary ‘bin/guard`. Do not put any logic in here, create a class and delegate instead.
Class Method Summary collapse
Instance Method Summary collapse
-
#init(*plugin_names) ⇒ Object
Initializes the templates of all installed Guard plugins and adds them to the ‘Guardfile` when no Guard name is passed.
-
#list ⇒ Object
List the Guard plugins that are available for use in your system and marks those that are currently used in your ‘Guardfile`.
-
#notifiers ⇒ Object
List the Notifiers for use in your system.
-
#show ⇒ Object
Shows all Guard plugins and their options that are defined in the ‘Guardfile`.
-
#start ⇒ Object
Start Guard by initializing the defined Guard plugins and watch the file system.
-
#version ⇒ Object
Shows the current version of Guard.
Class Method Details
.help(shell, subcommand = false) ⇒ Object
99 100 101 102 |
# File 'lib/guard/cli.rb', line 99 def self.help(shell, subcommand = false) super command_help(shell, default_task) end |
Instance Method Details
#init(*plugin_names) ⇒ Object
Initializes the templates of all installed Guard plugins and adds them to the ‘Guardfile` when no Guard name is passed. When passing Guard plugin names it does the same but only for those Guard plugins.
initialize
181 182 183 184 185 |
# File 'lib/guard/cli.rb', line 181 def init(*plugin_names) env = Cli::Environments::Valid.new() exitcode = env.initialize_guardfile(plugin_names) exit(exitcode) end |
#list ⇒ Object
List the Guard plugins that are available for use in your system and marks those that are currently used in your ‘Guardfile`.
132 133 134 135 |
# File 'lib/guard/cli.rb', line 132 def list Cli::Environments::EvaluateOnly.new().evaluate DslDescriber.new.list end |
#notifiers ⇒ Object
List the Notifiers for use in your system.
143 144 145 146 147 |
# File 'lib/guard/cli.rb', line 143 def notifiers Cli::Environments::EvaluateOnly.new().evaluate # TODO: pass the data directly to the notifiers? DslDescriber.new.notifiers end |
#show ⇒ Object
Shows all Guard plugins and their options that are defined in the ‘Guardfile`
195 196 197 198 |
# File 'lib/guard/cli.rb', line 195 def show Cli::Environments::EvaluateOnly.new().evaluate DslDescriber.new.show end |
#start ⇒ Object
Start Guard by initializing the defined Guard plugins and watch the file system.
This is the default task, so calling ‘guard` is the same as calling `guard start`.
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/guard/cli.rb', line 112 def start if defined?(JRUBY_VERSION) unless [:no_interactions] abort "\nSorry, JRuby and interactive mode are incompatible.\n"\ "As a workaround, use the '-i' option instead.\n\n"\ "More info: \n"\ " * https://github.com/guard/guard/issues/754\n"\ " * https://github.com/jruby/jruby/issues/2383\n\n" end end exit(Cli::Environments::Valid.new().start_guard) end |
#version ⇒ Object
Shows the current version of Guard.
156 157 158 |
# File 'lib/guard/cli.rb', line 156 def version $stdout.puts "Guard version #{ VERSION }" end |