swingset 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +9 -0
- data/bin/swingset +13 -0
- data/lib/swingset.rb +8 -0
- data/lib/swingset/command.rb +39 -0
- data/lib/swingset/framework_directory.rb +35 -0
- data/lib/swingset/framework_provider.rb +49 -0
- data/lib/swingset/gem_version.rb +6 -0
- data/lib/swingset/swingset.rb +52 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab43eb22bf8758ff5185d7a4bf8d27d7e148d3b3
|
4
|
+
data.tar.gz: e94e84f4834c527d8c0c9fb8679096eb52ba4a6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afb1b9b8b6ab571e4372b814b1a480cb45d2a3882081ca0cf6f44a7bef3b9de7379de300c117be3b3e6b49b6e4e156379a6a8cdf716c2f1ea0146d133fddeafe
|
7
|
+
data.tar.gz: ec6570a4d7084ee69a34af5f6bc7c819489ed88118044ecacb783257af992eeae226e752e418e912a6371faa836b5eba94ed2c74542ff41d933e50d39308eac6
|
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/swingset
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 'swingset'
|
12
|
+
|
13
|
+
SwingSet::Command.start(ARGV)
|
data/lib/swingset.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Test out compiled frameworks with Xcode playgrounds
|
2
|
+
#
|
3
|
+
module SwingSet
|
4
|
+
autoload :Command, 'swingset/command'
|
5
|
+
autoload :SwingSet, 'swingset/swingset'
|
6
|
+
autoload :FrameworkProvider, 'swingset/framework_provider'
|
7
|
+
autoload :FrameworkDirectory, 'swingset/framework_directory'
|
8
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
module SwingSet
|
3
|
+
require 'thor'
|
4
|
+
# Represents the CLI associated with swingset
|
5
|
+
#
|
6
|
+
class Command < Thor
|
7
|
+
option :path
|
8
|
+
option :framework_path
|
9
|
+
option :name
|
10
|
+
desc 'create [PLATFORM]', 'create a new swingset for platform (ios, osx)'
|
11
|
+
def create(platform)
|
12
|
+
name = options[:name] || 'SwingSet'
|
13
|
+
swingset = SwingSet.new(name, platform.to_sym)
|
14
|
+
import_frameworks(swingset, options[:framework_path], platform.to_sym)
|
15
|
+
write_swingset(swingset, options[:path])
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def import_frameworks(swingset, framework_path, platform)
|
21
|
+
if framework_path
|
22
|
+
puts 'Importing frameworks from provided directory'
|
23
|
+
FrameworkDirectory.new(swingset, framework_path)
|
24
|
+
elsif Dir.exist?('Carthage')
|
25
|
+
puts 'Importing frameworks from Carthage'
|
26
|
+
FrameworkDirectory.carthage_frameworks(swingset, platform)
|
27
|
+
else
|
28
|
+
puts 'You either need to provide a framework_path or use with Carthage'
|
29
|
+
return
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_swingset(swingset, path)
|
34
|
+
path ||= File.join(Dir.pwd, 'swingset')
|
35
|
+
puts 'Writing swingset'
|
36
|
+
swingset.write_swingset(path)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
module SwingSet
|
3
|
+
# Will add frameworks to a given swingset
|
4
|
+
class FrameworkDirectory
|
5
|
+
def initialize(swingset, framework_path)
|
6
|
+
@swingset = swingset
|
7
|
+
add_frameworks_from_path(framework_path)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.carthage_frameworks(swingset, platform = :ios)
|
11
|
+
path = File.join('Carthage', 'Build')
|
12
|
+
if platform == :ios
|
13
|
+
path = File.join(path, 'iOS')
|
14
|
+
elsif platform == :osx
|
15
|
+
path = File.join(path, 'Mac')
|
16
|
+
else
|
17
|
+
return
|
18
|
+
end
|
19
|
+
FrameworkDirectory.new(swingset, path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_framework_path(path)
|
23
|
+
add_frameworks_from_path(path) if Dir.exist?(path)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def add_frameworks_from_path(path)
|
29
|
+
fw_glob = File.join(path, '*.framework')
|
30
|
+
Dir.glob(fw_glob).each do |framework|
|
31
|
+
@swingset.add_framework(framework)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
module SwingSet
|
3
|
+
# Represents the "FrameworkProvider" Xcode project
|
4
|
+
class FrameworkProvider
|
5
|
+
require 'xcodeproj'
|
6
|
+
|
7
|
+
def initialize(path, platform, name = 'FrameworkProvider.xcodeproj')
|
8
|
+
@project, @copy_files = prepare_project(path, name, platform)
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_framework(path)
|
12
|
+
file_ref = @project.new_file(File.expand_path(path))
|
13
|
+
@copy_files.add_file_reference(file_ref)
|
14
|
+
end
|
15
|
+
|
16
|
+
def write
|
17
|
+
@project.save
|
18
|
+
end
|
19
|
+
|
20
|
+
def path
|
21
|
+
@project.path
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def prepare_project(path, name, platform)
|
27
|
+
project = Xcodeproj::Project.new(File.join(path, name))
|
28
|
+
target = create_target(project, platform)
|
29
|
+
project.targets << target
|
30
|
+
copy_files = create_copy_files(target)
|
31
|
+
[project, copy_files]
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_target(project, platform)
|
35
|
+
target = project.new(Xcodeproj::Project::Object::PBXAggregateTarget)
|
36
|
+
target.name = 'FrameworkProvider'
|
37
|
+
target.product_name = 'FrameworkProvider'
|
38
|
+
target.build_configuration_list = Xcodeproj::Project::ProjectHelper
|
39
|
+
.configuration_list(project, platform, nil, nil, :swift)
|
40
|
+
target
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_copy_files(target)
|
44
|
+
copy_files = target.new_copy_files_build_phase
|
45
|
+
copy_files.symbol_dst_subfolder_spec = :products_directory
|
46
|
+
copy_files
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
module SwingSet
|
3
|
+
# The primary class for swingset, representing the completed project
|
4
|
+
class SwingSet
|
5
|
+
require 'xcplayground'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
attr_reader :platform
|
10
|
+
attr_reader :frameworks
|
11
|
+
|
12
|
+
def initialize(name = 'SwingSet', platform = :ios)
|
13
|
+
@name = name
|
14
|
+
@platform = platform
|
15
|
+
@frameworks = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_framework(path)
|
19
|
+
@frameworks << path if Dir.exist?(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def write_swingset(path)
|
23
|
+
epath = File.expand_path(path)
|
24
|
+
FileUtils.mkdir_p(epath)
|
25
|
+
proj_path = write_project(epath, platform)
|
26
|
+
pg_path = write_playground(epath, platform, name)
|
27
|
+
write_workspace(epath, name, [proj_path, pg_path])
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def write_project(path, platform)
|
33
|
+
framework_provider = FrameworkProvider.new(path, platform)
|
34
|
+
frameworks.each { |f| framework_provider.add_framework(f) }
|
35
|
+
framework_provider.write
|
36
|
+
framework_provider.path
|
37
|
+
end
|
38
|
+
|
39
|
+
def write_playground(path, platform, name)
|
40
|
+
pg_path = File.join(path, name + '.playground')
|
41
|
+
pg = Xcplayground::Playground.new(pg_path, platform)
|
42
|
+
pg.save
|
43
|
+
pg.path
|
44
|
+
end
|
45
|
+
|
46
|
+
def write_workspace(path, name, contents)
|
47
|
+
ws = Xcodeproj::Workspace.new([])
|
48
|
+
contents.each { |c| ws << c }
|
49
|
+
ws.save_as(File.join(path, name + '.xcworkspace'))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swingset
|
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: xcodeproj
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.23.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.23.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xcplayground
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
description: swingset allows you to test out dynamic frameworks for OS X and iOS >8
|
56
|
+
using Xcode playgrounds. This gem will create the playground, and the necessary
|
57
|
+
workspace and project structure to allow importing the frameworks.
|
58
|
+
email: sam@visualputty.co.uk
|
59
|
+
executables:
|
60
|
+
- swingset
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- bin/swingset
|
67
|
+
- lib/swingset.rb
|
68
|
+
- lib/swingset/command.rb
|
69
|
+
- lib/swingset/framework_directory.rb
|
70
|
+
- lib/swingset/framework_provider.rb
|
71
|
+
- lib/swingset/gem_version.rb
|
72
|
+
- lib/swingset/swingset.rb
|
73
|
+
homepage: https://github.com/sammyd/swingset
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Create Xcode playgrounds with access to precompiled frameworks
|
97
|
+
test_files: []
|