diff options
author | Stan Hu <stanhu@gmail.com> | 2018-08-01 20:44:45 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-08-01 20:45:04 +0300 |
commit | aa5821e571620e09229721a1a235d93a554db6a3 (patch) | |
tree | e076faa082797f700e04f1920478f1e0d4f723d6 | |
parent | 636bcebcba5d9215e550f4ca7ba7c75404e06ba9 (diff) |
Assorted Bitbucket Server importer code cleanup based on review
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 2 | ||||
-rw-r--r-- | app/views/import/bitbucket_server/status.html.haml | 7 | ||||
-rw-r--r-- | lib/bitbucket_server/connection.rb | 8 | ||||
-rw-r--r-- | lib/bitbucket_server/page.rb | 2 |
4 files changed, 8 insertions, 11 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index 7495364fac9..798daeca6c9 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -13,7 +13,7 @@ class Import::BitbucketServerController < Import::BaseController # Repository names are limited to 128 characters. They must start with a # letter or number and may contain spaces, hyphens, underscores, and periods. # (https://community.atlassian.com/t5/Answers-Developer-Questions/stash-repository-names/qaq-p/499054) - VALID_BITBUCKET_CHARS = /\A[a-zA-z0-9\-_\.\s]+\z/ + VALID_BITBUCKET_CHARS = /\A[\w\-_\.\s]+\z/ def new end diff --git a/app/views/import/bitbucket_server/status.html.haml b/app/views/import/bitbucket_server/status.html.haml index d88c0e0a337..e8cae582811 100644 --- a/app/views/import/bitbucket_server/status.html.haml +++ b/app/views/import/bitbucket_server/status.html.haml @@ -41,12 +41,9 @@ = link_to project.full_path, [project.namespace.becomes(Namespace), project] %td.job-status - if project.import_status == 'finished' - %span - %i.fa.fa-check - Done + = icon('check', text: 'Done') - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started + = icon('spin', text: 'started') - else = project.human_import_status_name diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb index a3150cc38d5..45a437844bd 100644 --- a/lib/bitbucket_server/connection.rb +++ b/lib/bitbucket_server/connection.rb @@ -12,10 +12,10 @@ module BitbucketServer ConnectionError = Class.new(StandardError) def initialize(options = {}) - @api_version = options.fetch(:api_version, DEFAULT_API_VERSION) - @base_uri = options[:base_uri] - @username = options[:user] - @token = options[:password] + @api_version = options.fetch(:api_version, DEFAULT_API_VERSION) + @base_uri = options[:base_uri] + @username = options[:user] + @token = options[:password] end def get(path, extra_query = {}) diff --git a/lib/bitbucket_server/page.rb b/lib/bitbucket_server/page.rb index a91ccad5738..5d9a3168876 100644 --- a/lib/bitbucket_server/page.rb +++ b/lib/bitbucket_server/page.rb @@ -20,7 +20,7 @@ module BitbucketServer private def parse_attrs(raw) - raw.slice(*%w(size nextPageStart isLastPage)).symbolize_keys + raw.slice('size', 'nextPageStart', 'isLastPage').symbolize_keys end def parse_values(raw, bitbucket_rep_class) |