Class: GitWebhook::Repository
- Inherits:
-
Object
- Object
- GitWebhook::Repository
- Defined in:
- lib/git-webhook/repository.rb
Instance Method Summary collapse
- #commits_between(old, new) ⇒ Object
- #info ⇒ Object
-
#initialize(path, options = {}) ⇒ Repository
constructor
A new instance of Repository.
Constructor Details
#initialize(path, options = {}) ⇒ Repository
Returns a new instance of Repository.
7 8 9 10 11 12 13 14 15 |
# File 'lib/git-webhook/repository.rb', line 7 def initialize(path, = {}) . .assert_valid_keys :url, :name, :description, :homepage, :watchers, :forks, :private, :pledgie, :owner, :commit_url [:owner].assert_valid_keys(:name, :email) unless [:owner].nil? @repo = Grit::Repo.new(path) @options = end |
Instance Method Details
#commits_between(old, new) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/git-webhook/repository.rb', line 21 def commits_between(old, new) commits = [] @repo.commits_between(old, new).each do |commit| commit_data = { :id => commit.sha, :author => { :name => commit..name, :email => commit..email }, :message => commit., :timestamp => commit.date.xmlschema } commit_data[:url] = @options[:commit_url] % commit.sha unless @options[:commit_url].blank? commit_data.merge! commit_stats(commit) commits << commit_data end commits end |
#info ⇒ Object
17 18 19 |
# File 'lib/git-webhook/repository.rb', line 17 def info @options.except(:commit_url) end |