Class: Action::Project::Create

Inherits:
Object
  • Object
show all
Includes:
InchCI::Action
Defined in:
app/services/action/project/create.rb

Instance Method Summary collapse

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(params, origin = nil) ⇒ Create

Returns a new instance of Create.


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/action/project/create.rb', line 10

def initialize(params, origin = nil)
  return unless params[:repo_url].present?

  info = InchCI::RepoURL.new(params[:repo_url])
  if info.repo_url.nil?
    info = InchCI::RepoURL.new("https://github.com/#{params[:repo_url]}")
  end
  if @project = InchCI::Store::EnsureProject.call(info.repo_url, origin)
    if @project = update_project(@project)
      if branch = InchCI::Store::FindDefaultBranch.call(@project)
        create_build_if_possible(@project, branch)
      end
    end
  end
end

Instance Method Details

#build_idObject


26
27
28
# File 'app/services/action/project/create.rb', line 26

def build_id
  @build.id if @build
end

#success?Boolean

Returns:

  • (Boolean)

30
31
32
# File 'app/services/action/project/create.rb', line 30

def success?
  !@project.nil? && !@project.name.nil?
end