Class: FlutterRb::PluginGradleAndroidPackageCheck

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

Overview

This class represents a check for validating that the ‘android’ package does not exist 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:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 28

def check(project)
  # Get the Gradle configuration file.
  gradle = project.android_folder.gradle

  # Check if the 'package android' line exists in the build.gradle file.
  import_exist = File.readlines("#{gradle.path}/build.gradle").grep(/package android/).size.positive?

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

#descriptionString

Returns the description of the check.

Returns:

  • (String)

    The description of the check.



20
21
22
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 20

def description
  'Validate that \android\ package not exists in Gradle project config (build.gradle file)'
end

#nameString

Returns the name of the check.

Returns:

  • (String)

    The name of the check.



13
14
15
# File 'lib/flutter_rb/checks/plugin_gradle_check.rb', line 13

def name
  'PluginGradleAndroidPackageCheck'
end