From 806449bfea8c1b003464536ab23b75053c62bc20 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Mon, 19 Feb 2018 10:46:27 -0800 Subject: [PATCH] Create Podspec in root of library directory and use package.json for Spec details --- templates/ios.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/templates/ios.js b/templates/ios.js index 1e32262..875de83 100644 --- a/templates/ios.js +++ b/templates/ios.js @@ -1,28 +1,30 @@ /* eslint max-len: 0 */ module.exports = platform => [{ - name: ({ name }) => `${platform}/${name}.podspec`, - content: ({ name }) => ` + name: ({ name }) => `${name}.podspec`, + content: ({ name }) => `require "json" + +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) + Pod::Spec.new do |s| s.name = "${name}" - s.version = "1.0.0" - s.summary = "${name}" + s.version = package["version"] + s.summary = package["description"] s.description = <<-DESC ${name} DESC - s.homepage = "" + s.homepage = "https://github.com/author/${name}" s.license = "MIT" - # s.license = { :type => "MIT", :file => "FILE_LICENSE" } - s.author = { "author" => "author@domain.cn" } + # s.license = { :type => "MIT", :file => "FILE_LICENSE" } + s.author = { "author" => "author@domain.cn" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/author/${name}.git", :tag => "master" } - s.source_files = "${name}/**/*.{h,m}" - s.requires_arc = true + s.source = { :git => "https://github.com/author/${name}.git", :tag => "#{s.version}" } + s.source_files = "ios/**/*.{h,m}" + s.requires_arc = true s.dependency "React" #s.dependency "others" - end `,