class Suppository::CreateCommand
Public Class Methods
new(args)
click to toggle source
# File lib/suppository/create_command.rb, line 14 def initialize(args) assert_arguments args @repository = repository(args[0]) end
Public Instance Methods
run()
click to toggle source
# File lib/suppository/create_command.rb, line 19 def run assert_not_created create_repository end
Private Instance Methods
assert_arguments(args)
click to toggle source
# File lib/suppository/create_command.rb, line 26 def assert_arguments(args) message = 'Create command needs one argument, the path to the new repository' raise UsageError, message if args.nil? || args.length != 1 end
assert_not_created()
click to toggle source
# File lib/suppository/create_command.rb, line 35 def assert_not_created @repository.exist? ? raise("#{path} is already a repository") : '' end
create_archs_folders(dist)
click to toggle source
# File lib/suppository/create_command.rb, line 51 def create_archs_folders(dist) @repository.archs.each do |arch| create_folder(path, dist, arch) end end
create_dists_folders()
click to toggle source
# File lib/suppository/create_command.rb, line 45 def create_dists_folders @repository.dists.each do |dist| create_archs_folders dist end end
create_folder(path, dist, arch)
click to toggle source
# File lib/suppository/create_command.rb, line 57 def create_folder(path, dist, arch) dir_path = "#{path}/dists/#{dist}/internal/binary-#{arch}" FileUtils.mkdir_p dir_path create_packages_file(dir_path) end
create_packages_file(path)
click to toggle source
# File lib/suppository/create_command.rb, line 63 def create_packages_file(path) packages_file = "#{path}/Packages" FileUtils.touch packages_file Suppository::Gzip.compress packages_file end
create_repository()
click to toggle source
# File lib/suppository/create_command.rb, line 39 def create_repository FileUtils.mkdir_p suppository.to_s create_dists_folders log_success "Created new Repository - #{path}" end
path()
click to toggle source
# File lib/suppository/create_command.rb, line 73 def path @repository.path end
repository(path)
click to toggle source
# File lib/suppository/create_command.rb, line 31 def repository(path) Suppository::Repository.new(path) end
suppository()
click to toggle source
# File lib/suppository/create_command.rb, line 69 def suppository @repository.suppository end