class Bashly::LibrarySourceConfig
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/bashly/library_source_config.rb, line 7 def initialize(path) @path = path end
Public Instance Methods
data()
click to toggle source
# File lib/bashly/library_source_config.rb, line 11 def data @data ||= YAML.load_file path end
validate()
click to toggle source
# File lib/bashly/library_source_config.rb, line 20 def validate assert_root path, data end
validated_data()
click to toggle source
# File lib/bashly/library_source_config.rb, line 15 def validated_data validate data end
Private Instance Methods
assert_filespec(key, value)
click to toggle source
# File lib/bashly/library_source_config.rb, line 43 def assert_filespec(key, value) assert_string "#{key}.source", value['source'] assert_string "#{key}.target", value['target'] end
assert_lib(key, value)
click to toggle source
# File lib/bashly/library_source_config.rb, line 31 def assert_lib(key, value) assert_string "#{key}.help", value['help'] assert_optional_string "#{key}.usage", value['usage'] assert_optional_string "#{key}.handler", value['handler'] assert_optional_string "#{key}.post_install_message", value['post_install_message'] return if value['handler'] assert_array "#{key}.files", value['files'], of: :filespec end
assert_root(path, value)
click to toggle source
# File lib/bashly/library_source_config.rb, line 26 def assert_root(path, value) assert_hash path, value data.each { |id, spec| assert_lib "[#{path}] #{id}", spec } end