Class: Protoform::InstallGenerator

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

Constant Summary collapse

APPLICATION_CONFIGURATION_PATH =
Rails.root.join("config/application.rb")

Instance Method Summary collapse

Instance Method Details

#autoload_componentsObject



18
19
20
21
22
23
24
25
26
# File 'lib/generators/protoform/install/install_generator.rb', line 18

def autoload_components
  return unless APPLICATION_CONFIGURATION_PATH.exist?

  inject_into_class(
    APPLICATION_CONFIGURATION_PATH,
    "Application",
    %(    config.autoload_paths << "\#{root}/app/views/forms"\n)
  )
end

#create_application_formObject



28
29
30
31
# File 'lib/generators/protoform/install/install_generator.rb', line 28

def create_application_form
  template "application_form.rb",
           Rails.root.join("app/views/forms/application_form.rb")
end

#install_phlex_railsObject



11
12
13
14
15
16
# File 'lib/generators/protoform/install/install_generator.rb', line 11

def install_phlex_rails
  return if gem_in_bundle? "phlex-rails"

  gem "phlex-rails"
  generate "phlex:install"
end