Class: Flashee::Generators::Install::FoundationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/flashee/install/foundation_generator.rb

Overview

Houses the logic to install flashee into the target rails app using the foundation CSS framework. FoundationGenerator translates to the ‘flashee:install:foundation` command.

Instance Method Summary collapse

Instance Method Details

#create_helperObject

Creates foundation mode helper.



9
10
11
12
13
14
# File 'lib/generators/flashee/install/foundation_generator.rb', line 9

def create_helper
  @helper_file = Builders.helper_builder "foundation"
  helper_target_path = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")

  Builders.file_builder helper_target_path, @helper_file
end

#create_partialObject

Creates foundation mode view partial



17
18
19
# File 'lib/generators/flashee/install/foundation_generator.rb', line 17

def create_partial
  Builders.view_builder "foundation"
end

#print_post_install_infoObject

After installation completes, print the ERB snippet to the command line.



22
23
24
25
26
27
28
29
30
# File 'lib/generators/flashee/install/foundation_generator.rb', line 22

def print_post_install_info
  puts "==================================================================="
  puts "# One more step to go, To render the                              #"
  puts "# flash messages, you will need to add                            #"
  puts "# this line to application.html.erb.                              #"
  puts "#                                                                 #"
  puts '# <%= render partial: "partials/flash_messages", flash: flash %>  #'
  puts "==================================================================="
end