Class: Neetob::CLI::Github::Search
- Defined in:
- lib/neetob/cli/github/search.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#apps ⇒ Object
Returns the value of attribute apps.
-
#key_to_search ⇒ Object
Returns the value of attribute key_to_search.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#search_file_path ⇒ Object
Returns the value of attribute search_file_path.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(apps, key_to_search, search_file_path, sandbox = false) ⇒ Search
constructor
A new instance of Search.
- #run ⇒ Object
Methods inherited from Base
#check_for_apps_and_all_neeto_repos_option
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize(apps, key_to_search, search_file_path, sandbox = false) ⇒ Search
Returns a new instance of Search.
11 12 13 14 15 16 17 |
# File 'lib/neetob/cli/github/search.rb', line 11 def initialize(apps, key_to_search, search_file_path, sandbox = false) super() @apps = apps @key_to_search = key_to_search @search_file_path = search_file_path @sandbox = sandbox end |
Instance Attribute Details
#apps ⇒ Object
Returns the value of attribute apps.
9 10 11 |
# File 'lib/neetob/cli/github/search.rb', line 9 def apps @apps end |
#key_to_search ⇒ Object
Returns the value of attribute key_to_search.
9 10 11 |
# File 'lib/neetob/cli/github/search.rb', line 9 def key_to_search @key_to_search end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
9 10 11 |
# File 'lib/neetob/cli/github/search.rb', line 9 def sandbox @sandbox end |
#search_file_path ⇒ Object
Returns the value of attribute search_file_path.
9 10 11 |
# File 'lib/neetob/cli/github/search.rb', line 9 def search_file_path @search_file_path end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/neetob/cli/github/search.rb', line 19 def run matching_apps = find_all_matching_apps(apps, :github, sandbox) matching_apps.each do |app| begin ui.info("\n Searching in \"#{app}/#{search_file_path}\" for \"#{key_to_search}\"\n") content = Base64.decode64(client.contents(app, path: search_file_path).content) ui.error("Keyword not found") and next unless content.include? key_to_search content.each_line do |line| ui.success(line) if line.include?(key_to_search) end rescue StandardError => e ExceptionHandler.new(e).process end end end |