From 2e61a9ae14c61b2f8021c24252ff96546cbde395 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 12 Jun 2020 06:23:34 +0200 Subject: [PATCH] chore(cli): read plugin podspec values from package.json (#3092) --- cli/src/tasks/new-plugin.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cli/src/tasks/new-plugin.ts b/cli/src/tasks/new-plugin.ts index b72062c964..071ed6800a 100644 --- a/cli/src/tasks/new-plugin.ts +++ b/cli/src/tasks/new-plugin.ts @@ -167,17 +167,22 @@ async function createIosPlugin(config: Config, pluginPath: string, domain: strin function generatePodspec(config: Config, answers: NewPluginAnswers) { return ` + require 'json' + + package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + Pod::Spec.new do |s| s.name = '${fixName(answers.name)}' - s.version = '0.0.1' - s.summary = '${answers.description}' - s.license = '${answers.license}' - s.homepage = '${answers.git}' - s.author = '${answers.author}' - s.source = { :git => '${answers.git}', :tag => s.version.to_s } + s.version = package['version'] + s.summary = package['description'] + s.license = package['license'] + s.homepage = package['repository']['url'] + s.author = package['author'] + s.source = { :git => package['repository']['url'], :tag => s.version.to_s } s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '${config.ios.minVersion}' s.dependency 'Capacitor' + s.swift_version = '5.0' end`; }