Class: Fastlane::Helper::FrameworkHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb

Class Method Summary collapse

Class Method Details

.is_expo?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb', line 15

def self.is_expo?
  return false unless File.exist?('package.json')

  package_contents = read_package_json
  package_contents&.dig('dependencies')&.dig('expo') ? true : false
end

.is_flutter?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb', line 22

def self.is_flutter?
  return false unless File.exist?('pubspec.yaml')
  return false unless Dir.exist?('lib') && (Dir.exist?('android') || Dir.exist?('ios'))

  pubspec_content = read_pubspec_yaml
  pubspec_content&.dig('dependencies')&.dig('flutter')&.dig('sdk') == 'flutter'
end

.is_react_native?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
# File 'lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb', line 7

def self.is_react_native?
  return false unless File.exist?('package.json')
  return false unless Dir.exist?('android') && Dir.exist?('ios')

  package_contents = read_package_json
  package_contents&.dig('dependencies')&.dig('react-native') ? true : false
end

.read_package_jsonObject



30
31
32
33
34
# File 'lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb', line 30

def self.read_package_json
  JSON.parse(File.read('package.json'))
rescue StandardError
  {}
end

.read_pubspec_yamlObject



36
37
38
39
40
# File 'lib/fastlane/plugin/ravn_mobile/helper/framework_helper.rb', line 36

def self.read_pubspec_yaml
  Psych.load_file('pubspec.yaml')
rescue StandardError
  {}
end