Added functionality to initialize video repository
This commit is contained in:
parent
a8cd5d3d54
commit
4273bfbbae
18
src/repository.rb
Normal file
18
src/repository.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require_relative 'util.rb'
|
||||
|
||||
class Repository
|
||||
|
||||
def initialize(path)
|
||||
@basePath = path
|
||||
|
||||
# create repository base directory
|
||||
createDirectory(@basePath)
|
||||
|
||||
# create sub-directories
|
||||
subPaths = ['ingest', 'archive', 'output']
|
||||
subPaths.each { |p|
|
||||
createDirectory(File.join(@basePath, p))
|
||||
}
|
||||
end
|
||||
|
||||
end
|
7
src/util.rb
Normal file
7
src/util.rb
Normal file
@ -0,0 +1,7 @@
|
||||
def createDirectory(path)
|
||||
if Dir.exists?(path)
|
||||
puts "Directory #{path} already exists."
|
||||
else
|
||||
puts "Creating directory #{path}."
|
||||
end
|
||||
end
|
@ -1,7 +1,13 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative 'config.rb'
|
||||
require_relative 'repository.rb'
|
||||
|
||||
# create new configuration instance
|
||||
c = Config.new('~/.config/zealot.toml')
|
||||
|
||||
# create new repository instance
|
||||
r = Repository.new(c.get('transcoder.repository'))
|
||||
|
||||
# print repository directory as a test
|
||||
puts c.get('transcoder.repository')
|
||||
|
Loading…
Reference in New Issue
Block a user