Class: GitRunner::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/git-runner/branch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_path, name) ⇒ Branch

Returns a new instance of Branch.



6
7
8
9
# File 'lib/git-runner/branch.rb', line 6

def initialize(repository_path, name)
  self.repository_path = repository_path
  self.name            = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/git-runner/branch.rb', line 3

def name
  @name
end

#repository_pathObject

Returns the value of attribute repository_path.



3
4
5
# File 'lib/git-runner/branch.rb', line 3

def repository_path
  @repository_path
end

Instance Method Details

#instructionsObject



17
18
19
# File 'lib/git-runner/branch.rb', line 17

def instructions
  @instructions ||= extract_instructions
end

#repository_nameObject



21
22
23
# File 'lib/git-runner/branch.rb', line 21

def repository_name
  repository_path.split(File::SEPARATOR).last.gsub('.git', '')
end

#runObject



11
12
13
14
15
# File 'lib/git-runner/branch.rb', line 11

def run
  instructions.each do |instruction|
    instruction.run
  end
end