Class: Fastlane::Actions::SwiftDocAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SwiftDocAction
- Defined in:
- lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .optional_flags(params, mode) ⇒ Object
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
101 102 103 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 101 def self. ["Joshua Kaplan"] end |
.available_options ⇒ Object
27 28 29 30 31 32 33 34 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 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 27 def self. [ FastlaneCore::ConfigItem.new(key: :executable, env_name: "FL_SWIFT_DOC_EXECUTABLE", description: "Path to the `swift-doc` executable on your machine", type: String, optional: true), FastlaneCore::ConfigItem.new(key: :mode, env_name: "FL_SWIFT_DOC_MODE", description: "SwiftDoc mode: :generate, :coverage, or :diagram", type: Symbol, default_value: :generate, optional: true), FastlaneCore::ConfigItem.new(key: :minimum_access_level, env_name: "FL_SWIFT_DOC_MINIMUM_ACCESS_LEVEL", description: "SwiftDoc minimum access level: public, internal, etc", type: String, optional: true), FastlaneCore::ConfigItem.new(key: :input_paths, env_name: "FL_SWIFT_DOC_INPUT_PATHS", description: "SwiftDoc input paths for Swift files", type: Array, optional: true), FastlaneCore::ConfigItem.new(key: :output_path, env_name: "FL_SWIFT_DOC_OUTPUT_PATH", description: "The output path for generated files", type: String, optional: true), FastlaneCore::ConfigItem.new(key: :module_name, env_name: "FL_SWIFT_DOC_MODULE_NAME", description: "The module name to work on", type: String, optional: true), FastlaneCore::ConfigItem.new(key: :output_format, env_name: "FL_SWIFT_DOC_OUTPUT_FORMAT", description: "The output format: :commonmark or :html", type: Symbol, optional: true), FastlaneCore::ConfigItem.new(key: :base_url, env_name: "FL_SWIFT_DOC_BASE_URL", description: "The base url to work off of", type: String, optional: true) ] end |
.category ⇒ Object
113 114 115 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 113 def self.category :documentation end |
.description ⇒ Object
23 24 25 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 23 def self.description "Generate documentation, documentation coverage, or a class diagram using SwiftDoc" end |
.example_code ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 105 def self.example_code [ 'swift_doc', 'swift_doc(mode: :coverage)', 'swift_doc(module_name: "FooModule")' ] end |
.is_supported?(platform) ⇒ Boolean
117 118 119 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 117 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.optional_flags(params, mode) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 73 def self.optional_flags(params, mode) command = "" command << " #{params[:input_paths].map(&:shellescape).join(' ')}" if params[:input_paths] command << " --minimum-access-level #{params[:minimum_access_level]}" if params[:minimum_access_level] case mode when :generate command << " --module-name #{params[:module_name]}" if params[:module_name] command << " --output #{params[:output_path].shellescape}" if params[:output_path] command << " --format #{params[:output_format]}" if params[:output_format] command << " --base-url #{params[:base_url].shellescape}" if params[:base_url] when :coverage command << " --output #{params[:output_path].shellescape}" if params[:output_path] when :diagram # No unique options here else UI.user_error!("Unexpected mode: #{mode}") end return command end |
.output ⇒ Object
95 96 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 95 def self.output end |
.return_value ⇒ Object
98 99 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 98 def self.return_value end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fastlane/plugin/swift_doc/actions/swift_doc_action.rb', line 6 def self.run(params) if `which swift-doc`.to_s.length == 0 && params[:executable].nil? && !Helper.test? UI.user_error!("You have to install swift-doc using `brew install swiftdocorg/formulae/swift-doc` or specify the executable path with the `:executable` option.") end command = params[:executable] || "swift-doc" mode = params[:mode] || :generate command << " #{mode}" command << optional_flags(params, mode) Actions.sh(command) end |