lib/hanami/controller/configuration.rb in hanami-controller-1.0.0.beta1 vs lib/hanami/controller/configuration.rb in hanami-controller-1.0.0.beta2
- old
+ new
@@ -649,15 +649,19 @@
# @api private
def mime_type_for(format)
@formats.key(format)
end
+ # @api private
+ # @since 1.0.0.beta2
+ attr_reader :root_directory
+
def public_directory(value = nil)
if value.nil?
@public_directory
else
- @public_directory = Pathname.new(Dir.pwd).join(value).to_s
+ @public_directory = root_directory.join(value).to_s
end
end
# Duplicate by copying the settings in a new instance.
#
@@ -704,10 +708,11 @@
@default_request_format = nil
@default_response_format = nil
@default_charset = nil
@default_headers = {}
@cookies = {}
- @public_directory = ::File.join(Dir.pwd, "public")
+ @root_directory = ::Pathname.new(Dir.pwd).realpath
+ @public_directory = root_directory.join(DEFAULT_PUBLIC_DIRECTORY).to_s
@action_module = ::Hanami::Action
end
# Copy the configuration for the given action
#