icons 0.0.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +15 -0
- data/Gemfile.lock +162 -0
- data/README.md +66 -0
- data/Rakefile +10 -0
- data/bin/release +34 -0
- data/icons.gemspec +22 -0
- data/lib/icons/assets/animated/bouncing-dots.svg +1 -0
- data/lib/icons/assets/animated/faded-spinner.svg +1 -0
- data/lib/icons/assets/animated/fading-dots.svg +1 -0
- data/lib/icons/assets/animated/trailing-spinner.svg +1 -0
- data/lib/icons/configuration/animated.rb +26 -0
- data/lib/icons/configuration/boxicons.rb +80 -0
- data/lib/icons/configuration/feather.rb +51 -0
- data/lib/icons/configuration/flags.rb +71 -0
- data/lib/icons/configuration/heroicons.rb +107 -0
- data/lib/icons/configuration/linear.rb +51 -0
- data/lib/icons/configuration/lucide.rb +56 -0
- data/lib/icons/configuration/options.rb +20 -0
- data/lib/icons/configuration/phosphor.rb +147 -0
- data/lib/icons/configuration/radix.rb +49 -0
- data/lib/icons/configuration/sidekickicons.rb +107 -0
- data/lib/icons/configuration/tabler.rb +74 -0
- data/lib/icons/configuration/weather.rb +57 -0
- data/lib/icons/configuration.rb +54 -0
- data/lib/icons/errors.rb +24 -0
- data/lib/icons/icon/attributes.rb +66 -0
- data/lib/icons/icon/file_path.rb +74 -0
- data/lib/icons/icon.rb +72 -0
- data/lib/icons/libraries.rb +32 -0
- data/lib/icons/sync/process_variants.rb +80 -0
- data/lib/icons/sync/transformations.rb +29 -0
- data/lib/icons/sync.rb +83 -0
- data/lib/icons/version.rb +3 -0
- data/lib/icons.rb +21 -1
- metadata +66 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Linear
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = nil
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
options.default = default_options
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initializer_config
|
|
20
|
+
<<~RB.indent(2)
|
|
21
|
+
# Override Linear defaults
|
|
22
|
+
# config.libraries.linear.default_variant = "" # Set a default variant for Linear
|
|
23
|
+
# config.libraries.linear.exclude_variants = []
|
|
24
|
+
|
|
25
|
+
# config.libraries.linear.default.css = "size-6"
|
|
26
|
+
# config.libraries.linear.default.stroke_width = "2"
|
|
27
|
+
# config.libraries.linear.default.data = {}
|
|
28
|
+
RB
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def source
|
|
32
|
+
{
|
|
33
|
+
url: "https://github.com/cjpatoilo/linearicons.git",
|
|
34
|
+
variants: {
|
|
35
|
+
".": "dist/svg" # Linear has no variants, store in the top directory
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def default_options
|
|
43
|
+
Options.new.tap do |options|
|
|
44
|
+
options.stroke_width = "2"
|
|
45
|
+
options.css = "size-6"
|
|
46
|
+
options.data = {}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Lucide
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = :outline
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
setup_outline_config(options)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initializer_config
|
|
20
|
+
<<~RB.indent(2)
|
|
21
|
+
# Override Lucide defaults
|
|
22
|
+
# config.libraries.lucide.default_variant = "" # Set a default variant for Lucide
|
|
23
|
+
# config.libraries.lucide.exclude_variants = [] # Exclude specific variants
|
|
24
|
+
|
|
25
|
+
# config.libraries.lucide.outline.default.css = "size-6"
|
|
26
|
+
# config.libraries.lucide.outline.default.stroke_width = "1.5"
|
|
27
|
+
# config.libraries.lucide.outline.default.data = {}
|
|
28
|
+
RB
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def source
|
|
32
|
+
{
|
|
33
|
+
url: "https://github.com/lucide-icons/lucide.git",
|
|
34
|
+
variants: {
|
|
35
|
+
outline: "icons"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def setup_outline_config(options)
|
|
43
|
+
options.outline = Options.new
|
|
44
|
+
options.outline.default = default_outline_options
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def default_outline_options
|
|
48
|
+
Options.new.tap do |options|
|
|
49
|
+
options.stroke_width = "1.5"
|
|
50
|
+
options.css = "size-6"
|
|
51
|
+
options.data = {}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Icons
|
|
4
|
+
class Configuration
|
|
5
|
+
class Options < Hash
|
|
6
|
+
def method_missing(method_name, *args)
|
|
7
|
+
if method_name.to_s.end_with?("=")
|
|
8
|
+
key = method_name.to_s.chomp("=").to_sym
|
|
9
|
+
self[key] = args.first
|
|
10
|
+
else
|
|
11
|
+
self[method_name]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Phosphor
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = :regular
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
setup_bold_config(options)
|
|
16
|
+
setup_duotone_config(options)
|
|
17
|
+
setup_fill_config(options)
|
|
18
|
+
setup_light_config(options)
|
|
19
|
+
setup_regular_config(options)
|
|
20
|
+
setup_thin_config(options)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def initializer_config
|
|
25
|
+
<<~RB.indent(2)
|
|
26
|
+
# Override Phosphor defaults
|
|
27
|
+
# config.libraries.phosphor.default_variant = "" # Set a default variant for Phosphor
|
|
28
|
+
# config.libraries.phosphor.exclude_variants = [:duotone, :thin] # Exclude specific variants
|
|
29
|
+
|
|
30
|
+
# config.libraries.phosphor.bold.default.css = "size-6"
|
|
31
|
+
# config.libraries.phosphor.bold.default.data = {}
|
|
32
|
+
|
|
33
|
+
# config.libraries.phosphor.duotone.default.css = "size-6"
|
|
34
|
+
# config.libraries.phosphor.duotone.default.data = {}
|
|
35
|
+
|
|
36
|
+
# config.libraries.phosphor.fill.default.css = "size-6"
|
|
37
|
+
# config.libraries.phosphor.fill.default.data = {}
|
|
38
|
+
|
|
39
|
+
# config.libraries.phosphor.light.default.css = "size-6"
|
|
40
|
+
# config.libraries.phosphor.light.default.data = {}
|
|
41
|
+
|
|
42
|
+
# config.libraries.phosphor.regular.default.css = "size-6"
|
|
43
|
+
# config.libraries.phosphor.regular.default.data = {}
|
|
44
|
+
|
|
45
|
+
# config.libraries.phosphor.thin.default.css = "size-6"
|
|
46
|
+
# config.libraries.phosphor.thin.default.data = {}
|
|
47
|
+
RB
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def source
|
|
51
|
+
{
|
|
52
|
+
url: "https://github.com/phosphor-icons/core.git",
|
|
53
|
+
variants: {
|
|
54
|
+
bold: "raw/bold",
|
|
55
|
+
duotone: "raw/duotone",
|
|
56
|
+
fill: "raw/fill",
|
|
57
|
+
light: "raw/light",
|
|
58
|
+
regular: "raw/regular",
|
|
59
|
+
thin: "raw/thin"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def transformations
|
|
65
|
+
{
|
|
66
|
+
filenames: {
|
|
67
|
+
delete_suffix: ["-bold", "-duotone", "-fill", "-light", "-thin"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def setup_bold_config(options)
|
|
75
|
+
options.bold = Options.new
|
|
76
|
+
options.bold.default = default_bold_options
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def setup_duotone_config(options)
|
|
80
|
+
options.duotone = Options.new
|
|
81
|
+
options.duotone.default = default_duotone_options
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def setup_fill_config(options)
|
|
85
|
+
options.fill = Options.new
|
|
86
|
+
options.fill.default = default_fill_options
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def setup_light_config(options)
|
|
90
|
+
options.light = Options.new
|
|
91
|
+
options.light.default = default_light_options
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def setup_regular_config(options)
|
|
95
|
+
options.regular = Options.new
|
|
96
|
+
options.regular.default = default_regular_options
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def setup_thin_config(options)
|
|
100
|
+
options.thin = Options.new
|
|
101
|
+
options.thin.default = default_thin_options
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def default_bold_options
|
|
105
|
+
Options.new.tap do |options|
|
|
106
|
+
options.css = "size-6"
|
|
107
|
+
options.data = {}
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def default_duotone_options
|
|
112
|
+
Options.new.tap do |options|
|
|
113
|
+
options.css = "size-6"
|
|
114
|
+
options.data = {}
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def default_fill_options
|
|
119
|
+
Options.new.tap do |options|
|
|
120
|
+
options.css = "size-6"
|
|
121
|
+
options.data = {}
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def default_light_options
|
|
126
|
+
Options.new.tap do |options|
|
|
127
|
+
options.css = "size-6"
|
|
128
|
+
options.data = {}
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def default_regular_options
|
|
133
|
+
Options.new.tap do |options|
|
|
134
|
+
options.css = "size-6"
|
|
135
|
+
options.data = {}
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def default_thin_options
|
|
140
|
+
Options.new.tap do |options|
|
|
141
|
+
options.css = "size-6"
|
|
142
|
+
options.data = {}
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Radix
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = nil
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
options.default = default_options
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initializer_config
|
|
20
|
+
<<~RB.indent(2)
|
|
21
|
+
# Override Radix defaults
|
|
22
|
+
# config.libraries.radix.default_variant = "" # Radix has no variants, this is provided for backwards compatibility
|
|
23
|
+
# config.libraries.radix.exclude_variants = [] # Radix has no variants, this is provided for backwards compatibility
|
|
24
|
+
# config.libraries.radix.default.css = "size-6"
|
|
25
|
+
# config.libraries.radix.default.stroke_width = "2"
|
|
26
|
+
# config.libraries.radix.default.data = {}
|
|
27
|
+
RB
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def source
|
|
31
|
+
{
|
|
32
|
+
url: "https://github.com/radix-ui/icons.git",
|
|
33
|
+
variants: {
|
|
34
|
+
".": "packages/radix-icons/icons" # Radix has no variants, store in the top directory
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def default_options
|
|
42
|
+
Options.new.tap do |options|
|
|
43
|
+
options.css = "size-4"
|
|
44
|
+
options.data = {}
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Sidekickicons
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = :outline
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
setup_outline_config(options)
|
|
16
|
+
setup_solid_config(options)
|
|
17
|
+
setup_mini_config(options)
|
|
18
|
+
setup_micro_config(options)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initializer_config
|
|
23
|
+
<<~RB.indent(2)
|
|
24
|
+
# Override Sidekickicons defaults
|
|
25
|
+
# config.libraries.sidekickicons.default_variant = "" # Set a default variant for Sidekickicons
|
|
26
|
+
# config.libraries.sidekickicons.exclude_variants = [:mini, :micro] # Exclude specific variants
|
|
27
|
+
|
|
28
|
+
# config.libraries.sidekickicons.outline.default.css = "size-6"
|
|
29
|
+
# config.libraries.sidekickicons.outline.default.stroke_width = "1.5"
|
|
30
|
+
# config.libraries.sidekickicons.outline.default.data = {}
|
|
31
|
+
|
|
32
|
+
# config.libraries.sidekickicons.solid.default.css = "size-6"
|
|
33
|
+
# config.libraries.sidekickicons.solid.default.data = {}
|
|
34
|
+
|
|
35
|
+
# config.libraries.sidekickicons.mini.default.css = "size-5"
|
|
36
|
+
# config.libraries.sidekickicons.mini.default.data = {}
|
|
37
|
+
|
|
38
|
+
# config.libraries.sidekickicons.micro.default.css = "size-4"
|
|
39
|
+
# config.libraries.sidekickicons.micro.default.data = {}
|
|
40
|
+
RB
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def source
|
|
44
|
+
{
|
|
45
|
+
url: "https://github.com/ndri/sidekickicons",
|
|
46
|
+
variants: {
|
|
47
|
+
outline: "optimized/24/outline",
|
|
48
|
+
solid: "optimized/24/solid",
|
|
49
|
+
mini: "optimized/20/solid",
|
|
50
|
+
micro: "optimized/16/solid"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def setup_outline_config(options)
|
|
58
|
+
options.outline = Options.new
|
|
59
|
+
options.outline.default = default_outline_options
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def setup_solid_config(options)
|
|
63
|
+
options.solid = Options.new
|
|
64
|
+
options.solid.default = default_solid_options
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def setup_mini_config(options)
|
|
68
|
+
options.mini = Options.new
|
|
69
|
+
options.mini.default = default_mini_options
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def setup_micro_config(options)
|
|
73
|
+
options.micro = Options.new
|
|
74
|
+
options.micro.default = default_micro_options
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def default_solid_options
|
|
78
|
+
Options.new.tap do |options|
|
|
79
|
+
options.css = "size-6"
|
|
80
|
+
options.data = {}
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def default_outline_options
|
|
85
|
+
Options.new.tap do |options|
|
|
86
|
+
options.stroke_width = 1.5
|
|
87
|
+
options.css = "size-6"
|
|
88
|
+
options.data = {}
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def default_mini_options
|
|
93
|
+
Options.new.tap do |options|
|
|
94
|
+
options.css = "size-5"
|
|
95
|
+
options.data = {}
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def default_micro_options
|
|
100
|
+
Options.new.tap do |options|
|
|
101
|
+
options.css = "size-4"
|
|
102
|
+
options.data = {}
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Tabler
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = :outline
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
setup_outline_config(options)
|
|
16
|
+
setup_filled_config(options)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initializer_config
|
|
21
|
+
<<~RB.indent(2)
|
|
22
|
+
# Override Tabler defaults
|
|
23
|
+
# config.libraries.tabler.default_variant = "" # Set a default variant for Tabler
|
|
24
|
+
# config.libraries.tabler.exclude_variants = [] # Exclude specific variants
|
|
25
|
+
|
|
26
|
+
# config.libraries.tabler.regular.default.css = "size-6"
|
|
27
|
+
# config.libraries.tabler.solid.default.css = "size-6"
|
|
28
|
+
# config.libraries.tabler.solid.default.data = {}
|
|
29
|
+
|
|
30
|
+
# config.libraries.tabler.outline.default.css = "size-6"
|
|
31
|
+
# config.libraries.tabler.outline.default.stroke_width = "2"
|
|
32
|
+
# config.libraries.tabler.outline.default.data = {}
|
|
33
|
+
RB
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def source
|
|
37
|
+
{
|
|
38
|
+
url: "https://github.com/tabler/tabler-icons.git",
|
|
39
|
+
variants: {
|
|
40
|
+
filled: "icons/filled",
|
|
41
|
+
outline: "icons/outline"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def setup_outline_config(options)
|
|
49
|
+
options.outline = Options.new
|
|
50
|
+
options.outline.default = default_outline_options
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def setup_filled_config(options)
|
|
54
|
+
options.filled = Options.new
|
|
55
|
+
options.filled.default = default_filled_options
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def default_outline_options
|
|
59
|
+
Options.new.tap do |options|
|
|
60
|
+
options.stroke_width = 2
|
|
61
|
+
options.css = "size-6"
|
|
62
|
+
options.data = {}
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def default_filled_options
|
|
67
|
+
Options.new.tap do |options|
|
|
68
|
+
options.css = "size-6"
|
|
69
|
+
options.data = {}
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "icons/configuration/options"
|
|
4
|
+
|
|
5
|
+
module Icons
|
|
6
|
+
class Configuration
|
|
7
|
+
module Weather
|
|
8
|
+
extend self
|
|
9
|
+
|
|
10
|
+
def config
|
|
11
|
+
Options.new.tap do |options|
|
|
12
|
+
options.default_variant = nil
|
|
13
|
+
options.exclude_variants = []
|
|
14
|
+
|
|
15
|
+
options.default = default_options
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initializer_config
|
|
20
|
+
<<~RB.indent(2)
|
|
21
|
+
# Override Weather defaults
|
|
22
|
+
# config.libraries.weather.default_variant = "" # Set a default variant for Wweather
|
|
23
|
+
# config.libraries.weather.exclude_variants = []
|
|
24
|
+
|
|
25
|
+
# config.libraries.weather.default.css = "size-6"
|
|
26
|
+
# config.libraries.weather.default.data = {}
|
|
27
|
+
RB
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def source
|
|
31
|
+
{
|
|
32
|
+
url: "https://github.com/erikflowers/weather-icons.git",
|
|
33
|
+
variants: {
|
|
34
|
+
".": "svg" # Weather has no variants, store in the top directory
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def transformations
|
|
40
|
+
{
|
|
41
|
+
filenames: {
|
|
42
|
+
delete_prefix: ["wi-"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def default_options
|
|
50
|
+
Options.new.tap do |options|
|
|
51
|
+
options.css = "size-6"
|
|
52
|
+
options.data = {}
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pathname"
|
|
4
|
+
require "icons/configuration/options"
|
|
5
|
+
|
|
6
|
+
module Icons
|
|
7
|
+
class Configuration
|
|
8
|
+
attr_accessor :default_library, :icons_path, :default_variant
|
|
9
|
+
attr_reader :libraries
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@libraries = Options.new
|
|
13
|
+
|
|
14
|
+
set_default_config
|
|
15
|
+
set_libraries_config
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def destination_path
|
|
19
|
+
warn "[DEPRECATION] `destination_path` is deprecated. Use `icons_path` instead."
|
|
20
|
+
|
|
21
|
+
@icons_path
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def destination_path=(value)
|
|
25
|
+
warn "[DEPRECATION] `destination_path=` is deprecated. Use `icons_path=` instead."
|
|
26
|
+
|
|
27
|
+
@icons_path = value
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def base_path
|
|
31
|
+
@base_path ||= Pathname.new(Dir.pwd)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def base_path=(value)
|
|
35
|
+
@base_path = value.is_a?(Pathname) ? value : Pathname.new(value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def set_default_config
|
|
41
|
+
@default_library = nil
|
|
42
|
+
@default_variant = nil
|
|
43
|
+
@icons_path = "app/assets/svg/icons"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def set_libraries_config
|
|
47
|
+
Icons.libraries.each do |name, library|
|
|
48
|
+
@libraries[name] = library.config
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
@libraries[:animated] = Configuration::Animated.config
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/icons/errors.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Icons
|
|
4
|
+
class IconNotFound < StandardError
|
|
5
|
+
def initialize(icon_name = nil)
|
|
6
|
+
if icon_name
|
|
7
|
+
super("The icon `#{icon_name}` is not available. Please check the icon name and try again.")
|
|
8
|
+
else
|
|
9
|
+
super("Icon not found")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class LibraryNotFound < StandardError
|
|
15
|
+
def initialize(library_name)
|
|
16
|
+
if library_name.empty?
|
|
17
|
+
libraries = Icons.libraries.keys.join(", ")
|
|
18
|
+
super("No libraries were specified. Please choose from: #{libraries}")
|
|
19
|
+
else
|
|
20
|
+
super("The library `#{library_name}` is not available. Please check the library name and try again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|