Module: Todone::Views

Included in:
MessageProcessor
Defined in:
lib/todone/views.rb

Instance Method Summary collapse

Instance Method Details

#api_problem(data) ⇒ Object



57
58
59
# File 'lib/todone/views.rb', line 57

def api_problem data
  "There was a problem connecting to the PivotalTracker API." 
end

#exists_prepare_commit_msg_hook(data) ⇒ Object



19
20
21
22
23
24
# File 'lib/todone/views.rb', line 19

def exists_prepare_commit_msg_hook data
  "It looks like you're already using your pre-commit hook.\n" +
  "I was planning on putting something like the following in there:\n" +
  "todone tickets #{data[:project_id]} -m"

end

#missing_hooks_dir(data) ⇒ Object



8
9
10
11
12
13
# File 'lib/todone/views.rb', line 8

def missing_hooks_dir data
  "Couldn't find the .git dir.\n" +
  "Go to your project directory and type the following:\n" +
  "echo 'todone tickets #{data[:project][:id]} -m' > .git/hooks/pre-commit\n" +
  "chmod 751 #{Todone::Consts::HOOK_FILE}\n"
end

#missing_projectObject



4
5
6
# File 'lib/todone/views.rb', line 4

def missing_project
 "Error: Missing project id or users."  
end

#missing_project_idObject



15
16
17
# File 'lib/todone/views.rb', line 15

def missing_project_id
  "Error: No project id"
end

#missing_view(data) ⇒ Object



53
54
55
# File 'lib/todone/views.rb', line 53

def missing_view data
  "The method: #{data[:method]} does not currently have a view associated with it."
end

#missing_write_file(data) ⇒ Object



49
50
51
# File 'lib/todone/views.rb', line 49

def missing_write_file data
  "The file you are trying to write to '#{data[:file]}' does not exist"
end

#show_pivotal_stories(data) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/todone/views.rb', line 30

def show_pivotal_stories data
  #TODO: merge post-commit into precommit
  #TODO: resque from getaddrinfo: nodename nor servname provided, or not known (SocketError)
=begin  def last_msg
  last_commit = `git log -n1`.split("\n")
  3.times{ last_commit.shift }
  last_commit_msg = "#\n#==================Last Commit===============\n"
  last_commit_msg << last_commit.collect{|line| "##{line}"}.join("\n")+"\n"
end
=end

  prepare_commit_msg = "\n#==================Open Tickets================\n"
  unless data[:stories].nil?
    data[:stories].each do |story|
      prepare_commit_msg << "#[#{story['id']}] #{story['name']}\n"
    end
    prepare_commit_msg
  end
end

#updated_prepare_commit_msg_hookObject



26
27
28
# File 'lib/todone/views.rb', line 26

def updated_prepare_commit_msg_hook
  "Your pre-commit hook has been updated." 
end