lib/ember-cli/app.rb in ember-cli-rails-0.1.5 vs lib/ember-cli/app.rb in ember-cli-rails-0.1.6
- old
+ new
@@ -13,15 +13,16 @@
@name, @options = name.to_s, options
end
def compile
prepare
- silence_stream(STDOUT){ exec command }
+ silence_build { exec command }
check_for_build_error!
end
def install_dependencies
+ exec "#{bundler_path} install" if gemfile_path.exist?
exec "#{npm_path} install"
end
def run
prepare
@@ -90,12 +91,39 @@
private
delegate :match_version?, :non_production?, to: Helpers
delegate :configuration, to: EmberCLI
- delegate :tee_path, :npm_path, to: :configuration
+ delegate :tee_path, :npm_path, :bundler_path, to: :configuration
+ def default_app_path
+ path = Rails.root.join("app", name)
+
+ return name unless path.directory?
+
+ ActiveSupport::Deprecation.warn <<-MSG.strip_heredoc
+ We have found that placing your EmberCLI
+ application inside Rails' app has negative performance implications.
+
+ Please see, https://github.com/rwz/ember-cli-rails/issues/66 for more
+ detailed information.
+
+ It is now reccomended to place your EmberCLI application into the Rails
+ root path.
+ MSG
+
+ path
+ end
+
+ def silence_build(&block)
+ if ENV.fetch("EMBER_CLI_RAILS_VERBOSE"){ !Helpers.non_production? }
+ yield
+ else
+ silence_stream(STDOUT, &block)
+ end
+ end
+
def build_timeout
options.fetch(:build_timeout){ configuration.build_timeout }
end
def lockfile
@@ -189,12 +217,13 @@
@ember_app_name ||= options.fetch(:name){ package_json.fetch(:name) }
end
def app_path
@app_path ||= begin
- path = options.fetch(:path){ Rails.root.join("app", name) }
- Pathname.new(path)
+ path = options.fetch(:path){ default_app_path }
+ pathname = Pathname.new(path)
+ app_path = pathname.absolute?? pathname : Rails.root.join(path)
end
end
def tmp_path
@tmp_path ||= begin
@@ -239,10 +268,15 @@
def env_hash
ENV.clone.tap do |vars|
vars.store "DISABLE_FINGERPRINTING", "true"
vars.store "EXCLUDE_EMBER_ASSETS", excluded_ember_deps
+ vars.store "BUNDLE_GEMFILE", gemfile_path.to_s
end
+ end
+
+ def gemfile_path
+ app_path.join("Gemfile")
end
def exec(cmd, options={})
method_name = options.fetch(:method, :system)