Sha256: 51c1ad9a8b8d0e54ad84de426de879b1956224dbe8c00912cdadcb6906024bce

Contents?: true

Size: 1.77 KB

Versions: 17

Compression:

Stored size: 1.77 KB

Contents

module Fastlane
  module Apprepo
    # Responsible for setting up the Repofile configuration
    class Setup
      def setup_apprepo(file_path, data, _apprepo_path, _options)
        UI.message('[Apprepo:Setup] Setting up...')
        File.write(file_path, data)

        # TODO: implement later
        download_manifest(apprepo_path, options)

        UI.success("NOT! created new Repofile at path '#{file_path}'")
      end

      # This method takes care of creating a new 'apprepo' folder with metadata
      # and screenshots folders
      def generate_apprepo_file(_apprepo_path, options)
        # v = options[:app].latest_version
        # generate_apprepo_file(v, File.join(apprepo_path, 'manifest.json'))

        # Generate the final Repofile here
        gem_path = Helper.gem_path('apprepo')
        apprepo = File.read("#{gem_path}/../assets/RepofileDefault")
        apprepo.gsub!('[[APP_IDENTIFIER]]', options[:app].bundle_id)
        apprepo.gsub!('[[APPREPO_IPA_PATH]]', options[:app].file_path)
        apprepo.gsub!('[[APP_VERSION]]', options[:app].version)
        apprepo.gsub!('[[APP_NAME]]', options[:app].name)
        # apprepo (was deliver)
      end

      def download_manifest(apprepo_path, _options)
        path = File.join(apprepo_path, 'metadata')
        FileUtils.mkdir_p(path)
        UI.success("TODO: DOWNLOAD MANIFEST'")
        Apprepo::Uploader.new(options).download_manifest_only
      end

      def run(options)
        UI.message('[Apprepo:Setup] Running...')
        containing = (File.directory?('fastlane') ? 'fastlane' : '.')
        file_path = File.join(containing, 'Repofile')
        data = generate_apprepo_file(containing, options)
        setup_apprepo(file_path, data, containing, options)
      end
    end
  end

  # @setup = new Apprepo::Setup
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fastlane-plugin-apprepo-0.5.4 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.5.3 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.5.2 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.5.1 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.5.0 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.4.3 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.4.2 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.4.1 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.4.0 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.9 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.8 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.7 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.6 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.3 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.1 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.3.0 lib/fastlane/plugin/apprepo/helper/setup.rb
fastlane-plugin-apprepo-0.2.0 lib/fastlane/plugin/apprepo/helper/setup.rb