Sha256: 4b8b34ba31f4fa49d0c1171871f1c76ec800b5232bd49c26782386c1582fd6b7

Contents?: true

Size: 1.12 KB

Versions: 30

Compression:

Stored size: 1.12 KB

Contents

require 'excon'

module FastlaneCore
  class Changelog
    class << self
      def show_changes(gem_name, current_version)
        self.releases(gem_name).each_with_index do |release, index|
          next unless Gem::Version.new(release['tag_name']) > Gem::Version.new(current_version)
          puts ""
          puts release['name'].green
          puts release['body']

          next unless index == 2
          puts ""
          puts "To see all new releases, open https://github.com/fastlane/#{gem_name}/releases".green
          break
        end
        puts "\nUpdate using 'sudo gem update #{gem_name.downcase}'".green
      rescue
        # Something went wrong, we don't care so much about this
      end

      def releases(gem_name)
        url = "https://api.github.com/repos/fastlane/#{gem_name}/releases"
        # We have to follow redirects, since some repos were moved away into a separate org
        server_response = Excon.get(url,
                                    middlewares: Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower])
        JSON.parse(server_response.body)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fastlane_core-0.55.1 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.55.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.54.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.53.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.52.3 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.52.2 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.52.1 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.52.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.51.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.50.3 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.50.2 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.50.1 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.50.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.49.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.48.3 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.48.2 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.48.1 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.48.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.47.0 lib/fastlane_core/update_checker/changelog.rb
fastlane_core-0.46.3 lib/fastlane_core/update_checker/changelog.rb