jira-cli 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +21 -41
 - data/bin/jira +0 -2
 - data/lib/jira/commands/assign.rb +2 -2
 - data/lib/jira/commands/attachments.rb +2 -2
 - data/lib/jira/commands/comment/add.rb +1 -1
 - data/lib/jira/commands/comment/delete.rb +1 -1
 - data/lib/jira/commands/comment/list.rb +1 -1
 - data/lib/jira/commands/comment/update.rb +1 -1
 - data/lib/jira/commands/delete.rb +4 -42
 - data/lib/jira/commands/describe.rb +2 -2
 - data/lib/jira/commands/link.rb +2 -2
 - data/lib/jira/commands/new.rb +8 -20
 - data/lib/jira/commands/rename.rb +2 -2
 - data/lib/jira/commands/transition.rb +2 -2
 - data/lib/jira/commands/vote/add.rb +1 -1
 - data/lib/jira/commands/vote/delete.rb +1 -1
 - data/lib/jira/commands/vote/list.rb +2 -2
 - data/lib/jira/commands/watch/add.rb +1 -1
 - data/lib/jira/commands/watch/delete.rb +1 -1
 - data/lib/jira/commands/watch/list.rb +2 -2
 - data/lib/jira/constants.rb +1 -1
 - data/lib/jira/core.rb +2 -19
 - data/lib/jira/exceptions.rb +0 -1
 - metadata +5 -8
 - data/lib/jira/commands/all.rb +0 -72
 - data/lib/jira/commands/checkout.rb +0 -87
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 25748c17ff058c8bf351f77db807ef8a5702ec26
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ed745d5b66227e6e696dabe0c4747fd6279edecd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3008287942dcfe89f3c6cd73892a55fe2b767226e620b46e611af0291d368c63269ea20a43310cb95a308124d973a70318904df9f2b369edd4fc6e9603be669d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c7f58f7054e546df6374a5e7848f98d628fda7c38d4ff844f9dd7a6a5a0e2788aa7a82b0a51384687efb7e735b6fff5ec5792b12ec1a640538d419e854016800
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,34 +1,31 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # JIRA CLI [](http://badge.fury.io/rb/jira-cli)
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            Control JIRA from your terminal
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            * * *
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            [](https://codeclimate.com/github/darrenli/jira-cli)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://circleci.com/gh/ruby-jira/jira-cli)
         
     | 
| 
      
 8 
     | 
    
         
            +
            [](https://codeclimate.com/github/ruby-jira/jira-cli)
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
10 
     | 
    
         
             
            ### Available Commands
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                jira  
     | 
| 
       14 
     | 
    
         
            -
                jira  
     | 
| 
       15 
     | 
    
         
            -
                jira  
     | 
| 
       16 
     | 
    
         
            -
                jira  
     | 
| 
       17 
     | 
    
         
            -
                jira  
     | 
| 
       18 
     | 
    
         
            -
                jira  
     | 
| 
       19 
     | 
    
         
            -
                jira  
     | 
| 
       20 
     | 
    
         
            -
                jira  
     | 
| 
       21 
     | 
    
         
            -
                jira  
     | 
| 
       22 
     | 
    
         
            -
                jira  
     | 
| 
       23 
     | 
    
         
            -
                jira  
     | 
| 
       24 
     | 
    
         
            -
                jira  
     | 
| 
       25 
     | 
    
         
            -
                jira  
     | 
| 
       26 
     | 
    
         
            -
                jira  
     | 
| 
       27 
     | 
    
         
            -
                jira  
     | 
| 
       28 
     | 
    
         
            -
                jira  
     | 
| 
       29 
     | 
    
         
            -
                jira  
     | 
| 
       30 
     | 
    
         
            -
                jira vote <command>     # Commands for voting operations in JIRA
         
     | 
| 
       31 
     | 
    
         
            -
                jira watch <command>    # Commands for watching tickets in JIRA
         
     | 
| 
      
 12 
     | 
    
         
            +
                jira assign <ticket>       # Assign a ticket to a user
         
     | 
| 
      
 13 
     | 
    
         
            +
                jira attachments <ticket>  # View ticket attachments
         
     | 
| 
      
 14 
     | 
    
         
            +
                jira comment <command>     # Commands for comment operations in JIRA
         
     | 
| 
      
 15 
     | 
    
         
            +
                jira delete <ticket>       # Deletes a ticket
         
     | 
| 
      
 16 
     | 
    
         
            +
                jira describe <ticket>     # Describes the input ticket
         
     | 
| 
      
 17 
     | 
    
         
            +
                jira help [COMMAND]        # Describe available commands or one specific command
         
     | 
| 
      
 18 
     | 
    
         
            +
                jira install               # Guides the user through JIRA CLI installation
         
     | 
| 
      
 19 
     | 
    
         
            +
                jira link <ticket>         # Creates a link between two tickets in JIRA
         
     | 
| 
      
 20 
     | 
    
         
            +
                jira log <command>         # Commands for logging operations in JIRA
         
     | 
| 
      
 21 
     | 
    
         
            +
                jira new                   # Creates a new ticket
         
     | 
| 
      
 22 
     | 
    
         
            +
                jira rename <ticket>       # Updates the summary of the input ticket
         
     | 
| 
      
 23 
     | 
    
         
            +
                jira sprint                # Lists sprint info
         
     | 
| 
      
 24 
     | 
    
         
            +
                jira tickets [jql]         # List the tickets of the input jql
         
     | 
| 
      
 25 
     | 
    
         
            +
                jira transition <ticket>   # Transitions the input ticket to the next state
         
     | 
| 
      
 26 
     | 
    
         
            +
                jira version               # Displays the version
         
     | 
| 
      
 27 
     | 
    
         
            +
                jira vote <command>        # Commands for voting operations in JIRA
         
     | 
| 
      
 28 
     | 
    
         
            +
                jira watch <command>       # Commands for watching tickets in JIRA
         
     | 
| 
       32 
29 
     | 
    
         | 
| 
       33 
30 
     | 
    
         
             
            ### Gem Installation
         
     | 
| 
       34 
31 
     | 
    
         | 
| 
         @@ -38,27 +35,10 @@ Rubygems: 
     | 
|
| 
       38 
35 
     | 
    
         | 
| 
       39 
36 
     | 
    
         
             
            Manually:
         
     | 
| 
       40 
37 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                git clone git@github.com: 
     | 
| 
      
 38 
     | 
    
         
            +
                git clone git@github.com:ruby-jira/jira-cli.git
         
     | 
| 
       42 
39 
     | 
    
         
             
                cd jira-cli
         
     | 
| 
       43 
40 
     | 
    
         
             
                ./scripts/install
         
     | 
| 
       44 
41 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
            ### Project Installation
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
            In order to use this tool, you'll need to run the installation script in the
         
     | 
| 
       48 
     | 
    
         
            -
            git repository that you're managing via JIRA.
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                cd path/to/jira/repo
         
     | 
| 
       51 
     | 
    
         
            -
                jira install
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
            Note: Authentication files are expected to drastically change. Currently, they
         
     | 
| 
       54 
     | 
    
         
            -
            are completely unencrypted. Use are your own risk... (see disclaimer above)
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            ### Disclaimer
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
            This tool is in very early alpha and its architecture and commands
         
     | 
| 
       59 
     | 
    
         
            -
            are expected to change drastically. Please only use this tool for testing
         
     | 
| 
       60 
     | 
    
         
            -
            purposes.
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
42 
     | 
    
         
             
            ### License
         
     | 
| 
       63 
43 
     | 
    
         | 
| 
       64 
44 
     | 
    
         
             
            (The MIT License)
         
     | 
    
        data/bin/jira
    CHANGED
    
    | 
         @@ -17,8 +17,6 @@ rescue Faraday::Error, UnauthorizedException 
     | 
|
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         
             
              puts "JIRA failed connect, you may need to rerun 'jira install'"
         
     | 
| 
       20 
     | 
    
         
            -
            rescue GitException
         
     | 
| 
       21 
     | 
    
         
            -
              puts "JIRA commands can only be run within a git repository."
         
     | 
| 
       22 
20 
     | 
    
         
             
            rescue InstallationException
         
     | 
| 
       23 
21 
     | 
    
         
             
              puts "Please run #{Jira::Format.summary('jira install')} before "\
         
     | 
| 
       24 
22 
     | 
    
         
             
                   "running this command."
         
     | 
    
        data/lib/jira/commands/assign.rb
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Jira
         
     | 
| 
       2 
2 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                desc "assign", "Assign a ticket to a user"
         
     | 
| 
      
 4 
     | 
    
         
            +
                desc "assign <ticket>", "Assign a ticket to a user"
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :assignee, aliases: "-a", type: :string, default: nil, lazy_default: "auto", banner: "ASSIGNEE"
         
     | 
| 
       6 
     | 
    
         
            -
                def assign(ticket 
     | 
| 
      
 6 
     | 
    
         
            +
                def assign(ticket)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  Command::Assign.new(ticket, options).run
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
         @@ -3,7 +3,7 @@ module Jira 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                desc 'add', 'Add a comment to the input ticket'
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :text, aliases: "-t", type: :string, default: nil, lazy_default: "", banner: "TEXT"
         
     | 
| 
       6 
     | 
    
         
            -
                def add(ticket 
     | 
| 
      
 6 
     | 
    
         
            +
                def add(ticket)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  Command::Comment::Add.new(ticket, options).run
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
    
        data/lib/jira/commands/delete.rb
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Jira
         
     | 
| 
       2 
2 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                desc "delete", "Deletes a ticket 
     | 
| 
      
 4 
     | 
    
         
            +
                desc "delete <ticket>", "Deletes a ticket"
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :force, type: :boolean, default: false
         
     | 
| 
       6 
     | 
    
         
            -
                def delete(ticket 
     | 
| 
      
 6 
     | 
    
         
            +
                def delete(ticket)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  Command::Delete.new(ticket, options[:force]).run
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
         @@ -26,50 +26,12 @@ module Jira 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    return if subtasks_failure?
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                    api.delete "issue/#{ticket}?deleteSubtasks=#{force}",
         
     | 
| 
       29 
     | 
    
         
            -
                      success:  
     | 
| 
       30 
     | 
    
         
            -
                      failure:  
     | 
| 
      
 29 
     | 
    
         
            +
                      success: ->{ puts "Ticket #{ticket} has been deleted." },
         
     | 
| 
      
 30 
     | 
    
         
            +
                      failure: ->{ puts "No change made to ticket #{ticket}." }
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                private
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
                  def on_success
         
     | 
| 
       36 
     | 
    
         
            -
                    -> do
         
     | 
| 
       37 
     | 
    
         
            -
                      on_failure and return unless create_branch?
         
     | 
| 
       38 
     | 
    
         
            -
                      on_failure and return unless delete_branch?
         
     | 
| 
       39 
     | 
    
         
            -
                    end
         
     | 
| 
       40 
     | 
    
         
            -
                  end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  def on_failure
         
     | 
| 
       43 
     | 
    
         
            -
                    -> { puts "No change made to ticket #{ticket}." }
         
     | 
| 
       44 
     | 
    
         
            -
                  end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  def branches
         
     | 
| 
       47 
     | 
    
         
            -
                    branches = `git branch --list 2> /dev/null`.split(' ')
         
     | 
| 
       48 
     | 
    
         
            -
                    branches.delete("*")
         
     | 
| 
       49 
     | 
    
         
            -
                    branches.delete(ticket.to_s)
         
     | 
| 
       50 
     | 
    
         
            -
                    branches
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                  def create_branch?
         
     | 
| 
       54 
     | 
    
         
            -
                    response = io.yes?("Create branch?")
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                    if branches.count == 1 or response
         
     | 
| 
       57 
     | 
    
         
            -
                      io.say("Creating a new branch.")
         
     | 
| 
       58 
     | 
    
         
            -
                      new_branch = io.ask("Branch?").strip
         
     | 
| 
       59 
     | 
    
         
            -
                      new_branch.delete!(" ")
         
     | 
| 
       60 
     | 
    
         
            -
                      on_failure and return false if new_branch.empty?
         
     | 
| 
       61 
     | 
    
         
            -
                      `git branch #{new_branch} 2> /dev/null`
         
     | 
| 
       62 
     | 
    
         
            -
                    end
         
     | 
| 
       63 
     | 
    
         
            -
                    true
         
     | 
| 
       64 
     | 
    
         
            -
                  end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                  def delete_branch?
         
     | 
| 
       67 
     | 
    
         
            -
                    response = self.io.select("Select a branch:", branches)
         
     | 
| 
       68 
     | 
    
         
            -
                    `git checkout #{response} 2> /dev/null`
         
     | 
| 
       69 
     | 
    
         
            -
                    `git branch -D #{ticket} 2> /dev/null`
         
     | 
| 
       70 
     | 
    
         
            -
                    true
         
     | 
| 
       71 
     | 
    
         
            -
                  end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
35 
     | 
    
         
             
                  def subtasks_failure?
         
     | 
| 
       74 
36 
     | 
    
         
             
                    return false unless subtask?
         
     | 
| 
       75 
37 
     | 
    
         
             
                    if !metadata['fields']['subtasks'].empty? && !force
         
     | 
    
        data/lib/jira/commands/link.rb
    CHANGED
    
    
    
        data/lib/jira/commands/new.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Jira
         
     | 
| 
       2 
2 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                desc  
     | 
| 
      
 4 
     | 
    
         
            +
                desc 'new', 'Creates a new ticket'
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :project, aliases: "-p", type: :string, default: nil, banner: "PROJECT"
         
     | 
| 
       6 
6 
     | 
    
         
             
                method_option :components, aliases: "-c", type: :array, default: nil, lazy_default: [], banner: "COMPONENTS"
         
     | 
| 
       7 
7 
     | 
    
         
             
                method_option :issuetype, aliases: "-i", type: :string, default: nil, banner: "ISSUETYPE"
         
     | 
| 
         @@ -50,9 +50,9 @@ module Jira 
     | 
|
| 
       50 
50 
     | 
    
         
             
                        issuetype:   { id: issue_type['id'] },
         
     | 
| 
       51 
51 
     | 
    
         
             
                        summary:     summary,
         
     | 
| 
       52 
52 
     | 
    
         
             
                        description: description,
         
     | 
| 
       53 
     | 
    
         
            -
                        parent:      @parent.nil? ?  
     | 
| 
       54 
     | 
    
         
            -
                        components:  @components.nil? ?  
     | 
| 
       55 
     | 
    
         
            -
                      }
         
     | 
| 
      
 53 
     | 
    
         
            +
                        parent:      @parent.nil? ? nil : { key: @parent },
         
     | 
| 
      
 54 
     | 
    
         
            +
                        components:  @components.nil? ? nil : @components
         
     | 
| 
      
 55 
     | 
    
         
            +
                      }.delete_if{|_,v| v.nil? || v.eql?([])}
         
     | 
| 
       56 
56 
     | 
    
         
             
                    }
         
     | 
| 
       57 
57 
     | 
    
         
             
                  end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
         @@ -61,7 +61,6 @@ module Jira 
     | 
|
| 
       61 
61 
     | 
    
         
             
                      self.ticket = json['key']
         
     | 
| 
       62 
62 
     | 
    
         
             
                      io.say("Ticket #{ticket} created.")
         
     | 
| 
       63 
63 
     | 
    
         
             
                      assign? if options.empty? || !options['assignee'].nil?
         
     | 
| 
       64 
     | 
    
         
            -
                      create_branch? && checkout_branch? if options.empty?
         
     | 
| 
       65 
64 
     | 
    
         
             
                    end
         
     | 
| 
       66 
65 
     | 
    
         
             
                  end
         
     | 
| 
       67 
66 
     | 
    
         | 
| 
         @@ -69,18 +68,6 @@ module Jira 
     | 
|
| 
       69 
68 
     | 
    
         
             
                    Command::Assign.new(ticket, options).run if !options['assignee'].nil? || io.yes?('Assign?')
         
     | 
| 
       70 
69 
     | 
    
         
             
                  end
         
     | 
| 
       71 
70 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                  def create_branch?
         
     | 
| 
       73 
     | 
    
         
            -
                    return false if io.no?("Create branch?")
         
     | 
| 
       74 
     | 
    
         
            -
                    `git branch #{ticket} 2> /dev/null`
         
     | 
| 
       75 
     | 
    
         
            -
                    true
         
     | 
| 
       76 
     | 
    
         
            -
                  end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                  def checkout_branch?
         
     | 
| 
       79 
     | 
    
         
            -
                    return false if io.no?("Check-out branch?")
         
     | 
| 
       80 
     | 
    
         
            -
                    `git checkout #{ticket} 2> /dev/null`
         
     | 
| 
       81 
     | 
    
         
            -
                    true
         
     | 
| 
       82 
     | 
    
         
            -
                  end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
71 
     | 
    
         
             
                  def on_failure
         
     | 
| 
       85 
72 
     | 
    
         
             
                    ->{ puts "No ticket created." }
         
     | 
| 
       86 
73 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -139,7 +126,7 @@ module Jira 
     | 
|
| 
       139 
126 
     | 
    
         
             
                  end
         
     | 
| 
       140 
127 
     | 
    
         | 
| 
       141 
128 
     | 
    
         
             
                  def parent
         
     | 
| 
       142 
     | 
    
         
            -
                    @parent ||= options['parent'] || io.ask('Subtask parent:' 
     | 
| 
      
 129 
     | 
    
         
            +
                    @parent ||= options['parent'] || io.ask('Subtask parent:')
         
     | 
| 
       143 
130 
     | 
    
         
             
                  end
         
     | 
| 
       144 
131 
     | 
    
         | 
| 
       145 
132 
     | 
    
         
             
                  def issue_type
         
     | 
| 
         @@ -164,8 +151,9 @@ module Jira 
     | 
|
| 
       164 
151 
     | 
    
         | 
| 
       165 
152 
     | 
    
         
             
                  def description
         
     | 
| 
       166 
153 
     | 
    
         
             
                    @description ||= (
         
     | 
| 
       167 
     | 
    
         
            -
                       
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
      
 154 
     | 
    
         
            +
                      options['description'] ||
         
     | 
| 
      
 155 
     | 
    
         
            +
                        (io.ask("Description:", default: '') if options['summary'].nil?) ||
         
     | 
| 
      
 156 
     | 
    
         
            +
                        ""
         
     | 
| 
       169 
157 
     | 
    
         
             
                    )
         
     | 
| 
       170 
158 
     | 
    
         
             
                  end
         
     | 
| 
       171 
159 
     | 
    
         | 
    
        data/lib/jira/commands/rename.rb
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Jira
         
     | 
| 
       2 
2 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                desc "rename", "Updates the summary of the input ticket"
         
     | 
| 
      
 4 
     | 
    
         
            +
                desc "rename <ticket>", "Updates the summary of the input ticket"
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :summary, aliases: "-s", type: :string, default: nil, lazy_default: "", banner: "SUMMARY"
         
     | 
| 
       6 
     | 
    
         
            -
                def rename(ticket 
     | 
| 
      
 6 
     | 
    
         
            +
                def rename(ticket)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  Command::Rename.new(ticket, options).run
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Jira
         
     | 
| 
       2 
2 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                desc "transition", "Transitions the input ticket to the next state"
         
     | 
| 
      
 4 
     | 
    
         
            +
                desc "transition <ticket>", "Transitions the input ticket to the next state"
         
     | 
| 
       5 
5 
     | 
    
         
             
                method_option :transition, aliases: "-t", type: :string, default: nil, lazy_default: "", banner: "TRANSITION"
         
     | 
| 
       6 
6 
     | 
    
         
             
                method_option :resolution, aliases: "-r", type: :string, default: nil, lazy_default: "", banner: "RESOLUTION"
         
     | 
| 
       7 
     | 
    
         
            -
                def transition(ticket 
     | 
| 
      
 7 
     | 
    
         
            +
                def transition(ticket)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  Command::Transition.new(ticket, options).run
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -2,7 +2,7 @@ module Jira 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Vote < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                desc 'list', "List the votes on the input ticket"
         
     | 
| 
       5 
     | 
    
         
            -
                def list(ticket 
     | 
| 
      
 5 
     | 
    
         
            +
                def list(ticket)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  Command::Vote::List.new(ticket).run
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -42,7 +42,7 @@ module Jira 
     | 
|
| 
       42 
42 
     | 
    
         
             
                    end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                    def no_voters?
         
     | 
| 
       45 
     | 
    
         
            -
                      if voters.count 
     | 
| 
      
 45 
     | 
    
         
            +
                      if voters.count.zero?
         
     | 
| 
       46 
46 
     | 
    
         
             
                        puts "There are no votes on ticket #{ticket}."
         
     | 
| 
       47 
47 
     | 
    
         
             
                        return true
         
     | 
| 
       48 
48 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -2,7 +2,7 @@ module Jira 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Watch < Thor
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                desc 'list', 'Lists the watchers of the input ticket'
         
     | 
| 
       5 
     | 
    
         
            -
                def list(ticket 
     | 
| 
      
 5 
     | 
    
         
            +
                def list(ticket)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  Command::Watch::List.new(ticket).run
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -34,7 +34,7 @@ module Jira 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    attr_accessor :watcher
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
                    def no_watchers?
         
     | 
| 
       37 
     | 
    
         
            -
                      if watchers.count 
     | 
| 
      
 37 
     | 
    
         
            +
                      if watchers.count.zero?
         
     | 
| 
       38 
38 
     | 
    
         
             
                        puts "Ticket #{ticket} has no watchers."
         
     | 
| 
       39 
39 
     | 
    
         
             
                        return true
         
     | 
| 
       40 
40 
     | 
    
         
             
                      end
         
     | 
    
        data/lib/jira/constants.rb
    CHANGED
    
    
    
        data/lib/jira/core.rb
    CHANGED
    
    | 
         @@ -38,13 +38,6 @@ module Jira 
     | 
|
| 
       38 
38 
     | 
    
         
             
                    { name: config[:cookie]['name'], value: config[:cookie]['value'] }
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                  #
         
     | 
| 
       42 
     | 
    
         
            -
                  # @return [String] default ticket is the current branch
         
     | 
| 
       43 
     | 
    
         
            -
                  #
         
     | 
| 
       44 
     | 
    
         
            -
                  def ticket
         
     | 
| 
       45 
     | 
    
         
            -
                    `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip
         
     | 
| 
       46 
     | 
    
         
            -
                  end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
41 
     | 
    
         
             
                  #
         
     | 
| 
       49 
42 
     | 
    
         
             
                  # Determines whether or not the input ticket matches the expected JIRA
         
     | 
| 
       50 
43 
     | 
    
         
             
                  # ticketing syntax. Outputs a warning that the input ticket isn't a valid
         
     | 
| 
         @@ -69,14 +62,14 @@ module Jira 
     | 
|
| 
       69 
62 
     | 
    
         
             
                  # @return [String] path to .jira-cli file
         
     | 
| 
       70 
63 
     | 
    
         
             
                  #
         
     | 
| 
       71 
64 
     | 
    
         
             
                  def cli_path
         
     | 
| 
       72 
     | 
    
         
            -
                    @cli_path ||=  
     | 
| 
      
 65 
     | 
    
         
            +
                    @cli_path ||= "#{Dir.home}/.jira-cli"
         
     | 
| 
       73 
66 
     | 
    
         
             
                  end
         
     | 
| 
       74 
67 
     | 
    
         | 
| 
       75 
68 
     | 
    
         
             
                  #
         
     | 
| 
       76 
69 
     | 
    
         
             
                  # @return [String] path to .jira-rescue-cookie file
         
     | 
| 
       77 
70 
     | 
    
         
             
                  #
         
     | 
| 
       78 
71 
     | 
    
         
             
                  def rescue_cookie_path
         
     | 
| 
       79 
     | 
    
         
            -
                    @rescue_cookie_path ||=  
     | 
| 
      
 72 
     | 
    
         
            +
                    @rescue_cookie_path ||= "#{Dir.home}/.jira-rescue-cookie"
         
     | 
| 
       80 
73 
     | 
    
         
             
                  end
         
     | 
| 
       81 
74 
     | 
    
         | 
| 
       82 
75 
     | 
    
         
             
                  def config
         
     | 
| 
         @@ -86,16 +79,6 @@ module Jira 
     | 
|
| 
       86 
79 
     | 
    
         
             
                    )
         
     | 
| 
       87 
80 
     | 
    
         
             
                  end
         
     | 
| 
       88 
81 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                private
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
                  def root_path
         
     | 
| 
       92 
     | 
    
         
            -
                    @root_path ||= (
         
     | 
| 
       93 
     | 
    
         
            -
                      root_path = `git rev-parse --show-toplevel 2>/dev/null`.strip
         
     | 
| 
       94 
     | 
    
         
            -
                      raise GitException if root_path.empty?
         
     | 
| 
       95 
     | 
    
         
            -
                      root_path
         
     | 
| 
       96 
     | 
    
         
            -
                    )
         
     | 
| 
       97 
     | 
    
         
            -
                  end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
82 
     | 
    
         
             
                end
         
     | 
| 
       100 
83 
     | 
    
         
             
              end
         
     | 
| 
       101 
84 
     | 
    
         
             
            end
         
     | 
    
        data/lib/jira/exceptions.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: jira-cli
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Darren Cheng
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-12-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: thor
         
     | 
| 
         @@ -124,7 +124,7 @@ dependencies: 
     | 
|
| 
       124 
124 
     | 
    
         
             
                - - ">="
         
     | 
| 
       125 
125 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       126 
126 
     | 
    
         
             
                    version: 2.0.2
         
     | 
| 
       127 
     | 
    
         
            -
            description:  
     | 
| 
      
 127 
     | 
    
         
            +
            description: Control JIRA from your terminal
         
     | 
| 
       128 
128 
     | 
    
         
             
            email: darren@thanx.com
         
     | 
| 
       129 
129 
     | 
    
         
             
            executables:
         
     | 
| 
       130 
130 
     | 
    
         
             
            - jira
         
     | 
| 
         @@ -137,10 +137,8 @@ files: 
     | 
|
| 
       137 
137 
     | 
    
         
             
            - lib/jira/api.rb
         
     | 
| 
       138 
138 
     | 
    
         
             
            - lib/jira/auth_api.rb
         
     | 
| 
       139 
139 
     | 
    
         
             
            - lib/jira/command.rb
         
     | 
| 
       140 
     | 
    
         
            -
            - lib/jira/commands/all.rb
         
     | 
| 
       141 
140 
     | 
    
         
             
            - lib/jira/commands/assign.rb
         
     | 
| 
       142 
141 
     | 
    
         
             
            - lib/jira/commands/attachments.rb
         
     | 
| 
       143 
     | 
    
         
            -
            - lib/jira/commands/checkout.rb
         
     | 
| 
       144 
142 
     | 
    
         
             
            - lib/jira/commands/comment.rb
         
     | 
| 
       145 
143 
     | 
    
         
             
            - lib/jira/commands/comment/add.rb
         
     | 
| 
       146 
144 
     | 
    
         
             
            - lib/jira/commands/comment/delete.rb
         
     | 
| 
         @@ -174,7 +172,7 @@ files: 
     | 
|
| 
       174 
172 
     | 
    
         
             
            - lib/jira/exceptions.rb
         
     | 
| 
       175 
173 
     | 
    
         
             
            - lib/jira/format.rb
         
     | 
| 
       176 
174 
     | 
    
         
             
            - lib/jira/sprint_api.rb
         
     | 
| 
       177 
     | 
    
         
            -
            homepage: https://github.com/ 
     | 
| 
      
 175 
     | 
    
         
            +
            homepage: https://github.com/ruby-jira/jira-cli
         
     | 
| 
       178 
176 
     | 
    
         
             
            licenses:
         
     | 
| 
       179 
177 
     | 
    
         
             
            - MIT
         
     | 
| 
       180 
178 
     | 
    
         
             
            metadata: {}
         
     | 
| 
         @@ -194,9 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       194 
192 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       195 
193 
     | 
    
         
             
            requirements: []
         
     | 
| 
       196 
194 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       197 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 195 
     | 
    
         
            +
            rubygems_version: 2.6.11
         
     | 
| 
       198 
196 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       199 
197 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       200 
198 
     | 
    
         
             
            summary: JIRA CLI
         
     | 
| 
       201 
199 
     | 
    
         
             
            test_files: []
         
     | 
| 
       202 
     | 
    
         
            -
            has_rdoc: 
         
     | 
    
        data/lib/jira/commands/all.rb
    DELETED
    
    | 
         @@ -1,72 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Jira
         
     | 
| 
       2 
     | 
    
         
            -
              class CLI < Thor
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
                desc "all", "Describes all local branches that match JIRA ticketing syntax"
         
     | 
| 
       5 
     | 
    
         
            -
                def all
         
     | 
| 
       6 
     | 
    
         
            -
                  Command::All.new.run
         
     | 
| 
       7 
     | 
    
         
            -
                end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
              module Command
         
     | 
| 
       12 
     | 
    
         
            -
                class All < Base
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  def run
         
     | 
| 
       15 
     | 
    
         
            -
                    if tickets.empty?
         
     | 
| 
       16 
     | 
    
         
            -
                      puts 'No tickets'
         
     | 
| 
       17 
     | 
    
         
            -
                      return
         
     | 
| 
       18 
     | 
    
         
            -
                    end
         
     | 
| 
       19 
     | 
    
         
            -
                    return if json.empty?
         
     | 
| 
       20 
     | 
    
         
            -
                    return unless errors.empty?
         
     | 
| 
       21 
     | 
    
         
            -
                    render_table(header, rows)
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                private
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  def header
         
     | 
| 
       27 
     | 
    
         
            -
                    [ 'Ticket', 'Assignee', 'Status', 'Summary' ]
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                  def rows
         
     | 
| 
       31 
     | 
    
         
            -
                    json['issues'].map do |issue|
         
     | 
| 
       32 
     | 
    
         
            -
                      [
         
     | 
| 
       33 
     | 
    
         
            -
                        issue['key'],
         
     | 
| 
       34 
     | 
    
         
            -
                        issue['fields']['assignee']['name'] || 'Unassigned',
         
     | 
| 
       35 
     | 
    
         
            -
                        issue['fields']['status']['name'] || 'Unknown',
         
     | 
| 
       36 
     | 
    
         
            -
                        truncate(issue['fields']['summary'], 45)
         
     | 
| 
       37 
     | 
    
         
            -
                      ]
         
     | 
| 
       38 
     | 
    
         
            -
                    end
         
     | 
| 
       39 
     | 
    
         
            -
                  end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                  def errors
         
     | 
| 
       42 
     | 
    
         
            -
                    @errors ||= (json['errorMessages'] || []).join('. ')
         
     | 
| 
       43 
     | 
    
         
            -
                  end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                  def json
         
     | 
| 
       46 
     | 
    
         
            -
                    @json ||= api.get "search", params: params
         
     | 
| 
       47 
     | 
    
         
            -
                  end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  def params
         
     | 
| 
       50 
     | 
    
         
            -
                    {
         
     | 
| 
       51 
     | 
    
         
            -
                      jql: "key in (#{tickets.join(',')})"
         
     | 
| 
       52 
     | 
    
         
            -
                    }
         
     | 
| 
       53 
     | 
    
         
            -
                  end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                  def tickets
         
     | 
| 
       56 
     | 
    
         
            -
                    @tickets ||= (
         
     | 
| 
       57 
     | 
    
         
            -
                      tickets = []
         
     | 
| 
       58 
     | 
    
         
            -
                      branches.each do |branch|
         
     | 
| 
       59 
     | 
    
         
            -
                        ticket = branch.delete('*').strip
         
     | 
| 
       60 
     | 
    
         
            -
                        tickets << ticket if Jira::Core.ticket?(ticket, false)
         
     | 
| 
       61 
     | 
    
         
            -
                      end
         
     | 
| 
       62 
     | 
    
         
            -
                      tickets
         
     | 
| 
       63 
     | 
    
         
            -
                    )
         
     | 
| 
       64 
     | 
    
         
            -
                  end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                  def branches
         
     | 
| 
       67 
     | 
    
         
            -
                    `git branch`.strip.split("\n")
         
     | 
| 
       68 
     | 
    
         
            -
                  end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                end
         
     | 
| 
       71 
     | 
    
         
            -
              end
         
     | 
| 
       72 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,87 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Jira
         
     | 
| 
       2 
     | 
    
         
            -
              class CLI < Thor
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
                desc "checkout <ticket>", "Checks out a ticket from JIRA in the git branch"
         
     | 
| 
       5 
     | 
    
         
            -
                method_option :remote, aliases: "-r", type: :string, default: nil, lazy_default: "", banner: "REMOTE"
         
     | 
| 
       6 
     | 
    
         
            -
                def checkout(ticket)
         
     | 
| 
       7 
     | 
    
         
            -
                  Command::Checkout.new(ticket, options).run
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              module Command
         
     | 
| 
       13 
     | 
    
         
            -
                class Checkout < Base
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                  attr_accessor :ticket, :options
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  def initialize(ticket, options)
         
     | 
| 
       18 
     | 
    
         
            -
                    self.ticket = ticket
         
     | 
| 
       19 
     | 
    
         
            -
                    self.options = options
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  def run
         
     | 
| 
       23 
     | 
    
         
            -
                    return unless Jira::Core.ticket?(ticket)
         
     | 
| 
       24 
     | 
    
         
            -
                    return if metadata.empty?
         
     | 
| 
       25 
     | 
    
         
            -
                    unless metadata['errorMessages'].nil?
         
     | 
| 
       26 
     | 
    
         
            -
                      on_failure
         
     | 
| 
       27 
     | 
    
         
            -
                      return
         
     | 
| 
       28 
     | 
    
         
            -
                    end
         
     | 
| 
       29 
     | 
    
         
            -
                    unless remote?
         
     | 
| 
       30 
     | 
    
         
            -
                      on_failure
         
     | 
| 
       31 
     | 
    
         
            -
                      return
         
     | 
| 
       32 
     | 
    
         
            -
                    end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                    create_branch unless branches.include?(ticket)
         
     | 
| 
       35 
     | 
    
         
            -
                    checkout_branch
         
     | 
| 
       36 
     | 
    
         
            -
                    reset_branch unless branches.include?(ticket)
         
     | 
| 
       37 
     | 
    
         
            -
                    on_success
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                private
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  def on_success
         
     | 
| 
       43 
     | 
    
         
            -
                    puts "Ticket #{ticket} checked out."
         
     | 
| 
       44 
     | 
    
         
            -
                  end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  def on_failure
         
     | 
| 
       47 
     | 
    
         
            -
                    puts "No ticket checked out."
         
     | 
| 
       48 
     | 
    
         
            -
                  end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                  def branches
         
     | 
| 
       51 
     | 
    
         
            -
                    @branches ||= `git branch --list 2> /dev/null`.split(' ')
         
     | 
| 
       52 
     | 
    
         
            -
                    @branches.delete("*")
         
     | 
| 
       53 
     | 
    
         
            -
                    @branches
         
     | 
| 
       54 
     | 
    
         
            -
                  end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  def create_branch
         
     | 
| 
       57 
     | 
    
         
            -
                    `git branch #{ticket} 2> /dev/null`
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  def checkout_branch
         
     | 
| 
       61 
     | 
    
         
            -
                    `git checkout #{ticket} 2> /dev/null`
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                  def metadata
         
     | 
| 
       65 
     | 
    
         
            -
                    @metadata ||= api.get("issue/#{ticket}")
         
     | 
| 
       66 
     | 
    
         
            -
                  end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                  def remote
         
     | 
| 
       69 
     | 
    
         
            -
                    @remote ||= options['remote'] || io.select('Remote?', remotes)
         
     | 
| 
       70 
     | 
    
         
            -
                  end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                  def remotes
         
     | 
| 
       73 
     | 
    
         
            -
                    @remotes ||= `git remote 2> /dev/null`.split(' ')
         
     | 
| 
       74 
     | 
    
         
            -
                  end
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                  def remote?
         
     | 
| 
       77 
     | 
    
         
            -
                    return true if remotes.include?(remote)
         
     | 
| 
       78 
     | 
    
         
            -
                    false
         
     | 
| 
       79 
     | 
    
         
            -
                  end
         
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
                  def reset_branch
         
     | 
| 
       82 
     | 
    
         
            -
                    `git reset --hard #{remote} 2> /dev/null`
         
     | 
| 
       83 
     | 
    
         
            -
                  end
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                end
         
     | 
| 
       86 
     | 
    
         
            -
              end
         
     | 
| 
       87 
     | 
    
         
            -
            end
         
     |