Module: Pickler::Editor
- Included in:
- Runner::Base
- Defined in:
- lib/pickler.rb
Overview
Stolen from GHI - git://github.com/stephencelis/ghi.git
Instance Method Summary collapse
- #delete_message ⇒ Object
- #edit_format(type) ⇒ Object
- #gets_from_editor(type) ⇒ Object
- #launch_editor(file) ⇒ Object
- #message_path ⇒ Object
Instance Method Details
#delete_message ⇒ Object
153 154 155 156 157 |
# File 'lib/pickler.rb', line 153 def File.delete rescue Errno::ENOENT, TypeError nil end |
#edit_format(type) ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/pickler.rb', line 163 def edit_format(type) l = [] l << "" l << "# Editing #{type}." l << "# The first line will be the 'title', subsequent ones 'description'." l << "# Lines beginning '#' will be ignored and empty messages discarded." end |
#gets_from_editor(type) ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/pickler.rb', line 144 def gets_from_editor(type) if windows? warn "Windows fail => Please supply the message appended on the command" exit 1 end File.open , "a+", &file_proc(type) return @message.shift.strip, @message end |
#launch_editor(file) ⇒ Object
140 141 142 |
# File 'lib/pickler.rb', line 140 def launch_editor(file) system "#{editor} #{file.path}" end |
#message_path ⇒ Object
159 160 161 |
# File 'lib/pickler.rb', line 159 def File.join in_repo? ? gitdir : "/tmp", end |