Module: Cardio::Generators::ClassMethods
- Included in:
- Base, Deck::DeckGenerator, MigrationGenerator, ModBase
- Defined in:
- lib/cardio/generators.rb
Overview
methods shared across Generator bases (which inherit from Rails generator classes)
Instance Method Summary collapse
-
#banner ⇒ Object
Override Rails default banner (using card/decko for the command name).
- #banner_command ⇒ Object
-
#namespace(name = nil) ⇒ Object
Override Rails namespace handling so we can put generators in ‘module Cardio`.
- #source_root(path = nil) ⇒ Object
Instance Method Details
#banner ⇒ Object
Override Rails default banner (using card/decko for the command name).
23 24 25 26 27 |
# File 'lib/cardio/generators.rb', line 23 def usage_args = arguments.map(&:usage).join " " text = "\n#{} generate #{namespace} #{usage_args} [options]".green text.gsub(/\s+/, " ") end |
#banner_command ⇒ Object
29 30 31 |
# File 'lib/cardio/generators.rb', line 29 def Command.bin_name end |
#namespace(name = nil) ⇒ Object
Override Rails namespace handling so we can put generators in ‘module Cardio`
34 35 36 37 |
# File 'lib/cardio/generators.rb', line 34 def namespace name=nil return super if name @namespace ||= super.sub(/cardio:/, "") end |
#source_root(path = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/cardio/generators.rb', line 12 def source_root path=nil if path @_card_source_root = path else @_card_source_root ||= File.( "../../generators/#{generator_name}/templates", __FILE__ ) end end |