Class: Fastlane::Actions::ClocAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::ClocAction
- Defined in:
- fastlane/lib/fastlane/actions/cloc.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
62 63 64 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 62 def self. ["intere"] end |
.available_options ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 35 def self. [ FastlaneCore::ConfigItem.new(key: :binary_path, env_name: "FL_CLOC_BINARY_PATH", description: "Where the cloc binary lives on your system (full path including 'cloc')", optional: true, default_value: '/usr/local/bin/cloc'), FastlaneCore::ConfigItem.new(key: :exclude_dir, env_name: "FL_CLOC_EXCLUDE_DIR", description: "Comma separated list of directories to exclude", optional: true), FastlaneCore::ConfigItem.new(key: :output_directory, env_name: "FL_CLOC_OUTPUT_DIRECTORY", description: "Where to put the generated report file", default_value: "build"), FastlaneCore::ConfigItem.new(key: :source_directory, env_name: "FL_CLOC_SOURCE_DIRECTORY", description: "Where to look for the source code (relative to the project root folder)", default_value: ""), FastlaneCore::ConfigItem.new(key: :xml, env_name: "FL_CLOC_XML", description: "Should we generate an XML File (if false, it will generate a plain text file)?", type: Boolean, default_value: true) ] end |
.category ⇒ Object
80 81 82 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 80 def self.category :misc end |
.description ⇒ Object
24 25 26 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 24 def self.description "Generates a Code Count that can be read by Jenkins (xml format)" end |
.details ⇒ Object
28 29 30 31 32 33 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 28 def self.details [ "This action will run cloc to generate a SLOC report that the Jenkins SLOCCount plugin can read.", "See [https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin](https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin) and [https://github.com/AlDanial/cloc](https://github.com/AlDanial/cloc) for more information." ].join("\n") end |
.example_code ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 70 def self.example_code [ 'cloc( exclude_dir: "ThirdParty,Resources", output_directory: "reports", source_directory: "MyCoolApp" )' ] end |
.is_supported?(platform) ⇒ Boolean
66 67 68 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 66 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'fastlane/lib/fastlane/actions/cloc.rb', line 4 def self.run(params) cloc_binary = params[:binary_path] exclude_dirs = params[:exclude_dir].nil? ? '' : "--exclude-dir=#{params[:exclude_dir]}" xml_format = params[:xml] out_dir = params[:output_directory] output_file = xml_format ? "#{out_dir}/cloc.xml" : "#{out_dir}/cloc.txt" source_directory = params[:source_directory] command = [ cloc_binary, exclude_dirs, '--by-file', xml_format ? '--xml ' : '', "--out=#{output_file}", source_directory ].join(' ').strip Actions.sh(command) end |