Class: GitWorkflow::Story

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/git_workflow/story.rb

Defined Under Namespace

Classes: XmlWrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

default_logger, included, logger, logger=

Constructor Details

#initialize(service) ⇒ Story

Returns a new instance of Story.



17
18
19
20
# File 'lib/git_workflow/story.rb', line 17

def initialize(service)
  @service = service
  load_story!
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



15
16
17
# File 'lib/git_workflow/story.rb', line 15

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/git_workflow/story.rb', line 14

def name
  @name
end

#story_idObject (readonly)

Returns the value of attribute story_id.



13
14
15
# File 'lib/git_workflow/story.rb', line 13

def story_id
  @story_id
end

Instance Method Details

#branch_nameObject



22
23
24
# File 'lib/git_workflow/story.rb', line 22

def branch_name
  @local_branch_name ||= GitWorkflow::Configuration.instance.local_branch_convention.to(self)
end

#comment(message) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/git_workflow/story.rb', line 38

def comment(message)
  _service!(:post, 'notes') do |xml|
    xml.note {
      xml.text(message)
    }
  end
end

#finish_stateObject



34
35
36
# File 'lib/git_workflow/story.rb', line 34

def finish_state
  @story_type == 'chore' ? 'accepted' : 'finished'
end

#remote_branch_nameObject



26
27
28
# File 'lib/git_workflow/story.rb', line 26

def remote_branch_name
  @remote_branch_name ||= GitWorkflow::Configuration.instance.remote_branch_convention.to(self)
end

#service!(&block) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/git_workflow/story.rb', line 46

def service!(&block)
  _service!(:put) do |xml|
    xml.story {
      xml.owned_by(GitWorkflow::Configuration.instance.username)
      yield(xml) if block_given?
    }
  end
end

#start_stateObject



30
31
32
# File 'lib/git_workflow/story.rb', line 30

def start_state
  'started'
end