Class: ProjectPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/project_presenter.rb

Instance Method Summary collapse

Methods inherited from BasePresenter

inherited, #initialize, #to_model, use_presenters

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#badge?Boolean

Returns:

  • (Boolean)

11
12
13
# File 'app/presenters/project_presenter.rb', line 11

def badge?
  default_branch && !default_branch.try(:latest_revision_id).nil?
end

#build_on_inch_ci?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'app/presenters/project_presenter.rb', line 15

def build_on_inch_ci?
  InchCI::Worker::Project.build_on_inch_ci?(project.language)
end

#build_on_travis?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'app/presenters/project_presenter.rb', line 19

def build_on_travis?
  !build_on_inch_ci?
end

#hooked?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/presenters/project_presenter.rb', line 23

def hooked?
  !project.github_hook_id.nil? && project.github_hook_active
end

#language?(language) ⇒ Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/presenters/project_presenter.rb', line 27

def language?(language)
  project.language.to_s.downcase == language.to_s.downcase
end

#last_buildObject


31
32
33
# File 'app/presenters/project_presenter.rb', line 31

def last_build
  builds.first.to_presenter
end

#name_without_ownerObject


35
36
37
# File 'app/presenters/project_presenter.rb', line 35

def name_without_owner
  name.to_s.split('/').last
end

#unsupported_language?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'app/presenters/project_presenter.rb', line 39

def unsupported_language?
  !InchCI::Config::LANGUAGES.include?(project.language.to_s)
end