elm_install 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c2927819a68d5b12b552f5c9defa2d9e4895c9
4
- data.tar.gz: 5a4b0f36210f3488ee332cb94713ad07119e70f3
3
+ metadata.gz: 68ac8a8d664399020fed3aab08c9f510dfc0b342
4
+ data.tar.gz: f4fcd64db986475dd59293484060510fd7a039fd
5
5
  SHA512:
6
- metadata.gz: c58abacd3ea979c21953df4004e73b5aa855e64e5543c939a5dd28a77515532baecbe289bce4e58675092e651b64091f11a06b0e4d4c09aac5d44af9a4fd86f6
7
- data.tar.gz: ef6731190aee0039cfdd550dfba32587c7b7269f0f770d54249834eabed6cdf6424e52b974f4e00e51b6921df42b5854133054ecbb1379cb2cc575abc0e81585
6
+ metadata.gz: 84484f3b601baeb593ec56dc8fb751b015795a64855ede99038bd245f4cd379103c756a58d05264ce8f4d2cc6c76403fe57499e83346ba16590ba995cb4b9c18
7
+ data.tar.gz: 34745ee40861cf12e2511e6998b003239a09ac591defbd5f7889f0ad8d3aab0b0855ba6e17f49fb47f13d0d2be7d08865ae3480419236ff830ec8e2373d2a245
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ coverage
10
10
  test.elm
11
11
  test.rb
12
12
  index.html
13
+ scripts/dist*
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elm_install (1.1.1)
4
+ elm_install (1.2.0)
5
5
  adts (~> 0.1.2)
6
6
  commander (~> 4.4, >= 4.4.2)
7
7
  contracts (~> 0.16.0)
@@ -1,4 +1,4 @@
1
1
  module ElmInstall
2
2
  # The version of ElmInstall
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elm-github-install",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Install Elm packages directly from Git repositories",
5
5
  "scripts": {
6
6
  "install": "node scripts/install.js",
@@ -16,7 +16,9 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "adm-zip": "^0.4.7",
19
+ "progress": "^2.0.0",
19
20
  "request": "2.74.0",
21
+ "request-progress": "^3.0.0",
20
22
  "shelljs": "0.7.5",
21
23
  "tar-fs": "1.15.0",
22
24
  "tmp": "^0.0.31"
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  ruby '2.2.2'
4
4
 
5
- gem 'elm_install', '1.1.0'
5
+ gem 'elm_install', '1.2.0'
@@ -1,6 +1,8 @@
1
+ var progress = require('request-progress')
2
+ var ProgressBar = require('progress')
1
3
  var request = require('request')
2
- var shell = require('shelljs')
3
4
  var AdmZip = require('adm-zip')
5
+ var shell = require('shelljs')
4
6
  var tar = require('tar-fs')
5
7
  var path = require('path')
6
8
  var zlib = require('zlib')
@@ -13,7 +15,11 @@ var version =
13
15
  fs.readFileSync(versionPath, 'utf-8')
14
16
  .match(/(\d+\.\d+\.\d+)/)[1]
15
17
 
16
- var homedir = path.join(os.homedir(), '.elm-install')
18
+ var homedir = path.join(__dirname, 'dist-' + version)
19
+
20
+ // We already have that version downloaded
21
+ if(fs.existsSync(homedir)){ process.exit() }
22
+
17
23
  var platform = os.platform()
18
24
  var arch = process.arch
19
25
 
@@ -29,12 +35,31 @@ var packageUrl = function(suffix) {
29
35
  ].join('/')
30
36
  }
31
37
 
32
- var download = function(suffix){
33
- console.log(
34
- 'Downloading and extracting the binary from: ' + packageUrl(suffix))
38
+ var downloadRequest = function(url) {
39
+ var bar, lastTransferred
35
40
 
36
- request
37
- .get(packageUrl(suffix))
41
+ return progress(request.get(url))
42
+ .on("progress", function(data){
43
+ if (bar) {
44
+ bar.tick(data.size.transferred - lastTransferred)
45
+ lastTransferred = data.size.transferred
46
+ } else {
47
+ lastTransferred = 0
48
+ bar = new ProgressBar(
49
+ 'Downloading and extracting the binary: [:bar] :rate/bps :percent :etas',
50
+ {
51
+ total: data.size.total,
52
+ incomplete: ' ',
53
+ complete: '=',
54
+ width: 60
55
+ }
56
+ )
57
+ }
58
+ })
59
+ }
60
+
61
+ var download = function(suffix){
62
+ downloadRequest(packageUrl(suffix))
38
63
  .pipe(zlib.createGunzip())
39
64
  .pipe(extractor)
40
65
  }
@@ -53,10 +78,7 @@ if(platform === 'linux' && arch === 'x64') {
53
78
  'elm-install-' + version + '-win32.zip'
54
79
  ].join('/')
55
80
 
56
- console.log('Downloading and extracting the binary from: ' + url)
57
-
58
- request
59
- .get(url)
81
+ downloadRequest(url)
60
82
  .pipe(fs.createWriteStream(tmpFile.name))
61
83
  .on('finish', function(){
62
84
  var zip = new AdmZip(tmpFile.name)
@@ -10,7 +10,7 @@ var version =
10
10
  fs.readFileSync(versionPath, 'utf-8')
11
11
  .match(/(\d+\.\d+\.\d+)/)[1]
12
12
 
13
- var homedir = path.join(os.homedir(), '.elm-install')
13
+ var homedir = path.join(__dirname, 'dist-' + version)
14
14
  var platform = os.platform()
15
15
  var arch = process.arch
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elm_install
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusztáv Szikszai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-28 00:00:00.000000000 Z
11
+ date: 2017-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git