Sha256: 8c11a7dfe4f7c6b778272ea619e5cc9f1e4110f979a7d94fd3d6a5362c679248

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

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

      def uninstall
        case @view.format_result
        when 'HTML'
          uninstall_html
        when 'JS'
          uninstall_remote_js
        when 'Action'
          uninstall_only_action
        end
      rescue StandardError
        false
      end

      def uninstall_html
        service('routes').uninstall
        service('actions').uninstall
        service('html').uninstall
        service('css').uninstall
        service('js').uninstall
        true
      rescue StandardError
        false
      end

      def uninstall_remote_js
        service('routes').uninstall
        service('actions').uninstall
        service('remote_js').uninstall
        true
      rescue StandardError
        false
      end

      def uninstall_only_action
        service('routes').uninstall
        service('actions').uninstall
        true
      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/uninstall.rb
keppler-2.1.17 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.16 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/uninstall.rb