Sha256: 405d55d56f1a040e1e3845d9b6a9d726c23119d90e716ebc3591e6adc0e55584

Contents?: true

Size: 986 Bytes

Versions: 20

Compression:

Stored size: 986 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.to_s
  FileUtils.mkdir_p dir
  dir
end

def mod_dir new_mod=nil
  mod_name = new_mod || mod
  dir = Mod.dirs.path(mod_name) || (mod_name.to_sym == :test && "test")

  raise Error, "can't find mod \"#{mod_name}\"" unless dir
  dir
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::AnyoneID
end

def file_id
  id? ? id : upload_cache_card.id
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
card-1.95.0 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.94.1 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.94.0 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.13 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.12 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.11 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.10 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.9 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.8 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.7 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.6 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.5 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.4 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.3 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.2 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.1 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.93.0 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.92.2 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.92.1 mod/carrierwave/set/abstract/attachment/paths.rb
card-1.92 mod/carrierwave/set/abstract/attachment/paths.rb