Sha256: f97a126838e7eb37b82b02a293f7dc7ab368d7d7489aea4c3990a080698d5eaa

Contents?: true

Size: 647 Bytes

Versions: 4

Compression:

Stored size: 647 Bytes

Contents

module Grape
  module Generators
    module Transformations
      class InstallGenerator < ::Rails::Generators::Base

        source_root File.expand_path("../../templates", __FILE__)

        def copy_initializer
          template "grape-transformations.rb", "config/initializers/grape-transformations.rb"
        end

        def generate_layout
          create_file "app/api/#{app_name}/entities/.keep"
        end

        private

        # Returns the app name
        # @return [String]
        def app_name
          Rails.application.config.session_options[:key].sub(/^_/,'').sub(/_session/,'')
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grape-transformations-0.0.5 lib/grape/generators/transformations/install_generator.rb
grape-transformations-0.0.4 lib/grape/generators/transformations/install_generator.rb
grape-transformations-0.0.3 lib/grape/generators/transformations/install_generator.rb
grape-transformations-0.0.2 lib/grape/generators/transformations/install_generator.rb