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
16 changes: 8 additions & 8 deletions gemfiles/rails_7_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rails_icons (1.5.1)
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails (>= 7.0)

Expand Down Expand Up @@ -115,7 +115,8 @@ GEM
marcel (1.0.4)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
mutex_m (0.3.0)
net-imap (0.5.9)
date
Expand All @@ -127,9 +128,8 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-gnu)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
Expand Down Expand Up @@ -223,9 +223,9 @@ GEM
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
Expand Down
18 changes: 8 additions & 10 deletions gemfiles/rails_7_1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rails_icons (1.5.1)
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails (>= 7.0)

Expand Down Expand Up @@ -129,7 +129,8 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
mutex_m (0.3.0)
net-imap (0.5.9)
date
Expand All @@ -141,11 +142,8 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-gnu)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
Expand Down Expand Up @@ -245,9 +243,9 @@ GEM
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
Expand Down
18 changes: 8 additions & 10 deletions gemfiles/rails_7_2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rails_icons (1.5.1)
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails (>= 7.0)

Expand Down Expand Up @@ -123,7 +123,8 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
net-imap (0.5.9)
date
net-protocol
Expand All @@ -134,11 +135,8 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-gnu)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
Expand Down Expand Up @@ -238,9 +236,9 @@ GEM
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
useragent (0.16.11)
websocket-driver (0.8.0)
base64
Expand Down
16 changes: 8 additions & 8 deletions gemfiles/rails_8_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rails_icons (1.5.1)
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails (>= 7.0)

Expand Down Expand Up @@ -121,7 +121,8 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
net-imap (0.5.9)
date
net-protocol
Expand All @@ -132,9 +133,8 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-gnu)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
Expand Down Expand Up @@ -234,9 +234,9 @@ GEM
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.0.3)
useragent (0.16.11)
websocket-driver (0.8.0)
Expand Down
28 changes: 8 additions & 20 deletions gemfiles/rails_main.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ GIT
PATH
remote: ..
specs:
rails_icons (1.5.1)
rails_icons (1.6.0)
nokogiri (~> 1.16, >= 1.16.4)
rails (>= 7.0)

Expand Down Expand Up @@ -153,7 +153,8 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
net-imap (0.5.9)
date
net-protocol
Expand All @@ -164,21 +165,8 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.9-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.9-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.9-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.9-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-musl)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
Expand Down Expand Up @@ -257,9 +245,9 @@ GEM
tsort (0.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.0.3)
useragent (0.16.11)
websocket-driver (0.8.0)
Expand Down
11 changes: 9 additions & 2 deletions lib/generators/rails_icons/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class InstallGenerator < RailsIcons::BaseGenerator

desc "Install Rails Icons with the chosen libraries. This creates the configuration initializer and will sync the icons."

class_option :library, type: :string, desc: "Choose libraries (#{RailsIcons.libraries.keys.join("/")})"
class_option :libraries, type: :array, default: [], desc: "Choose libraries (#{RailsIcons.libraries.keys.join("/")})"
class_option :destination, type: :string, default: RailsIcons.configuration.icons_path, desc: "Specify destination folder for icons"
class_option :skip_sync, type: :boolean, default: false
Expand All @@ -17,14 +18,20 @@ def initializer_generator
end

def sync_generator
return if options[:skip_sync] || options[:libraries].blank?
return if options[:skip_sync] || libraries.blank?

generate("rails_icons:sync", *attributes)
end

private

def attributes = ["--libraries=#{options[:libraries].map(&:downcase).join(" ")}", "--destination=#{options[:destination]}"].join(" ")
def attributes
["--libraries=#{libraries.map(&:downcase).join(" ")}", "--destination=#{options[:destination]}"].join(" ")
end

def libraries
[*options.libraries, options.library].compact_blank
end

def validatable? = true
end
Expand Down
8 changes: 6 additions & 2 deletions lib/rails_icons/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ def initialize(*arguments)
def validate!
return if custom_library?

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

def validatable? = false

def invalid_libraries = options.libraries.map(&:to_sym).map(&:downcase).reject { RailsIcons.libraries.key?(_1) }
def libraries
[*options.libraries, options.library].compact_blank
end

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

def custom_library? = options.custom.present?

Expand Down