Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 51 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,75 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activemodel (6.1.4.1)
activesupport (= 6.1.4.1)
activesupport (6.1.4.1)
activemodel (7.1.2)
activesupport (= 7.1.2)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
bson (4.12.1)
coderay (1.1.0)
concurrent-ruby (1.1.9)
diff-lcs (1.4.4)
i18n (1.8.10)
base64 (0.2.0)
bigdecimal (3.1.4)
bson (4.15.0)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
drb (2.2.0)
ruby2_keywords
i18n (1.14.1)
concurrent-ruby (~> 1.0)
kgio (2.11.4)
method_source (0.8.2)
mime-types (1.17.2)
minitest (5.14.4)
mongo (2.15.0)
bson (>= 4.8.2, < 5.0.0)
mongoid (7.3.2)
activemodel (>= 5.1, < 6.2)
mongo (>= 2.10.5, < 3.0.0)
method_source (1.0.0)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.1003)
minitest (5.20.0)
mongo (2.19.2)
bson (>= 4.14.1, < 5.0.0)
mongoid (8.1.3)
activemodel (>= 5.1, < 7.2, != 7.0.0)
concurrent-ruby (>= 1.0.5, < 2.0)
mongo (>= 2.18.0, < 3.0.0)
ruby2_keywords (~> 0.0.5)
nokogiri (1.14.3-arm64-darwin)
mutex_m (0.2.0)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
ox (2.14.5)
pry (0.10.0)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
racc (1.5.2)
rack (2.2.3)
ox (2.14.17)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)
rack (3.0.8)
raindrops (0.20.1)
rake (13.0.6)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rake (13.1.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
ruby-prof (1.4.3)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
ruby-prof (1.6.3)
ruby2_keywords (0.0.5)
slop (3.5.0)
tzinfo (2.0.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uuidtools (2.1.5)
webrick (1.8.1)
zeitwerk (2.4.2)

PLATFORMS
arm64-darwin-22
Expand Down
4 changes: 2 additions & 2 deletions bin/dav4rack
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ opts.each do |opt,arg|
credentials[:password] = arg
when '--root'
credentials[:root] = arg
unless(File.exists?(arg) && File.directory?(arg))
unless(File.exist?(arg) && File.directory?(arg))
puts "ERROR: Path provided is not a valid directory (#{arg})"
exit(-1)
end
Expand All @@ -59,7 +59,7 @@ opts.each do |opt,arg|
credentials[:log_to] = [nil, Logger::FATAL] unless credentials[:log_to]
if(arg && !arg.empty?)
dirname = Pathname.new(arg).dirname
if((File.exists?(arg) && File.writable?(arg)) || (File.exists?(dirname) && File.writable?(dirname)))
if((File.exist?(arg) && File.writable?(arg)) || (File.exist?(dirname) && File.writable?(dirname)))
credentials[:log_to][0] = arg
else
puts "ERROR: Log file is not writable: #{arg}"
Expand Down
2 changes: 1 addition & 1 deletion lib/dav4rack/remote_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(path, args={})
@heads = {}
@cache_file = args[:cache_directory] ? cache_file_path : nil
@redefine_prefix = nil
if(@cache_file && File.exists?(@cache_file))
if(@cache_file && File.exist?(@cache_file))
@root = ''
@path_info = @cache_file
@path = @path_info
Expand Down
4 changes: 2 additions & 2 deletions lib/dav4rack/resources/file_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def delete
else
::File.unlink(file_path)
end
::File.unlink(prop_path) if ::File.exists?(prop_path)
::File.unlink(prop_path) if ::File.exist?(prop_path)
@_prop_hash = nil
NoContent
end
Expand Down Expand Up @@ -168,7 +168,7 @@ def make_collection
if(::File.directory?(file_path))
MethodNotAllowed
else
if(::File.directory?(::File.dirname(file_path)) && !::File.exists?(file_path))
if(::File.directory?(::File.dirname(file_path)) && !::File.exist?(file_path))
Dir.mkdir(file_path)
Created
else
Expand Down
2 changes: 1 addition & 1 deletion lib/dav4rack/resources/mongo_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def copy(dest, overwrite = false)
# FileUtils.cp_r("#{file_path}/.", "#{dest.send(:file_path)}/")
# OK
# else
# exists = File.exists?(file_path)
# exists = File.exist?(file_path)
# if(exists && !overwrite)
# PreconditionFailed
# else
Expand Down
4 changes: 2 additions & 2 deletions spec/handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
METHODS = %w(GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE OPTIONS HEAD LOCK UNLOCK)

before do
FileUtils.mkdir(DOC_ROOT) unless File.exists?(DOC_ROOT)
FileUtils.mkdir(DOC_ROOT) unless File.exist?(DOC_ROOT)
@controller = DAV4Rack::Handler.new(:root => DOC_ROOT)
end

after do
FileUtils.rm_rf(DOC_ROOT) if File.exists?(DOC_ROOT)
FileUtils.rm_rf(DOC_ROOT) if File.exist?(DOC_ROOT)
end

attr_reader :response
Expand Down
4 changes: 2 additions & 2 deletions spec/perf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
METHODS = %w(GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE OPTIONS HEAD LOCK UNLOCK)

before do
FileUtils.mkdir(DOC_ROOT) unless File.exists?(DOC_ROOT)
FileUtils.mkdir(DOC_ROOT) unless File.exist?(DOC_ROOT)
@controller = DAV4Rack::Handler.new(:root => DOC_ROOT)
end

after do
FileUtils.rm_rf(DOC_ROOT) if File.exists?(DOC_ROOT)
FileUtils.rm_rf(DOC_ROOT) if File.exist?(DOC_ROOT)
end

attr_reader :response
Expand Down