Class: Fastlane::Actions::ReadVersionAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



37
38
39
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 37

def self.authors
  ["Ibrahim AshShohail"]
end

.available_optionsObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 52

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :pubspec,
      env_name: 'PUBSPEC',
      description: 'The path of pubspec.yml file',
      optional: true,
      type: String,
      default_value: './pubspec.yaml'
    ),
  ]
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 33

def self.description
  "Version manager"
end

.detailsObject



48
49
50
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 48

def self.details
  "Version manager"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 65

def self.is_supported?(platform)
  true
end

.return_valueObject



41
42
43
44
45
46
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 41

def self.return_value
  [
    ['VERSION_NUMBER', 'The version number'],
    ['BUILD_NUMBER', 'The build number'],
  ]
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
# File 'lib/fastlane/plugin/version_manager/actions/read_version_action.rb', line 7

def self.run(params)
  pubspec_file = params[:pubspec]

  begin
    pubspec = YAML.load_file(pubspec_file)
  # rubocop:disable Style/RescueStandardError
  rescue
    raise 'Failed to read pubspec.yaml'
  end

  v = SemVersion.new(pubspec['version'])

  UI.message('Version is: '.dup.concat(v.to_s))

  version_number = Helper::VersionManagerHelper.version(v)
  build_number = v.

  UI.message('The version is: '.dup.concat(version_number))
  UI.message('The build number is: '.dup.concat(build_number))

  {
    'version_number' => version_number,
    'build_number' => build_number
  }
end