Class: Import::GitoriousController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/import/gitorious_controller.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject


8
9
10
11
# File 'app/controllers/import/gitorious_controller.rb', line 8

def callback
  session[:gitorious_repos] = params[:repos]
  redirect_to status_import_gitorious_path
end

#createObject


27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/import/gitorious_controller.rb', line 27

def create
  @repo_id = params[:repo_id]
  repo = client.repo(@repo_id)
  @target_namespace = params[:new_namespace].presence || repo.namespace
  @project_name = repo.name

  namespace = get_or_create_namespace || (render and return)

  @project = Gitlab::GitoriousImport::ProjectCreator.new(repo, namespace, current_user).execute
end

#jobsObject


22
23
24
25
# File 'app/controllers/import/gitorious_controller.rb', line 22

def jobs
  jobs = current_user.created_projects.where(import_type: "gitorious").to_json(only: [:id, :import_status])
  render json: jobs
end

#newObject


4
5
6
# File 'app/controllers/import/gitorious_controller.rb', line 4

def new
  redirect_to client.authorize_url(callback_import_gitorious_url)
end

#statusObject


13
14
15
16
17
18
19
20
# File 'app/controllers/import/gitorious_controller.rb', line 13

def status
  @repos = client.repos

  @already_added_projects = current_user.created_projects.where(import_type: "gitorious")
  already_added_projects_names = @already_added_projects.pluck(:import_source)

  @repos.reject! { |repo| already_added_projects_names.include? repo.full_name }
end