lib/ember-cli-rails.rb in ember-cli-rails-0.5.8 vs lib/ember-cli-rails.rb in ember-cli-rails-0.6.0
- old
+ new
@@ -22,66 +22,46 @@
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 enable!
- @enabled ||= begin
- Rails.configuration.assets.paths << root.join("assets").to_s
- cleanup
- true
- end
- end
-
def install_dependencies!
- enable!
each_app(&:install_dependencies)
end
def test!
- enable!
each_app(&:test)
end
def compile!
- enable!
+ cleanup!
each_app(&:compile)
end
def root
- @root ||= tmp.join("ember-cli-#{uid}")
+ @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
- previous_builds.each do |path|
- FileUtils.rm_rf(path)
- end
- end
-
- def previous_builds
- Pathname.glob(tmp.join("ember-cli-*"))
- end
-
- def tmp
- Rails.root.join("tmp")
- end
-
- def uid
- @uid ||= SecureRandom.uuid
+ def cleanup!
+ root.children.each { |tmp_file| FileUtils.rm_rf(tmp_file) }
end
def each_app
apps.each { |_, app| yield app }
end