Class: UtilityPalettes::Generators::GenerateGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/utility_palettes/generate_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.config_format_warnObject

TODO: add links to README for migration



26
27
28
# File 'lib/generators/utility_palettes/generate_generator.rb', line 26

def self.config_format_warn
  warn 'WARNING: Utility Palettes now uses an initializer to set config. You need to migrate and remove your YML/JSON file.'
end

.disabled_warnObject

TODO: add links to README for environment setting



31
32
33
# File 'lib/generators/utility_palettes/generate_generator.rb', line 31

def self.disabled_warn
  warn 'ERROR: Utility Palettes is disabled for this environment. Palettes will not be generated.'
end

Instance Method Details

#generate_utility_palettesObject



13
14
15
16
17
18
19
20
21
# File 'lib/generators/utility_palettes/generate_generator.rb', line 13

def generate_utility_palettes
  self.class.config_format_warn if File.exist?('config/utility_palettes.yml') || File.exist?('config/utility_palettes.json')

  if UtilityPalettes.configuration.enable_environments.include?(Rails.env.to_sym)
    UtilityPalettes::Palettes.generate
  else
    self.class.disabled_warn
  end
end