Sha256: 18575a00d7714d17a4a8cfd4b81d89c63420bb1c5855156891e2724fdf4de876

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module Isomorfeus
  module Puppetmaster
    class << self
      attr_accessor :app, :download_path, :server_port, :session
      attr_writer :server_host, :server_scheme

      def boot_app
        @served_app = Isomorfeus::Puppetmaster::Server.new(app, port: server_port, host: server_host).boot
      end

      def block_source_code(&block)
        source_block = Parser::CurrentRuby.parse(block.source).children.last
        source_block = source_block.children.last if source_block.type == :block
        Unparser.unparse(source_block)
      end

      def compile_ruby_source(source_code)
        Opal.compile(source_code)
      end

      def opal_prelude
        @opal_prelude ||= build_opal_prelude
      end

      def served_app
        @served_app ||= boot_app
      end

      def server_host
        @server_host ||= '127.0.0.1'
      end

      def server_scheme
        @server_scheme ||= 'http'
      end

      private

      def build_opal_prelude
        Opal::Builder.new.build_str("require 'opal'\n", 'puppetmaster_opal_prelude').to_s
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
isomorfeus-puppetmaster-0.6.3 lib/isomorfeus/puppetmaster.rb
isomorfeus-puppetmaster-0.6.2 lib/isomorfeus/puppetmaster.rb
isomorfeus-puppetmaster-0.6.1 lib/isomorfeus/puppetmaster.rb
isomorfeus-puppetmaster-0.6.0 lib/isomorfeus/puppetmaster.rb