Class: Capacitor::Lynx::Autolink
- Inherits:
-
Object
- Object
- Capacitor::Lynx::Autolink
- Defined in:
- lib/capacitor/lynx/autolink.rb
Class Method Summary collapse
-
.install!(podfile, options = {}) ⇒ Array<PluginInfo>
Declares every discovered Capacitor pod on the given Podfile.
-
.resolve(root, options = {}) ⇒ Hash
The pure half of install!, so callers (and tests) can inspect what would be declared without a Podfile.
Class Method Details
.install!(podfile, options = {}) ⇒ Array<PluginInfo>
Declares every discovered Capacitor pod on the given Podfile.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/capacitor/lynx/autolink.rb', line 45 def install!(podfile, = {}) root = File.([:root] || Dir.pwd) resolution = resolve(root, ) resolution[:skipped].each do |skipped| warn_once("[lynx-capacitor] skipping #{skipped.npm_name}: #{skipped.reason}") end resolution[:pods].each do |plugin| podfile.pod plugin.pod_name, :path => plugin.package_dir end resolution[:pods] end |
.resolve(root, options = {}) ⇒ Hash
The pure half of install!, so callers (and tests) can inspect what would be declared without a Podfile.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/capacitor/lynx/autolink.rb', line 63 def resolve(root, = {}) root = File.(root) packages = discover_packages(root) pods = [] skipped = [] if .fetch(:runtime, true) runtime = packages[RUNTIME_PACKAGE] if runtime pods.concat(runtime_pods(runtime)) else skipped << SkippedPackage.new( RUNTIME_PACKAGE, 'not installed; declare `pod \'Capacitor\'` yourself or pass :runtime => false' ) end end plugin_packages(packages, ).each do |npm_name, package_dir| podspec_path = find_podspec(package_dir) if podspec_path.nil? # @capacitor/motion is the standing example: published with a # `capacitor` key but no iOS implementation yet. skipped << SkippedPackage.new(npm_name, 'no iOS podspec in the package') next end pods << PluginInfo.new(npm_name, package_dir, real_path(package_dir), pod_name_from(podspec_path), podspec_path) end { :pods => dedupe(pods, skipped), :skipped => skipped } end |