Class: DevOops::Commands::EditScript
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- DevOops::Commands::EditScript
- Includes:
- Thor::Actions
- Defined in:
- lib/dev_oops/commands/edit_script.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
17 18 19 |
# File 'lib/dev_oops/commands/edit_script.rb', line 17 def self. "#{$PROGRAM_NAME} edit SCRIPT_NAME" end |
.source_root ⇒ Object
7 8 9 |
# File 'lib/dev_oops/commands/edit_script.rb', line 7 def self.source_root "#{File.dirname(__FILE__)}/../../../" end |
Instance Method Details
#edit ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dev_oops/commands/edit_script.rb', line 21 def edit script_dir = if [:global] ScriptsLoader::GLOBAL_DIR else ScriptsLoader.script_dir(script_name) end path = "#{script_dir}/#{script_name}.json" template 'templates/empty_script.tt', path unless File.exist?(path) system("#{ENV['EDITOR'] || 'vim'} #{path}") end |