Class: Gitlab::GoogleCodeImport::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/google_code_import/importer.rb

Constant Summary collapse

NICE_LABEL_COLOR_HASH =
{
  'Status: New'        => '#428bca',
  'Status: Accepted'   => '#5cb85c',
  'Status: Started'    => '#8e44ad',
  'Priority: Critical' => '#ffcfcf',
  'Priority: High'     => '#deffcf',
  'Priority: Medium'   => '#fff5cc',
  'Priority: Low'      => '#cfe9ff',
  'Type: Defect'       => '#d9534f',
  'Type: Enhancement'  => '#44ad8e',
  'Type: Task'         => '#4b6dd0',
  'Type: Review'       => '#8e44ad',
  'Type: Other'        => '#7f8c8d'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Importer

Returns a new instance of Importer.


24
25
26
27
28
29
30
31
32
33
# File 'lib/gitlab/google_code_import/importer.rb', line 24

def initialize(project)
  @project = project

  import_data = project.import_data.try(:data)
  repo_data = import_data["repo"] if import_data
  @repo = GoogleCodeImport::Repository.new(repo_data)

  @closed_statuses = []
  @known_labels = Set.new
end

Instance Attribute Details

#closed_statusesObject (readonly)

Returns the value of attribute closed_statuses


6
7
8
# File 'lib/gitlab/google_code_import/importer.rb', line 6

def closed_statuses
  @closed_statuses
end

#projectObject (readonly)

Returns the value of attribute project


6
7
8
# File 'lib/gitlab/google_code_import/importer.rb', line 6

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo


6
7
8
# File 'lib/gitlab/google_code_import/importer.rb', line 6

def repo
  @repo
end

Instance Method Details

#executeObject


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gitlab/google_code_import/importer.rb', line 35

def execute
  return true unless repo.valid?

  import_status_labels

  import_labels

  import_issues

  true
end