vendorer 0.1.16 → 0.2.0

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
- SHA1:
3
- metadata.gz: 974e3b0fdf74891506314818febd2cc27f90fd51
4
- data.tar.gz: f34d4d6772c221de4e7e04223298c1f988d80510
2
+ SHA256:
3
+ metadata.gz: d699fc83764584b1ff28261a1c893fe8d33010859f764fa76cd7c5e6a837c0e0
4
+ data.tar.gz: 2cc5eb095cf6a82a55ade13dcaf78875a8e63c6a0f8ce0ed27c40ab1873a7e4b
5
5
  SHA512:
6
- metadata.gz: ef78e31266acded7f84eae68fc0863b28b32239031a986da0ee4cb5f9d404e0e22d80cb2232b10b8b0ea9515bb7e6bce3a006cfe1d14d9bae9ae76808f3bd39a
7
- data.tar.gz: 36c3d883b8e1f57225c0b6111be3b6ded12c043930dd8eaf8f7f772bbf5a74e32b38146450c5e7d5dcf8183ea1d8ebcd8588681877c971a80608f2a147305d62
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
- Ensure you have:
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
- $ gem install vendorer
17
+ gem install vendorer
22
18
  ```
23
19
 
24
- Or add vendorer to your `Gemfile`:
25
-
26
- ``` ruby
27
- gem 'vendorer', :group => :development
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
 
@@ -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 #{File.dirname(target_path)}"
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 '#{url}' -L --compressed -o #{target_path}"
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 #{target_path}"
33
- run "mkdir -p #{File.dirname(target_path)}"
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
- output = ''
89
- IO.popen(cmd + ' 2>&1') do |pipe|
90
- while line = pipe.gets
91
- output << line
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 '#{url}' #{to}"
100
+ run "git", "clone", url, to
103
101
  if commit = (options[:ref] || options[:tag] || options[:branch])
104
- run "cd #{to} && git checkout '#{commit}'"
102
+ run "git", "checkout", commit, dir: to
105
103
  end
106
- run "cd #{to} && git submodule update --init --recursive"
107
- run "rm -rf #{to}/.git"
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 #{copy_from} #{dest_path}"
112
+ run "cp", "-Rp", copy_from, dest_path
115
113
  end
116
114
  end
@@ -1,3 +1,3 @@
1
1
  class Vendorer
2
- VERSION = '0.1.16'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.16
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: 2014-05-15 00:00:00.000000000 Z
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.2.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