Sha256: 62c5422a5e5cf462894774be9c85b4e8957779118175822471aea002f8d979f1

Contents?: true

Size: 525 Bytes

Versions: 12

Compression:

Stored size: 525 Bytes

Contents

module PT::Flow
  class Branch
    require 'i18n'
    require 'active_support/core_ext/string/inflections'

    attr_accessor :name

    def self.current
      new(`git rev-parse --abbrev-ref HEAD`.strip)
    end

    def self.from_task(task)
      new("#{current.target}.#{task.name.parameterize[0..50]}.#{task.id}")
    end

    def initialize(name)
      @name = name
    end

    def target
      name.split('.').first
    end

    def task_id
      name[/\d+$/] || ''
    end

    def to_s
      name
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pt-flow-2.1.0 lib/pt-flow/branch.rb
pt-flow-2.0.0 lib/pt-flow/branch.rb
pt-flow-1.1.1 lib/pt-flow/branch.rb
pt-flow-1.1.0 lib/pt-flow/branch.rb
pt-flow-1.0.0 lib/pt-flow/branch.rb
pt-flow-0.8.2 lib/pt-flow/branch.rb
pt-flow-0.8.1 lib/pt-flow/branch.rb
pt-flow-0.8.0 lib/pt-flow/branch.rb
pt-flow-0.7.0 lib/pt-flow/branch.rb
pt-flow-0.6.4 lib/pt-flow/branch.rb
pt-flow-0.6.3 lib/pt-flow/branch.rb
pt-flow-0.6.2 lib/pt-flow/branch.rb