Sha256: a13536f50ce95220c264c149e0517a863d570812fbb5a47e0ae16165f97c3203

Contents?: true

Size: 1.13 KB

Versions: 25

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative "base"

module Neetob
  class CLI
    module Github
      class Search < Base
        attr_accessor :apps, :key_to_search, :search_file_path, :sandbox

        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

        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
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
neetob-ud-1.0.59 lib/neetob/cli/github/search.rb
neetob-ud-0.2.8 lib/neetob/cli/github/search.rb
neetob-ud-0.2.6 lib/neetob/cli/github/search.rb
neetob-ud-0.2.4 lib/neetob/cli/github/search.rb
neetob-ud-0.2.3 lib/neetob/cli/github/search.rb
neetob-ud-0.2.2 lib/neetob/cli/github/search.rb
neetob-ud-0.2.1 lib/neetob/cli/github/search.rb
neetob-ud-0.2.0 lib/neetob/cli/github/search.rb
neetob-ud-0.1.3 lib/neetob/cli/github/search.rb
neetob-ud-0.1.2 lib/neetob/cli/github/search.rb
neetob-ud-0.1.1 lib/neetob/cli/github/search.rb
neetob-ud-0.1.0 lib/neetob/cli/github/search.rb
neetob-0.2.2 lib/neetob/cli/github/search.rb
neetob-0.2.1 lib/neetob/cli/github/search.rb
neetob-0.2.0 lib/neetob/cli/github/search.rb
neetob-0.1.5 lib/neetob/cli/github/search.rb
neetob-ud-0.2.14 lib/neetob/cli/github/search.rb
neetob-ud-0.2.13 lib/neetob/cli/github/search.rb
neetob-0.1.4 lib/neetob/cli/github/search.rb
neetob-ud-0.2.11 lib/neetob/cli/github/search.rb