summaryrefslogtreecommitdiff
path: root/lib/tasks/import.rake
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/tasks/import.rake
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
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