Skip to content

Commit

Permalink
Add repository export command. Now it's possible to export without ad…
Browse files Browse the repository at this point in the history
…d-pkg.
  • Loading branch information
SaltwaterC committed Jun 17, 2021
1 parent 3789e71 commit 942a69f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.2.1

* Add repo exporter to rebuild a local repo.

## v0.2.0

* Add git publisher.
Expand Down
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ begin

Jeweler::Tasks.new do |gem|
gem.name = 'repo-mgr'
gem.version = '0.2.0'
gem.version = '0.2.1'
gem.summary = %(deb and rpm repository manager)
gem.description = %(deb and rpm repository manager)
gem.author = 'Ștefan Rusu'
Expand All @@ -28,6 +28,9 @@ rescue LoadError
warn 'Rubocop, or one of its dependencies, is not available.'
end

task cop: %i[rubocop]
task lint: %i[rubocop]

desc 'Remove build artefacts'
task :clean_pkg do
rm_rf 'pkg'
Expand Down
4 changes: 4 additions & 0 deletions lib/repo_mgr/backends/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def rebuild_pkg_list(repo)
pkgs.map { |e| "#{e}.deb" }
end

def export(repo)
repo_publish repo
end

private

def init_aptly_config
Expand Down
4 changes: 4 additions & 0 deletions lib/repo_mgr/backends/rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def rebuild_pkg_list(repo)
end
end

def export(repo)
sync_repo repo
end

private

def extract_arch(pkg)
Expand Down
12 changes: 12 additions & 0 deletions lib/repo_mgr/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ def sync
puts "-- Synchronised #{options[:repo]} using #{pub_type} publisher"
end

desc 'export', 'Export packages and metadata as local repository'
option :repo, type: :string, required: true, aliases: %w[-r],
desc: 'The repository to export'
def export
config = Config.new
backend = Backends.load config.cfg[:repos][options[:repo]][:type], config

backend.export options[:repo]

puts "-- Exported #{options[:repo]} repo"
end

private

def load_backend(path)
Expand Down

0 comments on commit 942a69f

Please sign in to comment.