vendorer 0.1.16 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Readme.md +6 -10
- data/lib/vendorer.rb +15 -17
- data/lib/vendorer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d699fc83764584b1ff28261a1c893fe8d33010859f764fa76cd7c5e6a837c0e0
|
4
|
+
data.tar.gz: 2cc5eb095cf6a82a55ade13dcaf78875a8e63c6a0f8ce0ed27c40ab1873a7e4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39039ce08883adbb87a4e3f1b8c31da9a02e44d0afb5789b02b6709266194cbc5758767e0e174bf67865a04a8ebd909e6d198d12bc4553b4ead9117ad582b820
|
7
|
+
data.tar.gz: 7e52f2ad657e6dc513504f31f9d716b74990ef1fd44e57cbde6f4888c772a047ddffdd65247a55bed2ff53b7530e56e5230e3ad3480acbea9769f2ef4dddc0e6
|
data/Readme.md
CHANGED
@@ -9,22 +9,18 @@ Vendorer
|
|
9
9
|
Install
|
10
10
|
-------
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
- Curl
|
15
|
-
- Git v1.7+
|
16
|
-
- Ruby v1.8.7 or v1.9.2+
|
12
|
+
Needs: Curl + Git + Ruby
|
17
13
|
|
18
14
|
then:
|
19
15
|
|
20
16
|
``` bash
|
21
|
-
|
17
|
+
gem install vendorer
|
22
18
|
```
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
or standalone
|
21
|
+
```Bash
|
22
|
+
curl https://rubinjam.herokuapp.com/pack/vendorer > vendorer && chmod +x vendorer
|
23
|
+
./vendorer -v
|
28
24
|
```
|
29
25
|
|
30
26
|
|
data/lib/vendorer.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'tmpdir'
|
3
|
+
require 'shellwords'
|
3
4
|
|
4
5
|
class Vendorer
|
5
6
|
def initialize(options={})
|
@@ -14,11 +15,11 @@ class Vendorer
|
|
14
15
|
def file(path, url=nil)
|
15
16
|
target_path = complete_path(path)
|
16
17
|
update_or_not target_path do
|
17
|
-
run "mkdir -p
|
18
|
+
run "mkdir", "-p", File.dirname(target_path)
|
18
19
|
if @copy_from_url
|
19
20
|
copy_from_path(target_path, url || path)
|
20
21
|
else
|
21
|
-
run "curl
|
22
|
+
run "curl", url, "--fail", "-L", "--compressed", "-o", target_path
|
22
23
|
raise "Downloaded empty file" unless File.exist?(target_path)
|
23
24
|
end
|
24
25
|
yield target_path if block_given?
|
@@ -29,8 +30,8 @@ class Vendorer
|
|
29
30
|
if @copy_from_path or url
|
30
31
|
target_path = complete_path(path)
|
31
32
|
update_or_not target_path do
|
32
|
-
run "rm -rf
|
33
|
-
run "mkdir -p
|
33
|
+
run "rm", "-rf", target_path
|
34
|
+
run "mkdir", "-p", File.dirname(target_path)
|
34
35
|
if @copy_from_path
|
35
36
|
copy_from_path(target_path, url || path)
|
36
37
|
else
|
@@ -84,14 +85,11 @@ class Vendorer
|
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
87
|
-
def run(cmd)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
end
|
94
|
-
raise output unless $?.success?
|
88
|
+
def run(*cmd, dir: nil)
|
89
|
+
cmd = "#{cmd.shelljoin} 2>&1"
|
90
|
+
cmd = ["cd", dir].shelljoin + " && #{cmd}" if dir
|
91
|
+
output = `#{cmd}`
|
92
|
+
raise "Failed: #{cmd}\n#{output}" unless $?.success?
|
95
93
|
end
|
96
94
|
|
97
95
|
def complete_path(path)
|
@@ -99,18 +97,18 @@ class Vendorer
|
|
99
97
|
end
|
100
98
|
|
101
99
|
def download_repository(url, to, options)
|
102
|
-
run "git clone
|
100
|
+
run "git", "clone", url, to
|
103
101
|
if commit = (options[:ref] || options[:tag] || options[:branch])
|
104
|
-
run "
|
102
|
+
run "git", "checkout", commit, dir: to
|
105
103
|
end
|
106
|
-
run "
|
107
|
-
run "rm -rf
|
104
|
+
run "git", "submodule", "update", "--init", "--recursive", dir: to
|
105
|
+
run "rm", "-rf", ".git", dir: to
|
108
106
|
end
|
109
107
|
|
110
108
|
def copy_from_path(dest_path, src_path)
|
111
109
|
src_path ||= dest_path
|
112
110
|
copy_from = File.join(@copy_from_path, src_path)
|
113
111
|
raise "'#{src_path}' not found in #{@copy_from_url}" unless File.exist?(copy_from)
|
114
|
-
run "cp -Rp
|
112
|
+
run "cp", "-Rp", copy_from, dest_path
|
115
113
|
end
|
116
114
|
end
|
data/lib/vendorer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vendorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.
|
44
|
+
rubygems_version: 2.7.6
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Keep your vendor files up to date
|