Module: Afterlife::Cdn

Defined in:
lib/afterlife/cdn.rb,
lib/afterlife/cdn/cli.rb,
lib/afterlife/cdn/server.rb

Defined Under Namespace

Classes: Cli, Server

Class Method Summary collapse

Class Method Details



21
22
23
24
25
26
27
28
29
# File 'lib/afterlife/cdn.rb', line 21

def link
  FileUtils.rm_rf(Afterlife::Cdn.local_path)
  FileUtils.mkdir_p(Afterlife::Cdn.local_path)
  Repo.all.each do |repo|
    dest = Afterlife::Cdn.local_path.join(repo.full_name)
    FileUtils.mkdir_p(File.dirname(dest))
    FileUtils.ln_sf(repo.dist_path, dest)
  end
end

.local_pathObject



17
18
19
# File 'lib/afterlife/cdn.rb', line 17

def local_path
  Afterlife.local_path.join('cdn')
end

.log_pathObject



13
14
15
# File 'lib/afterlife/cdn.rb', line 13

def log_path
  Afterlife.local_path.join('logs/cdn.log')
end

.url(repo = nil) ⇒ Object



7
8
9
10
11
# File 'lib/afterlife/cdn.rb', line 7

def url(repo = nil)
  return Afterlife.current_stage.cdn_url unless repo

  "#{url}/#{repo.full_name}"
end