Sha256: 270283f7a78f6189a2f5ca45bbad7667f90e71108aae2fe19ae3dfea0242ebda

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module KepplerFrontend
  module Views
    # CodeHandler
    class Install
      def initialize(view_data)
        @view = view_data
      end

      def install
        case @view.format_result
        when 'HTML'
          install_html
        when 'JS'
          install_remote_js
        when 'Action'
          install_only_action
        end
      rescue StandardError
        false
      end

      def install_html
        service('actions').install
        service('html').install
        service('css').install
        service('js').install
        service('routes').install
      rescue StandardError
        false
      end

      def install_remote_js
        service('routes').install
        service('actions').install
        service('remote_js').install
      rescue StandardError
        false
      end

      def install_only_action
        service('routes').install
        service('actions').install
      rescue StandardError
        false
      end

      private

      def service(name)
        model = "KepplerFrontend::Views::#{name.camelize}Handler"
        model.constantize.new(@view)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
keppler-2.1.18 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.17 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.16 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/install.rb