Module: Cardio::Mod::Sow::RemoteSource
- Included in:
- Cardio::Mod::Sow
- Defined in:
- lib/cardio/mod/sow/remote_source.rb
Overview
Fetch sow data from remote
Instance Method Summary collapse
Instance Method Details
#pod_from_url ⇒ Object
17 18 19 20 21 22 |
# File 'lib/cardio/mod/sow/remote_source.rb', line 17 def pod_from_url parsed_yaml = parse_pod_yaml yaml_from_url Array.wrap(parsed_yaml) rescue Psych::SyntaxError raise "Url #{@remote_source} provided invalid yaml" end |
#remote_source ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cardio/mod/sow/remote_source.rb', line 6 def remote_source @remote_source ||= if @remote raise Card::Error::NotFound, "must specify name (-n)" unless @name URI.join(@remote, "/#{@name.cardname.url_key}/", "pod.yml") else @url end end |
#yaml_from_url ⇒ Object
24 25 26 27 28 |
# File 'lib/cardio/mod/sow/remote_source.rb', line 24 def yaml_from_url @yaml_from_url ||= URI.open(@remote_source).read rescue OpenURI::HTTPError => e raise "#{@remote_source} not available\n#{e}" end |