Class: Fastlane::Actions::GetGradlePropertyAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GetGradlePropertyAction
- Defined in:
- lib/fastlane/plugin/bowl/actions/get_gradle_property_action.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
48 49 50 |
# File 'lib/fastlane/plugin/bowl/actions/get_gradle_property_action.rb', line 48 def self. ["Benjamin Wulff"] end |
.available_options ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fastlane/plugin/bowl/actions/get_gradle_property_action.rb', line 34 def self. [ FastlaneCore::ConfigItem.new(key: :app_project_dir, env_name: "BOWL_APP_PROJECT_DIR", description: "The path to the application source folder in the Android project (default: android/app)", optional: true, type: String, default_value: "android/app"), FastlaneCore::ConfigItem.new(key: :key, description: "The property key", type: String) ] end |
.is_supported?(platform) ⇒ Boolean
52 53 54 |
# File 'lib/fastlane/plugin/bowl/actions/get_gradle_property_action.rb', line 52 def self.is_supported?(platform) platform == :android end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fastlane/plugin/bowl/actions/get_gradle_property_action.rb', line 9 def self.run(params) app_project_dir ||= params[:app_project_dir] regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<eql>=\s+)?(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/) value = "" found = false Dir.glob("#{app_project_dir}/build.gradle") do |path| begin File.open(path, 'r') do |file| file.each_line do |line| unless line.match(regex) and !found next end key, eql, left, value, right, comment = line.match(regex).captures break end file.close end end end return value end |