class RBT::Cookbooks::Url
Constants
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
Public Class Methods
new( i = nil, run_already = true ) { || ... }
click to toggle source
Public Instance Methods
array_urls?()
click to toggle source
#¶ ↑
array_urls?¶ ↑
This method will return the URLs in Array format.
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 142 def array_urls? [url1, url2] end
Also aliased as: result
consider_reporting_url2()
click to toggle source
#¶ ↑
consider_reporting_url2
¶ ↑
We will try to report the second URL, aka url2.
As of December 2017, if url2 does not exist BUT a homepage url exists, we will use that one instead.
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 179 def consider_reporting_url2 if url2? # <- Prevent nil entries here. # ===================================================================== # # Check whether there is a homepage-entry, which is not empty - but # only use it if url2? is empty. This allows us to use the homepage # entry when the cookbook file in question does not have a url2 # entry set. # ===================================================================== # if homepage? and !homepage.empty? and url2?.empty? e "homepage: #{homepage?.to_s}" use_this_as_xorg_buffer(homepage?) elsif !url2?.empty? result = ''.dup result << 'url2: ' if be_verbose? result << url2?.to_s e result use_this_as_xorg_buffer(url2?) end end end
determine_dataset( search_for = search_for? )
click to toggle source
#¶ ↑
determine_dataset
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 126 def determine_dataset( search_for = search_for? ) if RBT.does_include?(search_for) # In this case, we can search for it. @dataset = RBT::Cookbooks::Cookbook.new(search_for) { :bypass_menu_check } else # Else it was not included. opnn; e "The search_term `#{sfancy(search_for)}` is not included." exit end end
feedback_urls()
click to toggle source
#¶ ↑
feedback_urls
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 210 def feedback_urls if url1?.empty? e "url.rb: We did not find `"+search_for?+"`." if be_verbose? else use_this_as_xorg_buffer(url1?) result = ''.dup result << 'url1: ' if be_verbose? result << url1?.to_s if be_verbose? e result consider_reporting_url2 # Delegate to this method. end end end
homepage?()
click to toggle source
#¶ ↑
homepage?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 167 def homepage? @dataset.homepage? end
Also aliased as: homepage
reset()
click to toggle source
run()
click to toggle source
search_for?()
click to toggle source
#¶ ↑
search_for?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 119 def search_for? @find_this_program end
Also aliased as: find?
set_find_this_program(i)
click to toggle source
#¶ ↑
set_find_this_program
¶ ↑
Use this method to designate which program we wish to find the URL for.
#¶ ↑
# File lib/rbt/utility_scripts/url.rb, line 62 def set_find_this_program(i) i = i.to_s.strip i.delete!('-') if i.include? '-' # Since 05.11.2011 i.delete!('/') if i.include? '/' i.sub!(/\.yml$/,'') if i.end_with? '.yml' case i # case tag when 'PWD','pwd' i = File.basename(Dir.pwd+'/') end unless File.exist? i i = i.downcase # Since 24.09.2014. # ======================================================================= # # Check for a Cookbook-alias next: # ======================================================================= # if RBT.is_an_alias?(i) i = RBT.find_cookbook_alias_for(i) end unless RBT.has_this_program?(i) # This check is necessary so that "ruby" won't become rubysqlite. # ======================================================================= # # If the input was not found, then we also check for 'lib' as prefix. # # This will correct commands such as "url memcached" into # "url libmemcached". # ======================================================================= # unless RBT.does_include? i # ===================================================================== # # Check a +lib variant here. # ===================================================================== # if RBT.does_include? 'lib'+i i.prepend('lib') # ===================================================================== # # Check a -lib variant here. # ===================================================================== # elsif RBT.does_include? i.sub(/^lib/,'') i.sub!(/^lib/,'') end end if i.empty? and is_on_roebe? and return_pwd.include?(source_directory?) i = File.basename(return_pwd) end @find_this_program = i end
Also aliased as: search_for_url
tell_the_user_what_we_seek( be_verbose = be_verbose? )
click to toggle source
url1?()
click to toggle source
Also aliased as: return_main_url, url1
url2?()
click to toggle source