class Para::InstallGenerator

Public Instance Methods

bundle_install() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 42
def bundle_install
  Bundler.with_clean_env do
    run 'bundle install'
  end
end
copy_components_config() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 15
def copy_components_config
  copy_file 'components.rb', 'config/components.rb'
end
copy_initializer_file() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 11
def copy_initializer_file
  copy_file 'initializer.rb', 'config/initializers/para.rb'
end
copy_migrations() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 19
def copy_migrations
  rake 'para_engine:install:migrations'
end
create_default_admin() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 61
def create_default_admin
  generate 'para:admin_user'
end
devise_install() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 48
def devise_install
  generate 'devise:install'
  generate 'devise', 'AdminUser'
end
final_message() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 71
    def final_message
      say <<~MESSAGE

        *******************************************************************************

        Para was successfully installed in your app.

        Please not that your should define your root path in your application routes.rb
        for the Para admin panel to work :

          e.g.: root to: 'home#index'

        *******************************************************************************

      MESSAGE
    end
install_gems() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 23
def install_gems
  gemfile_contents = File.read(Rails.root.join('Gemfile'))

  [
    ['devise', '>= 3.0'],
    # Allows for installing default wrappers and bootstrap adapters
    # This should be avoided when add an initializer namespaced to the
    # para environment
    ['simple_form'],
    # Pull requests are pending, and I don't want to release the gem
    # under another name to be able to depend on it
    ['kaminari', '>= 0.16.1'],
    ['ransack', '>= 1.4.1'],
    ['bootstrap-kaminari-views', '>= 0.0.5']
  ].each do |name, *args|
    gem name, *args unless gemfile_contents.match(/gem ['"]#{name}['"]/)
  end
end
migrate() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 57
def migrate
  rake 'db:migrate'
end
mount_engine() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 65
def mount_engine
  say 'Mounting Para engine in routes'
  gsub_file 'config/routes.rb', /para_at.+\n/, ''
  route "para_at '/'"
end
simple_form_install() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 53
def simple_form_install
  generate 'simple_form:install', '--bootstrap'
end
welcome() click to toggle source
# File lib/generators/para/install/install_generator.rb, line 7
def welcome
  say 'Installing para engine ...'
end