Class: Action::User::InitProjects

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

Constant Summary collapse

ORIGIN =
'github_sync'
TRIGGER =
'first_signin'

Instance Method Summary collapse

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(current_user, params) ⇒ InitProjects

Returns a new instance of InitProjects.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/services/action/user/init_projects.rb', line 13

def initialize(current_user, params)
  @user = current_user.to_model
  if @user.last_synced_projects_at.nil?
    t1 = Time.now.to_f

    InchCI::Store::UpdateLastProjectSync.call(@user)
    if @user.provider == "github"
      update_projects_via_github(@user)
    end

    find_ruby_projects.each do |project|
      update_hook(project)
    end    # we disable auto-building all projects for now
    #.each do |project|
    #  build(project)
    #end

    t2 = Time.now.to_f

    Rails.logger.info "InitProjects: user=#{@user.user_name} projects=#{@user.projects.count} delta=#{t2-t1}"
  end
end