diff --git a/src/repository.rb b/src/repository.rb new file mode 100644 index 0000000..28ce619 --- /dev/null +++ b/src/repository.rb @@ -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 diff --git a/src/util.rb b/src/util.rb new file mode 100644 index 0000000..743357e --- /dev/null +++ b/src/util.rb @@ -0,0 +1,7 @@ +def createDirectory(path) + if Dir.exists?(path) + puts "Directory #{path} already exists." + else + puts "Creating directory #{path}." + end +end diff --git a/src/zealot.rb b/src/zealot.rb index 4e8673b..2007d41 100755 --- a/src/zealot.rb +++ b/src/zealot.rb @@ -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')