Sha256: 1f5608adc14d6566c2b9d71206468a6f653a447095182f009f19fe8be63f4b73

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'jsimple/version'

require 'jsimple/builder'
require 'jsimple/railtie' if defined?(Rails)

require 'hot_reload_proxy'

module Jsimple
  def self.app(name, props: {}, id: nil)
    Builder.app_factory(name, props, id)
  end

  # Config
  DEFAULT_HOST = 'localhost'
  DEFAULT_PORT = '3100'
  DEFAULT_DEVELOPMENT = defined?(Rails) ? Rails.env.development? : false
  DEFAULT_JS_START_COMMAND = 'start'
  @host = DEFAULT_HOST
  @port = DEFAULT_PORT
  @development = DEFAULT_DEVELOPMENT
  @js_start_command = DEFAULT_JS_START_COMMAND

  def self.host=(host)
    HotReloadProxy::Proxy.host = host
    @host = host
  end

  def self.port=(port)
    HotReloadProxy::Proxy.port = port
    @port = port
  end

  def self.development=(development)
    @development = development
  end

  def self.js_start_command=(js_start_command)
    @js_start_command = js_start_command
  end

  def self.host
    @host
  end

  def self.port
    @port
  end

  def self.development
    @development
  end

  def self.js_start_command
    @js_start_command
  end

  def self.reset!
    @host = DEFAULT_HOST
    @port = DEFAULT_PORT
    @development = DEFAULT_DEVELOPMENT
    @js_start_command = DEFAULT_JS_START_COMMAND
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsimple-0.2.0 lib/jsimple.rb