Class: Fastlane::Actions::EnsureNoDebugCodeAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::EnsureNoDebugCodeAction
- Defined in:
- lib/fastlane/actions/ensure_no_debug_code.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, sh, step_text
Class Method Details
.authors ⇒ Object
73 74 75 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 73 def self. ["KrauseFx"] end |
.available_options ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 47 def self. [ FastlaneCore::ConfigItem.new(key: :text, env_name: "FL_ENSURE_NO_DEBUG_CODE_TEXT", description: "The text that must not be in the code base"), FastlaneCore::ConfigItem.new(key: :path, env_name: "FL_ENSURE_NO_DEBUG_CODE_PATH", description: "The directory containing all the source files", default_value: ".", verify_block: Proc.new do |value| raise "Couldn't find the folder at '#{File.absolute_path(value)}'".red unless File.directory?(value) end), FastlaneCore::ConfigItem.new(key: :extension, env_name: "FL_ENSURE_NO_DEBUG_CODE_EXTENSION", description: "The extension that should be searched for", optional: true, verify_block: Proc.new do |value| value.gsub!(".", "") if value.include?"." end), ] end |
.description ⇒ Object
35 36 37 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 35 def self.description "Ensures the given text is nowhere in the code base" end |
.details ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 39 def self.details [ "Makes sure the given text is nowhere in the code base. This can be used", "to check if there is any debug code still in your code base or if you have", "things like // TO DO or similar" ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
77 78 79 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 77 def self.is_supported?(platform) true end |
.output ⇒ Object
69 70 71 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 69 def self.output [] end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fastlane/actions/ensure_no_debug_code.rb', line 4 def self.run(params) command = "grep -R '#{params[:text]}' '#{File.absolute_path(params[:path])}'" return command if Helper.is_test? Helper.log.info command.yellow results = `#{command}` # we don't use `sh` as the return code of grep is wrong for some reason # Example Output # ./fastlane.gemspec: spec.add_development_dependency 'my_word' # ./Gemfile.lock: my_word (0.10.1) found = [] results.split("\n").each do |current_raw| current = current_raw.strip if params[:extension] if current.include?".#{params[:extension]}:" found << current end else found << current end end raise "Found debug code '#{params[:text]}': \n\n#{found.join("\n")}" if found.count > 0 Helper.log.info "No debug code found in code base 🐛" end |