cocoapods-playgrounds 0.0.3 → 0.1.0
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 +4 -4
- data/.gitignore +0 -1
- data/.rubocop.yml +4 -0
- data/.travis.yml +10 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +98 -0
- data/README.md +10 -0
- data/Rakefile +4 -0
- data/bin/carthage-play +46 -0
- data/cocoapods-playgrounds.gemspec +2 -2
- data/lib/cocoapods-playgrounds/gem_version.rb +1 -1
- data/lib/cocoapods-playgrounds/generate.rb +1 -1
- data/lib/cocoapods-playgrounds/workspace.rb +79 -12
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8d76cad4c9cc3283f0b08be6590081bd969892
|
4
|
+
data.tar.gz: 13d30b88df34d1013df165e0d8bd1d4ea41bd581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ddb9369b9b4fc04b337233a2959998e34279c33ad83b710aa211c4fe2251e2373899a05c2477dfee501f3ee381a92fb2cf6ca9e29355c76e2fb8e560d6f3154
|
7
|
+
data.tar.gz: ab93d1fe834cd6e9589f85878d0d3fc44a3eca694b1f4aeb8a533d58e61c0fbd52c2fd159d0080deb438f010ddeac748d4f6b2fd20d7b18cb9a91cb37236c372
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -5,6 +5,7 @@ Style/Documentation:
|
|
5
5
|
Exclude:
|
6
6
|
- 'spec/**/*'
|
7
7
|
- 'test/**/*'
|
8
|
+
- 'bin/carthage-play'
|
8
9
|
- 'bin/playground'
|
9
10
|
- 'lib/cocoapods-playgrounds/generate.rb'
|
10
11
|
- 'lib/cocoapods-playgrounds/workspace.rb'
|
@@ -23,3 +24,6 @@ Metrics/AbcSize:
|
|
23
24
|
|
24
25
|
Metrics/MethodLength:
|
25
26
|
Max: 20
|
27
|
+
|
28
|
+
Metrics/ClassLength:
|
29
|
+
Max: 150
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-playgrounds (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (4.2.5.1)
|
10
|
+
i18n (~> 0.7)
|
11
|
+
json (~> 1.7, >= 1.7.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
ast (2.2.0)
|
16
|
+
bacon (1.2.0)
|
17
|
+
claide (0.9.1)
|
18
|
+
cocoapods (0.39.0)
|
19
|
+
activesupport (>= 4.0.2)
|
20
|
+
claide (~> 0.9.1)
|
21
|
+
cocoapods-core (= 0.39.0)
|
22
|
+
cocoapods-downloader (~> 0.9.3)
|
23
|
+
cocoapods-plugins (~> 0.4.2)
|
24
|
+
cocoapods-search (~> 0.1.0)
|
25
|
+
cocoapods-stats (~> 0.6.2)
|
26
|
+
cocoapods-trunk (~> 0.6.4)
|
27
|
+
cocoapods-try (~> 0.5.1)
|
28
|
+
colored (~> 1.2)
|
29
|
+
escape (~> 0.0.4)
|
30
|
+
molinillo (~> 0.4.0)
|
31
|
+
nap (~> 1.0)
|
32
|
+
xcodeproj (~> 0.28.2)
|
33
|
+
cocoapods-core (0.39.0)
|
34
|
+
activesupport (>= 4.0.2)
|
35
|
+
fuzzy_match (~> 2.0.4)
|
36
|
+
nap (~> 1.0)
|
37
|
+
cocoapods-downloader (0.9.3)
|
38
|
+
cocoapods-plugins (0.4.2)
|
39
|
+
nap
|
40
|
+
cocoapods-search (0.1.0)
|
41
|
+
cocoapods-stats (0.6.2)
|
42
|
+
cocoapods-trunk (0.6.4)
|
43
|
+
nap (>= 0.8, < 2.0)
|
44
|
+
netrc (= 0.7.8)
|
45
|
+
cocoapods-try (0.5.1)
|
46
|
+
colored (1.2)
|
47
|
+
escape (0.0.4)
|
48
|
+
fuzzy_match (2.0.4)
|
49
|
+
i18n (0.7.0)
|
50
|
+
json (1.8.3)
|
51
|
+
metaclass (0.0.4)
|
52
|
+
minitest (5.8.4)
|
53
|
+
mocha (1.1.0)
|
54
|
+
metaclass (~> 0.0.1)
|
55
|
+
mocha-on-bacon (0.2.2)
|
56
|
+
mocha (>= 0.13.0)
|
57
|
+
molinillo (0.4.2)
|
58
|
+
nap (1.1.0)
|
59
|
+
netrc (0.7.8)
|
60
|
+
parser (2.3.0.5)
|
61
|
+
ast (~> 2.2)
|
62
|
+
powerpack (0.1.1)
|
63
|
+
prettybacon (0.0.2)
|
64
|
+
bacon (~> 1.2)
|
65
|
+
rainbow (2.1.0)
|
66
|
+
rake (10.5.0)
|
67
|
+
rubocop (0.37.2)
|
68
|
+
parser (>= 2.3.0.4, < 3.0)
|
69
|
+
powerpack (~> 0.1)
|
70
|
+
rainbow (>= 1.99.1, < 3.0)
|
71
|
+
ruby-progressbar (~> 1.7)
|
72
|
+
unicode-display_width (~> 0.3)
|
73
|
+
ruby-progressbar (1.7.5)
|
74
|
+
thread_safe (0.3.5)
|
75
|
+
tzinfo (1.2.2)
|
76
|
+
thread_safe (~> 0.1)
|
77
|
+
unicode-display_width (0.3.1)
|
78
|
+
xcodeproj (0.28.2)
|
79
|
+
activesupport (>= 3)
|
80
|
+
claide (~> 0.9.1)
|
81
|
+
colored (~> 1.2)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
ruby
|
85
|
+
|
86
|
+
DEPENDENCIES
|
87
|
+
bacon
|
88
|
+
bundler (~> 1.3)
|
89
|
+
cocoapods
|
90
|
+
cocoapods-playgrounds!
|
91
|
+
mocha
|
92
|
+
mocha-on-bacon
|
93
|
+
prettybacon
|
94
|
+
rake
|
95
|
+
rubocop
|
96
|
+
|
97
|
+
BUNDLED WITH
|
98
|
+
1.11.2
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# This Could Be Us But You Playing
|
2
2
|
|
3
|
+
[](https://travis-ci.org/neonichu/ThisCouldBeUsButYouPlaying)
|
4
|
+
|
3
5
|

|
4
6
|
|
5
7
|
Generates a Swift Playground for any Pod.
|
@@ -24,6 +26,14 @@ To generate a Playground with multiple Pods:
|
|
24
26
|
|
25
27
|
$ pod playgrounds RxSwift,RxCocoa
|
26
28
|
|
29
|
+
### Carthage
|
30
|
+
|
31
|
+
To generate a Playground for a Carthage-enabled library:
|
32
|
+
|
33
|
+
$ carthage-play Alamofire/Alamofire
|
34
|
+
|
35
|
+
Note: This currently assumes that libraries are hosted on GitHub.
|
36
|
+
|
27
37
|
### CLI
|
28
38
|
|
29
39
|
To generate an empty Playground from the commandline:
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
+
require 'rubocop/rake_task'
|
2
3
|
|
3
4
|
def specs(dir)
|
4
5
|
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
@@ -9,4 +10,7 @@ task :specs do
|
|
9
10
|
sh "bundle exec bacon #{specs('**')}"
|
10
11
|
end
|
11
12
|
|
13
|
+
desc 'Lints all the files'
|
14
|
+
RuboCop::RakeTask.new(:rubocop)
|
15
|
+
|
12
16
|
task default: :specs
|
data/bin/carthage-play
ADDED
@@ -0,0 +1,46 @@
|
|
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('../../lib', __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'claide'
|
11
|
+
require 'cocoapods-playgrounds/gem_version'
|
12
|
+
require 'cocoapods-playgrounds/workspace'
|
13
|
+
|
14
|
+
class PlainInformative < StandardError
|
15
|
+
include CLAide::InformativeError
|
16
|
+
end
|
17
|
+
|
18
|
+
class Informative < PlainInformative
|
19
|
+
def message
|
20
|
+
"[!] #{super}".ansi.red
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Command < CLAide::Command
|
25
|
+
self.command = 'carthage-play'
|
26
|
+
self.description = 'Generate a Swift Playground for Carthage-enabled libraries'
|
27
|
+
self.version = CocoapodsPlaygrounds::VERSION
|
28
|
+
|
29
|
+
self.arguments = [CLAide::Argument.new('NAME', true)]
|
30
|
+
|
31
|
+
def initialize(argv)
|
32
|
+
@name = argv.shift_argument
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def validate!
|
37
|
+
help! 'A library name is required.' if @name.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
generator = Pod::WorkspaceGenerator.new([@name], :carthage)
|
42
|
+
generator.generate
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Command.run(ARGV)
|
@@ -6,10 +6,10 @@ require 'cocoapods-playgrounds/gem_version.rb'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'cocoapods-playgrounds'
|
8
8
|
spec.version = CocoapodsPlaygrounds::VERSION
|
9
|
-
spec.authors = ['Boris
|
9
|
+
spec.authors = ['Boris Bügling']
|
10
10
|
spec.email = ['boris@icculus.org']
|
11
11
|
spec.summary = 'Generates a Swift Playground for any Pod.'
|
12
|
-
spec.homepage = 'https://github.com/
|
12
|
+
spec.homepage = 'https://github.com/neonichu/ThisCouldBeUsButYouPlaying'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
@@ -8,7 +8,7 @@ module Pod
|
|
8
8
|
|
9
9
|
def initialize(platform)
|
10
10
|
@template = self.class.dir_for_platform(platform)
|
11
|
-
|
11
|
+
raise "Could not find template for #{platform}" if @template.nil?
|
12
12
|
@template += TEMPLATE_NAME
|
13
13
|
end
|
14
14
|
|
@@ -1,18 +1,27 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-playgrounds/generate'
|
3
|
+
require 'xcodeproj'
|
4
|
+
|
1
5
|
module Pod
|
2
6
|
class WorkspaceGenerator
|
3
|
-
|
7
|
+
SUPPORTED_TOOLS = [:carthage, :cocoapods].freeze
|
8
|
+
|
9
|
+
def initialize(names, tool = :cocoapods, platform = :ios, deployment_target = '9.0')
|
4
10
|
@names = names
|
5
11
|
@platform = platform
|
6
12
|
@deployment_target = deployment_target
|
13
|
+
|
14
|
+
raise "Unsupported tool #{tool}" unless SUPPORTED_TOOLS.include?(tool)
|
15
|
+
@tool = tool
|
7
16
|
end
|
8
17
|
|
9
18
|
def generate
|
10
19
|
@cwd = Pathname.getwd
|
11
|
-
|
20
|
+
`rm -fr #{target_dir}`
|
21
|
+
FileUtils.mkdir_p(target_dir)
|
12
22
|
|
13
23
|
Dir.chdir(target_dir) do
|
14
|
-
|
15
|
-
Pod::Executable.execute_command('pod', ['install', '--no-repo-update'])
|
24
|
+
setup_project
|
16
25
|
|
17
26
|
generator = Pod::PlaygroundGenerator.new(@platform)
|
18
27
|
path = generator.generate(names.first)
|
@@ -24,6 +33,20 @@ module Pod
|
|
24
33
|
|
25
34
|
private
|
26
35
|
|
36
|
+
def setup_project
|
37
|
+
case @tool
|
38
|
+
when :carthage then
|
39
|
+
generate_cartfile
|
40
|
+
Pod::Executable.execute_command('carthage', ['update', '--platform', @platform.to_s])
|
41
|
+
generate_project
|
42
|
+
copy_carthage_frameworks
|
43
|
+
when :cocoapods then
|
44
|
+
generate_podfile
|
45
|
+
generate_project
|
46
|
+
Pod::Executable.execute_command('pod', ['install', '--no-repo-update'])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
27
50
|
def names
|
28
51
|
@names.map do |name|
|
29
52
|
File.basename(name, '.podspec')
|
@@ -48,7 +71,52 @@ module Pod
|
|
48
71
|
end
|
49
72
|
|
50
73
|
def workspace_path
|
51
|
-
|
74
|
+
extension = @tool == :cocoapods ? 'xcworkspace' : 'xcodeproj'
|
75
|
+
target_dir + "#{names.first}.#{extension}"
|
76
|
+
end
|
77
|
+
|
78
|
+
def potential_cartfile
|
79
|
+
potential_cartfile = @cwd + @names.first
|
80
|
+
File.exist?(potential_cartfile) ? File.read(potential_cartfile) : nil
|
81
|
+
end
|
82
|
+
|
83
|
+
def generate_cartfile
|
84
|
+
contents = if potential_cartfile
|
85
|
+
potential_cartfile
|
86
|
+
else
|
87
|
+
@names.map do |name|
|
88
|
+
"github \"#{name}\""
|
89
|
+
end.join("\n")
|
90
|
+
end
|
91
|
+
File.open('Cartfile', 'w') { |f| f.write(contents) }
|
92
|
+
end
|
93
|
+
|
94
|
+
def carthage_platform_dir
|
95
|
+
platform_dir = Dir.entries('Carthage/Build').find do |dir|
|
96
|
+
dir.downcase.to_sym == @platform
|
97
|
+
end
|
98
|
+
raise "Could not find frameworks for platform #{@platform}" if platform_dir.nil?
|
99
|
+
|
100
|
+
Pathname.new('Carthage/Build') + platform_dir
|
101
|
+
end
|
102
|
+
|
103
|
+
def derived_data_dir
|
104
|
+
result = Pod::Executable.execute_command('xcodebuild',
|
105
|
+
['-configuration', 'Debug',
|
106
|
+
'-sdk', 'iphonesimulator',
|
107
|
+
'-showBuildSettings'])
|
108
|
+
built_products_dir = result.lines.find do |line|
|
109
|
+
line[/ BUILT_PRODUCTS_DIR =/]
|
110
|
+
end.split('=').last.strip
|
111
|
+
Pathname.new(built_products_dir)
|
112
|
+
end
|
113
|
+
|
114
|
+
def copy_carthage_frameworks
|
115
|
+
Dir.entries(carthage_platform_dir).each do |entry|
|
116
|
+
next unless entry.end_with?('.framework')
|
117
|
+
FileUtils.mkdir_p(derived_data_dir)
|
118
|
+
FileUtils.cp_r(carthage_platform_dir + entry, derived_data_dir)
|
119
|
+
end
|
52
120
|
end
|
53
121
|
|
54
122
|
def generate_podfile
|
@@ -60,10 +128,7 @@ module Pod
|
|
60
128
|
end
|
61
129
|
|
62
130
|
def generate_project
|
63
|
-
|
64
|
-
FileUtils.mkdir_p(target_dir)
|
65
|
-
|
66
|
-
project_path = "#{target_dir}/#{names.first}.xcodeproj"
|
131
|
+
project_path = "#{names.first}.xcodeproj"
|
67
132
|
project = Xcodeproj::Project.new(project_path)
|
68
133
|
|
69
134
|
target = project.new_target(:framework,
|
@@ -84,10 +149,12 @@ module Pod
|
|
84
149
|
f.write("//: Please build the scheme '#{target_name}' first\n")
|
85
150
|
f.write("import XCPlayground\n")
|
86
151
|
f.write("XCPlaygroundPage.currentPage.needsIndefiniteExecution = true\n\n")
|
87
|
-
|
88
|
-
|
152
|
+
unless potential_cartfile
|
153
|
+
names.each do |name|
|
154
|
+
f.write("import #{name}\n")
|
155
|
+
end
|
156
|
+
f.write("\n")
|
89
157
|
end
|
90
|
-
f.write("\n")
|
91
158
|
end
|
92
159
|
end
|
93
160
|
end
|
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: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Boris
|
7
|
+
- Boris Bügling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,17 +42,21 @@ description:
|
|
42
42
|
email:
|
43
43
|
- boris@icculus.org
|
44
44
|
executables:
|
45
|
+
- carthage-play
|
45
46
|
- playground
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
48
49
|
files:
|
49
50
|
- .gitignore
|
50
51
|
- .rubocop.yml
|
52
|
+
- .travis.yml
|
51
53
|
- Gemfile
|
54
|
+
- Gemfile.lock
|
52
55
|
- LICENSE.txt
|
53
56
|
- README.md
|
54
57
|
- README_images/alamofire.png
|
55
58
|
- Rakefile
|
59
|
+
- bin/carthage-play
|
56
60
|
- bin/playground
|
57
61
|
- cocoapods-playgrounds.gemspec
|
58
62
|
- lib/cocoapods-playgrounds.rb
|
@@ -65,7 +69,7 @@ files:
|
|
65
69
|
- spec/command/playgrounds_spec.rb
|
66
70
|
- spec/generate_spec.rb
|
67
71
|
- spec/spec_helper.rb
|
68
|
-
homepage: https://github.com/
|
72
|
+
homepage: https://github.com/neonichu/ThisCouldBeUsButYouPlaying
|
69
73
|
licenses:
|
70
74
|
- MIT
|
71
75
|
metadata: {}
|