podspec 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b798322ce45c6e44cfafe969d3649fea023deb1e
4
- data.tar.gz: 2fd359c2adcea780866160461bab3ce488bdbec6
3
+ metadata.gz: 92a9ea57345b232966bd7ab96b5cfdfd9ee97788
4
+ data.tar.gz: 2076e0d82079e3dcd3b65acbef7c56a4b1f07707
5
5
  SHA512:
6
- metadata.gz: f02586759c08c70d272fd583fd024c5046ff22522b9a7be2482652f23e60111e5fdea7a4f0e0d7c9e2afc658d8273076903220645bf23a0e68ce07349f2711aa
7
- data.tar.gz: 239c9ed705e3c0c58c88669ff5513b2b920ae26f1dfcde3afb21df8dfd06e675811f6b1868690854c7341c40041ae6631612ef000362019108415c44750868be
6
+ metadata.gz: f11f1f63bc7367a0fc8ec99887eaeb4a133eaf82da1d83534951022b8d06dc0708ae760d980afa2efaf55932b94b400b0a1cf17bd922f5b5777f770b5814d386
7
+ data.tar.gz: c96c095288f9f1c95ce356659be45d8c3821304c5710dc9c844ca10ff9d4b2f8e815e63c2142099d3bb307c573786b167d25840f4575972829c3767ec5ba3eb4
@@ -6,7 +6,8 @@ install:
6
6
  script:
7
7
  - bundle exec podspec
8
8
  - gem install podspec --pre
9
+ - rspec -fd
9
10
  after_script:
10
- - bundle exec podspec postmates/PMJSON
11
+ - podspec postmates/PMJSON
11
12
  - cat PMJSON.podspec
12
- - pod spec lint PMJSON.podspec --verbose
13
+ - pod spec lint PMJSON.podspec
@@ -1,10 +1,14 @@
1
- # Podspec
1
+ # Podspec changelog
2
2
 
3
- ## 0.1.1
3
+ ## 0.2.0
4
4
 
5
- - [gemspec] set `github-readme` version
5
+ - [parse] use semver to get latest tag
6
+ - [podspec] refactor, isolate, rspec tests
7
+ - [podspec] escape double quote for `license`, `summary`, `description`
8
+ - [podspec] fix logic for description
9
+ - [podspec] fix logic for homepage
6
10
 
7
- ## 0.1.0
11
+ ## 0.1.1
8
12
 
9
13
  - [gemspec] use `github-readme`
10
14
  - [gemspec] remove `netrc` dependency
