Sha256: 2a84a0f3e7082d8c3c8f7f0985f35732cc34d1d3bcd0f35d0e71702a6541d996

Contents?: true

Size: 1.83 KB

Versions: 18

Compression:

Stored size: 1.83 KB

Contents

module Fastlane
  class ActionCollector
    HOST_URL = "https://fastlane-enhancer.herokuapp.com/"

    def did_launch_action(name)
      if is_official(name)
        launches[name] ||= 0
        launches[name] += 1
      end
    end

    def did_raise_error(name)
      if is_official(name)
        @error = name
      end
    end

    # Sends the used actions
    # Example data => [:xcode_select, :deliver, :notify, :slack]
    def did_finish
      Thread.new do
        unless ENV["FASTLANE_OPT_OUT_USAGE"]
          begin
            unless did_show_message?
              Helper.log.debug("Sending Crash/Success information. More information on: https://github.com/fastlane/enhancer")
              Helper.log.debug("No personal/sensitive data is sent. Only sharing the following:")
              Helper.log.debug(launches)
              Helper.log.debug(@error) if @error
              Helper.log.debug("This information is used to fix failing actions and improve integrations that are often used.")
              Helper.log.debug("You can disable this by adding `opt_out_usage` to your Fastfile")
            end

            require 'excon'
            url = HOST_URL + '/did_launch?'
            url += URI.encode_www_form(
                    steps: launches.to_json,
                    error: @error
                  )

            unless Helper.is_test? # don't send test data
              Excon.post(url)
            end
          rescue
            # We don't care about connection errors
          end
        end
      end
    end

    def launches
      @launches ||= {}
    end

    def is_official(name)
      Actions.get_all_official_actions.include?name
    end

    def did_show_message?
      path = File.join(File.expand_path('~'), '.did_show_opt_info')

      did_show = File.exists?path
      File.write(path, '1')
      did_show
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
fastlane-1.7.3 lib/fastlane/action_collector.rb
fastlane-1.7.2 lib/fastlane/action_collector.rb
fastlane-1.7.1 lib/fastlane/action_collector.rb
fastlane-1.7.0 lib/fastlane/action_collector.rb
fastlane-1.6.0 lib/fastlane/action_collector.rb
fastlane-1.5.0 lib/fastlane/action_collector.rb
fastlane-1.4.0 lib/fastlane/action_collector.rb
fastlane-1.3.2 lib/fastlane/action_collector.rb
fastlane-1.3.1 lib/fastlane/action_collector.rb
fastlane-1.3.0 lib/fastlane/action_collector.rb
fastlane-1.2.3 lib/fastlane/action_collector.rb
fastlane-1.2.2 lib/fastlane/action_collector.rb
fastlane-1.2.1 lib/fastlane/action_collector.rb
fastlane-1.2.0 lib/fastlane/action_collector.rb
fastlane-1.1.0 lib/fastlane/action_collector.rb
fastlane-1.0.2 lib/fastlane/action_collector.rb
fastlane-1.0.1 lib/fastlane/action_collector.rb
fastlane-1.0.0 lib/fastlane/action_collector.rb