Class: DevOops::Commands::EditScriptSh
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- DevOops::Commands::EditScriptSh
- Includes:
- Thor::Actions
- Defined in:
- lib/dev_oops/commands/edit_script_sh.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
17 18 19 |
# File 'lib/dev_oops/commands/edit_script_sh.rb', line 17 def self. "#{$PROGRAM_NAME} edit_sh SCRIPT_NAME" end |
.source_root ⇒ Object
7 8 9 |
# File 'lib/dev_oops/commands/edit_script_sh.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 32 |
# File 'lib/dev_oops/commands/edit_script_sh.rb', line 21 def edit script_dir = if [:global] ScriptsLoader::GLOBAL_DIR else ScriptsLoader.script_dir(script_name) end path = "#{script_dir}/#{script_name}.sh" create_file(path) unless File.exist?(path) FileUtils.chmod(0o750, path) system("#{ENV['EDITOR'] || 'vim'} #{path}") end |