lib/concourse-resource/rubygems/in.rb in concourse-resource-rubygems-0.2.0 vs lib/concourse-resource/rubygems/in.rb in concourse-resource-rubygems-0.3.0

- old
+ new

@@ -1,12 +1,25 @@ require 'contracts' require 'concourse-fuselage' require 'concourse-resource/rubygems/core' +require 'http' module ConcourseResource module RubyGems # In Step class In < Fuselage::In include Core + + def filename + @filename ||= "#{gem}-#{version.fetch 'number'}.gem" + end + + def download + @download ||= HTTP.get "https://#{host}/gems/#{filename}", follow: true + end + + def fetch! + File.write "#{workdir}/#{filename}", download.flush + end end end end