lib/ember-cli-rails.rb in ember-cli-rails-0.5.6 vs lib/ember-cli-rails.rb in ember-cli-rails-0.5.7
- old
+ new
@@ -30,11 +30,11 @@
end
def enable!
@enabled ||= begin
Rails.configuration.assets.paths << root.join("assets").to_s
- at_exit{ cleanup }
+ cleanup
true
end
end
def install_dependencies!
@@ -51,26 +51,34 @@
enable!
each_app(&:compile)
end
def root
- @root ||= Rails.root.join("tmp", "ember-cli-#{uid}")
+ @root ||= tmp.join("ember-cli-#{uid}")
end
def env
@env ||= Helpers.current_environment.inquiry
end
delegate :apps, to: :configuration
private
- def uid
- @uid ||= SecureRandom.uuid
+ def cleanup
+ previous_builds.each(&:rmtree)
end
- def cleanup
- root.rmtree if root.exist?
+ def previous_builds
+ Pathname.glob(tmp.join("ember-cli-*"))
+ end
+
+ def tmp
+ Rails.root.join("tmp")
+ end
+
+ def uid
+ @uid ||= SecureRandom.uuid
end
def each_app
apps.each { |_, app| yield app }
end