Skip to content

Commit d1dd0ca

Browse files
committed
feat: add CocoaPods support
1 parent 541cf4d commit d1dd0ca

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

Helpers/ValidatableKit.podspec

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'json'
2+
3+
Pod::Spec.new do |s|
4+
s.name = 'ValidatableKit'
5+
s.module_name = s.name
6+
7+
require_relative 'spec'
8+
s.extend ValidatableKit::Spec
9+
s.common_spec
10+
s.file_spec
11+
end

Helpers/spec.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require 'json'
2+
3+
module ValidatableKit
4+
module Spec
5+
def common_spec
6+
package = JSON.parse(File.read('package.json'), {object_class: OpenStruct})
7+
8+
self.version = package.version.to_s
9+
self.homepage = package.homepage
10+
self.summary = package.summary
11+
self.description = package.description
12+
self.license = { :type => package.license, :file => 'LICENSE' }
13+
self.social_media_url = package.author.url
14+
self.readme = "#{self.homepage}/blob/main/README.md"
15+
self.changelog = "#{self.homepage}/blob/main/CHANGELOG.md"
16+
17+
self.source = {
18+
package.repository.type.to_sym => package.repository.url,
19+
:tag => "v#{self.version}"
20+
}
21+
22+
self.authors = {
23+
package.author.name => package.author.email
24+
}
25+
26+
self.swift_version = '5.0'
27+
self.ios.deployment_target = '8.0'
28+
self.macos.deployment_target = '10.10'
29+
self.tvos.deployment_target = '9.0'
30+
self.watchos.deployment_target = '2.0'
31+
self.osx.deployment_target = '10.10'
32+
end
33+
34+
def file_spec
35+
self.documentation_url = "https://swiftylab.github.io/ValidatableKit/#{self.version}/documentation/#{self.module_name.downcase}/"
36+
self.source_files = "Sources/#{self.module_name}/**/*.swift", "Sources/#{self.module_name}/*.docc"
37+
self.preserve_paths = "Sources/#{self.module_name}/**/*", "*.md"
38+
# @todo: Enable when CocoaPods starts supporting docc
39+
# s.source_files = "#{s.module_name}.docc"
40+
end
41+
end
42+
end

ValidatableKit.podspec

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'ValidatableKit'
3+
s.module_name = s.name
4+
5+
require_relative 'Helpers/spec'
6+
s.extend ValidatableKit::Spec
7+
s.common_spec
8+
s.file_spec
9+
10+
s.test_spec do |ts|
11+
ts.source_files = "Tests/#{s.module_name}Tests/**/*.swift"
12+
end
13+
end

0 commit comments

Comments
 (0)