Class: RailsIcons::Sync::Engine

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/rails_icons/sync/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Engine

Returns a new instance of Engine.



11
12
13
14
15
16
17
# File 'lib/rails_icons/sync/engine.rb', line 11

def initialize(name)
  super

  raise "[Rails Icons] Not a valid library" if RailsIcons.libraries.keys.exclude?(name.to_sym)

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

Instance Method Details

#syncObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rails_icons/sync/engine.rb', line 19

def sync
  clone_repository
  process_variants
  remove_non_svg_files

  move_library

  purge_temp_directory
rescue => error
  say "[Rails Icons] Failed to sync icons: #{error.message}", :red

  post_error_clean_up

  raise
end