Class: Redbreast::Crawler::Color
- Inherits:
-
Object
- Object
- Redbreast::Crawler::Color
- Defined in:
- lib/redbreast/crawlers/color_crawler.rb
Overview
Class used for finding colors
Class Method Summary collapse
Class Method Details
.color_names_uniq(assets_search_path) ⇒ Object
5 6 7 8 9 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 |
# File 'lib/redbreast/crawlers/color_crawler.rb', line 5 def self.color_names_uniq(assets_search_path) Dir.glob(assets_search_path).flat_map do |asset_folder| Dir.glob("#{asset_folder}/**/*.colorset").map do |color_name| name_to_split = color_name split_name = name_to_split.split('.xcassets/') current_color_name = split_name[0] + '.xcassets/' = split_name[0] + '.xcassets/' split_name[1].split('/').each do |folder| if folder.include? '.colorset' current_color_name += folder next end += folder + '/' Dir.glob("#{}*.json").map do |path_name| File.open path_name do |file| unless file.find { |line| line =~ /provides/ }.nil? current_color_name += folder + '/' next end end end end current_color_name.split('.xcassets/')[-1].chomp('.colorset') end end .uniq end |