summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-03 15:29:27 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-03 15:29:27 +0200
commit7b5bc32cadbf2c0a3ac1e80643e46786fd8b1b56 (patch)
tree0dfa9add1156d8ce9ff8709e36da577b7c94ad1c /app/models
parent9157985cfce1391973673ea278dc7506a90f8f53 (diff)
downloadgitlab-ce-7b5bc32cadbf2c0a3ac1e80643e46786fd8b1b56.tar.gz
Allow projects to be imported from Google Code.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 79572f255db..9b0d5c509b4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -27,6 +27,7 @@
# import_type :string(255)
# import_source :string(255)
# avatar :string(255)
+# import_data :text
#
require 'carrierwave/orm/activerecord'
@@ -50,6 +51,8 @@ class Project < ActiveRecord::Base
default_value_for :wall_enabled, false
default_value_for :snippets_enabled, gitlab_config_features.snippets
+ serialize :import_data, JSON
+
# set last_activity_at to the same as created_at
after_create :set_last_activity_at
def set_last_activity_at
@@ -185,6 +188,7 @@ class Project < ActiveRecord::Base
state :failed
after_transition any => :started, do: :add_import_job
+ after_transition any => :finished, do: :clear_import_data
end
class << self
@@ -262,6 +266,11 @@ class Project < ActiveRecord::Base
RepositoryImportWorker.perform_in(2.seconds, id)
end
+ def clear_import_data
+ self.import_data = nil
+ self.save
+ end
+
def import?
import_url.present?
end