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

Instance Method Details

#delete_messageObject



153
154
155
156
157
# File 'lib/pickler.rb', line 153

def delete_message
  File.delete message_path
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 message_path, "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_pathObject



159
160
161
# File 'lib/pickler.rb', line 159

def message_path
  File.join in_repo? ? gitdir : "/tmp", message_filename
end