Class: Nesta::Commands::Edit

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nesta/commands.rb

Instance Method Summary collapse

Methods included from Command

#copy_template, #copy_templates, #fail, #run_process, #template_root, #update_config_yaml

Constructor Details

#initialize(*args) ⇒ Edit

Returns a new instance of Edit



69
70
71
# File 'lib/nesta/commands.rb', line 69

def initialize(*args)
  @filename = Nesta::Config.page_path(args.shift)
end

Instance Method Details

#executeObject



73
74
75
76
77
78
79
# File 'lib/nesta/commands.rb', line 73

def execute
  editor = ENV.fetch('EDITOR')
rescue IndexError
  $stderr.puts "No editor: set EDITOR environment variable"
else
  run_process(editor, @filename)
end