xcplayground 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +8 -0
- data/bin/xcplayground +13 -0
- data/lib/xcplayground.rb +9 -0
- data/lib/xcplayground/command.rb +10 -0
- data/lib/xcplayground/gem_version.rb +6 -0
- data/lib/xcplayground/playground.rb +37 -0
- data/lib/xcplayground/swift_file.rb +23 -0
- data/lib/xcplayground/xcplayground_file.rb +32 -0
- data/lib/xcplayground/xctimeline_file.rb +30 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf25e95e827ad5d8c8449e44d551365cd5cee6cc
|
4
|
+
data.tar.gz: 28d5e684704ef9320386e0b8ffed8bef3778a898
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c863d2b1eff47d979de9ed79576ec3768a989c61af967026f33358171cd7483fd8ff66d007b01900f7324b82b0b8098000fafee612078d87ccc9c61daaa3aae1
|
7
|
+
data.tar.gz: fd01002c24b48d74961dd6762710813127368a3f3150028444f909f4b5dd7b8d873514a578c56bcd9a93d547077e28505fd7838a5d7eb5dcc398fc3df5cd0059
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Sam Davies
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/bin/xcplayground
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if $PROGRAM_NAME == __FILE__
|
4
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../ext', __FILE__)
|
8
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'xcplayground'
|
12
|
+
|
13
|
+
Xcplayground::Command.go()
|
data/lib/xcplayground.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Allows creating of Xcode playgounds
|
2
|
+
#
|
3
|
+
module Xcplayground
|
4
|
+
autoload :Command, 'xcplayground/command'
|
5
|
+
autoload :Playground, 'xcplayground/playground'
|
6
|
+
autoload :SwiftFile, 'xcplayground/swift_file'
|
7
|
+
autoload :XctimelineFile, 'xcplayground/xctimeline_file'
|
8
|
+
autoload :XcplaygroundFile, 'xcplayground/Xcplayground_file'
|
9
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
module Xcplayground
|
3
|
+
# Represents a .playground file
|
4
|
+
class Playground
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
attr_accessor :source_files
|
8
|
+
attr_reader :path, :timeline_file, :playground_file, :swift_file
|
9
|
+
|
10
|
+
def initialize(path, platform = :ios)
|
11
|
+
@path = File.expand_path(path)
|
12
|
+
@swift_file = SwiftFile.new('contents.swift')
|
13
|
+
@timeline_file = XctimelineFile.new
|
14
|
+
@playground_file = XcplaygroundFile.new(platform)
|
15
|
+
@source_files = [SwiftFile.new('SupportCode.swift')]
|
16
|
+
end
|
17
|
+
|
18
|
+
def save
|
19
|
+
# Make the playground container directory
|
20
|
+
FileUtils.mkdir_p(path)
|
21
|
+
|
22
|
+
# Save the timeline and playground files
|
23
|
+
[timeline_file, playground_file, swift_file].each { |f| f.save(path) }
|
24
|
+
|
25
|
+
# Save the additional source files
|
26
|
+
save_sources
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def save_sources
|
32
|
+
source_path = File.join(path, 'Sources')
|
33
|
+
FileUtils.mkdir_p(source_path)
|
34
|
+
source_files.each { |f| f.save(source_path) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Xcplayground
|
2
|
+
# Represent a Swift language file on disc
|
3
|
+
class SwiftFile
|
4
|
+
attr_accessor :content
|
5
|
+
attr_accessor :filename
|
6
|
+
|
7
|
+
def initialize(filename, content = nil)
|
8
|
+
@filename = filename
|
9
|
+
@content = content
|
10
|
+
end
|
11
|
+
|
12
|
+
def save(path)
|
13
|
+
file = File.join(path, filename)
|
14
|
+
File.open(file, 'w') do |f|
|
15
|
+
f.puts to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
@content || '//: Playground - noun: a place where people can play'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Xcplayground
|
2
|
+
# Represent a Swift language file on disc
|
3
|
+
class XcplaygroundFile
|
4
|
+
require 'builder'
|
5
|
+
|
6
|
+
attr_accessor :version
|
7
|
+
attr_accessor :platform
|
8
|
+
attr_accessor :filename
|
9
|
+
|
10
|
+
def initialize(platform, fname = 'contents.xcplayground', version = '5.0')
|
11
|
+
@platform = platform
|
12
|
+
@filename = fname
|
13
|
+
@version = version
|
14
|
+
end
|
15
|
+
|
16
|
+
def save(path, timeline_file = 'timeline.xctimeline')
|
17
|
+
file = File.join(path, filename)
|
18
|
+
File.open(file, 'w') do |f|
|
19
|
+
f.puts to_s(timeline_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_s(timeline_file)
|
24
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
25
|
+
xml.instruct! :xml, version: '1.0', encoding: 'UTF-8', standalone: 'yes'
|
26
|
+
xml.playground(version: version, 'target-platform' => platform) do |p|
|
27
|
+
p.timeline(fileName: timeline_file)
|
28
|
+
end
|
29
|
+
xml.target!
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Xcplayground
|
2
|
+
# Represent a .xctimeline file on disc
|
3
|
+
class XctimelineFile
|
4
|
+
require 'builder'
|
5
|
+
|
6
|
+
attr_reader :filename
|
7
|
+
attr_reader :version
|
8
|
+
|
9
|
+
def initialize(filename = 'timeline.xctimeline', version = '3.0')
|
10
|
+
@filename = filename
|
11
|
+
@version = version
|
12
|
+
end
|
13
|
+
|
14
|
+
def save(path)
|
15
|
+
file = File.join(path, filename)
|
16
|
+
File.open(file, 'w') do |f|
|
17
|
+
f.puts to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
23
|
+
xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
|
24
|
+
xml.Timeline(version: version) do |tl|
|
25
|
+
tl.TimelineItems {}
|
26
|
+
end
|
27
|
+
xml.target!
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xcplayground
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sam Davies
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: builder
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.2.2
|
33
|
+
description: xcplayground allows you to create Xcode playground documents from the
|
34
|
+
command line or within Ruby.
|
35
|
+
email: sam@visualputty.co.uk
|
36
|
+
executables:
|
37
|
+
- xcplayground
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- LICENSE
|
42
|
+
- README.md
|
43
|
+
- bin/xcplayground
|
44
|
+
- lib/xcplayground.rb
|
45
|
+
- lib/xcplayground/command.rb
|
46
|
+
- lib/xcplayground/gem_version.rb
|
47
|
+
- lib/xcplayground/playground.rb
|
48
|
+
- lib/xcplayground/swift_file.rb
|
49
|
+
- lib/xcplayground/xcplayground_file.rb
|
50
|
+
- lib/xcplayground/xctimeline_file.rb
|
51
|
+
homepage: https://github.com/sammyd/xcplayground
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 2.0.0
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.4.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Create Xcode playgrounds
|
75
|
+
test_files: []
|