module Djin

Constants

FileNotFoundError
InvalidConfigFileError
InvalidConfigurationError
InvalidSyntaxError
MissingVersionError
TaskError
VERSION
VersionNotSupportedError

Public Class Methods

cache() click to toggle source
# File lib/djin.rb, line 73
def cache
  @cache ||= MemoryCache.new
end
load_tasks!(*file_paths) click to toggle source
# File lib/djin.rb, line 42
def load_tasks!(*file_paths)
  files = file_paths.presence || RootCliParser.parse![:files] || ['djin.yml']

  file_config = ConfigLoader.load_files!(*files)

  # TODO: Make all tasks be under 'tasks' key, passing only the tasks here
  tasks = Interpreter.load!(file_config)

  @task_repository = TaskRepository.new(tasks)

  remote_configs = file_config.include_configs.select { |f| f.type == :remote }
  @remote_config_repository = RemoteConfigRepository.new(remote_configs)

  CLI.load_tasks!(tasks)
rescue Djin::InvalidConfigurationError => e
  error_name = e.class.name.split('::').last
  abort("[#{error_name}] #{e.message}")
end
remote_config_repository() click to toggle source
# File lib/djin.rb, line 69
def remote_config_repository
  @remote_config_repository ||= RemoteConfigRepository.new
end
root_path() click to toggle source
# File lib/djin.rb, line 77
def root_path
  Pathname.new File.expand_path(__dir__ + '/..')
end
stderr() click to toggle source
# File lib/djin.rb, line 93
def stderr
  $stderr
end
task_repository() click to toggle source
# File lib/djin.rb, line 65
def task_repository
  @task_repository ||= TaskRepository.new
end
tasks() click to toggle source
# File lib/djin.rb, line 61
def tasks
  task_repository.all
end
warn(message, type: 'WARNING') click to toggle source
# File lib/djin.rb, line 81
def warn(message, type: 'WARNING')
  stderr.puts "[#{type}] #{message}"
end
warn_once(message, type: 'WARNING') click to toggle source
# File lib/djin.rb, line 85
def warn_once(message, type: 'WARNING')
  return if warnings.include?(message)

  warn(message, type: type)

  warnings << message
end

Private Class Methods

warnings() click to toggle source
# File lib/djin.rb, line 99
def warnings
  @warnings ||= []
end