data/README.md CHANGED
@@ -9,16 +9,13 @@ Effortlessly create a [CocoaPods Podspec](https://guides.cocoapods.org/making/sp
9
9
  ## Installation
10
10
 
11
11
  ```shell
12
- $ git clone https://github.com/dkhamsing/podspec.git
13
- $ cd podspec/
14
- $ bundle install
12
+ $ gem install podspec --pre
15
13
  ```
16
14
 
17
15
  ## Usage
18
16
 
19
17
  ```shell
20
- $ bundle exec podspec postmates/PMJSON
21
- podspec 0.1.0
18
+ $ podspec postmates/PMJSON
22
19
  Generating Podspec for postmates/PMJSON...
23
20
  Wrote PMJSON.podspec in 3s ✨
24
21
  ```
@@ -65,7 +62,13 @@ Analyzed 1 podspec.
65
62
  PMJSON.podspec passed validation.
66
63
  ```
67
64
 
68
- :coffee:
65
+ :coffee:
66
+
67
+ ## Examples
68
+
69
+ - https://github.com/storehouse/Advance/pull/3
70
+ - https://github.com/postmates/PMJSON/pull/3
71
+ - https://github.com/dkhamsing/TwitterSafariViewControllerAuth
69
72
 
70
73
  ## Contact
71
74
 
@@ -1,8 +1,8 @@
1
1
  # Command line interface
2
- module Podspec
3
- require 'podspec/version'
2
+ module Podspec
4
3
  require 'podspec/parse'
5
- require 'podspec/write'
4
+ require 'podspec/spec'
5
+ require 'podspec/version'
6
6
 
7
7
  class << self
8
8
 
@@ -40,10 +40,13 @@ module Podspec
40
40
  puts "Warning: #{x}"
41
41
  end
42
42
 
43
- p = write_podspec parsed
43
+ s = create_spec parsed
44
+
45
+ filename = "#{parsed['name']}.podspec"
46
+ File.open(filename, 'w') { |f| f.write(s) }
44
47
  elapsed_seconds = Time.now - elapsed_time_start
45
48
 
46
- puts "Wrote #{p} in #{elapsed_seconds.round}s ✨"
49
+ puts "Wrote #{filename} in #{elapsed_seconds.round}s ✨"
47
50
 
48
51
  puts %{
49
52
  • You can use an alternative author / authors format
@@ -7,6 +7,10 @@ module Podspec
7
7
  'Sources'
8
8
  ]
9
9
 
10
+ def tag(name)
11
+ name.gsub(/[A-z]/, '').gsub('-','')
12
+ end
13
+
10
14
  def parse(repo)
11
15
  puts "Generating Podspec for #{repo}..."
12
16
 
@@ -32,13 +36,19 @@ module Podspec
32
36
  summary = r['description']
33
37
 
34
38
  begin
35
- t = c.tags(repo)[0]
39
+ tags = c.tags(repo)
36
40
  rescue => e
37
41
  return {
38
42
  'error' => e
39
43
  }
40
44
  end
41
45
 
46
+ t = tags.sort do |a,b|
47
+ v1 = tag a['name']
48
+ v2 = tag b['name']
49
+ Gem::Version.new(v2) <=> Gem::Version.new(v1)
50
+ end[0]
51
+
42
52
  return {
43
53
  'error' => 'No tags'
44
54
  } if c.tags(repo).count == 0
@@ -0,0 +1,116 @@
1
+ # Create spec
2
+ module Podspec
3
+ class << self
4
+
5
+ DESC = "# s.description = \"A description of the Pod more detailed than the summary.\""
6
+ IOS = '8.0'
7
+ OSX = '10.9'
8
+ WATCHOS = '2.0'
9
+ TVOS = '9.0'
10
+
11
+ def description(d, s)
12
+ description = DESC
13
+
14
+ if d.nil?
15
+ description = DESC
16
+ else
17
+ description =
18
+ if d == s
19
+ DESC
20
+ else
21
+ "s.description = \"#{escape d}\""
22
+ end
23
+ end
24
+
25
+ description
26
+ end
27
+
28
+ def escape(s)
29
+ return '' if s.nil?
30
+ s.gsub('"', '\"')
31
+ end
32
+
33
+ def format(options)
34
+ name = options['name']
35
+ version = options['version']
36
+ summary = options['summary']
37
+ description = options['description']
38
+ homepage = options['homepage']
39
+ license = options['license']
40
+ author = options['author']
41
+ source = options['source']
42
+ source_files = options['source_files']
43
+ ios = options['ios']
44
+ osx = options['osx']
45
+ watchos = options['watchos']
46
+ tvos = options['tvos']
47
+
48
+ %{Pod::Spec.new do |s|
49
+ s.name = "#{name}"
50
+ s.version = "#{version}"
51
+ s.summary = "#{summary}"
52
+ #{description}
53
+
54
+ s.homepage = "#{homepage}"
55
+
56
+ s.license = "#{license}"
57
+
58
+ s.author = "#{author}"
59
+
60
+ s.source = #{source}
61
+
62
+ s.source_files = "#{source_files}"
63
+
64
+ s.ios.deployment_target = "#{ios}"
65
+ # s.osx.deployment_target = "#{osx}"
66
+ # s.watchos.deployment_target = "#{watchos}"
67
+ # s.tvos.deployment_target = "#{tvos}"
68
+ end
69
+ }
70
+ end
71
+
72
+ def homepage(s)
73
+ homepage = s['homepage']
74
+ homepage = s['html_url'] if homepage.nil? || homepage==''
75
+ homepage
76
+ end
77
+
78
+ def source_files(s)
79
+ "#{s['source_folder']}/*.{h,m,swift}"
80
+ end
81
+
82
+ def make_options(s)
83
+ homepage = homepage s
84
+
85
+ git = s['git'].sub('git://', 'https://')
86
+
87
+ license = escape s['license']
88
+
89
+ source_files = source_files s
90
+
91
+ summary = s['summary']
92
+
93
+ {
94
+ 'name' => s['name'],
95
+ 'version' => s['version'],
96
+ 'summary' => escape(summary),
97
+ 'description' => description(s['description'], summary),
98
+ 'homepage' => homepage,
99
+ 'license' => escape(s['license']),
100
+ 'author' => s['author'],
101
+ 'source' => "{ :git => \"#{git}\", :tag => \"#{s['tag']}\" }",
102
+ 'source_files' => source_files,
103
+ 'ios' => IOS,
104
+ 'osx' => OSX,
105
+ 'watchos' => WATCHOS,
106
+ 'tvos' => TVOS
107
+ }
108
+ end
109
+
110
+ def create_spec(s)
111
+ options = make_options s
112
+ format options
113
+ end
114
+
115
+ end # class
116
+ end
@@ -1,6 +1,6 @@
1
1
  # Version, constants
2
2
  module Podspec
3
- VERSION = "0.1.1"
3
+ VERSION = '0.2.0'
4
4
 
5
5
  PRODUCT = 'podspec'
6
6
  end
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_runtime_dependency 'github-readme', '~> 0.1.0.pre'
23
+ spec.add_development_dependency 'rspec'
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dkhamsing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-readme
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.1.0.pre
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Effortlessly create a CocoaPods Podspec.
28
42
  email:
29
43
  - dkhamsing8@gmail.com
@@ -43,8 +57,8 @@ files:
43
57
  - lib/podspec.rb
44
58
  - lib/podspec/cli.rb
45
59
  - lib/podspec/parse.rb
60
+ - lib/podspec/spec.rb
46
61
  - lib/podspec/version.rb
47
- - lib/podspec/write.rb
48
62
  - podspec.gemspec
49
63
  homepage: https://github.com/dkhamsing/podspec
50
64
  licenses:
@@ -66,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
80
  version: '0'
67
81
  requirements: []
68
82
  rubyforge_project:
69
- rubygems_version: 2.0.14
83
+ rubygems_version: 2.0.14.1
70
84
  signing_key:
71
85
  specification_version: 4
72
86
  summary: Effortlessly create a CocoaPods Podspec.
@@ -1,66 +0,0 @@
1
- # Write Podspec file
2
- module Podspec
3
- class << self
4
- DESC = "# s.description = \"A description of the Pod more detailed than the summary.\""
5
- IOS = '8.0'
6
-
7
- def write_podspec(s)
8
- name = s['name']
9
-
10
- homepage = s['homepage ']
11
- homepage = s['html_url'] if homepage.nil?
12
-
13
- git = s['git'].sub('git://', 'https://')
14
-
15
- description = DESC
16
-
17
- summary = "\"#{s['summary']}\""
18
-
19
- readme = s['readme']
20
- d = s['description']
21
-
22
- if d.nil?
23
- description = DESC
24
- else
25
- description =
26
- if d == summary
27
- DESC
28
- else
29
- "s.description = \"#{d}\""
30
- end
31
- end
32
-
33
- source_files = "#{s['source_folder']}/*.{h,m,swift}"
34
-
35
- spec =
36
- %{Pod::Spec.new do |s|
37
- s.name = "#{name}"
38
- s.version = "#{s['version']}"
39
- s.summary = #{summary}
40
- #{description}
41
-
42
- s.homepage = "#{homepage}"
43
-
44
- s.license = "#{s['license']}"
45
-
46
- s.author = "#{s['author']}"
47
-
48
- s.source = { :git => "#{git}", :tag => "#{s['tag']}" }
49
-
50
- s.source_files = "#{source_files}"
51
-
52
- s.ios.deployment_target = "#{IOS}"
53
- # s.osx.deployment_target = "10.9"
54
- # s.watchos.deployment_target = "2.0"
55
- # s.tvos.deployment_target = "9.0"
56
- end
57
- }
58
-
59
- filename = "#{name}.podspec"
60
- File.open(filename, 'w') { |f| f.write(spec) }
61
-
62
- return filename
63
- end
64
-
65
- end
66
- end