Sha256: a5f4ff8a157f2c97a83819bb3d3fec46d7219c5b0ca96932eeb88d5cd6e3508c

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

require_relative 'definitions/connection/presenter'

module WebammToRails
  module Features
    module DeviseOnlineable
      class Definition
        def initialize(waml_definition:)
          @waml_definition = waml_definition
        end

        def collection
          return [] if @waml_definition.authentication.none? { |auth| auth.features.include?('online_indication') }

          [
            {
              path: 'app/channels/application_cable/connection.rb',
              content: ::WebammToRails::Features::DeviseOnlineable::Definitions::Connection::Presenter.new(waml_definition: @waml_definition).render
            },
            {
              path: 'app/channels/online_channel.rb',
              content: File.read(File.expand_path('templates/app/channels/online_channel.rb.erb', __dir__))
            },
            {
              path: 'app/models/concerns/devise_onlineable.rb',
              content: File.read(File.expand_path('templates/app/models/concerns/devise_onlineable.rb.erb', __dir__))
            },
            {
              path: 'app/javascript/channels/consumer.js',
              content: File.read(File.expand_path('templates/app/javascript/channels/consumer.js.erb', __dir__))
            },
            {
              path: 'app/javascript/channels/index.js',
              content: File.read(File.expand_path('templates/app/javascript/channels/index.js.erb', __dir__))
            },
            {
              path: 'app/javascript/channels/online_channel.js',
              content: File.read(File.expand_path('templates/app/javascript/channels/online_channel.js.erb', __dir__))
            }
          ]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webamm_to_rails-7.0.1 lib/webamm_to_rails/features/devise_onlineable/definition.rb
webamm_to_rails-7.0.0 lib/webamm_to_rails/features/devise_onlineable/definition.rb