dddr 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dddr/version.rb +1 -1
  3. data/lib/dddr.rb +15 -10
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f0b301e90995f597fe2eccbb90579528f09e20ac702e8ca5f18855c64047d95
4
- data.tar.gz: 94a1d19f0a0f1d38b72453519396d231e8ed7d0184ab42b0d828149dd75780e6
3
+ metadata.gz: a61d06c6ebc3616c3da5cb9529144c21227a87c9cc16066c3d30676f689d6315
4
+ data.tar.gz: e3d69c17b85e80c0c8b78ed560c1921b4ccddb766908e2798b5fab10c998a009
5
5
  SHA512:
6
- metadata.gz: 5eeabb4563c3bd63e1e62d1e84045b4dc62c8944de6a41942fefe71ebca46850b55bf2e8ddcfa7e319cb58c1df0010803f3ae9f9200550067183299ab363f451
7
- data.tar.gz: b6c98d57d03fe35c3f4488cd1d661b19f79804c55c73592959fc12d5d9cd56acd288325c5d93262f622306f9a19d013e37326487aae9779c4ac72c4f726b43fc
6
+ metadata.gz: 3439a0a2a18760fdc510927d336e3e42b17a1cb933f602f21e7ea938f60c8d8bcd4585f54d2f7fd44bcd9f12cee428e83c7b2b791aa7ea4b7b056035dd60ebbc
7
+ data.tar.gz: 7a0bfeb34044c07b29a584f7000be838f0f2b48a0bc98d08e815f112ba4baf9b65b326e6c24627ae77f4ab6e90d811488a73e4ef885dc4b14d19c6d1dcc9d513
data/lib/dddr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dddr
4
- VERSION = "1.1.3"
4
+ VERSION = "1.1.4"
5
5
  end
data/lib/dddr.rb CHANGED
@@ -68,19 +68,24 @@ module Dddr
68
68
  data_dir = Dddr.configuration.data_dir
69
69
  container = Dddr.configuration.container
70
70
  raise Dddr::Error, "Container name is required" unless container
71
-
72
- unless Dir.exist?("#{data_dir}/#{container}")
73
- if data_dir.include?("/var/")
74
- full_path = "/var/dddr/#{container}/#{env}"
75
- FileUtils.mkdir_p(full_path)
76
- FileUtils.chown_R(ENV["USER"], nil, full_path)
77
- else
78
- FileUtils.mkdir_p("#{data_dir}/#{container}/#{env}")
71
+
72
+ # Construct the target directory path
73
+ @name = "#{data_dir}/#{container}/#{env}/#{entity_class.name.downcase}"
74
+
75
+ begin
76
+ # Ensure all directories in the path are created
77
+ FileUtils.mkdir_p(@name)
78
+
79
+ # Change ownership only if the path starts with "/var/"
80
+ if @name.start_with?("/var/")
81
+ FileUtils.chown_R(ENV["USER"], nil, @name)
79
82
  end
83
+ rescue Errno::ENOENT => e
84
+ # Log or handle the error
85
+ raise "Failed to create or access the directory: #{e.message}"
80
86
  end
81
-
82
- @name = "#{data_dir}/#{container}/#{env}/#{entity_class.name.downcase}"
83
87
  end
88
+
84
89
 
85
90
  def count
86
91
  all.count
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dddr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Burke