debian-mirror-gitlab/lib/tasks/gitlab/import.rake

23 lines
801 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
namespace :gitlab do
namespace :import do
# How to use:
#
2018-03-17 18:26:18 +05:30
# 1. copy the bare repos to a specific path that contain the group or subgroups structure as folders
# 2. run: bundle exec rake gitlab:import:repos[/path/to/repos] RAILS_ENV=production
2014-09-02 18:07:02 +05:30
#
# Notes:
# * The project owner will set to the first administator of the system
# * Existing projects will be skipped
2016-08-24 12:49:21 +05:30
desc "GitLab | Import bare repositories from repositories -> storages into GitLab project instance"
2018-03-17 18:26:18 +05:30
task :repos, [:import_path] => :environment do |_t, args|
unless args.import_path
puts 'Please specify an import path that contains the repositories'.color(:red)
2014-09-02 18:07:02 +05:30
2018-03-17 18:26:18 +05:30
exit 1
2014-09-02 18:07:02 +05:30
end
2018-03-17 18:26:18 +05:30
Gitlab::BareRepositoryImport::Importer.execute(args.import_path)
2014-09-02 18:07:02 +05:30
end
end
end