podspec 0.1.0dev
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +38 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +29 -0
- data/LICENSE +21 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/bin/podspec +5 -0
- data/lib/podspec.rb +4 -0
- data/lib/podspec/cli.rb +56 -0
- data/lib/podspec/parse.rb +118 -0
- data/lib/podspec/version.rb +6 -0
- data/lib/podspec/write.rb +78 -0
- data/podspec.gemspec +23 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f079f055a3e35f6596b409a485052f5cca48ff3a
|
4
|
+
data.tar.gz: 24278aeb062238789561d1604c783cae8863ada5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7beb7ea557a17b7527745584478fc77d6b8dbcd0e45f8654cbd46386b4f512dbda39fdc0ebc4f789814089011bda852d76474979426c9396fd081f9595a41b65
|
7
|
+
data.tar.gz: 7c62bb78d367046d3b9964151b1452e8b68dc17b9b1a1c790aef26b0aa5da169ade0615d482384ea2063d1aa8674bcc5163a816b1cabf304ad6d57f8d7b299a6
|
data/.gitignore
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
37
|
+
|
38
|
+
*.podspec
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
podspec (0.1.0)
|
5
|
+
netrc
|
6
|
+
octokit (~> 4.2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.8)
|
12
|
+
faraday (0.9.2)
|
13
|
+
multipart-post (>= 1.2, < 3)
|
14
|
+
multipart-post (2.0.0)
|
15
|
+
netrc (0.11.0)
|
16
|
+
octokit (4.2.0)
|
17
|
+
sawyer (~> 0.6.0, >= 0.5.3)
|
18
|
+
sawyer (0.6.0)
|
19
|
+
addressable (~> 2.3.5)
|
20
|
+
faraday (~> 0.8, < 0.10)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
podspec!
|
27
|
+
|
28
|
+
BUNDLED WITH
|
29
|
+
1.10.6
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016
|
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
@@ -0,0 +1,77 @@
|
|
1
|
+
# Podspec
|
2
|
+
|
3
|
+
Effortlessly create a [CocoaPods Podspec](https://guides.cocoapods.org/making/specs-and-specs-repo.html).
|
4
|
+
|
5
|
+
![](http://i.giphy.com/rsQu1BC0BF8wo.gif)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```shell
|
10
|
+
$ git clone https://github.com/dkhamsing/podspec.git
|
11
|
+
$ cd podspec/
|
12
|
+
$ rake install
|
13
|
+
```
|
14
|
+
|
15
|
+
This project requires GitHub credentials in [.netrc](https://github.com/octokit/octokit.rb#using-a-netrc-file).
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```shell
|
20
|
+
$ podspec postmates/PMJSON
|
21
|
+
podspec 0.1.0
|
22
|
+
Generating Podspec for postmates/PMJSON...
|
23
|
+
Wrote PMJSON.podspec in 3s ✨
|
24
|
+
```
|
25
|
+
|
26
|
+
### Sample Output
|
27
|
+
|
28
|
+
`PMJSON.podspec`
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Pod::Spec.new do |s|
|
32
|
+
s.name = "PMJSON"
|
33
|
+
s.version = "0.9"
|
34
|
+
s.summary = "Pure Swift JSON encoding/decoding library"
|
35
|
+
s.description = "PMJSON provides a pure-Swift strongly-typed JSON encoder/decoder as well as a set of convenience methods for converting to/from Foundation objects and for decoding JSON structures."
|
36
|
+
|
37
|
+
s.homepage = "https://github.com/postmates/PMJSON"
|
38
|
+
|
39
|
+
s.license = "Apache License 2.0"
|
40
|
+
|
41
|
+
s.author = "Postmates Inc."
|
42
|
+
|
43
|
+
s.source = { :git => "https://github.com/postmates/PMJSON.git", :tag => "v0.9" }
|
44
|
+
|
45
|
+
s.source_files = "Sources/*",
|
46
|
+
|
47
|
+
s.ios.deployment_target = '9.0'
|
48
|
+
# s.osx.deployment_target = '10.9'
|
49
|
+
# s.watchos.deployment_target = '2.0'
|
50
|
+
# s.tvos.deployment_target = '9.0'
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
The Podspec created should get you started, make sure to consult the [Podspec syntax reference](https://guides.cocoapods.org/syntax/podspec.html).
|
55
|
+
|
56
|
+
### Validate the Podspec
|
57
|
+
|
58
|
+
```
|
59
|
+
$ pod spec lint PMJSON.podspec
|
60
|
+
|
61
|
+
-> PMJSON (0.9)
|
62
|
+
|
63
|
+
Analyzed 1 podspec.
|
64
|
+
|
65
|
+
PMJSON.podspec passed validation.
|
66
|
+
```
|
67
|
+
|
68
|
+
😎
|
69
|
+
|
70
|
+
## Contact
|
71
|
+
|
72
|
+
- [github.com/dkhamsing](https://github.com/dkhamsing)
|
73
|
+
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
This project is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/podspec
ADDED
data/lib/podspec.rb
ADDED
data/lib/podspec/cli.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Command line interface
|
2
|
+
module Podspec
|
3
|
+
require 'podspec/version'
|
4
|
+
require 'podspec/parse'
|
5
|
+
require 'podspec/write'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def usage
|
10
|
+
puts "Usage: #{PRODUCT} <GitHub Repo>\n i.e. #{PRODUCT} postmates/PMJSON"
|
11
|
+
end
|
12
|
+
|
13
|
+
def cli
|
14
|
+
elapsed_time_start = Time.now
|
15
|
+
|
16
|
+
puts "#{PRODUCT} #{VERSION}"
|
17
|
+
|
18
|
+
if ARGV.count == 0
|
19
|
+
usage
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
repo = ARGV[0].sub('https://github.com/', '')
|
24
|
+
|
25
|
+
unless repo.include? '/'
|
26
|
+
usage
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
parsed = parse repo
|
31
|
+
|
32
|
+
e = parsed['error']
|
33
|
+
unless e.nil?
|
34
|
+
puts "Error: #{e}"
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
|
38
|
+
w = parsed['warnings']
|
39
|
+
w.each do |x|
|
40
|
+
puts "Warning: #{x}"
|
41
|
+
end
|
42
|
+
|
43
|
+
p = write_podspec parsed
|
44
|
+
elapsed_seconds = Time.now - elapsed_time_start
|
45
|
+
|
46
|
+
puts "Wrote #{p} in #{elapsed_seconds.round}s ✨"
|
47
|
+
|
48
|
+
puts %{
|
49
|
+
• You can use an alternative author / authors format
|
50
|
+
• The deployment target(s) should be edited manually
|
51
|
+
Details → https://guides.cocoapods.org/syntax/podspec.html
|
52
|
+
}
|
53
|
+
end # cli
|
54
|
+
|
55
|
+
end # class
|
56
|
+
end # module
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Parse GitHub repository into spec values
|
2
|
+
module Podspec
|
3
|
+
class << self
|
4
|
+
require 'octokit'
|
5
|
+
require 'netrc'
|
6
|
+
|
7
|
+
SOURCE_FILES = [
|
8
|
+
'Sources'
|
9
|
+
]
|
10
|
+
|
11
|
+
def parse(repo)
|
12
|
+
puts "Generating Podspec for #{repo}..."
|
13
|
+
|
14
|
+
begin
|
15
|
+
c = Octokit::Client.new(netrc: true)
|
16
|
+
rescue => e
|
17
|
+
return {
|
18
|
+
'error' => e
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
begin
|
23
|
+
r = c.repo(repo, :accept => 'application/vnd.github.drax-preview+json')
|
24
|
+
|
25
|
+
lang = r['language']
|
26
|
+
unless (lang == 'Swift') || (lang == 'Objective-C')
|
27
|
+
return {
|
28
|
+
'error' => "#{lang} is not supported"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
name = r['name']
|
33
|
+
summary = r['description']
|
34
|
+
|
35
|
+
begin
|
36
|
+
t = c.tags(repo)[0]
|
37
|
+
rescue => e
|
38
|
+
return {
|
39
|
+
'error' => e
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
return {
|
44
|
+
'error' => 'No tags'
|
45
|
+
} if c.tags(repo).count == 0
|
46
|
+
|
47
|
+
begin
|
48
|
+
license = r['license']['name']
|
49
|
+
rescue
|
50
|
+
license = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
begin
|
54
|
+
tag = t['name']
|
55
|
+
version = tag.gsub(/[a-zA-Z]/, '')
|
56
|
+
rescue
|
57
|
+
tag = nil
|
58
|
+
version = nil;
|
59
|
+
end
|
60
|
+
|
61
|
+
contents = c.contents repo
|
62
|
+
folders = contents.select { |x| x['type']=='dir'}.map { |f| f['name'] }
|
63
|
+
|
64
|
+
source_files = SOURCE_FILES
|
65
|
+
source_files.push name
|
66
|
+
intersect = source_files & folders
|
67
|
+
source_folder = intersect.count == 0 ? nil : intersect[0]
|
68
|
+
|
69
|
+
warnings = []
|
70
|
+
warnings.push 'No sources found' if source_folder.nil?
|
71
|
+
|
72
|
+
contents.select { |x| x['type']=='file'}
|
73
|
+
.map { |f| f['name'] }
|
74
|
+
.each do |x|
|
75
|
+
warnings.push "A Podspec already exists for #{repo}" if x.include? 'podspec'
|
76
|
+
end
|
77
|
+
|
78
|
+
html_url = r['html_url']
|
79
|
+
homepage = r['homepage']
|
80
|
+
|
81
|
+
username = r['owner']['login']
|
82
|
+
u = c.user username
|
83
|
+
author = u['name']
|
84
|
+
|
85
|
+
git = r['git_url']
|
86
|
+
|
87
|
+
begin
|
88
|
+
re = c.readme repo
|
89
|
+
content = re['content']
|
90
|
+
readme = Base64.decode64 content unless content.nil?
|
91
|
+
rescue => e
|
92
|
+
readme = nil
|
93
|
+
end
|
94
|
+
|
95
|
+
return {
|
96
|
+
'error' => nil,
|
97
|
+
'name' => name,
|
98
|
+
'summary' => summary,
|
99
|
+
'license' => license,
|
100
|
+
'git' => git,
|
101
|
+
'tag' => tag,
|
102
|
+
'version' => version,
|
103
|
+
'author' => author,
|
104
|
+
'source_folder' => source_folder,
|
105
|
+
'html_url' => html_url,
|
106
|
+
'homepage' => homepage,
|
107
|
+
'readme' => readme,
|
108
|
+
'warnings' => warnings
|
109
|
+
}
|
110
|
+
rescue => e
|
111
|
+
return {
|
112
|
+
'error' => e
|
113
|
+
}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
end # class
|
118
|
+
end # module
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Write Podspec file
|
2
|
+
module Podspec
|
3
|
+
class << self
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
DESC = "# s.description = \"A description of the Pod more detailed than the summary.\""
|
7
|
+
IOS = '8.0'
|
8
|
+
|
9
|
+
def write_podspec(s)
|
10
|
+
name = s['name']
|
11
|
+
|
12
|
+
homepage = s['homepage ']
|
13
|
+
homepage = s['html_url'] if homepage.nil?
|
14
|
+
|
15
|
+
git = s['git'].sub('git://', 'https://')
|
16
|
+
|
17
|
+
description = DESC
|
18
|
+
|
19
|
+
summary = "\"#{s['summary']}\""
|
20
|
+
|
21
|
+
readme = s['readme']
|
22
|
+
num_lines = 1
|
23
|
+
description = if readme.nil?
|
24
|
+
DESC
|
25
|
+
else
|
26
|
+
lines = readme.split "\n"
|
27
|
+
d = []
|
28
|
+
lines[1..-1].each do |l|
|
29
|
+
unless (l.include? '==') || (l.include? '[') || (l.include? '#') || (l.include? '<')
|
30
|
+
d.push l if l.length > 0
|
31
|
+
end
|
32
|
+
# puts d.count
|
33
|
+
break if d.count == num_lines
|
34
|
+
end
|
35
|
+
|
36
|
+
d = "\"#{d[0]}\""
|
37
|
+
|
38
|
+
if d == summary
|
39
|
+
DESC
|
40
|
+
else
|
41
|
+
"s.description = #{d}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
source_files = "#{s['source_folder']}/*.{h,m,swift}"
|
46
|
+
|
47
|
+
spec =
|
48
|
+
%{Pod::Spec.new do |s|
|
49
|
+
s.name = "#{name}"
|
50
|
+
s.version = "#{s['version']}"
|
51
|
+
s.summary = #{summary}
|
52
|
+
#{description}
|
53
|
+
|
54
|
+
s.homepage = "#{homepage}"
|
55
|
+
|
56
|
+
s.license = "#{s['license']}"
|
57
|
+
|
58
|
+
s.author = "#{s['author']}"
|
59
|
+
|
60
|
+
s.source = { :git => "#{git}", :tag => "#{s['tag']}" }
|
61
|
+
|
62
|
+
s.source_files = "#{source_files}",
|
63
|
+
|
64
|
+
s.ios.deployment_target = "#{IOS}"
|
65
|
+
# s.osx.deployment_target = "10.9"
|
66
|
+
# s.watchos.deployment_target = "2.0"
|
67
|
+
# s.tvos.deployment_target = "9.0"
|
68
|
+
end
|
69
|
+
}
|
70
|
+
|
71
|
+
filename = "#{name}.podspec"
|
72
|
+
File.open(filename, 'w') { |f| f.write(spec) }
|
73
|
+
|
74
|
+
return filename
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
data/podspec.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'podspec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = Podspec::PRODUCT
|
8
|
+
spec.version = Podspec::VERSION
|
9
|
+
spec.authors = ["dkhamsing"]
|
10
|
+
spec.email = ["dkhamsing8@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Effortlessly create a CocoaPods Podspec.'
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = 'https://github.com/dkhamsing/podspec'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'bin'
|
18
|
+
spec.executables = [Podspec::PRODUCT]
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'octokit', '~> 4.2.0' # github
|
22
|
+
spec.add_dependency 'netrc', '~> 0.11.0' # credentials
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: podspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0dev
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- dkhamsing
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: netrc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.11.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.11.0
|
41
|
+
description: Effortlessly create a CocoaPods Podspec.
|
42
|
+
email:
|
43
|
+
- dkhamsing8@gmail.com
|
44
|
+
executables:
|
45
|
+
- podspec
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/podspec
|
56
|
+
- lib/podspec.rb
|
57
|
+
- lib/podspec/cli.rb
|
58
|
+
- lib/podspec/parse.rb
|
59
|
+
- lib/podspec/version.rb
|
60
|
+
- lib/podspec/write.rb
|
61
|
+
- podspec.gemspec
|
62
|
+
homepage: https://github.com/dkhamsing/podspec
|
63
|
+
licenses: []
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>'
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.3.1
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.0.14
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Effortlessly create a CocoaPods Podspec.
|
85
|
+
test_files: []
|