cocoapods-playgrounds 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f5673764f827a2a21cf5a6fe544b1d4252fcadc
4
- data.tar.gz: 11e36382f5ac1dffd67c26ec9017e2863ca19050
3
+ metadata.gz: 333cec7d10b19b1369c3f332481cdf46654c193e
4
+ data.tar.gz: 2e8f9b47ae5058b395af372b2562c79c514e0df5
5
5
  SHA512:
6
- metadata.gz: 52647563ac67b36ff1b9887fa3e47141d812c459fd3f6dbf4528c6ec83c4d86fb1ef3ea869137aa7b1ea49e6c0d5812392d73bf9cf55354e00b7a3044c7b27e7
7
- data.tar.gz: a8ba409eb1837835a42248f99500b6f77564fda35f71007003bad6906346eb9999cb9740bb97bd413522e54db4aafe0457dd1c1f9b8d506d05dc9378d1987867
6
+ metadata.gz: a2cca40587f1bd4f12af215736857151902864bed002d72cf37b107cbac454e1bc1dc43e7503f21d9782eff605853ef23834cb1eb484b65b3720ee2601ad6406
7
+ data.tar.gz: c584e65a2b5d37e74e39ac07577704d5e4532fb623ea3533a0bab8c7a7f9eccf9d84a2c20374b9077803e7a78a90d06fde5be98221c0d536436984ce74e83123
@@ -23,7 +23,10 @@ Metrics/AbcSize:
23
23
  Max: 20
24
24
 
25
25
  Metrics/MethodLength:
26
- Max: 20
26
+ Max: 25
27
27
 
28
28
  Metrics/ClassLength:
29
29
  Max: 150
30
+
31
+ Style/SpecialGlobalVars:
32
+ Enabled: false
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-playgrounds (1.2.0)
5
- cocoapods (~> 1.0.0)
4
+ cocoapods-playgrounds (1.2.1)
5
+ cocoapods (>= 1.0.0, < 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -100,4 +100,4 @@ DEPENDENCIES
100
100
  rubocop
101
101
 
102
102
  BUNDLED WITH
103
- 1.11.2
103
+ 1.12.5
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'cocoapods', '~> 1.0.0'
20
+ spec.add_dependency 'cocoapods', '>= 1.0.0', '< 2.0'
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'rake'
@@ -15,7 +15,10 @@ module Pod
15
15
 
16
16
  def self.options
17
17
  [
18
+ ['--ipad', 'Create an iPad compatible Playground.'],
18
19
  ['--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.'],
19
22
  ['--platform', "Platform to generate for (default: #{DEFAULT_PLATFORM_NAME})"],
20
23
  ['--platform_version', 'Platform version to generate for ' \
21
24
  "(default: #{default_version_for_platform(DEFAULT_PLATFORM_NAME)})"]
@@ -30,6 +33,9 @@ module Pod
30
33
  arg = argv.shift_argument
31
34
  @names = arg.split(',') if arg
32
35
  @install = argv.flag?('install', true)
36
+ @ipad = argv.flag?('ipad', false)
37
+ @migrate = argv.flag?('migrate', true)
38
+ @open = argv.flag?('open', true) && !@ipad
33
39
  @platform = argv.option('platform', DEFAULT_PLATFORM_NAME).to_sym
34
40
  @platform_version = argv.option('platform_version', Playgrounds.default_version_for_platform(@platform))
35
41
  super
@@ -43,7 +49,41 @@ module Pod
43
49
  def run
44
50
  # TODO: Pass platform and deployment target from configuration
45
51
  generator = WorkspaceGenerator.new(@names, :cocoapods, @platform, @platform_version)
46
- generator.generate(@install)
52
+ name = generator.generate(@install, @open)
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
47
87
  end
48
88
  end
49
89
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPlaygrounds
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
  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, open = true)
19
19
  @cwd = Pathname.getwd
20
20
  `rm -fr '#{target_dir}'`
21
21
  FileUtils.mkdir_p(target_dir)
@@ -28,7 +28,8 @@ module Pod
28
28
  generate_swift_code(path)
29
29
  end
30
30
 
31
- `open #{workspace_path}` if install
31
+ `open #{workspace_path}` if install && open
32
+ names.first
32
33
  end
33
34
 
34
35
  private
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-playgrounds
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
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-05-30 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 1.0.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
109
  version: '0'
104
110
  requirements: []
105
111
  rubyforge_project:
106
- rubygems_version: 2.0.14
112
+ rubygems_version: 2.0.14.1
107
113
  signing_key:
108
114
  specification_version: 4
109
115
  summary: Generates a Swift Playground for any Pod.