Created
August 8, 2014 15:37
-
-
Save marcboquet/340c240c50aed6c71a1e to your computer and use it in GitHub Desktop.
Create empty Swift playground files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
require 'pathname' | |
platform = "iphonesimulator" # or "macosx" | |
contents_xcplayground = <<XML | |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<playground version='1.0' sdk='#{platform}'> | |
<sections> | |
<code source-file-name='section-1.swift'/> | |
</sections> | |
</playground> | |
XML | |
time = Time.now.strftime "%Y%m%d-%H%M%S" | |
path = Pathname.new "/tmp/playgrounder/#{time}.playground" | |
path.rmtree if path.exist? | |
path.mkpath | |
File.open(path+"contents.xcplayground", 'w') {|f| f.write(contents_xcplayground) } | |
`open #{path}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment