Sha256: b12aa1bd879c611348a2ccb63c843ebd557f9a87acac100874da2fadceda66a0

Contents?: true

Size: 865 Bytes

Versions: 10

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

module Stenographer
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc 'Create Stenographer base files'
      source_root File.expand_path('templates', __dir__)

      def add_initializer
        path = "#{Rails.root}/config/initializers/stenographer.rb"

        if File.exist?(path)
          puts 'Skipping config/initializers/stenographer.rb creation, as file already exists!'
        else
          puts 'Adding Stenographer initializer (config/initializers/stenographer.rb)...'

          template 'config/initializers/stenographer.rb', path
        end
      end

      def add_routes
        route 'mount Stenographer::Engine, at: "/stenographer"'
      end

      def add_migrations
        exec('rake stenographer:install:migrations')
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stenographer-rails-0.7.4 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.7.3 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.7.1 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.7.0 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.5 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.4 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.3 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.2 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.1 lib/generators/stenographer/install_generator.rb
stenographer-rails-0.6.0 lib/generators/stenographer/install_generator.rb