Class: HTML5UP::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/html5up/helpers.rb

Class Method Summary collapse

Class Method Details

.download(url, filename) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/html5up/helpers.rb', line 16

def self.download(url, filename)
  easy = Curl::Easy.new
  easy.follow_location = true
  easy.url = url
  print "'#{url}' :"

  File.open(filename, 'wb') do |f|
    easy.on_progress do |dl_total, dl_now, ul_total, ul_now|
      print "="
      true
    end
    easy.on_body { |data| f << data; data.size }
    easy.perform
    puts "=> '#{filename}'"
  end
end

.extract(src, dest, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/html5up/helpers.rb', line 7

def self.extract(src, dest, options = {})
  Archive::Zip.extract(src, dest)
  if options[:save]
    FileUtils.mv(src, dest + "/" + src)
  else
    FileUtils.rm(src)
  end
end

.templatesObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/html5up/helpers.rb', line 33

def self.templates
  %w(
    hyperspace future-imperfect solid-state identity
    lens fractal eventually spectral photon
    highlights landed strata read-only alpha
    directive aeriel twenty big-picture tessellate
    overflow prologue helios telephasic strongly-typed
    parallelism escape-velocity astral striped
    dopetrope miniport txt verti zerofour arcana
    halcyonic minimaxing
  )
end