Sha256: ac14a746417a2cb7a2a9f8c580abf790b8e6d85eafcac69355b9e05575f96582
Contents?: true
Size: 975 Bytes
Versions: 6
Compression:
Stored size: 975 Bytes
Contents
#!/usr/bin/env ruby APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) require 'rubygems/specification' require 'net/http' @gem_name = "netroots-ruby-votesmart" @gem_spec_file = "ruby-votesmart.gemspec" @gem_spec = eval(File.open(File.join(APP_ROOT, @gem_spec_file)) {|f| f.read }) @gem_path = "/gems/#{@gem_name}-#{@gem_spec.version}.gem" def gem_available_on_server? Net::HTTP.start('gems.github.com') {|http| req = Net::HTTP::Head.new(@gem_path) response = http.request(req) return response.code == "200" } end def gem_is_in_specfile? fetcher = Gem::SpecFetcher.new specs = fetcher.load_specs(URI.parse('http://gems.github.com/'), 'specs') specs.any?{|(name, spec)| name == @gem_name and spec.version.to_s == @gem_spec.version.to_s } end is_built = false while not is_built if gem_available_on_server? && gem_is_in_specfile? is_built = true system "say 'gem is built'" else Kernel.sleep(10) end end
Version data entries
6 entries across 6 versions & 1 rubygems