Class: Fastlane::Actions::DeviceImageSelectorAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::DeviceImageSelectorAction
- Defined in:
- lib/fastlane/plugin/device_image_selector/actions/select.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 50 def self. ["Mario Zimmermann"] 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 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 69 def self. [ FastlaneCore::ConfigItem.new(key: :screenshot_directory, env_name: "DEVICE_IMAGE_SELECTOR_SCREENSHOT_DIRECTORY", description: "Directory where the screenshots are located", optional: false, default_value: "./fastlane/screenshots", type: String), FastlaneCore::ConfigItem.new(key: :output_directory, env_name: "DEVICE_IMAGE_SELECTOR_OUTPUT_DIRECTORY", description: "Directory where to put the selected screenshots", optional: false, default_value: "./fastlane/screenshots/device_images", type: String), FastlaneCore::ConfigItem.new(key: :name_prefixes, env_name: "DEVICE_IMAGE_SELECTOR_NAME_PREFIXES", description: "Array of filename prefixes to select", optional: true, type: Array) ] end |
.description ⇒ Object
46 47 48 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 46 def self.description "Selects screenshots with specified names for processing with frameit" end |
.details ⇒ Object
64 65 66 67 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 64 def self.details # Optional: "Takes the device screenshots which match the specified names and puts them in the output directory for frameit to process. The screenshot files can then be cleaned up after the device images are created." end |
.is_supported?(platform) ⇒ Boolean
93 94 95 96 97 98 99 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 93 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 |
.output ⇒ Object
58 59 60 61 62 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 58 def self.output [ ["DEVICE_IMAGE_SELECTOR_FILES", "Comma separated list of selected screenshot files"] ] end |
.return_value ⇒ Object
54 55 56 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 54 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 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fastlane/plugin/device_image_selector/actions/select.rb', line 11 def self.run(params) Dir.mkdir(params[:output_directory]) unless Dir.exists?(params[:output_directory]) files = [] Dir.entries(params[:screenshot_directory]).each do |entry| next if entry == "." || entry == ".." input_dir = params[:screenshot_directory] + "/#{entry}" next unless File.directory?(input_dir) next if input_dir == params[:output_directory] output_dir = "#{params[:output_directory]}/#{entry}" Dir.mkdir(output_dir) unless Dir.exists?(output_dir) Dir.entries(input_dir).each do |filename| next if filename == "." || filename == ".." use_this = false params[:name_prefixes].each do |name_prefix| if filename.start_with?(name_prefix) use_this = true break end end next unless use_this FileUtils.copy("#{input_dir}/#{filename}","#{output_dir}/#{filename}") files << "#{output_dir}/#{filename}" end end Actions.lane_context[SharedValues::DEVICE_IMAGE_SELECTOR_FILES] = files.join(",") end |