diff --git a/generators/bootstrap.rb b/generators/bootstrap.rb new file mode 100644 index 000000000..c39a749be --- /dev/null +++ b/generators/bootstrap.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +require_relative 'helper' + +REPO_URL = 'https://github.com/twbs/icons.git' +REPO_NAME = 'twbs-icons' +ICONS_PACK_PATH = 'lib/phlex/icons/bootstrap' + +TEMPLATE = ERB.new <<~TEMPLATE + # frozen_string_literal: true + + # rubocop:disable #{ROBOCOP_DISABLE_WARNINGS} + module Phlex + module Icons + module Bootstrap + class <%= icon_name %> < Base + def view_template + <%= icon %> + end + end + end + end + end + # rubocop:enable #{ROBOCOP_DISABLE_WARNINGS} +TEMPLATE + +REPLACEMENTS = { + '0-' => 'zero-', + '1-' => 'one-', + '2-' => 'two-', + '3-' => 'three-', + '4-' => 'four-', + '5-' => 'five-', + '6-' => 'six-', + '7-' => 'seven-', + '8-' => 'eight-', + '9-' => 'nine-', + '123' => 'one-two-three' +}.freeze + +def main + run_generator { icon_file_paths.tqdm.each { create_icon_component(_1) } } +end + +def icon_file_paths + Dir.glob("generators/#{REPO_NAME}/icons/*") +end + +def create_icon_component(icon_file_path) + File.write( + File.join(ICONS_PACK_PATH, component_file_name(icon_file_path, REPLACEMENTS)), + TEMPLATE.result_with_hash( + icon_name: component_class_name(icon_file_path, REPLACEMENTS), + icon: read_and_convert_icon(icon_file_path) + ) + ) +end + +def read_and_convert_icon(icon_file_path) + icon_file_content = File.read(icon_file_path) + .sub(/class="bi [^"]*"/, '') + .sub('width="16"', '') + .sub('height="16"', '') + + Phlexing::Converter.convert(icon_file_content) + .sub('svg(', "svg(\nclass: classes,") +end + +main if __FILE__ == $PROGRAM_NAME diff --git a/generators/bootstrap_icons.rb b/generators/bootstrap_icons.rb deleted file mode 100644 index 36e36df4f..000000000 --- a/generators/bootstrap_icons.rb +++ /dev/null @@ -1,129 +0,0 @@ -# frozen_string_literal: true - -require 'erb' -require 'fileutils' -require 'phlexing' -require 'tqdm' - -PHLEX_ICONS_BOOTSTRAP_PATH = 'lib/phlex/icons/bootstrap' - -TEMPLATE = ERB.new <<~TEMPLATE - # frozen_string_literal: true - - # rubocop:disable Layout/LineLength - module Phlex - module Icons - module Bootstrap - class <%= icon_name %> < Base - def view_template - <%= icon %> - end - end - end - end - end - # rubocop:enable Layout/LineLength -TEMPLATE - -REPLACEMENTS = { - '0-' => 'zero-', - '1-' => 'one-', - '2-' => 'two-', - '3-' => 'three-', - '4-' => 'four-', - '5-' => 'five-', - '6-' => 'six-', - '7-' => 'seven-', - '8-' => 'eight-', - '9-' => 'nine-', - '123' => 'one-two-three' -}.freeze - -def run - clone_bootstrap_icons_repo - prepare_phlex_icons_bootstrap_directory - - puts 'Creating icon components...' - icon_file_paths.tqdm.each { |icon_file_path| create_icon_component(icon_file_path) } - puts 'Icon components created' - - delete_bootstrap_icons_repo -end - -def clone_bootstrap_icons_repo - puts 'Cloning bootstrap icons repo...' - - if Dir.exist?('generators/bootstrap_icons') - puts 'Bootstrap icons repo already cloned' - - return - end - - system('git clone https://github.com/twbs/icons.git generators/bootstrap_icons', out: File::NULL, err: File::NULL) - - puts 'Bootstrap icons repo cloned' -end - -def prepare_phlex_icons_bootstrap_directory - FileUtils.mkdir_p(PHLEX_ICONS_BOOTSTRAP_PATH) - - Dir.glob("#{PHLEX_ICONS_BOOTSTRAP_PATH}/*").each do |file| - next if ['base.rb'].include?(File.basename(file)) - - File.delete(file) - end -end - -def icon_file_paths - Dir.glob('generators/bootstrap_icons/icons/*') -end - -def create_icon_component(icon_file_path) - component_file_path = "#{PHLEX_ICONS_BOOTSTRAP_PATH}/#{formatted_icon_name(icon_file_path)}.rb" - - File.write( - component_file_path, - TEMPLATE.result_with_hash( - icon_name: formatted_icon_class_name(icon_file_path), - icon: read_and_convert_icon(icon_file_path) - ) - ) - - system("rubocop -A #{component_file_path}", out: File::NULL, err: File::NULL) -end - -def read_and_convert_icon(icon_file_path) - icon_file_content = File.read(icon_file_path) - .sub(/class="bi [^"]*"/, '') - .sub('width="16"', '') - .sub('height="16"', '') - - Phlexing::Converter.convert(icon_file_content) - .sub('svg(', "svg(\nclass: classes,") -end - -def formatted_icon_name(icon_file_path) - icon_name = File.basename(icon_file_path, '.svg') - - REPLACEMENTS.each do |key, value| - icon_name = icon_name.gsub(key, value) if icon_name.start_with?(key) - end - - icon_name.gsub('-', '_') -end - -def formatted_icon_class_name(icon_file_path) - icon_name = File.basename(icon_file_path, '.svg') - - REPLACEMENTS.each do |key, value| - icon_name = icon_name.gsub(key, value) if icon_name.start_with?(key) - end - - icon_name.gsub('-', ' ').split.map(&:capitalize).join -end - -def delete_bootstrap_icons_repo - FileUtils.rm_rf('generators/bootstrap_icons') -end - -run if __FILE__ == $PROGRAM_NAME diff --git a/generators/flag.rb b/generators/flag.rb new file mode 100644 index 000000000..db87be604 --- /dev/null +++ b/generators/flag.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require_relative 'helper' + +REPO_URL = 'https://github.com/lipis/flag-icons.git' +REPO_NAME = 'lipis-flag-icons' +ICONS_PACK_PATH = 'lib/phlex/icons/flag' + +TEMPLATE = ERB.new <<~TEMPLATE + # frozen_string_literal: true + + # rubocop:disable #{ROBOCOP_DISABLE_WARNINGS} + module Phlex + module Icons + module Flag + class <%= icon_name %> < Base + def square + <%= square_icon %> + end + + def rectangle + <%= rectangle_icon %> + end + end + end + end + end + # rubocop:enable #{ROBOCOP_DISABLE_WARNINGS} +TEMPLATE + +def main + run_generator { icon_file_names.tqdm.each { create_icon_component(_1) } } +end + +def icon_file_names + Dir.glob("generators/#{REPO_NAME}/flags/1x1/*").map { |file| File.basename(file) } +end + +def create_icon_component(icon_file_name) + File.write( + File.join(ICONS_PACK_PATH, component_file_name(icon_file_name)), + TEMPLATE.result_with_hash( + icon_name: component_class_name(icon_file_name), + square_icon: read_and_convert_icon(square_icon_file_path(icon_file_name)), + rectangle_icon: read_and_convert_icon(rectangle_icon_file_path(icon_file_name)) + ) + ) +end + +def read_and_convert_icon(icon_file_path) + icon_file_content = File.read(icon_file_path) + .sub(/id="flag-icons-[^"]*"/, '') + + Phlexing::Converter.convert(icon_file_content) + .sub('svg(', "svg(\nclass: classes,") + .sub('xmlns:xlink:', '"xmlns:xlink":') + .gsub('xlink:href:', '"xlink:href":') +end + +def square_icon_file_path(icon_file_name) + "generators/#{REPO_NAME}/flags/1x1/#{icon_file_name}" +end + +def rectangle_icon_file_path(icon_file_name) + "generators/#{REPO_NAME}/flags/4x3/#{icon_file_name}" +end + +main if __FILE__ == $PROGRAM_NAME diff --git a/generators/flag_icons.rb b/generators/flag_icons.rb deleted file mode 100644 index 3d8f6e8c6..000000000 --- a/generators/flag_icons.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -require 'erb' -require 'fileutils' -require 'phlexing' -require 'tqdm' - -PHLEX_ICONS_FLAG_PATH = 'lib/phlex/icons/flag' - -TEMPLATE = ERB.new <<~TEMPLATE - # frozen_string_literal: true - - # rubocop:disable Layout/LineLength,Metrics/AbcSize,Metrics/BlockLength,Metrics/ClassLength,Metrics/MethodLength - module Phlex - module Icons - module Flag - class <%= icon_name %> < Base - def square - <%= square_icon %> - end - - def rectangle - <%= rectangle_icon %> - end - end - end - end - end - # rubocop:enable Layout/LineLength,Metrics/AbcSize,Metrics/BlockLength,Metrics/ClassLength,Metrics/MethodLength -TEMPLATE - -def run - clone_flag_icons_repo - prepare_phlex_icons_flag_directory - - puts 'Creating icon components...' - icon_file_names.tqdm.each { |icon_file_name| create_icon_component(icon_file_name) } - puts 'Icon components created' - - delete_flag_icons_repo -end - -def clone_flag_icons_repo - puts 'Cloning flag icons repo...' - - if Dir.exist?('generators/flag_icons') - puts 'Flag icons repo already cloned' - - return - end - - system( - 'git clone https://github.com/lipis/flag-icons.git generators/flag_icons', - out: File::NULL, - err: File::NULL - ) - - puts 'Flag icons repo cloned' -end - -def prepare_phlex_icons_flag_directory - FileUtils.mkdir_p(PHLEX_ICONS_FLAG_PATH) - - Dir.glob("#{PHLEX_ICONS_FLAG_PATH}/*").each do |file| - next if ['base.rb', 'configuration.rb'].include?(File.basename(file)) - - File.delete(file) - end -end - -def icon_file_names - Dir.glob('generators/flag_icons/flags/1x1/*').map { |file| File.basename(file) } -end - -def create_icon_component(icon_file_name) - component_file_path = "#{PHLEX_ICONS_FLAG_PATH}/#{formatted_icon_name(icon_file_name)}.rb" - - File.write( - component_file_path, - TEMPLATE.result_with_hash( - icon_name: formatted_icon_class_name(icon_file_name), - square_icon: read_and_convert_icon(square_icon_file_path(icon_file_name)), - rectangle_icon: read_and_convert_icon(rectangle_icon_file_path(icon_file_name)) - ) - ) - - system("rubocop -A #{component_file_path}", out: File::NULL, err: File::NULL) - - File.write(component_file_path, File.read(component_file_path).gsub('rubocop:enable ,', 'rubocop:enable ')) -end - -def read_and_convert_icon(icon_file_path) - icon_file_content = File.read(icon_file_path) - .sub(/id="flag-icons-[^"]*"/, '') - - Phlexing::Converter.convert(icon_file_content) - .sub('svg(', "svg(\nclass: classes,") - .sub('xmlns:xlink:', '"xmlns:xlink":') - .gsub('xlink:href:', '"xlink:href":') -end - -def formatted_icon_name(icon_file_name) - File.basename(icon_file_name, '.svg').gsub('-', '_') -end - -def formatted_icon_class_name(icon_file_name) - File.basename(icon_file_name, '.svg').gsub('-', ' ').split.map(&:capitalize).join -end - -def square_icon_file_path(icon_file_name) - "generators/flag_icons/flags/1x1/#{icon_file_name}" -end - -def rectangle_icon_file_path(icon_file_name) - "generators/flag_icons/flags/4x3/#{icon_file_name}" -end - -def delete_flag_icons_repo - FileUtils.rm_rf('generators/flag_icons') -end - -run if __FILE__ == $PROGRAM_NAME diff --git a/generators/helper.rb b/generators/helper.rb new file mode 100644 index 000000000..88074ebf0 --- /dev/null +++ b/generators/helper.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: true + +require 'erb' +require 'fileutils' +require 'phlexing' +require 'tqdm' + +ROBOCOP_DISABLE_WARNINGS = %w[ + Layout/LineLength + Metrics/AbcSize + Metrics/BlockLength + Metrics/ClassLength + Metrics/MethodLength +].join(',') + +def run_generator(&block) + clone_repo(REPO_URL, REPO_NAME) + prepare_phlex_icons_pack_directory(ICONS_PACK_PATH) + + print '⌛ Creating icon components...' + yield block + puts "\r🎉 Icon components created successfully!" + + run_rubocop(ICONS_PACK_PATH) + delete_repo(REPO_NAME) +end + +def clone_repo(repo_url, repo_name) + print "⌛ Cloning '#{repo_name}' repo..." + + if Dir.exist?("generators/#{repo_name}") + puts "\r✅ '#{repo_name}' repo already exists" + + return + end + + system!("git clone #{repo_url} generators/#{repo_name}") + + puts "\r🎉 '#{repo_name}' repo cloned successfully!" +end + +def prepare_phlex_icons_pack_directory(icons_pack_path) + print "⌛ Preparing '#{icons_pack_path}' directory..." + + FileUtils.mkdir_p(icons_pack_path) + + Dir.glob("#{icons_pack_path}/*").each do |file| + next if ['base.rb', 'configuration.rb'].include?(File.basename(file)) + + File.delete(file) + end + + puts "\r🎉 '#{icons_pack_path}' directory prepared successfully!" +end + +def component_file_name(icon_file_name, replacements = nil) + replacements ||= {} + + icon_name = File.basename(icon_file_name, '.svg') + + replacements.each do |key, value| + icon_name = icon_name.gsub(key, value) if icon_name.start_with?(key) + end + + "#{icon_name.gsub('-', '_')}.rb" +end + +def component_class_name(icon_file_name, replacements = nil) + replacements ||= {} + + icon_name = File.basename(icon_file_name, '.svg') + + replacements.each do |key, value| + icon_name = icon_name.gsub(key, value) if icon_name.start_with?(key) + end + + icon_name.gsub('-', ' ').split.map(&:capitalize).join +end + +def run_rubocop(path) + print '⌛ Running RuboCop...' + + system("rubocop -A #{path}", out: File::NULL, err: File::NULL) + + Dir.glob("#{path}/*.rb").each do |file| + File.write(file, File.read(file).gsub('rubocop:enable ,', 'rubocop:enable ')) + end + + puts "\r🎉 RuboCop ran successfully!" +end + +def delete_repo(repo_name) + print "⌛ Deleting '#{repo_name}' repo..." + + FileUtils.rm_rf("generators/#{repo_name}") + + puts "\r🎉 '#{repo_name}' repo deleted successfully!" +end + +def system!(command) + system(command, out: File::NULL, err: File::NULL) || raise("❌ Command failed: '#{command}'") +end diff --git a/generators/hero.rb b/generators/hero.rb new file mode 100644 index 000000000..2283bf2f0 --- /dev/null +++ b/generators/hero.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require_relative 'helper' + +REPO_URL = 'https://github.com/tailwindlabs/heroicons.git' +REPO_NAME = 'tailwindlabs-heroicons' +ICONS_PACK_PATH = 'lib/phlex/icons/hero' + +TEMPLATE = ERB.new <<~TEMPLATE + # frozen_string_literal: true + + # rubocop:disable #{ROBOCOP_DISABLE_WARNINGS} + module Phlex + module Icons + module Hero + class <%= icon_name %> < Base + def solid + <%= solid_icon %> + end + + def outline + <%= outline_icon %> + end + end + end + end + end + # rubocop:enable #{ROBOCOP_DISABLE_WARNINGS} +TEMPLATE + +def main + run_generator { icon_file_names.tqdm.each { create_icon_component(_1) } } +end + +def icon_file_names + Dir.glob("generators/#{REPO_NAME}/optimized/24/solid/*").map { |file| File.basename(file) } +end + +def create_icon_component(icon_file_name) + File.write( + File.join(ICONS_PACK_PATH, component_file_name(icon_file_name)), + TEMPLATE.result_with_hash( + icon_name: component_class_name(icon_file_name), + solid_icon: read_and_convert_icon(solid_icon_file_path(icon_file_name)), + outline_icon: read_and_convert_icon(outline_icon_file_path(icon_file_name)) + ) + ) +end + +def read_and_convert_icon(icon_file_path) + icon_file_content = File.read(icon_file_path) + Phlexing::Converter.convert(icon_file_content).sub('svg(', "svg(\nclass: classes,") +end + +def solid_icon_file_path(icon_file_name) + "generators/#{REPO_NAME}/optimized/24/solid/#{icon_file_name}" +end + +def outline_icon_file_path(icon_file_name) + "generators/#{REPO_NAME}/optimized/24/outline/#{icon_file_name}" +end + +main if __FILE__ == $PROGRAM_NAME diff --git a/generators/heroicons.rb b/generators/heroicons.rb deleted file mode 100644 index 5216e4095..000000000 --- a/generators/heroicons.rb +++ /dev/null @@ -1,115 +0,0 @@ -# frozen_string_literal: true - -require 'erb' -require 'fileutils' -require 'phlexing' -require 'tqdm' - -PHLEX_ICONS_HERO_PATH = 'lib/phlex/icons/hero' - -TEMPLATE = ERB.new <<~TEMPLATE - # frozen_string_literal: true - - # rubocop:disable Layout/LineLength - module Phlex - module Icons - module Hero - class <%= icon_name %> < Base - def solid - <%= solid_icon %> - end - - def outline - <%= outline_icon %> - end - end - end - end - end - # rubocop:enable Layout/LineLength -TEMPLATE - -def run - clone_heroicons_repo - prepare_phlex_icons_hero_directory - - puts 'Creating icon components...' - icon_file_names.tqdm.each { |icon_file_name| create_icon_component(icon_file_name) } - puts 'Icon components created' - - delete_heroicons_repo -end - -def clone_heroicons_repo - puts 'Cloning heroicons repo...' - - if Dir.exist?('generators/heroicons') - puts 'Heroicons repo already cloned' - - return - end - - system( - 'git clone https://github.com/tailwindlabs/heroicons.git generators/heroicons', - out: File::NULL, - err: File::NULL - ) - - puts 'Heroicons repo cloned' -end - -def prepare_phlex_icons_hero_directory - FileUtils.mkdir_p(PHLEX_ICONS_HERO_PATH) - - Dir.glob("#{PHLEX_ICONS_HERO_PATH}/*").each do |file| - next if ['base.rb', 'configuration.rb'].include?(File.basename(file)) - - File.delete(file) - end -end - -def icon_file_names - Dir.glob('generators/heroicons/optimized/24/solid/*').map { |file| File.basename(file) } -end - -def create_icon_component(icon_file_name) - component_file_path = "#{PHLEX_ICONS_HERO_PATH}/#{formatted_icon_name(icon_file_name)}.rb" - - File.write( - component_file_path, - TEMPLATE.result_with_hash( - icon_name: formatted_icon_class_name(icon_file_name), - solid_icon: read_and_convert_icon(solid_icon_file_path(icon_file_name)), - outline_icon: read_and_convert_icon(outline_icon_file_path(icon_file_name)) - ) - ) - - system("rubocop -A #{component_file_path}", out: File::NULL, err: File::NULL) -end - -def read_and_convert_icon(icon_file_path) - icon_file_content = File.read(icon_file_path) - Phlexing::Converter.convert(icon_file_content).sub('svg(', "svg(\nclass: classes,") -end - -def formatted_icon_name(icon_file_name) - File.basename(icon_file_name, '.svg').gsub('-', '_') -end - -def formatted_icon_class_name(icon_file_name) - File.basename(icon_file_name, '.svg').gsub('-', ' ').split.map(&:capitalize).join -end - -def solid_icon_file_path(icon_file_name) - "generators/heroicons/optimized/24/solid/#{icon_file_name}" -end - -def outline_icon_file_path(icon_file_name) - "generators/heroicons/optimized/24/outline/#{icon_file_name}" -end - -def delete_heroicons_repo - FileUtils.rm_rf('generators/heroicons') -end - -run if __FILE__ == $PROGRAM_NAME diff --git a/generators/lucide.rb b/generators/lucide.rb new file mode 100644 index 000000000..342cb3311 --- /dev/null +++ b/generators/lucide.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require_relative 'helper' + +REPO_URL = 'https://github.com/lucide-icons/lucide.git' +REPO_NAME = 'lucide-icons-lucide' +ICONS_PACK_PATH = 'lib/phlex/icons/lucide' + +TEMPLATE = ERB.new <<~TEMPLATE + # frozen_string_literal: true + + # rubocop:disable #{ROBOCOP_DISABLE_WARNINGS} + module Phlex + module Icons + module Lucide + class <%= icon_name %> < Base + def view_template + <%= icon %> + end + end + end + end + end + # rubocop:enable #{ROBOCOP_DISABLE_WARNINGS} +TEMPLATE + +def main + run_generator { icon_file_paths.tqdm.each { create_icon_component(_1) } } +end + +def icon_file_paths + Dir.glob("generators/#{REPO_NAME}/icons/*.svg") +end + +def create_icon_component(icon_file_path) + File.write( + File.join(ICONS_PACK_PATH, component_file_name(icon_file_path)), + TEMPLATE.result_with_hash( + icon_name: component_class_name(icon_file_path), + icon: read_and_convert_icon(icon_file_path) + ) + ) +end + +def read_and_convert_icon(icon_file_path) + icon_file_content = File.read(icon_file_path) + .sub('width="24"', '') + .sub('height="24"', '') + + Phlexing::Converter.convert(icon_file_content) + .sub('svg(', "svg(\nclass: classes,") +end + +main if __FILE__ == $PROGRAM_NAME diff --git a/generators/lucide_icons.rb b/generators/lucide_icons.rb deleted file mode 100644 index 230e6e557..000000000 --- a/generators/lucide_icons.rb +++ /dev/null @@ -1,108 +0,0 @@ -# frozen_string_literal: true - -require 'erb' -require 'fileutils' -require 'phlexing' -require 'tqdm' - -PHLEX_ICONS_LUCIDE_PATH = 'lib/phlex/icons/lucide' - -TEMPLATE = ERB.new <<~TEMPLATE - # frozen_string_literal: true - - # rubocop:disable Layout/LineLength,Metrics/AbcSize,Metrics/BlockLength,Metrics/MethodLength - module Phlex - module Icons - module Lucide - class <%= icon_name %> < Base - def view_template - <%= icon %> - end - end - end - end - end - # rubocop:enable Layout/LineLength,Metrics/AbcSize,Metrics/BlockLength,Metrics/MethodLength -TEMPLATE - -def run - clone_lucide_icons_repo - prepare_phlex_icons_lucide_directory - - puts 'Creating icon components...' - icon_file_paths.tqdm.each { |icon_file_path| create_icon_component(icon_file_path) } - puts 'Icon components created' - - delete_lucide_icons_repo -end - -def clone_lucide_icons_repo - puts 'Cloning lucide icons repo...' - - if Dir.exist?('generators/lucide_icons') - puts 'Lucide icons repo already cloned' - - return - end - - system( - 'git clone https://github.com/lucide-icons/lucide.git generators/lucide_icons', - out: File::NULL, - err: File::NULL - ) - - puts 'Lucide icons repo cloned' -end - -def prepare_phlex_icons_lucide_directory - FileUtils.mkdir_p(PHLEX_ICONS_LUCIDE_PATH) - - Dir.glob("#{PHLEX_ICONS_LUCIDE_PATH}/*").each do |file| - next if ['base.rb'].include?(File.basename(file)) - - File.delete(file) - end -end - -def icon_file_paths - Dir.glob('generators/lucide_icons/icons/*.svg') -end - -def create_icon_component(icon_file_path) - component_file_path = "#{PHLEX_ICONS_LUCIDE_PATH}/#{formatted_icon_name(icon_file_path)}.rb" - - File.write( - component_file_path, - TEMPLATE.result_with_hash( - icon_name: formatted_icon_class_name(icon_file_path), - icon: read_and_convert_icon(icon_file_path) - ) - ) - - system("rubocop -A #{component_file_path}", out: File::NULL, err: File::NULL) - - File.write(component_file_path, File.read(component_file_path).gsub('rubocop:enable ,', 'rubocop:enable ')) -end - -def read_and_convert_icon(icon_file_path) - icon_file_content = File.read(icon_file_path) - .sub('width="24"', '') - .sub('height="24"', '') - - Phlexing::Converter.convert(icon_file_content) - .sub('svg(', "svg(\nclass: classes,") -end - -def formatted_icon_name(icon_file_path) - File.basename(icon_file_path, '.svg').gsub('-', '_') -end - -def formatted_icon_class_name(icon_file_path) - File.basename(icon_file_path, '.svg').gsub('-', ' ').split.map(&:capitalize).join -end - -def delete_lucide_icons_repo - FileUtils.rm_rf('generators/lucide_icons') -end - -run if __FILE__ == $PROGRAM_NAME