Class: ShopifyApp::Generators::HomeControllerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/shopify_app/home_controller/home_controller_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_home_index_routeObject


22
23
24
# File 'lib/generators/shopify_app/home_controller/home_controller_generator.rb', line 22

def add_home_index_route
  route "root :to => 'home#index'"
end

#create_home_controllerObject


8
9
10
# File 'lib/generators/shopify_app/home_controller/home_controller_generator.rb', line 8

def create_home_controller
  template 'home_controller.rb', 'app/controllers/home_controller.rb'
end

#create_home_index_viewObject


12
13
14
15
16
17
18
19
20
# File 'lib/generators/shopify_app/home_controller/home_controller_generator.rb', line 12

def create_home_index_view
  copy_file 'index.html.erb', 'app/views/home/index.html.erb'
  if embedded_app?
    prepend_to_file(
      'app/views/home/index.html.erb',
      File.read(File.expand_path(find_in_source_paths('shopify_app_ready_script.html.erb')))
    )
  end
end

#embedded_app?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/generators/shopify_app/home_controller/home_controller_generator.rb', line 26

def embedded_app?
  ShopifyApp.configuration.embedded_app?
end