Class: Nesta::Commands::Edit

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nesta/commands/edit.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



8
9
10
# File 'lib/nesta/commands/edit.rb', line 8

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

Instance Method Details

#executeObject



12
13
14
15
16
17
18
# File 'lib/nesta/commands/edit.rb', line 12

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