class RBT::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
colourize_this_local_version(i)
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/rbt/check_for_updates/check_for_new_release_on_rubygems.rb, line 130 def compare_the_remote_program_version_with_the_local_program_version reset_main_array program_name = File.basename(@homepage) local_version = RBT::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: #{colourize_this_local_version(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)}`." # ===================================================================== # # Delegate towards class UpdateEntry next. # ===================================================================== # RBT::UpdateEntry.new(remote_download_url) @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}") } # ===================================================================== # # Also store this result in a module-level instance variable next. # That way we can query the state of programs that were compiled. # ===================================================================== # RBT.set_array_these_ruby_gems_were_updated( @array_we_did_update_these_programs ) 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/rbt/check_for_updates/check_for_new_release_on_rubygems.rb, line 98 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 #{crimson('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/rbt/check_for_updates/check_for_new_release_on_rubygems.rb, line 184 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
remote_url?()
click to toggle source
reset()
click to toggle source
reset_main_array()
click to toggle source
run()
click to toggle source