cocoapods-playgrounds 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cocoapods-playgrounds/command/playgrounds.rb +1 -41
- data/lib/cocoapods-playgrounds/gem_version.rb +1 -1
- data/lib/cocoapods-playgrounds/generate.rb +5 -0
- data/lib/cocoapods-playgrounds/workspace.rb +8 -4
- data/spec/generate_spec.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 664af3506c1df8fe9e1926d49a8237737b3d1f45
|
4
|
+
data.tar.gz: 1f4ceb634c9512368b60c3f5c775448b217a4b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7f5ba78344d4389c71751b86c77cce42a63422ffee19351e8fa341f882f24d758b737596480861657bd00dd323f65e085181f115ab519ab3213d790d0e3b169
|
7
|
+
data.tar.gz: e69861709b8909b4f44c6e11fcb33b54ffa9c7e9f05806da0ac0d29464115a769a29f0e09f951b6943b0c39bf024def4326d13875c7d0218346a325ac6d292f6
|
data/Gemfile.lock
CHANGED
@@ -15,10 +15,7 @@ module Pod
|
|
15
15
|
|
16
16
|
def self.options
|
17
17
|
[
|
18
|
-
['--ipad', 'Create an iPad compatible Playground.'],
|
19
18
|
['--no-install', 'Skip running `pod install`'],
|
20
|
-
['--no-migrate', 'Skip Swift migration for iPad Playgrounds.'],
|
21
|
-
['--no-open', 'Do not open Xcode after generating the Playground.'],
|
22
19
|
['--platform', "Platform to generate for (default: #{DEFAULT_PLATFORM_NAME})"],
|
23
20
|
['--platform_version', 'Platform version to generate for ' \
|
24
21
|
"(default: #{default_version_for_platform(DEFAULT_PLATFORM_NAME)})"]
|
@@ -33,9 +30,6 @@ module Pod
|
|
33
30
|
arg = argv.shift_argument
|
34
31
|
@names = arg.split(',') if arg
|
35
32
|
@install = argv.flag?('install', true)
|
36
|
-
@ipad = argv.flag?('ipad', false)
|
37
|
-
@migrate = argv.flag?('migrate', true)
|
38
|
-
@open = argv.flag?('open', true) && !@ipad
|
39
33
|
@platform = argv.option('platform', DEFAULT_PLATFORM_NAME).to_sym
|
40
34
|
@platform_version = argv.option('platform_version', Playgrounds.default_version_for_platform(@platform))
|
41
35
|
super
|
@@ -49,41 +43,7 @@ module Pod
|
|
49
43
|
def run
|
50
44
|
# TODO: Pass platform and deployment target from configuration
|
51
45
|
generator = WorkspaceGenerator.new(@names, :cocoapods, @platform, @platform_version)
|
52
|
-
|
53
|
-
|
54
|
-
if @ipad
|
55
|
-
FileUtils.rm_rf(Dir.glob("#{name}Playground/*.xcodeproj"))
|
56
|
-
FileUtils.rm_rf(Dir.glob("#{name}Playground/*.xcworkspace"))
|
57
|
-
FileUtils.rm_f(Dir.glob("#{name}Playground/Podfile*"))
|
58
|
-
|
59
|
-
playground_files = "#{name}Playground/#{name}.playground/Sources"
|
60
|
-
FileUtils.mkdir_p(playground_files)
|
61
|
-
pods = "#{name}Playground/Pods"
|
62
|
-
|
63
|
-
Dir.glob("#{pods}/**/*.swift").each do |file|
|
64
|
-
if @migrate
|
65
|
-
migrate(file, "#{playground_files}/#{File.basename(file)}")
|
66
|
-
else
|
67
|
-
FileUtils.cp(file, playground_files)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
FileUtils.rm_rf(pods)
|
71
|
-
|
72
|
-
File.open("#{name}Playground/#{name}.playground/Contents.swift", 'w') do |f|
|
73
|
-
f.write("import PlaygroundSupport\n")
|
74
|
-
f.write("PlaygroundPage.current.needsIndefiniteExecution = true\n\n")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
# Thanks to http://swift.ayaka.me/posts/2016/6/17/running-the-swift-30-migrator-on-a-standalone-swift-file
|
82
|
-
def migrate(input, output)
|
83
|
-
xcode_path = `xcode-select -p`.strip
|
84
|
-
sdk_path = "#{xcode_path}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
|
85
|
-
`xcrun swift-update -sdk '#{sdk_path}' -target arm64-apple-ios9 #{input} >#{output}`
|
86
|
-
FileUtils.cp(input, output) if $?.exitstatus != 0
|
46
|
+
generator.generate(@install)
|
87
47
|
end
|
88
48
|
end
|
89
49
|
end
|
@@ -30,11 +30,16 @@ module Pod
|
|
30
30
|
xcode + TEMPLATE_DIR
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.major_version
|
34
|
+
`xcodebuild -version`.split("\n").first.split(' ')[1].split('.').first.to_i
|
35
|
+
end
|
36
|
+
|
33
37
|
def self.platform_name(file)
|
34
38
|
file.downcase.sub(' ', '').to_sym
|
35
39
|
end
|
36
40
|
|
37
41
|
def self.dir_for_platform(platform)
|
42
|
+
platform = :macos if major_version == 8 && platform.to_sym == :osx
|
38
43
|
Dir.foreach(template_dir) do |file|
|
39
44
|
return (template_dir + file) if platform_name(file) == platform
|
40
45
|
end
|
@@ -15,7 +15,7 @@ module Pod
|
|
15
15
|
@tool = tool
|
16
16
|
end
|
17
17
|
|
18
|
-
def generate(install = true
|
18
|
+
def generate(install = true)
|
19
19
|
@cwd = Pathname.getwd
|
20
20
|
`rm -fr '#{target_dir}'`
|
21
21
|
FileUtils.mkdir_p(target_dir)
|
@@ -28,8 +28,7 @@ module Pod
|
|
28
28
|
generate_swift_code(path)
|
29
29
|
end
|
30
30
|
|
31
|
-
`open #{workspace_path}` if install
|
32
|
-
names.first
|
31
|
+
`open #{workspace_path}` if install
|
33
32
|
end
|
34
33
|
|
35
34
|
private
|
@@ -148,12 +147,17 @@ EOT
|
|
148
147
|
project_path = "#{names.first}.xcodeproj"
|
149
148
|
project = Xcodeproj::Project.new(project_path)
|
150
149
|
|
151
|
-
target = project.new_target(:
|
150
|
+
target = project.new_target(:application,
|
152
151
|
target_name,
|
153
152
|
@platform,
|
154
153
|
@deployment_target)
|
155
154
|
target.build_configurations.each do |config|
|
155
|
+
config.build_settings['ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME'] = 'LaunchImage'
|
156
|
+
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = ''
|
157
|
+
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
158
|
+
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
156
159
|
config.build_settings['DEFINES_MODULE'] = 'NO'
|
160
|
+
config.build_settings['EMBEDDED_CONTENT_CONTAINS_SWIFT'] = 'NO'
|
157
161
|
end
|
158
162
|
|
159
163
|
# TODO: Should be at the root of the project
|
data/spec/generate_spec.rb
CHANGED
@@ -12,7 +12,8 @@ module Pod
|
|
12
12
|
it 'can list available platforms for Playgrounds' do
|
13
13
|
platforms = PlaygroundGenerator.platforms
|
14
14
|
|
15
|
-
|
15
|
+
expected_platforms = PlaygroundGenerator.major_version == 8 ? [:ios, :macos, :tvos] : [:ios, :osx, :tvos]
|
16
|
+
platforms.should == expected_platforms
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'returns nil if template for platform cannot be found' do
|
@@ -24,7 +25,8 @@ module Pod
|
|
24
25
|
it 'can find the template for OS X' do
|
25
26
|
platform = PlaygroundGenerator.dir_for_platform(:osx)
|
26
27
|
|
27
|
-
|
28
|
+
suffix = PlaygroundGenerator.major_version == 8 ? 'macOS' : 'OS X'
|
29
|
+
platform.to_s.end_with?(suffix).should == true
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'can find the template for iOS' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-playgrounds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Bügling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|