Class: Guard::Cli::Environments::Valid
- Inherits:
-
Object
- Object
- Guard::Cli::Environments::Valid
- Defined in:
- lib/guard/cli/environments/valid.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Valid
constructor
A new instance of Valid.
- #initialize_guardfile(plugin_names = []) ⇒ Object
- #start_guard ⇒ Object
Constructor Details
#initialize(options) ⇒ Valid
Returns a new instance of Valid.
9 10 11 |
# File 'lib/guard/cli/environments/valid.rb', line 9 def initialize() @options = end |
Instance Method Details
#initialize_guardfile(plugin_names = []) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/guard/cli/environments/valid.rb', line 26 def initialize_guardfile(plugin_names = []) = @options[:bare] Guard.init(@options) session = Guard.state.session generator = Guardfile::Generator.new begin Guardfile::Evaluator.new(session.).evaluate rescue Guardfile::Evaluator::NoGuardfileError generator.create_guardfile rescue Guard::Guardfile::Evaluator::NoPluginsError # Do nothing - just the error end return 0 if # 0 - exit code # Evaluate because it might have existed and creating was skipped begin Guardfile::Evaluator.new(session.).evaluate rescue Guard::Guardfile::Evaluator::NoPluginsError end begin if plugin_names.empty? generator.initialize_all_templates else plugin_names.each do |plugin_name| generator.initialize_template(plugin_name) end end rescue Guardfile::Generator::Error => e UI.error(e.) return 1 end # TODO: capture exceptions to show msg and return exit code on # failures 0 # exit code end |
#start_guard ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/guard/cli/environments/valid.rb', line 13 def start_guard # TODO: just to make sure tests are ok Bundler.new.verify unless @options[:no_bundler_warning] Guard.start(@options) rescue Dsl::Error, Guardfile::Evaluator::NoPluginsError, Guardfile::Evaluator::NoGuardfileError, Guardfile::Evaluator::NoCustomGuardfile => e # catch to throw message instead of call stack UI.error(e.) abort end |