Sha256: c1c5b1103149bcb0890a2d5d05b6eb5d7ac9cb10d9c0869dccee9bb59aa858c3

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "fileutils"
require "ember_cli/engine"
require "ember-cli-rails-assets"
require "ember_cli/errors"

module EmberCli
  extend self

  autoload :App,           "ember_cli/app"
  autoload :Configuration, "ember_cli/configuration"
  autoload :Helpers,       "ember_cli/helpers"
  autoload :PathSet,       "ember_cli/path_set"

  def configure
    yield configuration
  end

  def configuration
    Configuration.instance
  end

  def app(name)
    apps.fetch(name) do
      fail KeyError, "#{name.inspect} app is not defined"
    end
  end

  def build(name)
    app(name).build
  end

  alias_method :[], :app

  def skip?
    ENV["SKIP_EMBER"].present?
  end

  def install_dependencies!
    each_app(&:install_dependencies)
  end

  def test!
    each_app(&:test)
  end

  def compile!
    cleanup!
    each_app(&:compile)
  end

  def root
    @root ||= Rails.root.join("tmp", "ember-cli").tap(&:mkpath)
  end

  def env
    @env ||= Helpers.current_environment.inquiry
  end

  delegate :apps, to: :configuration

  private

  def cleanup!
    root.children.each { |tmp_file| FileUtils.rm_rf(tmp_file) }
  end

  def each_app
    apps.each { |_, app| yield app }
  end
end

EmberCLI = EmberCli

Version data entries

1 entries across 1 versions & 1 rubygems

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