Sha256: a3433218ca0fdb41d46774f4682f88f20e513527723878b8c9ad20ebb684942a

Contents?: true

Size: 503 Bytes

Versions: 3

Compression:

Stored size: 503 Bytes

Contents

require 'thor'
require 'redmine-cli/resources'

module Redmine
  module Cli
    class Git < Thor

      desc "new TICKET", "Generate branch from ticket's information"
      def new(ticket)
        issue = Issue.find(ticket)
        subject = issue.subject.gsub(/[^a-z0-9\-]+/i, "-").gsub(/-{1,}/,'-').gsub(/-$|^-/, '').downcase
        `git checkout -b #{ticket}-#{subject}`
      rescue ActiveResource::ResourceNotFound
        say "No ticket with number: #{ticket}", :red
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redmine-cli-0.1.6 lib/redmine-cli/git.rb
redmine-cli-0.1.5 lib/redmine-cli/git.rb
redmine-cli-0.1.4 lib/redmine-cli/git.rb