Class: Git::Nebenan::Commands::Open
- Defined in:
- lib/git/nebenan/commands/open.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options) ⇒ Open
constructor
A new instance of Open.
Methods inherited from Command
#config, #jira_client, #logger, #platform, #prompt
Constructor Details
#initialize(options) ⇒ Open
Returns a new instance of Open.
5 6 7 |
# File 'lib/git/nebenan/commands/open.rb', line 5 def initialize() @options = end |
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/git/nebenan/commands/open.rb', line 9 def execute current_branch = `git branch --show-current` project = config.fetch('jira.project') issue = current_branch[/#{project}-\d+/] url = [config.fetch('jira.site'), 'projects', project, 'issues', issue].join(?/).squeeze(?/) logger.info url if platform.mac? `open #{url}` elsif platform.linux? `xdg-open #{url}` else `start #{url}` end end |