Class: Fastlane::Actions::FigmaGetStylesAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FigmaGetStylesAction
- Defined in:
- lib/admiral-tools-figma/actions/figma_get_styles.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
40 41 42 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 40 def self. ['ton252'] end |
.available_options ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 52 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: :style_types, description: 'Figma style type filter [FILL, TEXT, EFFECT, GRID]', 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 styles file path', optional: true, type: String) ] end |
.description ⇒ Object
36 37 38 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 36 def self.description 'Figma plugin' end |
.details ⇒ Object
48 49 50 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 48 def self.details 'Figma plugin' end |
.is_supported?(_platform) ⇒ Boolean
81 82 83 84 85 86 87 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 81 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
44 45 46 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 44 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/admiral-tools-figma/actions/figma_get_styles.rb', line 11 def self.run(params) Actions.verify_gem!('liquid') access_token = params[:access_token] file_key = params[:file_key] styles_output_file = params[:output_file] style_types = params[:style_types] request_batch = params[:request_batch] client = FigmaClient.new(access_token: access_token) styles = client.get_full_styles(file_key: file_key, request_batch: request_batch) || [] styles = styles.select { |s| (style_types.nil? || style_types.include?(s.style_type)) } styles_list = StylesList.new(styles: styles) unless styles_output_file.nil? File.write_file_json( hash: styles_list.to_hash, path: styles_output_file, create_directories: true ) end styles_list end |