Class: Fastlane::Actions::FigmaGetImageLinksAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FigmaGetImageLinksAction
- Defined in:
- lib/admiral-tools-figma/actions/figma_get_image_links.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(_platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
57 58 59 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 57 def self. ['ton252'] end |
.available_options ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 69 def self. [ FastlaneCore::ConfigItem.new(key: :access_token, description: 'Figma access token', env_name: 'FIGMA_ACCESS_TOKEN', optional: false, type: String), FastlaneCore::ConfigItem.new(key: :file_key, env_name: 'FIGMA_FILE_KEY', description: 'Figma file key', optional: false, type: String), FastlaneCore::ConfigItem.new(key: :name_filter_regex, description: 'Name filter regex', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :description_filter_regex, description: 'Description filter regex', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :frame_filter_regex, description: 'Frame filter regex', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :page_filter_regex, description: 'Page filter regex', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :format, description: 'Image output format, can be [jpg png svg pdf]', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :scales, description: 'An array of number between 0.01 and 4, the image scaling factor. Example: ["0.5", "1", "2", "3"]', optional: true, type: Array), FastlaneCore::ConfigItem.new(key: :request_batch, description: 'Figma max request components batch', default_value: 1_000_000, optional: true, type: Integer), FastlaneCore::ConfigItem.new(key: :output_file, description: 'Figma output component file path', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :svg_include_id, description: 'Whether to include id attributes for all SVG elements. Default: false', optional: true, type: Boolean), FastlaneCore::ConfigItem.new(key: :svg_simplify_stroke, description: 'Whether to simplify inside/outside strokes and use stroke attribute if possible instead of <mask>. Default: true', optional: true, type: Boolean), FastlaneCore::ConfigItem.new(key: :use_absolute_bounds, description: 'If image use its bounds box', default_value: true, optional: true, type: Boolean) ] end |
.description ⇒ Object
53 54 55 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 53 def self.description 'Figma plugin' end |
.details ⇒ Object
65 66 67 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 65 def self.details 'Figma plugin' end |
.is_supported?(_platform) ⇒ Boolean
130 131 132 133 134 135 136 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 130 def self.is_supported?(_platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.return_value ⇒ Object
61 62 63 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 61 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 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 |
# File 'lib/admiral-tools-figma/actions/figma_get_image_links.rb', line 10 def self.run(params) access_token = params[:access_token] file_key = params[:file_key] name_filter_regex = params[:name_filter_regex] description_filter_regex = params[:description_filter_regex] frame_filter_regex = params[:frame_filter_regex] page_filter_regex = params[:page_filter_regex] components_output_file = params[:output_file] image_format = params[:format] image_scales = params[:scales] svg_include_id = params[:svg_include_id] svg_simplify_stroke = params[:svg_simplify_stroke] use_absolute_bounds = params[:use_absolute_bounds] request_batch = params[:request_batch] scales = ScaleFormatter.new.any_scales_to_scales(image_scales) client = FigmaClient.new(access_token: access_token) components_list = client.get_full_image_components( file_key: file_key, image_format: image_format, scales: scales, name_filter_regex: name_filter_regex, desc_filter_regex: description_filter_regex, frame_filter_regex: frame_filter_regex, page_filter_regex: page_filter_regex, svg_include_id: svg_include_id, svg_simplify_stroke: svg_simplify_stroke, use_absolute_bounds: use_absolute_bounds, request_batch: request_batch ) unless components_output_file.nil? File.write_file_json( hash: components_list.to_hash, path: components_output_file, create_directories: true ) end components_list end |