Sha256: 7aabc86d2ac7d36dc10be5ef432455f84d6daec2b7f4fac3b09a0fdbc9f94a0c

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

#!/usr/bin/env ruby

if $PROGRAM_NAME == __FILE__
  ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
  require 'rubygems'
  require 'bundler/setup'
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
end

require 'claide'
require 'cocoapods-playgrounds/generate'
require 'cocoapods-playgrounds/gem_version'

class PlainInformative < StandardError
  include CLAide::InformativeError
end

class Informative < PlainInformative
  def message
    "[!] #{super}".ansi.red
  end
end

AVAILABLE = Pod::PlaygroundGenerator.platforms.join(', ')
DEFAULT = :osx

class Command < CLAide::Command
  self.command = 'playground'
  self.description = 'Generate Xcode Playgrounds'
  self.version = CocoapodsPlaygrounds::VERSION

  self.arguments = [CLAide::Argument.new('NAME', true)]

  def self.options
    [
      ['--platform', "Platform to generate for (default: #{DEFAULT}, available: #{AVAILABLE})"]
    ]
  end

  def initialize(argv)
    @name = argv.shift_argument
    @platform = argv.option('platform', DEFAULT).to_sym
    super
  end

  def validate!
    help! 'Please specify a name for your Playground' if @name.nil?
  end

  def run
    generator = Pod::PlaygroundGenerator.new(@platform)
    generator.generate(@name)
  end
end

Command.run(ARGV)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cocoapods-playgrounds-1.2.2 bin/playground
cocoapods-playgrounds-1.2.1 bin/playground
cocoapods-playgrounds-1.2.0 bin/playground
cocoapods-playgrounds-1.1.0 bin/playground
cocoapods-playgrounds-1.0.0 bin/playground
cocoapods-playgrounds-0.1.0 bin/playground
cocoapods-playgrounds-0.0.3 bin/playground
cocoapods-playgrounds-0.0.2 bin/playground
cocoapods-playgrounds-0.0.1 bin/playground