Class: Geordi::Gitlinear
- Inherits:
-
Object
- Object
- Geordi::Gitlinear
- Defined in:
- lib/geordi/gitlinear.rb
Constant Summary collapse
- API_ENDPOINT =
'https://api.linear.app/graphql'.freeze
Instance Method Summary collapse
- #branch(from_master: false) ⇒ Object
- #commit(git_args) ⇒ Object
-
#initialize ⇒ Gitlinear
constructor
A new instance of Gitlinear.
Constructor Details
Instance Method Details
#branch(from_master: false) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/geordi/gitlinear.rb', line 27 def branch(from_master: false) issue = choose_issue local_branches = local_branch_names matching_local_branch = local_branches.find { |branch_name| branch_name == issue['branchName'] } matching_local_branch ||= local_branches.find { |branch_name| branch_name.include? issue['identifier'].to_s } if matching_local_branch Util.run! ['git', 'checkout', matching_local_branch] else default_branch = Util.git_default_branch Util.run! ['git', 'checkout', default_branch] if from_master Util.run! ['git', 'checkout', '-b', issue['branchName']] end end |
#commit(git_args) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/geordi/gitlinear.rb', line 18 def commit(git_args) Interaction.warn <<~WARNING unless Util.staged_changes? No staged changes. Will create an empty commit. WARNING issue = choose_issue create_commit "[#{issue['identifier']}] #{issue['title']}", "Issue: #{issue['url']}", *git_args end |