Sha256: f2961dc72d137383c65dfff6b0aa7c99eb72be76e6ca11793b202a38819f18b5

Contents?: true

Size: 1.47 KB

Versions: 558

Compression:

Stored size: 1.47 KB

Contents

module Fastlane
  # Use the RubyGems API to get all fastlane plugins
  class PluginFetcher
    require 'fastlane_core'
    require 'fastlane/plugins/plugin_manager'

    # Returns an array of FastlanePlugin objects
    def self.fetch_gems(search_query: nil)
      require 'json'
      require 'open-uri'

      page = 1
      plugins = []
      loop do
        url = "https://rubygems.org/api/v1/search.json?query=#{PluginManager.plugin_prefix}&page=#{page}"
        FastlaneCore::UI.verbose("RubyGems API Request: #{url}")
        results = JSON.parse(open(url).read)
        break if results.count == 0

        plugins += results.collect do |current|
          FastlanePlugin.new(current)
        end
        page += 1
      end

      return plugins if search_query.to_s.length == 0
      plugins.keep_if do |current|
        current.full_name.include?(search_query) or current.info.include?(search_query)
      end

      return plugins
    end
  end

  class FastlanePlugin
    attr_accessor :full_name
    attr_accessor :name
    attr_accessor :downloads
    attr_accessor :info
    attr_accessor :homepage

    def initialize(hash)
      self.full_name = hash["name"]
      self.name = self.full_name.gsub(PluginManager.plugin_prefix, '')
      self.downloads = hash["downloads"]
      self.info = hash["info"]
      self.homepage = hash["homepage_uri"]
    end

    def linked_title
      return "`#{name}`" if homepage.to_s.length == 0
      return "[#{name}](#{homepage})"
    end
  end
end

Version data entries

558 entries across 558 versions & 2 rubygems

Version Path
fastlane-2.92.0 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.92.0.beta.20180416050023 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.92.0.beta.20180415050019 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.92.0.beta.20180414050023 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.91.0 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.91.0.beta.20180413050017 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180412050111 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180411050056 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180410050128 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180409050033 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180408050113 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180407050037 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180406050006 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180405050125 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180404050031 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.90.0.beta.20180403050108 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.89.0 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.89.0.beta.20180402050042 fastlane/lib/fastlane/plugins/plugin_fetcher.rb
fastlane-2.89.0.beta.20180401050120 fastlane/lib/fastlane/plugins/plugin_fetcher.rb