Class: Fastlane::Actions::GsSaveRcVersionAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



20
21
22
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 20

def self.authors
  ["SAVeselovskiy"]
end

.available_optionsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 33

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "GS_VERSIONS_FILE_PATH",
                                 description: "path to versions file",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "GS_APP_VERSION",
                                 description: "App version",
                                 optional: false,
                                 type: Version),
    FastlaneCore::ConfigItem.new(key: :project_name,
                                 env_name: "ALIAS",
                                 description: "project name for versions file access",
                                 optional: false,
                                 type: String)
  ]
end

.descriptionObject



16
17
18
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 16

def self.description
  "Plugin for GradoService versioning system"
end

.detailsObject



28
29
30
31
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 28

def self.details
  # Optional:
  "Plugin for GradoService versioning system"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
56
57
58
59
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 53

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



24
25
26
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 24

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb', line 4

def self.run(params)
  require 'json'
  jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
  UI.message(jsonstr)
  json = JSON.parse(jsonstr)
  res = params[:version].toString
  UI.message("New relese_candidate version " + res)
  json[params[:project_name]]["rc"] = res
  FileHelper.write(params[:path], json.to_json)
  GSVersionApiProvider.updateVersions(params[:project_name])
end