Sha256: ee1d44e1aea01bb9301c31d00168242541f4b7c0b4c03e294c06a1072fd75a6d

Contents?: true

Size: 1 KB

Versions: 13

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'rails/generators'

class BrowseEverything::ConfigGenerator < Rails::Generators::Base
  desc <<-DESC
  This generator makes the following changes to your application:
   1. Creates config/browse_everything_providers.yml with a placeholder value
   2. Modifies your app's routes.rb to mount BrowseEverything at /browse
  DESC
  source_root File.expand_path('templates', __dir__)

  def inject_routes
    insert_into_file 'config/routes.rb', after: '.draw do' do
      %(
        mount BrowseEverything::Engine => '/browse')
    end
  end

  def copy_example_config
    FileUtils.rm 'config/browse_everything_providers.yml', force: true if File.exist? 'config/browse_everything_providers.yml'
    copy_file 'browse_everything_providers.yml.example', 'config/browse_everything_providers.yml', force: true
  end

  def insert_file_system_path
    insert_into_file 'config/browse_everything_providers.yml', before: '# dropbox:' do
      "file_system:\n  home: #{Rails.root}\n"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
browse-everything-1.5.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.4.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.3.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.2.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.1.2 lib/generators/browse_everything/config_generator.rb
browse-everything-1.1.1 lib/generators/browse_everything/config_generator.rb
browse-everything-1.1.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.0.2 lib/generators/browse_everything/config_generator.rb
browse-everything-1.0.1 lib/generators/browse_everything/config_generator.rb
browse-everything-1.0.0 lib/generators/browse_everything/config_generator.rb
browse-everything-1.0.0.rc2 lib/generators/browse_everything/config_generator.rb
browse-everything-1.0.0.rc1 lib/generators/browse_everything/config_generator.rb
browse-everything-0.16.1 lib/generators/browse_everything/config_generator.rb