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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7521e21690d915d92d318dd9b2ca27693a63e12fe4ae526c4874b1778bc5f453
4
- data.tar.gz: dc58506f7b9584b21c7cab48ee3d9338a08c497458417234b84030897b7e7cce
3
+ metadata.gz: 045d1d5474d0981fae687c89a3c6bfb5e74a39dd7edeb27f7420d89b2a9e8790
4
+ data.tar.gz: 6c383308b0e21e9753a68736ffc9fac4b0218ec8fd991d0aebcc176aa1cc8ff6
5
5
  SHA512:
6
- metadata.gz: 641424d982c0bbe047121d14edd53f9cf4e53f25714f8f23d7afd03e1308bb8666026ce6ee75e56de3a742acf366a24e0f742684d6a5d06f22805d6713ee92ec
7
- data.tar.gz: 7c0e1da6c6c13eb091cbef4c19765fb5cc7d6c1f4e95ad5309367285a451a627a0ca0d00ef328a9b5e79aa6e497bd6a1452a02d2e99931d6a5d461a1541b83a5
6
+ metadata.gz: f3ddf0bac91411dd6772e47ef52c5285ae638052a7c65d5c0a449141e75185330ef311648b5a84d80cbc2b7696cc45ec900f006e48e2b172807714bd47c9ff13
7
+ data.tar.gz: 62fcbb15578dbe19df99907c3f5bfa491c321659cc71034c8ffe9c9b3b11c7fd107049f13a333874eb23e7a2e9fe4fd565a75386ded38f6379e79dbb321717e9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # UtilityColors
2
2
 
3
- ![Static Badge](https://img.shields.io/badge/Gem_Version-1.0.0-blue)
3
+ ![Static Badge](https://img.shields.io/badge/Gem_Version-1.0.4-blue)
4
4
  [![Static Badge](https://img.shields.io/badge/RubyGems-red)](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
- module UtilityColors
4
- module Generators
5
- class ConfigGenerator < Rails::Generators::Base
6
- source_root File.expand_path('../../..', __dir__)
7
-
8
- def copy_config
9
- copy_file 'lib/generators/templates/config/utility_colors.rb', 'config/initializers/utility_colors.rb'
10
- end
11
- end
12
- end
13
- end
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
- module UtilityColors
4
- module Generators
5
- class GenerateGenerator < Rails::Generators::Base
6
- def generate_utility_colors
7
- # TODO: check if the v0.1.8 scss files exists
8
- # "app/app/assets/stylesheets/utility_colors_files" directory
9
- self.class.config_format_warn if File.exist?('config/utility_colors.yml') || File.exist?('config/utility_colors.json')
10
-
11
- if UtilityColors.configuration.enable_environments.include?(Rails.env.to_sym)
12
- UtilityColors::Colors.generate
13
- else
14
- self.class.disabled_warn
15
- end
16
- end
17
-
18
- private
19
-
20
- # TODO: add links to README for migration
21
- def self.config_format_warn
22
- warn 'WARNING: Utility Colors now uses an initializer to set config. You need to migrate and remove your YML/JSON file.'
23
- end
24
-
25
- # TODO: add links to README for environment setting
26
- def self.disabled_warn
27
- warn 'ERROR: Utility Colors is disabled for this environment. Color classes will not be generated.'
28
- end
29
- end
30
- end
31
- end
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UtilityColors
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utility_colors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Davis