diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-26 05:47:49 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-26 05:47:49 +0300 |
commit | d082b78998d43349f6d0cbaeb90bb448aa1188c3 (patch) | |
tree | 441d3b85c44412863514ae24f48bf96f42ce497f /lib | |
parent | f184cb433b90e5b03d8a2ecf9916e7a1bfda5ee9 (diff) |
Add basic progress output to GitHub import
Diffstat (limited to 'lib')
-rw-r--r-- | lib/github/import.rb | 11 | ||||
-rw-r--r-- | lib/tasks/import.rake | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/github/import.rb b/lib/github/import.rb index f12f979ae02..3e9162ffb9d 100644 --- a/lib/github/import.rb +++ b/lib/github/import.rb @@ -38,24 +38,33 @@ module Github self.reset_callbacks :validate end - attr_reader :project, :repository, :repo, :options, :errors, :cached + attr_reader :project, :repository, :repo, :options, :errors, :cached, :verbose def initialize(project, options) @project = project @repository = project.repository @repo = project.import_source @options = options + @verbose = options.fetch(:verbose, false) @cached = Hash.new { |hash, key| hash[key] = Hash.new } @errors = [] end + # rubocop: disable Rails/Output def execute + puts 'Fetching repository...'.color(:aqua) if verbose fetch_repository + puts 'Fetching labels...'.color(:aqua) if verbose fetch_labels + puts 'Fetching milestones...'.color(:aqua) if verbose fetch_milestones + puts 'Fetching pull requests...'.color(:aqua) if verbose fetch_pull_requests + puts 'Fetching issues...'.color(:aqua) if verbose fetch_issues + puts 'Cloning wiki repository...'.color(:aqua) if verbose fetch_wiki_repository + puts 'Expiring repository cache...'.color(:aqua) if verbose expire_repository_cache true diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index e22424c98d3..bc76d7edc55 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -7,7 +7,7 @@ class GithubImport end def initialize(token, gitlab_username, project_path, extras) - @options = { url: 'https://api.github.com', token: token } + @options = { url: 'https://api.github.com', token: token, verbose: true } @project_path = project_path @current_user = User.find_by_username(gitlab_username) @github_repo = extras.empty? ? nil : extras.first @@ -28,7 +28,7 @@ class GithubImport private def show_warning! - puts "This will import GH #{@repo['full_name'].bright} into GL #{@project_path.bright} as #{@current_user.name}" + puts "This will import GitHub #{@repo['full_name'].bright} into GitLab #{@project_path.bright} as #{@current_user.name}" puts "Permission checks are ignored. Press any key to continue.".color(:red) STDIN.getch |