class Cookbooks::Url
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
Public Class Methods
Public Instance Methods
array_urls?()
click to toggle source
#¶ ↑
array_urls?¶ ↑
This method will return the URLs in Array format.
#¶ ↑
# File lib/cookbooks/utility_scripts/url.rb, line 152 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/cookbooks/utility_scripts/url.rb, line 181 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? e "url2: #{url2?.to_s}" use_this_as_xorg_buffer(url2?) end end end
determine_dataset( search_for = search_for? )
click to toggle source
#¶ ↑
#determine_dataset¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/url.rb, line 108 def determine_dataset( search_for = search_for? ) if Cookbooks.does_include?(search_for) # In this case, we can search for it. @dataset = 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
homepage?()
click to toggle source
#¶ ↑
homepage?¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/url.rb, line 169 def homepage? @dataset.homepage? end
Also aliased as: homepage
opnn()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
search_for?()
click to toggle source
#¶ ↑
search_for?¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/url.rb, line 101 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/cookbooks/utility_scripts/url.rb, line 51 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 Cookbooks.is_an_alias?(i) i = Cookbooks.find_cookbook_alias_for(i) end unless Cookbooks.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 Cookbooks.does_include? i # ===================================================================== # # Check a +lib variant here. # ===================================================================== # if Cookbooks.does_include? 'lib'+i i.prepend('lib') # ===================================================================== # # Check a -lib variant here. # ===================================================================== # elsif Cookbooks.does_include? i.sub(/^lib/,'') i.sub!(/^lib/,'') end end @find_this_program = i end
Also aliased as: search_for_url
tell_the_user_what_we_seek()
click to toggle source
url1?()
click to toggle source
#¶ ↑
url1?¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/url.rb, line 129 def url1? @dataset.url1? end
Also aliased as: return_main_url, url1