class Guard::Cli::Environments::Valid
def initialize_guardfile(plugin_names = [])
def initialize_guardfile(plugin_names = []) bare = @options[:bare] Guard.init(@options) session = Guard.state.session generator = Guardfile::Generator.new begin Guardfile::Evaluator.new(session.evaluator_options).evaluate rescue Guardfile::Evaluator::NoGuardfileError generator.create_guardfile rescue Guard::Guardfile::Evaluator::NoPluginsError # Do nothing - just the error end return 0 if bare # 0 - exit code # Evaluate because it might have existed and creating was skipped begin Guardfile::Evaluator.new(session.evaluator_options).evaluate rescue Guard::Guardfile::Evaluator::NoPluginsError end if plugin_names.empty? generator.initialize_all_templates else plugin_names.each do |plugin_name| generator.initialize_template(plugin_name) end end # TODO: capture exceptions to show msg and return exit code on # failures 0 # exit code end