Class: CIJoe::Build

Inherits:
Struct
  • Object
show all
Defined in:
lib/cijoe/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Build

Returns a new instance of Build.



3
4
5
6
# File 'lib/cijoe/build.rb', line 3

def initialize(*args)
  super
  self.started_at = Time.now
end

Instance Attribute Details

#finished_atObject

Returns the value of attribute finished_at

Returns:

  • (Object)

    the current value of finished_at



2
3
4
# File 'lib/cijoe/build.rb', line 2

def finished_at
  @finished_at
end

#outputObject

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



2
3
4
# File 'lib/cijoe/build.rb', line 2

def output
  @output
end

#projectObject

Returns the value of attribute project

Returns:

  • (Object)

    the current value of project



2
3
4
# File 'lib/cijoe/build.rb', line 2

def project
  @project
end

#shaObject

Returns the value of attribute sha

Returns:

  • (Object)

    the current value of sha



2
3
4
# File 'lib/cijoe/build.rb', line 2

def sha
  @sha
end

#started_atObject

Returns the value of attribute started_at

Returns:

  • (Object)

    the current value of started_at



2
3
4
# File 'lib/cijoe/build.rb', line 2

def started_at
  @started_at
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



2
3
4
# File 'lib/cijoe/build.rb', line 2

def status
  @status
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



2
3
4
# File 'lib/cijoe/build.rb', line 2

def user
  @user
end

Instance Method Details

#clean_outputObject



25
26
27
# File 'lib/cijoe/build.rb', line 25

def clean_output
  output.gsub(/\e\[.+?m/, '').strip
end

#commitObject



29
30
31
# File 'lib/cijoe/build.rb', line 29

def commit
  @commit ||= Commit.new(sha, user, project)
end

#failed?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cijoe/build.rb', line 13

def failed?
  status == :failed
end

#short_shaObject



21
22
23
# File 'lib/cijoe/build.rb', line 21

def short_sha
  sha[0,7] if sha
end

#worked?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cijoe/build.rb', line 17

def worked?
  status == :worked
end