diff --git a/LICENSE b/LICENSE index 5f662b3..f8df596 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) +Copyright (c) 2022 Metaunix.net Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/data/defaults.yaml b/data/defaults.yaml new file mode 100644 index 0000000..fda6a21 --- /dev/null +++ b/data/defaults.yaml @@ -0,0 +1,2 @@ +vulture: + run_interval: 1 diff --git a/lib/config.rb b/lib/config.rb new file mode 100644 index 0000000..fe21f39 --- /dev/null +++ b/lib/config.rb @@ -0,0 +1,20 @@ +require 'yaml' + +class Config + + def initialize(config_path) + @data = YAML::load_file(config_path) + end + + def get(key, depth = 0) + bits = key.split('.') + value = @data + + bits.each do |bit| + value = value[bit] + end + + return value + end + +end diff --git a/vulture.rb b/vulture.rb new file mode 100644 index 0000000..a2eaa41 --- /dev/null +++ b/vulture.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require 'logger' + +require_relative 'lib/config.rb' + +# Load configuration +conf = Config.new(File.join(__dir__, 'data/defaults.yaml')) + +# Initialize logging +logger = Logger.new(STDOUT) +logger.level = Logger::INFO + +# Main program loop +while true + # Let the user know something is going on + logger.info('Checking for new social media posts to make public...') + + # Wait for the specified wait period + sleep(conf.get('vulture.run_interval') * 60) +end