summaryrefslogtreecommitdiff
path: root/lib/tasks/import.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/import.rake')
-rw-r--r--lib/tasks/import.rake26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index f912f521dfb..6bd83ef1b2b 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -1,5 +1,5 @@
-require 'benchmark'
-require 'rainbow/ext/string'
+require "benchmark"
+require "rainbow/ext/string"
class GithubImport
def self.run!(*args)
@@ -7,7 +7,7 @@ class GithubImport
end
def initialize(token, gitlab_username, project_path, extras)
- @options = { token: token }
+ @options = {token: token}
@project_path = project_path
@current_user = UserFinder.new(gitlab_username).find_by_username
@@ -21,7 +21,7 @@ class GithubImport
.new(@options[:token], @current_user, @github_repo)
.choose_one!
- raise 'No repo found!' unless @repo
+ raise "No repo found!" unless @repo
show_warning!
@@ -38,7 +38,7 @@ class GithubImport
STDIN.getch
- puts 'Starting the import (this could take a while)'.color(:green)
+ puts "Starting the import (this could take a while)".color(:green)
end
def import!
@@ -46,11 +46,11 @@ class GithubImport
import_success = false
- timings = Benchmark.measure do
+ timings = Benchmark.measure {
import_success = Gitlab::GithubImport::SequentialImporter
.new(@project, token: @options[:token])
.execute
- end
+ }
if import_success
@project.after_import
@@ -63,7 +63,7 @@ class GithubImport
def new_project
Project.transaction do
- namespace_path, _sep, name = @project_path.rpartition('/')
+ namespace_path, _sep, name = @project_path.rpartition("/")
namespace = find_or_create_namespace(namespace_path)
project = Projects::CreateService.new(
@@ -77,9 +77,9 @@ class GithubImport
).execute
project.update!(
- import_type: 'github',
+ import_type: "github",
import_source: @repo.full_name,
- import_url: @repo.clone_url.sub('://', "://#{@options[:token]}@")
+ import_url: @repo.clone_url.sub("://", "://#{@options[:token]}@")
)
project
@@ -119,7 +119,7 @@ class GithubRepos
print "\tName: #{repo.full_name}\n".color(:green)
end
- print 'ID? '.bright
+ print "ID? ".bright
repos.find { |repo| repo.id == repo_id }
end
@@ -138,9 +138,9 @@ class GithubRepos
end
namespace :import do
- desc 'Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)'
+ desc "Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)"
task :github, [:token, :gitlab_username, :project_path] => :environment do |_t, args|
- abort 'Project path must be: namespace(s)/project_name'.color(:red) unless args.project_path.include?('/')
+ abort "Project path must be: namespace(s)/project_name".color(:red) unless args.project_path.include?("/")
GithubImport.run!(args.token, args.gitlab_username, args.project_path, args.extras)
end