Class: Txgh::GitRepo
- Inherits:
-
Object
- Object
- Txgh::GitRepo
- Defined in:
- lib/txgh/git_repo.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #branch ⇒ Object
- #commit_message ⇒ Object
- #diff_point ⇒ Object
- #git_config_branch ⇒ Object
- #git_config_tag ⇒ Object
-
#initialize(config, api) ⇒ GitRepo
constructor
A new instance of GitRepo.
- #name ⇒ Object
- #process_all_branches? ⇒ Boolean
- #process_all_tags? ⇒ Boolean
- #should_process_ref?(candidate) ⇒ Boolean
- #tag ⇒ Object
- #upload_diffs? ⇒ Boolean
- #webhook_protected? ⇒ Boolean
- #webhook_secret ⇒ Object
Constructor Details
#initialize(config, api) ⇒ GitRepo
Returns a new instance of GitRepo.
5 6 7 8 |
# File 'lib/txgh/git_repo.rb', line 5 def initialize(config, api) @config = config @api = api end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/txgh/git_repo.rb', line 3 def api @api end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/txgh/git_repo.rb', line 3 def config @config end |
Instance Method Details
#branch ⇒ Object
14 15 16 |
# File 'lib/txgh/git_repo.rb', line 14 def branch config['branch'] end |
#commit_message ⇒ Object
74 75 76 |
# File 'lib/txgh/git_repo.rb', line 74 def config['commit_message'] end |
#diff_point ⇒ Object
30 31 32 |
# File 'lib/txgh/git_repo.rb', line 30 def diff_point config['diff_point'] end |
#git_config_branch ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/txgh/git_repo.rb', line 46 def git_config_branch @git_config_branch ||= begin if process_all_branches? 'all' else Utils.absolute_branch(branch || 'master') end end end |
#git_config_tag ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/txgh/git_repo.rb', line 56 def git_config_tag @git_config_tag ||= begin if 'all' else Utils.absolute_branch(tag) if tag end end end |
#name ⇒ Object
10 11 12 |
# File 'lib/txgh/git_repo.rb', line 10 def name config['name'] end |
#process_all_branches? ⇒ Boolean
22 23 24 |
# File 'lib/txgh/git_repo.rb', line 22 def process_all_branches? branch == 'all' end |
#process_all_tags? ⇒ Boolean
34 35 36 |
# File 'lib/txgh/git_repo.rb', line 34 def tag == 'all' end |
#should_process_ref?(candidate) ⇒ Boolean
38 39 40 41 42 43 44 |
# File 'lib/txgh/git_repo.rb', line 38 def should_process_ref?(candidate) if Utils.is_tag?(candidate) should_process_tag?(candidate) else should_process_branch?(candidate) end end |
#tag ⇒ Object
18 19 20 |
# File 'lib/txgh/git_repo.rb', line 18 def tag config['tag'] end |
#upload_diffs? ⇒ Boolean
26 27 28 |
# File 'lib/txgh/git_repo.rb', line 26 def upload_diffs? !(diff_point || '').empty? end |
#webhook_protected? ⇒ Boolean
70 71 72 |
# File 'lib/txgh/git_repo.rb', line 70 def webhook_protected? !(webhook_secret || '').empty? end |
#webhook_secret ⇒ Object
66 67 68 |
# File 'lib/txgh/git_repo.rb', line 66 def webhook_secret config['webhook_secret'] end |