Class: Fastlane::Actions::FlutterVersionManagerAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



206
207
208
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 206

def self.authors
  ["Davor Maric", "rubicon-world.com"]
end

.available_optionsObject



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 218

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :arguments,
      description: "Additional arguments",
      optional: true,
      type: String),
    FastlaneCore::ConfigItem.new(
      key: :yml,
      description: "Path to version.yml",
      optional: false,
      type: String),
    FastlaneCore::ConfigItem.new(
      key: :pubspec,
      description: "Path to pubspec.yaml",
      optional: false,
      type: String),
    FastlaneCore::ConfigItem.new(
      key: :git_repo,
      description: "Path to root folder of git repository",
      optional: true,
      type: String)
  ]
end

.descriptionObject



202
203
204
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 202

def self.description
  "Manages app versioning of a Flutter project."
end

.detailsObject



214
215
216
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 214

def self.details
  "App versioning tool for Flutter projects that can be plugged into pipeline via CI/CD"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


243
244
245
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 243

def self.is_supported?(platform)
  true
end

.return_valueObject



210
211
212
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 210

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

.run(params) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/fastlane/plugin/flutter_version_manager/actions/flutter_version_manager_action.rb', line 168

def self.run(params)
  version_path = params[:yml]
  pubspec_path = params[:pubspec]
  git_path = params[:git_repo] || './'
  args = (params[:arguments] || "").split(" ")

  # Paths valid, continue
  versionManager = VersionManager.new(version_path, pubspec_path, git_path)

  # Check if the user has passed additional arguments
  if(args.include?("-h") || args.include?("-version") || args.include?("-code") || args.include?("-major") || args.include?("-minor") || args.include?("-patch") || args.include?("-apply"))
    args.each { |a|
      case a
      when '-h'
        UI.message(ARGUMENT_MANAGER.commands)
      when "-version"
        UI.message(versionManager.get_current_version_name)
      when "-code"
        UI.message(versionManager.get_current_version_code)
      when "-major"
        versionManager.bump_major
      when "-minor"
        versionManager.bump_minor
      when "-patch"
        versionManager.bump_patch
      when "-apply"
        versionManager.update_pubspec
      end
    }
  else
    ARGUMENT_MANAGER.invalid_argument
  end
end