Class: Amitree::GitClient

Inherits:
Object
  • Object
show all
Defined in:
lib/amitree/git_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, username, password) ⇒ GitClient

Returns a new instance of GitClient.



5
6
7
8
# File 'lib/amitree/git_client.rb', line 5

def initialize(repository, username, password)
  @repository = repository
  @client = Octokit::Client.new login: username, password: password
end

Instance Method Details

#commit_messages_between(rev1, rev2) ⇒ Object



15
16
17
# File 'lib/amitree/git_client.rb', line 15

def commit_messages_between(rev1, rev2)
  commits_between(rev1, rev2).map(&:commit).map(&:message)
end

#commits_between(rev1, rev2) ⇒ Object



10
11
12
13
# File 'lib/amitree/git_client.rb', line 10

def commits_between(rev1, rev2)
  result = @client.compare @repository, rev1, rev2
  result.commits
end


24
25
26
# File 'lib/amitree/git_client.rb', line 24

def link_to(rev)
  "https://github.com/#{@repository}/commit/#{rev}"
end

#stories_worked_on_between(rev1, rev2) ⇒ Object



19
20
21
22
# File 'lib/amitree/git_client.rb', line 19

def stories_worked_on_between(rev1, rev2)
  messages = commit_messages_between(rev1, rev2)
  messages.map{|msg| msg.scan /(?<=#)\d+/}.flatten.uniq
end