require 'singleton'
end
end
end
end
end
end
def save
@current_repo.save
end
def cleanup
FileUtils.rm_rf(Dir.glob(root_path.join('*')))
end
end
class Repo
attr_accessor :url_maps
def initialize(name, url=nil)
@name = name
@path = url || RepositoryCreator.instance.root_path.join(name)
@url_maps = []
unless url
Subprocess.run 'git', 'init', @path
end
end
def save
r = Repository.new name: @name, description: 'Seeded Repository', source_address: @path.to_s, access: 'public_r'
r.user = User.first
r.url_maps = @url_maps
r.save!
RepositoryConversionWorker.perform_async(r.id)
end
end