Sha256: 52ab22fd4d4d3b026a877c7960d0485c8555e9f9b900e12c3e01884e83dde0e4

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

require "ember-cli/railtie" if defined?(Rails)

module EmberCLI
  extend self

  autoload :BuildServer,   "ember-cli/build_server"
  autoload :Configuration, "ember-cli/configuration"
  autoload :RackServer,    "ember-cli/rack_server"
  autoload :ViewHelpers,   "ember-cli/view_helpers"
  autoload :Helpers,       "ember-cli/helpers"

  def configure
    yield configuration
  end

  def configuration
    Configuration.instance
  end

  def prepare!
    Rack::Server.prepend RackServer
    Rails.configuration.assets.paths << root.join("assets").to_s
    at_exit{ cleanup }
  end

  def start!
    configuration.apps.values.each(&:start)
  end

  def stop!
    configuration.apps.values.each(&:stop)
  end

  def root
    @root ||= Rails.root.join("tmp", "ember-cli-#{uid}")
  end

  private

  def uid
    @uid ||= SecureRandom.uuid
  end

  def cleanup
    root.rmtree if root.exist?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-cli-rails-0.0.2 lib/ember-cli-rails.rb