Class: Icons::Sync

Inherits:
Object
  • Object
show all
Defined in:
lib/icons/sync.rb,
lib/icons/sync/transformations.rb,
lib/icons/sync/process_variants.rb

Defined Under Namespace

Classes: ProcessVariants, Transformations

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Sync

Returns a new instance of Sync.



8
9
10
11
12
13
14
# File 'lib/icons/sync.rb', line 8

def initialize(name)
  raise "[Icons] Not a valid library" unless Icons.libraries.key?(name.to_sym)

  @name = name
  @library = Icons.libraries.fetch(name.to_sym).source
  @temp_directory = File.join(temp_directory_root, name)
end

Instance Method Details

#nowObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/icons/sync.rb', line 16

def now
  clone_repository
  process_variants
  remove_non_svg_files

  move_library

  purge_temp_directory
rescue => error
  puts "[Icons] Failed to sync icons: #{error.message}"

  post_error_clean_up

  raise
end