Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ source "https://rubygems.org"
# Specify your gem's dependencies in rails_icons.gemspec
gemspec

# gem "rails", "~> 7.0.6"
gem "appraisal"
gem "propshaft"

Expand Down
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
rails_icons (1.6.1)
nokogiri (~> 1.16, >= 1.16.4)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -102,6 +102,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
6 changes: 4 additions & 2 deletions gemfiles/rails_7_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: ..
specs:
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails_icons (1.6.1)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -96,6 +96,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
6 changes: 4 additions & 2 deletions gemfiles/rails_7_1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: ..
specs:
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails_icons (1.6.1)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -110,6 +110,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
6 changes: 4 additions & 2 deletions gemfiles/rails_7_2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: ..
specs:
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails_icons (1.6.1)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -104,6 +104,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
6 changes: 4 additions & 2 deletions gemfiles/rails_8_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: ..
specs:
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails_icons (1.6.1)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -102,6 +102,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
6 changes: 4 additions & 2 deletions gemfiles/rails_main.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ GIT
PATH
remote: ..
specs:
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails_icons (1.6.1)
icons (~> 0.6.0)
rails (>= 7.0)

GEM
Expand Down Expand Up @@ -134,6 +134,8 @@ GEM
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
icons (0.6.0)
nokogiri (~> 1.16, >= 1.16.4)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/rails_icons/initializer_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def insert_custom_configuration
def create_custom_directory = FileUtils.mkdir_p(File.join(options[:destination], options[:custom]))

def library_configuration
libraries.map { RailsIcons.libraries[_1.to_sym].initializer_config }.join("\n")
libraries.map { |library| RailsIcons.libraries[library.to_sym].initializer_config }.join("\n")
end

def custom_configuration
Expand All @@ -92,7 +92,7 @@ def custom_configuration
def default_configuration_exists?
line = /^\s*config\.default_library\s*=/

File.readlines(INITIALIZER).any? { _1.match?(line) }
File.readlines(INITIALIZER).any? { |file_line| file_line.match?(line) }
end

def libraries
Expand Down
5 changes: 3 additions & 2 deletions lib/generators/rails_icons/sync_generator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "rails_icons/base_generator"
require "rails_icons/sync/engine"

module RailsIcons
class SyncGenerator < RailsIcons::BaseGenerator
Expand All @@ -12,7 +11,9 @@ class SyncGenerator < RailsIcons::BaseGenerator
class_option :library, type: :string, desc: "Choose a library (#{RailsIcons.libraries.keys.join("/")})"
class_option :libraries, type: :array, default: [], desc: "Choose libraries (#{RailsIcons.libraries.keys.join("/")})"

def sync_icons = libraries.each { Sync::Engine.new(_1).sync }
def sync_icons
libraries.each { |library| Icons::Sync.new(library).now }
end

private

Expand Down
14 changes: 10 additions & 4 deletions lib/rails_icons.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# frozen_string_literal: true

require "icons"

require_relative "rails_icons/version"
require_relative "rails_icons/libraries"
require_relative "rails_icons/configuration"
require_relative "rails_icons/engine"
require_relative "rails_icons/errors"
require_relative "rails_icons/icon"

module RailsIcons
class << self
def configure(&block) = Icons.configure(&block)

def configuration = Icons.configuration
alias_method :config, :configuration

def libraries = Icons.libraries
end
end
12 changes: 8 additions & 4 deletions lib/rails_icons/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def initialize(*arguments)
def validate!
return if custom_library?

raise RailsIcons::LibraryNotFound.new("") if libraries.empty?
raise RailsIcons::LibraryNotFound.new(invalid_libraries.join(", ")) if invalid_libraries.any?
raise Icons::LibraryNotFound.new("") if libraries.empty?
raise Icons::LibraryNotFound.new(invalid_libraries.join(", ")) if invalid_libraries.any?
end

def validatable? = false
Expand All @@ -25,9 +25,13 @@ def libraries
[*options.libraries, options.library].compact_blank
end

def invalid_libraries = libraries.map(&:to_sym).map(&:downcase).reject { RailsIcons.libraries.key?(_1) }
def invalid_libraries
libraries.map(&:to_sym).map(&:downcase).reject { |library| RailsIcons.libraries.key?(library) }
end

def custom_library? = options.custom.present?
def custom_library?
options.custom.present?
end

# Uses `gsub_file` as a read-only operation to check file content. This
# approach is preferred over `File.read` because `gsub_file` is properly stubbed
Expand Down
59 changes: 0 additions & 59 deletions lib/rails_icons/configuration.rb

This file was deleted.

24 changes: 0 additions & 24 deletions lib/rails_icons/configuration/animated.rb

This file was deleted.

78 changes: 0 additions & 78 deletions lib/rails_icons/configuration/boxicons.rb

This file was deleted.

Loading