From c11588ef838ac2a4592b91b8fc987483db859531 Mon Sep 17 00:00:00 2001 From: Sean Doyle Date: Fri, 14 Jul 2017 13:15:23 -0400 Subject: [PATCH] Introduce `lib/ember_cli.rb` So that the files and tests follow Ruby's naming idioms, move the contents of `lib/ember-cli-rails.rb` to `lib/ember_cli.rb`, to match the constant that the file contains. --- lib/ember-cli-rails.rb | 68 +----------------------------------------- lib/ember_cli.rb | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 67 deletions(-) create mode 100644 lib/ember_cli.rb diff --git a/lib/ember-cli-rails.rb b/lib/ember-cli-rails.rb index 1b6ed959..d6e892f1 100644 --- a/lib/ember-cli-rails.rb +++ b/lib/ember-cli-rails.rb @@ -1,69 +1,3 @@ -require "fileutils" -require "ember-cli-rails-assets" -require "ember_cli/engine" -require "ember_cli/configuration" -require "ember_cli/helpers" -require "ember_cli/errors" - -module EmberCli - extend self - - 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 - 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 +require "ember_cli" EmberCLI = EmberCli diff --git a/lib/ember_cli.rb b/lib/ember_cli.rb new file mode 100644 index 00000000..1a23478f --- /dev/null +++ b/lib/ember_cli.rb @@ -0,0 +1,67 @@ +require "fileutils" +require "ember-cli-rails-assets" +require "ember_cli/engine" +require "ember_cli/configuration" +require "ember_cli/helpers" +require "ember_cli/errors" + +module EmberCli + extend self + + 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 + 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