1
2module Expo
3
4  class PackagePod
5
6    # Name of the pod
7    attr_reader :pod_name
8
9    # The directory where the podspec is
10    attr_reader :podspec_dir
11
12    def initialize(json)
13      @pod_name = json['podName']
14      @podspec_dir = json['podspecDir']
15    end
16
17  end # class PackagePod
18
19  class Package
20
21    # Name of the npm package
22    attr_reader :name
23
24    # Version of the npm package
25    attr_reader :version
26
27    # An array of pods found in the package
28    attr_reader :pods
29
30    # Flags to pass to the pod definition
31    attr_reader :flags
32
33    # Class names of the modules that need to be included in the generated modules provider.
34    attr_reader :modules
35
36    # Whether this module should only be added to the debug configuration.
37    attr_reader :debugOnly
38
39    def initialize(json)
40      @name = json['packageName']
41      @version = json['packageVersion']
42      @pods = json['pods'].map { |pod| PackagePod.new(pod) }
43      @flags = json.fetch('flags', {})
44      @modules = json.fetch('modules', [])
45      @debugOnly = json['debugOnly']
46    end
47
48    def has_swift_modules_to_link?
49      return !@modules.empty?
50    end
51
52  end # class Package
53
54end # module Expo
55