summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-04-05 15:41:15 +0200
committerJames Lopez <james@jameslopez.es>2016-04-05 15:41:15 +0200
commit5e51fce4dcd62997f372aed44badc844f98851e9 (patch)
tree5599e0de61315e6274449c11c1fa011c91f8d749 /lib
parent850180aa393e2cfc124bb9687a123a196cff734c (diff)
downloadgitlab-ce-5e51fce4dcd62997f372aed44badc844f98851e9.tar.gz
some refactoring to symbolise keys across importers and left a TODO
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/bitbucket_import/client.rb8
-rw-r--r--lib/gitlab/bitbucket_import/project_creator.rb2
-rw-r--r--lib/gitlab/fogbugz_import/importer.rb8
-rw-r--r--lib/gitlab/fogbugz_import/project_creator.rb2
-rw-r--r--lib/gitlab/gitlab_import/importer.rb6
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb
index acd0f298b3d..49f86ab5edf 100644
--- a/lib/gitlab/bitbucket_import/client.rb
+++ b/lib/gitlab/bitbucket_import/client.rb
@@ -6,10 +6,10 @@ module Gitlab
attr_reader :consumer, :api
def self.from_project(project)
- credentials = project.import_data.stringified_credentials if project.import_data
- if defined?(credentials) && credentials['bb_session']
- token = credentials['bb_session']['bitbucket_access_token']
- token_secret = credentials['bb_session']['bitbucket_access_token_secret']
+ credentials = project.import_data if project.import_data
+ if credentials && credentials[:bb_session]
+ token = credentials[:bb_session][:bitbucket_access_token]
+ token_secret = credentials[:bb_session][:bitbucket_access_token_secret]
new(token, token_secret)
else
raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
diff --git a/lib/gitlab/bitbucket_import/project_creator.rb b/lib/gitlab/bitbucket_import/project_creator.rb
index cc7f2017142..109010cb962 100644
--- a/lib/gitlab/bitbucket_import/project_creator.rb
+++ b/lib/gitlab/bitbucket_import/project_creator.rb
@@ -25,7 +25,7 @@ module Gitlab
import_data = project.import_data
# merge! with a bang doesn't work here
- import_data.credentials = import_data.credentials.merge("bb_session" => session_data)
+ import_data.credentials = import_data.credentials.merge(bb_session: session_data)
import_data.save
project
diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb
index 5c1c1c4865a..249c5b48b1c 100644
--- a/lib/gitlab/fogbugz_import/importer.rb
+++ b/lib/gitlab/fogbugz_import/importer.rb
@@ -18,7 +18,7 @@ module Gitlab
def execute
return true unless repo.valid?
- client = Gitlab::FogbugzImport::Client.new(token: import_data_credentials['fb_session']['token'], uri: import_data_credentials['fb_session']['uri'])
+ client = Gitlab::FogbugzImport::Client.new(token: import_data_credentials[:fb_session][:token], uri: import_data_credentials[:fb_session][:uri])
@cases = client.cases(@repo.id.to_i)
@categories = client.categories
@@ -31,7 +31,7 @@ module Gitlab
private
def import_data_credentials
- @import_data_credentials ||= project.import_data.stringified_credentials if project.import_data
+ @import_data_credentials ||= project.import_data if project.import_data
end
def user_map
@@ -240,8 +240,8 @@ module Gitlab
end
def build_attachment_url(rel_url)
- uri = import_data_credentials['fb_session']['uri']
- token = import_data_credentials['fb_session']['token']
+ uri = import_data_credentials[:fb_session][:uri]
+ token = import_data_credentials[:fb_session][:token]
"#{uri}/#{rel_url}&token=#{token}"
end
diff --git a/lib/gitlab/fogbugz_import/project_creator.rb b/lib/gitlab/fogbugz_import/project_creator.rb
index 0a87b406c56..e9fac8968e6 100644
--- a/lib/gitlab/fogbugz_import/project_creator.rb
+++ b/lib/gitlab/fogbugz_import/project_creator.rb
@@ -28,7 +28,7 @@ module Gitlab
import_data.data = { 'repo' => repo.raw_data, 'user_map' => user_map }
# merge! with a bang doesn't work here
- import_data.credentials = import_data.credentials.merge('fb_session' => fb_session)
+ import_data.credentials = import_data.credentials.merge(fb_session: fb_session)
import_data.save
project
diff --git a/lib/gitlab/gitlab_import/importer.rb b/lib/gitlab/gitlab_import/importer.rb
index 19dc79462c0..96717b42bae 100644
--- a/lib/gitlab/gitlab_import/importer.rb
+++ b/lib/gitlab/gitlab_import/importer.rb
@@ -5,9 +5,9 @@ module Gitlab
def initialize(project)
@project = project
- credentials = import_data.stringified_credentials
- if credentials && credentials["password"]
- @client = Client.new(credentials["password"])
+ credentials = import_data
+ if credentials && credentials[:password]
+ @client = Client.new(credentials[:password])
@formatter = Gitlab::ImportFormatter.new
else
raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"