lib/ember_cli/path_set.rb in ember-cli-rails-0.6.1 vs lib/ember_cli/path_set.rb in ember-cli-rails-0.7.0
- old
+ new
@@ -1,10 +1,11 @@
+require "ember_cli/helpers"
+
module EmberCli
class PathSet
- def initialize(app:, rails_root:, ember_cli_root:, environment:, configuration:)
+ def initialize(app:, rails_root:, ember_cli_root:, environment:)
@app = app
- @configuration = configuration
@rails_root = rails_root
@environment = environment
@ember_cli_root = ember_cli_root
end
@@ -16,14 +17,10 @@
else
rails_root.join(path)
end
end
- def index_file
- dist.join("index.html")
- end
-
def tmp
@tmp ||= root.join("tmp").tap(&:mkpath)
end
def log
@@ -63,11 +60,11 @@
@build_error_file ||= tmp.join("error.txt")
end
def bower
@bower ||= begin
- bower_path = app_options.fetch(:bower_path) { configuration.bower_path }
+ bower_path = app_options.fetch(:bower_path) { which("bower") }
bower_path.tap do |path|
unless Pathname(path).executable?
fail DependencyError.new <<-MSG.strip_heredoc
Bower is required by EmberCLI
@@ -80,27 +77,35 @@
end
end
end
def npm
- @npm ||= app_options.fetch(:npm_path) { configuration.npm_path }
+ @npm ||= app_options.fetch(:npm_path) { which("npm") }
end
def tee
- @tee ||= app_options.fetch(:tee_path) { configuration.tee_path }
+ @tee ||= app_options.fetch(:tee_path) { which("tee") }
end
def bundler
- @bundler ||= app_options.fetch(:bundler_path) do
- configuration.bundler_path
- end
+ @bundler ||= app_options.fetch(:bundler_path) { which("bundler") }
end
private
- attr_reader :app, :configuration, :ember_cli_root, :environment, :rails_root
+ attr_reader :app, :ember_cli_root, :environment, :rails_root
- delegate :name, :options, to: :app, prefix: true
+ def app_name
+ app.name
+ end
+
+ def app_options
+ app.options
+ end
+
+ def which(executable)
+ Helpers.which(executable)
+ end
def logs
rails_root.join("log").tap(&:mkpath)
end