Class: IssueEditor

Inherits:
Object show all
Defined in:
lib/taco/taco.rb

Instance Method Summary collapse

Constructor Details

#initialize(taco, retry_path) ⇒ IssueEditor

Returns a new instance of IssueEditor.



106
107
108
# File 'lib/taco/taco.rb', line 106

def initialize(taco, retry_path)
  @taco, @retry_path = taco, retry_path
end

Instance Method Details

#edit_issue!(issue, opts = {}) ⇒ Object



121
122
123
124
125
# File 'lib/taco/taco.rb', line 121

def edit_issue!(issue, opts={})
  if text = invoke_editor(opts[:template] || issue.to_template)
    write_issue!(issue.update_from_template!(text), text)
  end
end

#new_issue!(opts = {}) ⇒ Object



110
111
112
113
114
115
116
117
118
119
# File 'lib/taco/taco.rb', line 110

def new_issue!(opts={})
  if opts[:from_file]
    text = open(opts[:from_file]) { |f| f.read }
  else
    raise ArgumentError.new("Please define $EDITOR in your environment.") unless ENV['EDITOR']
    text = invoke_editor(opts[:template])
  end

  write_issue!(Issue.from_template(text), text) if text
end