utility_colors 1.0.3 → 1.0.4
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/README.md +1 -1
- data/lib/generators/utility_colors/config_generator.rb +20 -13
- data/lib/generators/utility_colors/generate_generator.rb +38 -31
- data/lib/utility_colors/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045d1d5474d0981fae687c89a3c6bfb5e74a39dd7edeb27f7420d89b2a9e8790
|
4
|
+
data.tar.gz: 6c383308b0e21e9753a68736ffc9fac4b0218ec8fd991d0aebcc176aa1cc8ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ddf0bac91411dd6772e47ef52c5285ae638052a7c65d5c0a449141e75185330ef311648b5a84d80cbc2b7696cc45ec900f006e48e2b172807714bd47c9ff13
|
7
|
+
data.tar.gz: 62fcbb15578dbe19df99907c3f5bfa491c321659cc71034c8ffe9c9b3b11c7fd107049f13a333874eb23e7a2e9fe4fd565a75386ded38f6379e79dbb321717e9
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# UtilityColors
|
2
2
|
|
3
|
-

|
4
4
|
[](https://rubygems.org/gems/utility_colors)
|
5
5
|
|
6
6
|
> Generate your own colour specific classes in an instance.
|
@@ -1,13 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rails/generators'
|
5
|
+
require 'rails/generators/base'
|
6
|
+
rescue LoadError => e
|
7
|
+
raise LoadError, "railties gem is required for generators. Add 'railties' to your Gemfile: #{e.message}"
|
8
|
+
end
|
9
|
+
|
10
|
+
module UtilityColors
|
11
|
+
module Generators
|
12
|
+
class ConfigGenerator < Rails::Generators::Base
|
13
|
+
source_root File.expand_path('../../..', __dir__)
|
14
|
+
|
15
|
+
def copy_config
|
16
|
+
copy_file 'lib/generators/templates/config/utility_colors.rb', 'config/initializers/utility_colors.rb'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,31 +1,38 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rails/generators'
|
5
|
+
require 'rails/generators/base'
|
6
|
+
rescue LoadError => e
|
7
|
+
raise LoadError, "railties gem is required for generators. Add 'railties' to your Gemfile: #{e.message}"
|
8
|
+
end
|
9
|
+
|
10
|
+
module UtilityColors
|
11
|
+
module Generators
|
12
|
+
class GenerateGenerator < Rails::Generators::Base
|
13
|
+
def generate_utility_colors
|
14
|
+
# TODO: check if the v0.1.8 scss files exists
|
15
|
+
# "app/app/assets/stylesheets/utility_colors_files" directory
|
16
|
+
self.class.config_format_warn if File.exist?('config/utility_colors.yml') || File.exist?('config/utility_colors.json')
|
17
|
+
|
18
|
+
if UtilityColors.configuration.enable_environments.include?(Rails.env.to_sym)
|
19
|
+
UtilityColors::Colors.generate
|
20
|
+
else
|
21
|
+
self.class.disabled_warn
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# TODO: add links to README for migration
|
28
|
+
def self.config_format_warn
|
29
|
+
warn 'WARNING: Utility Colors now uses an initializer to set config. You need to migrate and remove your YML/JSON file.'
|
30
|
+
end
|
31
|
+
|
32
|
+
# TODO: add links to README for environment setting
|
33
|
+
def self.disabled_warn
|
34
|
+
warn 'ERROR: Utility Colors is disabled for this environment. Color classes will not be generated.'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|