Class: Fastlane::Actions::BlackberryMamVersionAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/blackberry_mam/actions/blackberry_mam_version_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



43
44
45
# File 'lib/fastlane/plugin/blackberry_mam/actions/blackberry_mam_version_action.rb', line 43

def self.authors
  ["lyndsey-ferguson/ldferguson"]
end

.descriptionObject



39
40
41
# File 'lib/fastlane/plugin/blackberry_mam/actions/blackberry_mam_version_action.rb', line 39

def self.description
  "Checks the version of the installed Good framework"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/fastlane/plugin/blackberry_mam/actions/blackberry_mam_version_action.rb', line 47

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fastlane/plugin/blackberry_mam/actions/blackberry_mam_version_action.rb', line 7

def self.run(params)
  selected_xcode_dev_dirpath = sh(
    'xcode-select --print-path',
    print_command: false,
    print_command_output: false
  ).strip

  selected_xcode_frameworks_path = File.join(
    selected_xcode_dev_dirpath,
    'Platforms',
    'iPhoneOS.platform',
    'Developer',
    'SDKs',
    'iPhoneOS.sdk',
    'System',
    'Library',
    'Frameworks'
  )

  good_framework_path = File.join(selected_xcode_frameworks_path, 'GD.framework')
  unless Dir.exist?(good_framework_path)
    Actions.lane_context[SharedValues::BLACKBERRY_MAM_VERSION_ACTION_VERSION_NUMBER] = "0"
    UI.user_error!("The Good framework is not installed")
    return
  end
  good_version_filepath = File.join(good_framework_path, 'version')
  good_version_filecontents = File.read(good_version_filepath)
  good_version = /version:\s+([\.0-9]+)/.match(good_version_filecontents)[1]

  Actions.lane_context[SharedValues::BLACKBERRY_MAM_VERSION_ACTION_VERSION_NUMBER] = good_version
end