Class: Fastlane::Helper::StaticAssetsHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/static_assets/helper/static_assets_helper.rb

Class Method Summary collapse

Class Method Details

.fetch_images(paths) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/static_assets/helper/static_assets_helper.rb', line 4

def self.fetch_images(paths)
  image = {}
  paths.each do |path|
    path_arr = Dir["#{FastlaneCore::FastlaneFolder.path}../#{path}/**/*.imageset"].each do |image_path|
      path = image_path.sub('.imageset', '')
      path_arr = path.split('/')
      image_name = path_arr[path_arr.length - 1]

      key = self.sanitize_name(image_name)
      image[key] ||= []

      image[key] << image_path
    end
  end
  image
end

.remove_dir(path) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fastlane/plugin/static_assets/helper/static_assets_helper.rb', line 25

def self.remove_dir(path)
  if File.directory?(path)
    Dir.foreach(path) do |file|
      if (file.to_s != ".") and (file.to_s != "..")
        remove_dir("#{path}/#{file}")
      end
    end
    Dir.delete(path)
  else
    File.delete(path)
  end
end

.sanitize_name(name) ⇒ Object



21
22
23
# File 'lib/fastlane/plugin/static_assets/helper/static_assets_helper.rb', line 21

def self.sanitize_name(name)
  name.tr(' ', '_')
end