Class: DeployLog::Github::Helper
- Inherits:
-
Object
- Object
- DeployLog::Github::Helper
- Defined in:
- lib/deploy_log/github/helper.rb
Constant Summary collapse
- LINE_FORMAT =
"%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n -- %s\n\n"
Instance Method Summary collapse
-
#initialize(user_repo) ⇒ Helper
constructor
A new instance of Helper.
- #pulls_in_timeframe(date_start, date_end) ⇒ Object
- #search_pulls_by(value, field = :title) ⇒ Object
Constructor Details
Instance Method Details
#pulls_in_timeframe(date_start, date_end) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/deploy_log/github/helper.rb', line 15 def pulls_in_timeframe(date_start, date_end) @cache.create(date_start, date_end) return @cache.contents if @cache.exists? pool = timeframe_pool(date_start, date_end) = "#{pool.size} PR(s) merged from #{date_start} to #{date_end}" @cache.write_object(pool, ) do |item| format(LINE_FORMAT, item.title, item.html_url, item.user.login, item.head.ref, user_who_merged(item.number), formatted_time(item.merged_at, true), item.diff_url, committers_for(item.number).join("\n -- ") ) end @cache.contents end |
#search_pulls_by(value, field = :title) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/deploy_log/github/helper.rb', line 38 def search_pulls_by(value, field = :title) @cache.create(field, value) return @cache.contents if @cache.exists? pool = search_pool(field, value) = "#{pool.size} PR(s) matched" @cache.write_object(pool, ) do |item| format(LINE_FORMAT, item.title, item.html_url, item.user.login, item.head.ref, user_who_merged(item.number), formatted_time(item.merged_at, true), item.diff_url, committers_for(item.number).join("\n -- ") ) end @cache.contents end |