Sha256: 195584881632973bfa274b66e270d6e07d0930da9dd284770153e42fef9642aa

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'migration_bundler/targets/base'

module MigrationBundler
  module Targets
    class CocoapodsTarget < MigrationBundler::Targets::Base
      def init
        unless project.config['cocoapods.repo']
          project.config['cocoapods.repo'] = ask("What is the name of your Cocoapods specs repo? ")
        end
        if options['bundler']
          append_to_file 'Gemfile', "gem 'cocoapods'\n"
        end
      end

      def generate
        invoke :validate
        template('podspec.erb', podspec_name, force: true)
      end

      def validate
        fail Error, "Invalid configuration: cocoapods.repo is not configured." unless cocoapods_repo
      end

      def push
        invoke :validate
        run "pod repo push #{options['quiet'] && '--silent '}--allow-warnings #{cocoapods_repo} #{podspec_name}"
      end

      private
      def cocoapods_repo
        project.config['cocoapods.repo']
      end

      def podspec_name
        "#{project.name}.podspec"
      end

      def pod_version
        unique_tag_for_version(migrations.latest_version)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
migration_bundler-1.4.0 lib/migration_bundler/targets/cocoapods/cocoapods_target.rb
migration_bundler-1.3.3 lib/migration_bundler/targets/cocoapods/cocoapods_target.rb
migration_bundler-1.3.2 lib/migration_bundler/targets/cocoapods/cocoapods_target.rb
migration_bundler-1.3.1 lib/migration_bundler/targets/cocoapods/cocoapods_target.rb
migration_bundler-1.3.0 lib/migration_bundler/targets/cocoapods/cocoapods_target.rb