html5up 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcd1bb18765852f7fa4d9e2e4db871b9a9f1b774
4
- data.tar.gz: e21a2952808694575f98a8f65fe3eb9f65a3d74c
3
+ metadata.gz: 6748d7b0b1c8f513482ac69f79110f67f836e2c6
4
+ data.tar.gz: b53f80dccdf42bc067e8dbe63a17ebaa92335f77
5
5
  SHA512:
6
- metadata.gz: 9dfaa7cb0918dc1c8a2f2d68af687ad82e62789bf7c19cb76111774459ba3e50dca7773d91ac932cc6acf29df3959af28c57ff9413e9bf5b302724e3694110bb
7
- data.tar.gz: 5eeda5104ee15b6aec568171302970c3baf34df496d35b98ffc2add1c1c57868161dfad1b65b006d727d3211d191658335f487b804274a0ffeef8d66b21e06ea
6
+ metadata.gz: 69b35ede60ff03e021446679d35355d85f898ea04642216f97e46d35ea2100f9dd993e06e052601c0dd693d8bd862ceca5c13e005f235a29f8a180b82821bc8c
7
+ data.tar.gz: af0eae206405473b01b50def6fcc0714d7325de8dadd194b2c3b103e2b47bc2230fba623962eba6a1066919f9657846bbf13bd46debba187c452e2f1edaf226d
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- [![Gem Version](https://badge.fury.io/rb/html5up-ruby.png)](http://badge.fury.io/rb/html5up-ruby)
1
+ [![Gem Version](https://badge.fury.io/rb/html5up.svg)](https://badge.fury.io/rb/html5up)
2
2
  [![Build Status](https://travis-ci.org/rlqualls/html5up-ruby.png?branch=master)](https://travis-ci.org/rlqualls/html5up-ruby)
3
3
 
4
4
  # HTML5UP
5
5
 
6
- **HTML5UP** is a command-line downloader for [html5-up.net](https://html5up.net) templates.
6
+ **HTML5UP** is a command-line downloader for [html5up.net](http://html5up.net) templates.
7
7
 
8
8
  ## Dependencies
9
9
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'html5up'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.summary = "HTML5UP download tool"
5
5
  s.description = "Create and manage HTML5UP projects"
6
6
  s.authors = ["Robert Qualls"]
@@ -8,11 +8,9 @@ module HTML5UP
8
8
  option :save
9
9
  def new(project_name)
10
10
  template = options[:template]
11
- puts "Downloading #{template}..."
12
11
  filename = "html5up-#{template}.zip"
13
- url = "html5up.net/#{template}/download"
14
12
 
15
- Helpers::download(url, filename)
13
+ Helpers::download(template, filename)
16
14
  Helpers::extract(filename, project_name, options)
17
15
  end
18
16
 
@@ -1,39 +1,50 @@
1
1
  require "fileutils"
2
2
  require "curb"
3
3
  require "archive/zip"
4
+ require "tty-spinner"
4
5
 
5
6
  module HTML5UP
6
7
  class Helpers
7
8
  def self.extract(src, dest, options = {})
8
- Archive::Zip.extract(src, dest)
9
+ begin
10
+ Archive::Zip.extract(src, dest)
11
+ rescue Archive::Zip::UnzipError
12
+ puts "Error: Website down or invalid template name."
13
+ puts "Removing #{src}"
14
+ FileUtils.rm(src)
15
+ exit(false)
16
+ end
17
+
9
18
  if options[:save]
10
19
  FileUtils.mv(src, dest + "/" + src)
11
20
  else
12
21
  FileUtils.rm(src)
13
22
  end
23
+
24
+ puts "Extracted to #{dest}"
14
25
  end
15
26
 
16
- def self.download(url, filename)
27
+ def self.download(template, filename)
17
28
  easy = Curl::Easy.new
18
29
  easy.follow_location = true
19
- easy.url = url
20
- print "'#{url}' :"
30
+ easy.url = "html5up.net/#{template}/download"
21
31
 
22
32
  File.open(filename, 'wb') do |f|
33
+ spinner = TTY::Spinner.new("Downloading #{template}... ")
23
34
  easy.on_progress do |dl_total, dl_now, ul_total, ul_now|
24
- print "="
35
+ spinner.spin
25
36
  true
26
37
  end
27
38
  easy.on_body { |data| f << data; data.size }
28
39
  easy.perform
29
- puts "=> '#{filename}'"
40
+ puts " => '#{filename}'"
30
41
  end
31
42
  end
32
43
 
33
44
  def self.templates
34
45
  %w(
35
- hyperspace future-imperfect solid-state identity
36
- lens fractal eventually spectral photon
46
+ multiverse hyperspace future-imperfect solid-state
47
+ identity lens fractal eventually spectral photon
37
48
  highlights landed strata read-only alpha
38
49
  directive aeriel twenty big-picture tessellate
39
50
  overflow prologue helios telephasic strongly-typed
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html5up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Qualls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Create and manage HTML5UP projects
14
14
  email: robert@robertqualls.com