class Cookbooks::CheckForNewReleaseOnRubygems
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
- RUBYGEMS_ORG_DOWNLOADS_URL
#¶ ↑
RUBYGEMS_ORG_DOWNLOADS_URL¶ ↑
#¶ ↑
- USE_THIS_REGEX
#¶ ↑
USE_THIS_REGEX¶ ↑
This is the main regex that will be used.
#¶ ↑
Public Class Methods
new( remote_url, run_already = true )
click to toggle source
Public Instance Methods
apply_the_main_regex_onto_the_dataset()
click to toggle source
check_this_remote_url(remote_url)
click to toggle source
compare_the_remote_program_version_with_the_local_program_version()
click to toggle source
#¶ ↑
#compare_the_remote_program_version_with_the_local_program_version¶ ↑
#¶ ↑
# File lib/cookbooks/check_for_updates/check_for_new_release_on_rubygems.rb, line 118 def compare_the_remote_program_version_with_the_local_program_version array_we_did_update_these_programs = [] require 'cookbooks/class/class.rb' unless Cookbooks.const_defined? :Cookbook program_name = File.basename(@homepage) local_version = ::Cookbooks::Cookbook.new(program_name) { :bypass_menu_check }.program_version? remote_program_version = ProgramInformation.new(@remote_program_version).version? if remote_program_version == local_version opnn; e "The local program #{sfancy(program_name)} is "\ "#{turquoise('up to date')}"\ "! (At version: #{simp(local_version)})" else # ===================================================================== # # We must build up the remote download-URL next. # ===================================================================== # remote_download_url = RUBYGEMS_ORG_DOWNLOADS_URL+@remote_program_version+'.gem' opnn; e 'Now updating to a new program version '\ 'at `'+sfancy(remote_download_url)+'`.' UpdateEntry.new(remote_download_url) # <- Delegate towards UpdateEntry. array_we_did_update_these_programs << remote_download_url end unless array_we_did_update_these_programs.empty? opnn; e "The following "\ "#{simp(array_we_did_update_these_programs.size.to_s)}"\ " programs were updated:" array_we_did_update_these_programs.each {|remote_url| e sfancy(' '+remote_url) } end end
identify_homepage()
click to toggle source
#¶ ↑
#identify_homepage¶ ↑
This method will determine the homepage of the given .gem file at hand. Keep in mind that a homepage on rubygems.org may have '-' characters.
#¶ ↑
# File lib/cookbooks/check_for_updates/check_for_new_release_on_rubygems.rb, line 100 def identify_homepage _ = remote_url? if _.end_with? '.gem' basename = File.basename(_) basename = ProgramInformation.new(basename).program_name? basename << '/' unless basename.end_with? '/' @homepage = 'https://rubygems.org/gems/'+basename opnn; e 'Next checking for any updates '\ 'on the remote URL '+sfancy(@homepage) obtain_dataset apply_the_main_regex_onto_the_dataset compare_the_remote_program_version_with_the_local_program_version end end
obtain_dataset( use_this_url = @homepage )
click to toggle source
#¶ ↑
#obtain_dataset¶ ↑
The first URL to this method should be the remote homepage of the given .gem at hand.
#¶ ↑
# File lib/cookbooks/check_for_updates/check_for_new_release_on_rubygems.rb, line 162 def obtain_dataset( use_this_url = @homepage ) begin @dataset = open(use_this_url).read rescue OpenURI::HTTPError opnn; e 'OpenURI::HTTPError error for `'+sfancy(use_this_url)+'`.' end end
opnn()
click to toggle source
remote_url?()
click to toggle source
reset()
click to toggle source
run()
click to toggle source