Sha256: 97b0cec711569677534dfbe41d3555f9ea93cb5fe565a5a1a25e7f29ea3c5c10

Contents?: true

Size: 943 Bytes

Versions: 6

Compression:

Stored size: 943 Bytes

Contents

MOD_FILE_DIR = "file".freeze

def store_dir
  will_become_coded? ? coded_dir(@new_mod) : upload_dir
end

def retrieve_dir
  coded? ? coded_dir : upload_dir
end

# place for files of regular file cards
def upload_dir
  id ? "#{files_base_dir}/#{id}" : tmp_upload_dir
end

# place for files of mod file cards
def coded_dir new_mod=nil
  dir = File.join mod_dir(new_mod), MOD_FILE_DIR, codename
  FileUtils.mkdir_p dir
  dir
end

def mod_dir new_mod=nil
  find_mod = new_mod || mod
  Card::Mod::Loader.mod_dirs.path(find_mod) ||
    raise(Error, "can't find mod \"#{find_mod}\"")
end

def files_base_dir
  bucket ? bucket_config[:subdirectory] : Card.paths["files"].existent.first
end

# used in the indentifier
def file_dir
  if coded?
    ":#{codename}"
  elsif cloud?
    "(#{bucket})/#{file_id}"
  else
    "~#{file_id}"
  end
end

def public?
  who_can(:read).include? Card[:anyone].id
end

def file_id
  id? ? id : upload_cache_card.id
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.19.6 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.19.5 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.19.4 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.19.3 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.19.2 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.19.1 mod/carrierwave/set/abstract/attachment/paths.rb