Module: TaxonworksNet
- Defined in:
- lib/taxonworks_net.rb
Overview
net/http helpers
Class Method Summary collapse
-
.commit_date ⇒ String
The commit date of the current commit based on the Capistrano provided ‘REVISION’ as supplied by githubs API.
- .commit_sha ⇒ Object
Class Method Details
.commit_date ⇒ String
Returns the commit date of the current commit based on the Capistrano provided ‘REVISION’ as supplied by githubs API.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/taxonworks_net.rb', line 8 def self.commit_date revision = commit_sha if revision uri = URI("https://api.github.com/repos/SpeciesFileGroup/taxonworks/commits/#{revision}") begin response = Net::HTTP.get( uri ) JSON.parse(response)['commit']['author']['date'] rescue return 'UNKNOWN (failed to contact Github or response not parsable)' end else 'UNKNOWN (no REVISION available)' end end |
.commit_sha ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/taxonworks_net.rb', line 23 def self.commit_sha file = Rails.root + 'REVISION' if File.exist?(file) File.read(file).strip else nil end end |