Class: FlutterRb::PluginGradleVersionCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/flutter_rb/checks/plugin_gradle_check.rb

Overview

This class represents a check for validating the version of the plugin in the Gradle project configuration.

Constant Summary

Constants inherited from Check

Check::UNIMPLEMENTED_ERROR

Instance Method Summary collapse

Instance Method Details

#check(project) ⇒ CheckReport

Performs the check on the given project.

Parameters:

  • project (Project)

    The project to perform the check on.

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 65

def check(project)
  # Get the version of the plugin from the pubspec file.
  version_in_pubspec = project.pubspec.pubspec_info.version

  # Get the Gradle configuration file.
  gradle = project.android_folder.gradle

  # Get the version of the plugin from the Gradle build file.
  version_in_gradle = gradle.version

  # Create a check report based on the result.
  CheckReport.new(
    name,
    version_in_pubspec == version_in_gradle ? ::CheckReportStatus::NORMAL : ::CheckReportStatus::WARNING,
    description,
    gradle.path
  )
end

#descriptionString

Returns the description of the check.

Returns:

  • (String)

    The description of the check.



57
58
59
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 57

def description
  'Check plugin version in Gradle project config (build.gradle file)'
end

#nameString

Returns the name of the check.

Returns:

  • (String)

    The name of the check.



50
51
52
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 50

def name
  'PluginGradleVersionCheck'
end