cocoapods-playgrounds 0.0.2 → 0.0.3
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 +1 -0
- data/.rubocop.yml +1 -0
- data/README.md +18 -6
- data/lib/cocoapods-playgrounds/command.rb +1 -0
- data/lib/cocoapods-playgrounds/command/playgrounds.rb +7 -63
- data/lib/cocoapods-playgrounds/gem_version.rb +1 -1
- data/lib/cocoapods-playgrounds/workspace.rb +94 -0
- metadata +3 -3
- data/Gemfile.lock +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b476f2ee0d9461b0d7b75689d4d06184505c230
|
4
|
+
data.tar.gz: 04365247c29e13ee170f491ff3e859c21cedc880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e82ff75337f6ddc80edd0e6072d864b0ef7e8e8455a0d33d3028ccae19c93a0e6be1d657dd99102776451bb633289259b8b9548a6601371ec8d7794429f564e
|
7
|
+
data.tar.gz: 1ea35dfd880f71b2c18d6bcac630b2bd68f69c56d5bd16485260077e99ced1327661d4eb3c1ac61f9304b0769543b99be946c76afc49d74f1dc883d0a39e5dbc
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -4,17 +4,29 @@
|
|
4
4
|
|
5
5
|
Generates a Swift Playground for any Pod.
|
6
6
|
|
7
|
-
##
|
7
|
+
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
$ gem install cocoapods-playgrounds
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### CocoaPods
|
13
14
|
|
14
15
|
To generate a Playground for a specific Pod:
|
15
16
|
|
16
17
|
$ pod playgrounds Alamofire
|
17
18
|
|
18
|
-
|
19
|
+
To generate a Playground for a local development Pod:
|
19
20
|
|
20
|
-
$
|
21
|
+
$ pod playgrounds ../../../Sources/Alamofire/Alamofire.podspec
|
22
|
+
|
23
|
+
To generate a Playground with multiple Pods:
|
24
|
+
|
25
|
+
$ pod playgrounds RxSwift,RxCocoa
|
26
|
+
|
27
|
+
### CLI
|
28
|
+
|
29
|
+
To generate an empty Playground from the commandline:
|
30
|
+
|
31
|
+
$ playground --platform=ios YOLO
|
32
|
+
$ open YOLO.playground
|
@@ -7,79 +7,23 @@ module Pod
|
|
7
7
|
Generates a Swift Playground for any Pod.
|
8
8
|
DESC
|
9
9
|
|
10
|
-
self.arguments = [CLAide::Argument.new('
|
10
|
+
self.arguments = [CLAide::Argument.new('NAMES', true)]
|
11
11
|
|
12
12
|
def initialize(argv)
|
13
|
-
|
14
|
-
@
|
15
|
-
@deployment_target = '9.0' # TODO: Should be configurable
|
13
|
+
arg = argv.shift_argument
|
14
|
+
@names = arg.split(',') if arg
|
16
15
|
super
|
17
16
|
end
|
18
17
|
|
19
18
|
def validate!
|
20
19
|
super
|
21
|
-
help! '
|
20
|
+
help! 'At least one Pod name is required.' unless @names
|
22
21
|
end
|
23
22
|
|
24
23
|
def run
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
generate_podfile
|
29
|
-
Pod::Executable.execute_command('pod', ['install', '--no-repo-update'])
|
30
|
-
generator = Pod::PlaygroundGenerator.new(@platform)
|
31
|
-
path = generator.generate(@name)
|
32
|
-
File.open(path + 'Contents.swift', 'w') do |f|
|
33
|
-
f.write("//: Please build the scheme '#{target_name}' first\n")
|
34
|
-
f.write("import XCPlayground\n")
|
35
|
-
f.write("XCPlaygroundPage.currentPage.needsIndefiniteExecution = true\n\n")
|
36
|
-
f.write("import #{@name}\n\n")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
`open #{workspace_path}`
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def target_dir
|
46
|
-
Pathname.new(target_name)
|
47
|
-
end
|
48
|
-
|
49
|
-
def target_name
|
50
|
-
"#{@name}Playground"
|
51
|
-
end
|
52
|
-
|
53
|
-
def workspace_path
|
54
|
-
target_dir + "#{@name}.xcworkspace"
|
55
|
-
end
|
56
|
-
|
57
|
-
def generate_podfile
|
58
|
-
contents = "use_frameworks!\n\n"
|
59
|
-
contents << "target '#{target_name}' do\n"
|
60
|
-
contents << "pod '#{@name}'\n"
|
61
|
-
contents << "end\n"
|
62
|
-
File.open('Podfile', 'w') { |f| f.write(contents) }
|
63
|
-
end
|
64
|
-
|
65
|
-
def generate_project
|
66
|
-
`rm -fr #{target_dir}`
|
67
|
-
FileUtils.mkdir_p(target_dir)
|
68
|
-
|
69
|
-
project_path = "#{target_dir}/#{@name}.xcodeproj"
|
70
|
-
project = Xcodeproj::Project.new(project_path)
|
71
|
-
|
72
|
-
target = project.new_target(:framework,
|
73
|
-
target_name,
|
74
|
-
@platform,
|
75
|
-
@deployment_target)
|
76
|
-
target.build_configurations.each do |config|
|
77
|
-
config.build_settings['DEFINES_MODULE'] = 'NO'
|
78
|
-
end
|
79
|
-
|
80
|
-
# TODO: Should be at the root of the project
|
81
|
-
project.new_file("#{@name}.playground")
|
82
|
-
project.save
|
24
|
+
# TODO: Pass platform and deployment target from configuration
|
25
|
+
generator = WorkspaceGenerator.new(@names)
|
26
|
+
generator.generate
|
83
27
|
end
|
84
28
|
end
|
85
29
|
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Pod
|
2
|
+
class WorkspaceGenerator
|
3
|
+
def initialize(names, platform = :ios, deployment_target = '9.0')
|
4
|
+
@names = names
|
5
|
+
@platform = platform
|
6
|
+
@deployment_target = deployment_target
|
7
|
+
end
|
8
|
+
|
9
|
+
def generate
|
10
|
+
@cwd = Pathname.getwd
|
11
|
+
generate_project
|
12
|
+
|
13
|
+
Dir.chdir(target_dir) do
|
14
|
+
generate_podfile
|
15
|
+
Pod::Executable.execute_command('pod', ['install', '--no-repo-update'])
|
16
|
+
|
17
|
+
generator = Pod::PlaygroundGenerator.new(@platform)
|
18
|
+
path = generator.generate(names.first)
|
19
|
+
generate_swift_code(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
`open #{workspace_path}`
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def names
|
28
|
+
@names.map do |name|
|
29
|
+
File.basename(name, '.podspec')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def pods
|
34
|
+
names.zip(@names).map do |name, path|
|
35
|
+
path = @cwd + path
|
36
|
+
requirement = "pod '#{name}'"
|
37
|
+
requirement += ", :path => '#{path.dirname}'" if path.exist?
|
38
|
+
requirement
|
39
|
+
end.join("\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
def target_dir
|
43
|
+
Pathname.new(target_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
def target_name
|
47
|
+
"#{names.first}Playground"
|
48
|
+
end
|
49
|
+
|
50
|
+
def workspace_path
|
51
|
+
target_dir + "#{names.first}.xcworkspace"
|
52
|
+
end
|
53
|
+
|
54
|
+
def generate_podfile
|
55
|
+
contents = "use_frameworks!\n\n"
|
56
|
+
contents << "target '#{target_name}' do\n"
|
57
|
+
contents << "#{pods}\n"
|
58
|
+
contents << "end\n"
|
59
|
+
File.open('Podfile', 'w') { |f| f.write(contents) }
|
60
|
+
end
|
61
|
+
|
62
|
+
def generate_project
|
63
|
+
`rm -fr #{target_dir}`
|
64
|
+
FileUtils.mkdir_p(target_dir)
|
65
|
+
|
66
|
+
project_path = "#{target_dir}/#{names.first}.xcodeproj"
|
67
|
+
project = Xcodeproj::Project.new(project_path)
|
68
|
+
|
69
|
+
target = project.new_target(:framework,
|
70
|
+
target_name,
|
71
|
+
@platform,
|
72
|
+
@deployment_target)
|
73
|
+
target.build_configurations.each do |config|
|
74
|
+
config.build_settings['DEFINES_MODULE'] = 'NO'
|
75
|
+
end
|
76
|
+
|
77
|
+
# TODO: Should be at the root of the project
|
78
|
+
project.new_file("#{names.first}.playground")
|
79
|
+
project.save
|
80
|
+
end
|
81
|
+
|
82
|
+
def generate_swift_code(path)
|
83
|
+
File.open(path + 'Contents.swift', 'w') do |f|
|
84
|
+
f.write("//: Please build the scheme '#{target_name}' first\n")
|
85
|
+
f.write("import XCPlayground\n")
|
86
|
+
f.write("XCPlaygroundPage.currentPage.needsIndefiniteExecution = true\n\n")
|
87
|
+
names.each do |name|
|
88
|
+
f.write("import #{name}\n")
|
89
|
+
end
|
90
|
+
f.write("\n")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
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.0.3
|
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-02-
|
11
|
+
date: 2016-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- .gitignore
|
50
50
|
- .rubocop.yml
|
51
51
|
- Gemfile
|
52
|
-
- Gemfile.lock
|
53
52
|
- LICENSE.txt
|
54
53
|
- README.md
|
55
54
|
- README_images/alamofire.png
|
@@ -61,6 +60,7 @@ files:
|
|
61
60
|
- lib/cocoapods-playgrounds/command/playgrounds.rb
|
62
61
|
- lib/cocoapods-playgrounds/gem_version.rb
|
63
62
|
- lib/cocoapods-playgrounds/generate.rb
|
63
|
+
- lib/cocoapods-playgrounds/workspace.rb
|
64
64
|
- lib/cocoapods_plugin.rb
|
65
65
|
- spec/command/playgrounds_spec.rb
|
66
66
|
- spec/generate_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cocoapods-playgrounds (0.0.2)
|
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
|
-
bacon (1.2.0)
|
16
|
-
claide (0.9.1)
|
17
|
-
cocoapods (0.39.0)
|
18
|
-
activesupport (>= 4.0.2)
|
19
|
-
claide (~> 0.9.1)
|
20
|
-
cocoapods-core (= 0.39.0)
|
21
|
-
cocoapods-downloader (~> 0.9.3)
|
22
|
-
cocoapods-plugins (~> 0.4.2)
|
23
|
-
cocoapods-search (~> 0.1.0)
|
24
|
-
cocoapods-stats (~> 0.6.2)
|
25
|
-
cocoapods-trunk (~> 0.6.4)
|
26
|
-
cocoapods-try (~> 0.5.1)
|
27
|
-
colored (~> 1.2)
|
28
|
-
escape (~> 0.0.4)
|
29
|
-
molinillo (~> 0.4.0)
|
30
|
-
nap (~> 1.0)
|
31
|
-
xcodeproj (~> 0.28.2)
|
32
|
-
cocoapods-core (0.39.0)
|
33
|
-
activesupport (>= 4.0.2)
|
34
|
-
fuzzy_match (~> 2.0.4)
|
35
|
-
nap (~> 1.0)
|
36
|
-
cocoapods-downloader (0.9.3)
|
37
|
-
cocoapods-plugins (0.4.2)
|
38
|
-
nap
|
39
|
-
cocoapods-search (0.1.0)
|
40
|
-
cocoapods-stats (0.6.2)
|
41
|
-
cocoapods-trunk (0.6.4)
|
42
|
-
nap (>= 0.8, < 2.0)
|
43
|
-
netrc (= 0.7.8)
|
44
|
-
cocoapods-try (0.5.1)
|
45
|
-
colored (1.2)
|
46
|
-
escape (0.0.4)
|
47
|
-
fuzzy_match (2.0.4)
|
48
|
-
i18n (0.7.0)
|
49
|
-
json (1.8.3)
|
50
|
-
metaclass (0.0.4)
|
51
|
-
minitest (5.8.4)
|
52
|
-
mocha (1.1.0)
|
53
|
-
metaclass (~> 0.0.1)
|
54
|
-
mocha-on-bacon (0.2.2)
|
55
|
-
mocha (>= 0.13.0)
|
56
|
-
molinillo (0.4.2)
|
57
|
-
nap (1.1.0)
|
58
|
-
netrc (0.7.8)
|
59
|
-
prettybacon (0.0.2)
|
60
|
-
bacon (~> 1.2)
|
61
|
-
rake (10.5.0)
|
62
|
-
thread_safe (0.3.5)
|
63
|
-
tzinfo (1.2.2)
|
64
|
-
thread_safe (~> 0.1)
|
65
|
-
xcodeproj (0.28.2)
|
66
|
-
activesupport (>= 3)
|
67
|
-
claide (~> 0.9.1)
|
68
|
-
colored (~> 1.2)
|
69
|
-
|
70
|
-
PLATFORMS
|
71
|
-
ruby
|
72
|
-
|
73
|
-
DEPENDENCIES
|
74
|
-
bacon
|
75
|
-
bundler (~> 1.3)
|
76
|
-
cocoapods
|
77
|
-
cocoapods-playgrounds!
|
78
|
-
mocha
|
79
|
-
mocha-on-bacon
|
80
|
-
prettybacon
|
81
|
-
rake
|
82
|
-
|
83
|
-
BUNDLED WITH
|
84
|
-
1.11.2
|