vendorer 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/vendorer +3 -1
- data/lib/vendorer/version.rb +1 -1
- metadata +8 -24
- data/.travis.yml +0 -5
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -28
- data/Rakefile +0 -7
- data/Readme.md +0 -89
- data/spec/spec_helper.rb +0 -4
- data/spec/vendorer_spec.rb +0 -583
- data/vendorer.gemspec +0 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c9d9dd1243bab4fadf0c44dd84e1be3676555c7a
|
4
|
+
data.tar.gz: 3aa7207a6b3270fae463a11bd5ebd80b1abe2de7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ccbced7c3adfdcff9e27cffb7ea299333859812076d7c0503e937a1999e9d2ba4114a9abdfaf4ad029ca59b2062afa6b26514f08cb13902292715610a41378e
|
7
|
+
data.tar.gz: f11f38a9ddc9ec4e5016904d711d9438332e820eec84c333983c247261d9cc6372c2a840eb993eeca47229630e1d5df0c11598d23c6e90d69c9b96c7dde98eb1
|
data/bin/vendorer
CHANGED
@@ -34,4 +34,6 @@ require 'vendorer'
|
|
34
34
|
v = Vendorer.new(:update => (ARGV[1] || true if ARGV[0] == 'update'),
|
35
35
|
:init => (true if ARGV[0] == 'init'))
|
36
36
|
v.init and exit if ARGV[0] == 'init'
|
37
|
-
|
37
|
+
config_locations = ['Vendorfile.rb', 'Vendorfile']
|
38
|
+
config_location = config_locations.detect { |f| File.exist?(f) } || config_locations.last
|
39
|
+
v.parse(File.read(config_location))
|
data/lib/vendorer/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vendorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.15
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Grosser
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description:
|
15
14
|
email: michael@grosser.it
|
@@ -18,46 +17,31 @@ executables:
|
|
18
17
|
extensions: []
|
19
18
|
extra_rdoc_files: []
|
20
19
|
files:
|
21
|
-
- .travis.yml
|
22
|
-
- Gemfile
|
23
|
-
- Gemfile.lock
|
24
|
-
- Rakefile
|
25
|
-
- Readme.md
|
26
20
|
- bin/vendorer
|
27
21
|
- lib/vendorer.rb
|
28
22
|
- lib/vendorer/version.rb
|
29
|
-
|
30
|
-
- spec/vendorer_spec.rb
|
31
|
-
- vendorer.gemspec
|
32
|
-
homepage: http://github.com/grosser/vendorer
|
23
|
+
homepage: https://github.com/grosser/vendorer
|
33
24
|
licenses:
|
34
25
|
- MIT
|
26
|
+
metadata: {}
|
35
27
|
post_install_message:
|
36
28
|
rdoc_options: []
|
37
29
|
require_paths:
|
38
30
|
- lib
|
39
31
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
32
|
requirements:
|
42
|
-
- -
|
33
|
+
- - ">="
|
43
34
|
- !ruby/object:Gem::Version
|
44
35
|
version: '0'
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
hash: -2133170739879048900
|
48
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
37
|
requirements:
|
51
|
-
- -
|
38
|
+
- - ">="
|
52
39
|
- !ruby/object:Gem::Version
|
53
40
|
version: '0'
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
hash: -2133170739879048900
|
57
41
|
requirements: []
|
58
42
|
rubyforge_project:
|
59
|
-
rubygems_version:
|
43
|
+
rubygems_version: 2.2.2
|
60
44
|
signing_key:
|
61
|
-
specification_version:
|
45
|
+
specification_version: 4
|
62
46
|
summary: Keep your vendor files up to date
|
63
47
|
test_files: []
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
vendorer (0.1.14)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
bump (0.3.9)
|
10
|
-
diff-lcs (1.1.3)
|
11
|
-
rake (10.0.3)
|
12
|
-
rspec (2.12.0)
|
13
|
-
rspec-core (~> 2.12.0)
|
14
|
-
rspec-expectations (~> 2.12.0)
|
15
|
-
rspec-mocks (~> 2.12.0)
|
16
|
-
rspec-core (2.12.2)
|
17
|
-
rspec-expectations (2.12.1)
|
18
|
-
diff-lcs (~> 1.1.3)
|
19
|
-
rspec-mocks (2.12.2)
|
20
|
-
|
21
|
-
PLATFORMS
|
22
|
-
ruby
|
23
|
-
|
24
|
-
DEPENDENCIES
|
25
|
-
bump
|
26
|
-
rake
|
27
|
-
rspec (>= 2)
|
28
|
-
vendorer!
|
data/Rakefile
DELETED
data/Readme.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
Vendorer
|
2
|
-
========
|
3
|
-
|
4
|
-
- documented & cached dependencies
|
5
|
-
- automatic updates
|
6
|
-
- no unwanted/accidental updates
|
7
|
-
|
8
|
-
|
9
|
-
Install
|
10
|
-
-------
|
11
|
-
|
12
|
-
Ensure you have:
|
13
|
-
|
14
|
-
- Curl
|
15
|
-
- Git v1.7+
|
16
|
-
- Ruby v1.8.7 or v1.9.2+
|
17
|
-
|
18
|
-
then:
|
19
|
-
|
20
|
-
``` bash
|
21
|
-
$ gem install vendorer
|
22
|
-
```
|
23
|
-
|
24
|
-
Or add vendorer to your `Gemfile`:
|
25
|
-
|
26
|
-
``` ruby
|
27
|
-
gem 'vendorer', :group => :development
|
28
|
-
```
|
29
|
-
|
30
|
-
|
31
|
-
Usage
|
32
|
-
-----
|
33
|
-
|
34
|
-
Add a `Vendorfile` to your project root:
|
35
|
-
|
36
|
-
|
37
|
-
<!-- extracted by vendorer init -->
|
38
|
-
``` ruby
|
39
|
-
file 'vendor/assets/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
|
40
|
-
folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'
|
41
|
-
|
42
|
-
# Execute a block after updates
|
43
|
-
file 'vendor/assets/javascripts/jquery.js', 'http://code.jquery.com/jquery.js' do |path|
|
44
|
-
puts "Do something useful with #{path}"
|
45
|
-
rewrite(path) { |content| content.gsub(/\r\n/, \n).gsub /\t/, ' ' }
|
46
|
-
end
|
47
|
-
|
48
|
-
# Checkout a specific :ref/:tag/:branch
|
49
|
-
folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git', :tag => 'v0.6.10'
|
50
|
-
|
51
|
-
# DRY folders
|
52
|
-
folder 'vendor/assets/javascripts' do
|
53
|
-
file 'jquery.js', 'http://code.jquery.com/jquery-latest.js'
|
54
|
-
end
|
55
|
-
|
56
|
-
# Copy files & folders from repos (also works with private repos)
|
57
|
-
from 'https://github.com/grosser/parallel_tests.git' do |checkout_location|
|
58
|
-
file 'Readme.md'
|
59
|
-
file 'target-folder/file.rb', 'lib/parallel_tests.rb'
|
60
|
-
folder 'spec'
|
61
|
-
folder 'renamed-folder', 'spec'
|
62
|
-
end
|
63
|
-
```
|
64
|
-
<!-- extracted by vendorer init -->
|
65
|
-
|
66
|
-
- Create a new Vendorfile: `vendorer init`
|
67
|
-
- excute all installations: `vendorer`
|
68
|
-
- Update all dependencies: `vendorer update`
|
69
|
-
- update a single dependency: `vendorer update vendor/assets/javascripts/jquery.min.js`
|
70
|
-
- update everything in a specific folder: `vendorer update vendor/assets/javascripts`
|
71
|
-
|
72
|
-
|
73
|
-
TODO
|
74
|
-
====
|
75
|
-
- nice error message when no Vendorfile was found
|
76
|
-
|
77
|
-
Author
|
78
|
-
======
|
79
|
-
|
80
|
-
### [Contributors](http://github.com/grosser/vendorer/contributors)
|
81
|
-
- [Kurtis Rainbolt-Greene](https://github.com/krainboltgreene)
|
82
|
-
- [Ivan K.](https://github.com/divout)
|
83
|
-
- [Matt Brictson](https://github.com/mbrictson)
|
84
|
-
- [Andreas Haller](https://github.com/ahx)
|
85
|
-
|
86
|
-
[Michael Grosser](http://grosser.it)<br/>
|
87
|
-
michael@grosser.it<br/>
|
88
|
-
License: MIT<br/>
|
89
|
-
[![Build Status](https://travis-ci.org/grosser/vendorer.png)](https://travis-ci.org/grosser/vendorer)
|
data/spec/spec_helper.rb
DELETED
data/spec/vendorer_spec.rb
DELETED
@@ -1,583 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Vendorer do
|
4
|
-
before do
|
5
|
-
Dir.chdir File.dirname(File.dirname(__FILE__))
|
6
|
-
`rm -rf spec/tmp`
|
7
|
-
`mkdir spec/tmp`
|
8
|
-
Dir.chdir 'spec/tmp'
|
9
|
-
end
|
10
|
-
|
11
|
-
after do
|
12
|
-
`rm -rf spec/tmp`
|
13
|
-
end
|
14
|
-
|
15
|
-
def write(file, content)
|
16
|
-
File.open(file, 'w') { |f| f.write(content) }
|
17
|
-
end
|
18
|
-
|
19
|
-
def read(file)
|
20
|
-
File.read(file)
|
21
|
-
end
|
22
|
-
|
23
|
-
def size(file)
|
24
|
-
File.size(file)
|
25
|
-
end
|
26
|
-
|
27
|
-
def run(cmd)
|
28
|
-
result = `#{cmd} 2>&1`
|
29
|
-
raise result unless $?.success?
|
30
|
-
result
|
31
|
-
end
|
32
|
-
|
33
|
-
def ls(path)
|
34
|
-
`ls #{path} 2>&1`.split("\n")
|
35
|
-
end
|
36
|
-
|
37
|
-
def vendorer(args='', options={})
|
38
|
-
out = `bundle exec ../../bin/vendorer #{args} 2>&1`
|
39
|
-
raise out if $?.success? == !!options[:raise]
|
40
|
-
out
|
41
|
-
end
|
42
|
-
|
43
|
-
it "has a VERSION" do
|
44
|
-
Vendorer::VERSION.should =~ /^[\.\da-z]+$/
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'version' do
|
48
|
-
it "shows its version via -v" do
|
49
|
-
vendorer('-v').should == "#{Vendorer::VERSION}\n"
|
50
|
-
end
|
51
|
-
|
52
|
-
it "shows its version via --version" do
|
53
|
-
vendorer('--version').should == "#{Vendorer::VERSION}\n"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'help' do
|
58
|
-
it "shows help via -h" do
|
59
|
-
vendorer('-h').should include("Usage")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "shows help via --help" do
|
63
|
-
vendorer('--help').should include("Usage")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#file' do
|
68
|
-
def simple_vendorfile
|
69
|
-
write 'Vendorfile', "file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'"
|
70
|
-
end
|
71
|
-
|
72
|
-
it "can download a new file" do
|
73
|
-
simple_vendorfile
|
74
|
-
vendorer
|
75
|
-
ls('public/javascripts').should == ["jquery.min.js"]
|
76
|
-
read('public/javascripts/jquery.min.js').should include('jQuery')
|
77
|
-
end
|
78
|
-
|
79
|
-
it "can download a file via redirect" do
|
80
|
-
# old github raw urls are redirected
|
81
|
-
write 'Vendorfile', "file 'xxx', 'https://github.com/grosser/vendorer/raw/master/Gemfile'"
|
82
|
-
vendorer
|
83
|
-
read('xxx').should include('rspec')
|
84
|
-
end
|
85
|
-
|
86
|
-
it "does not update an existing file" do
|
87
|
-
simple_vendorfile
|
88
|
-
vendorer
|
89
|
-
write('public/javascripts/jquery.min.js', 'Foo')
|
90
|
-
vendorer
|
91
|
-
read('public/javascripts/jquery.min.js').should == 'Foo'
|
92
|
-
end
|
93
|
-
|
94
|
-
it "fails with a nice message if the Vendorfile is broken" do
|
95
|
-
write 'Vendorfile', "file 'xxx.js', 'http://NOTFOUND'"
|
96
|
-
result = vendorer '', :raise => true
|
97
|
-
# different errors on travis / local
|
98
|
-
raise result unless result.include?("NOTFOUND") or result.include?('Downloaded empty file')
|
99
|
-
end
|
100
|
-
|
101
|
-
describe "with update" do
|
102
|
-
it "updates all files when update is called" do
|
103
|
-
simple_vendorfile
|
104
|
-
vendorer
|
105
|
-
write('public/javascripts/jquery.min.js', 'Foo')
|
106
|
-
vendorer 'update'
|
107
|
-
read('public/javascripts/jquery.min.js').should include('jQuery')
|
108
|
-
end
|
109
|
-
|
110
|
-
context "with multiple files" do
|
111
|
-
before do
|
112
|
-
write 'Vendorfile', "
|
113
|
-
file 'public/javascripts/jquery.js', 'http://code.jquery.com/jquery-latest.js'
|
114
|
-
file 'public/javascripts/jquery.js.min', 'http://code.jquery.com/jquery-latest.min.js'
|
115
|
-
"
|
116
|
-
vendorer
|
117
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
118
|
-
read('public/javascripts/jquery.js.min').should include('jQuery')
|
119
|
-
|
120
|
-
write('public/javascripts/jquery.js', 'Foo')
|
121
|
-
write('public/javascripts/jquery.js.min', 'Foo')
|
122
|
-
end
|
123
|
-
|
124
|
-
it "updates a single file when update is called with the file" do
|
125
|
-
vendorer 'update public/javascripts/jquery.js.min'
|
126
|
-
size('public/javascripts/jquery.js.min').should > 300
|
127
|
-
size('public/javascripts/jquery.js').should == 3
|
128
|
-
end
|
129
|
-
|
130
|
-
it "does not update a file that starts with the same path" do
|
131
|
-
vendorer 'update public/javascripts/jquery.js'
|
132
|
-
size('public/javascripts/jquery.js').should > 300
|
133
|
-
size('public/javascripts/jquery.js.min').should == 3
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
it "does not change file modes" do
|
138
|
-
simple_vendorfile
|
139
|
-
vendorer
|
140
|
-
run 'chmod 711 public/javascripts/jquery.min.js'
|
141
|
-
lambda {
|
142
|
-
vendorer 'update'
|
143
|
-
}.should_not change { run('ls -l public/javascripts').split("\n") }
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context "with a passed block" do
|
148
|
-
before do
|
149
|
-
write 'Vendorfile', "file('public/javascripts/jquery.js', 'http://code.jquery.com/jquery-latest.js'){|path| puts 'THE PATH IS ' + path }"
|
150
|
-
@output = "THE PATH IS public/javascripts/jquery.js"
|
151
|
-
end
|
152
|
-
|
153
|
-
it "runs the block after update" do
|
154
|
-
vendorer.should include(@output)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "does not run the block when not updating" do
|
158
|
-
vendorer
|
159
|
-
vendorer.should_not include(@output)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context "with a compressed resource" do
|
164
|
-
def vendorfile_for_compressed_resource
|
165
|
-
write 'Vendorfile', "file 'public/javascripts/highcharts.js', 'http://code.highcharts.com/highcharts.js'"
|
166
|
-
end
|
167
|
-
|
168
|
-
it "decompresses to plain text" do
|
169
|
-
vendorfile_for_compressed_resource
|
170
|
-
vendorer
|
171
|
-
read('public/javascripts/highcharts.js').should include('Highcharts')
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe '#folder' do
|
177
|
-
before do
|
178
|
-
write 'Vendorfile', "folder 'its_recursive', '../../.git'"
|
179
|
-
end
|
180
|
-
|
181
|
-
it "can download from remote" do
|
182
|
-
write 'Vendorfile', "folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'"
|
183
|
-
vendorer
|
184
|
-
ls('vendor/plugins').should == ["parallel_tests"]
|
185
|
-
read('vendor/plugins/parallel_tests/Gemfile').should include('cucumber')
|
186
|
-
end
|
187
|
-
|
188
|
-
it "reports errors when the Vendorfile is broken" do
|
189
|
-
write 'Vendorfile', "folder 'vendor/plugins/parallel_tests', 'https://blob'"
|
190
|
-
output = vendorer '', :raise => true
|
191
|
-
# different errors on travis / local
|
192
|
-
raise unless output.include?('Connection refused') or output.include?('resolve host')
|
193
|
-
end
|
194
|
-
|
195
|
-
it "can download from local" do
|
196
|
-
vendorer
|
197
|
-
ls('').should =~ ["its_recursive", "Vendorfile"]
|
198
|
-
read('its_recursive/Gemfile').should include('rake')
|
199
|
-
end
|
200
|
-
|
201
|
-
it "can handle a trailing slash" do
|
202
|
-
write 'Vendorfile', "folder 'its_recursive/', '../../.git'"
|
203
|
-
output = vendorer
|
204
|
-
ls('').should =~ ["its_recursive", "Vendorfile"]
|
205
|
-
read('its_recursive/Gemfile').should include('rake')
|
206
|
-
output.should_not include('//')
|
207
|
-
end
|
208
|
-
|
209
|
-
it "does not keep .git folder so everything can be checked in" do
|
210
|
-
vendorer
|
211
|
-
ls('its_recursive/.git').first.should =~ /cannot access|No such file or directory/
|
212
|
-
end
|
213
|
-
|
214
|
-
it "does not update an existing folder" do
|
215
|
-
vendorer
|
216
|
-
write('its_recursive/Gemfile', 'Foo')
|
217
|
-
vendorer
|
218
|
-
read('its_recursive/Gemfile').should == 'Foo'
|
219
|
-
end
|
220
|
-
|
221
|
-
describe '#update' do
|
222
|
-
it "updates a folder" do
|
223
|
-
vendorer
|
224
|
-
write('its_recursive/Gemfile', 'Foo')
|
225
|
-
vendorer 'update'
|
226
|
-
read('its_recursive/Gemfile').should include('rake')
|
227
|
-
end
|
228
|
-
|
229
|
-
it "can update a specific folder" do
|
230
|
-
write 'Vendorfile', "
|
231
|
-
folder 'its_recursive', '../../.git'
|
232
|
-
folder 'its_really_recursive', '../../.git'
|
233
|
-
"
|
234
|
-
vendorer
|
235
|
-
write('its_recursive/Gemfile', 'Foo')
|
236
|
-
write('its_really_recursive/Gemfile', 'Foo')
|
237
|
-
vendorer 'update its_recursive'
|
238
|
-
size('its_really_recursive/Gemfile').should == 3
|
239
|
-
size('its_recursive/Gemfile').should > 30
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
describe "git options" do
|
244
|
-
it "can checkout by :ref" do
|
245
|
-
write 'Vendorfile', "folder 'its_recursive', '../../.git', :ref => 'b1e6460'"
|
246
|
-
vendorer
|
247
|
-
read('its_recursive/Readme.md').should include('CODE EXAMPLE')
|
248
|
-
end
|
249
|
-
|
250
|
-
it "can checkout by :branch" do
|
251
|
-
write 'Vendorfile', "folder 'its_recursive', '../../.git', :branch => 'b1e6460'"
|
252
|
-
vendorer
|
253
|
-
read('its_recursive/Readme.md').should include('CODE EXAMPLE')
|
254
|
-
end
|
255
|
-
|
256
|
-
it "can checkout by :tag" do
|
257
|
-
write 'Vendorfile', "folder 'its_recursive', '../../.git', :tag => 'b1e6460'"
|
258
|
-
vendorer
|
259
|
-
read('its_recursive/Readme.md').should include('CODE EXAMPLE')
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
context "with an execute after update block" do
|
264
|
-
before do
|
265
|
-
write 'Vendorfile', "folder('its_recursive', '../../.git'){|path| puts 'THE PATH IS ' + path }"
|
266
|
-
@output = 'THE PATH IS its_recursive'
|
267
|
-
end
|
268
|
-
|
269
|
-
it "runs the block after update" do
|
270
|
-
vendorer.should include(@output)
|
271
|
-
end
|
272
|
-
|
273
|
-
it "does not run the block when not updating" do
|
274
|
-
vendorer
|
275
|
-
vendorer.should_not include(@output)
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
context "with folder scoping" do
|
280
|
-
before do
|
281
|
-
write 'Vendorfile', "
|
282
|
-
folder 'public/javascripts' do
|
283
|
-
file 'jquery.js', 'http://code.jquery.com/jquery-latest.min.js'
|
284
|
-
end
|
285
|
-
"
|
286
|
-
end
|
287
|
-
|
288
|
-
it "can download a nested file" do
|
289
|
-
vendorer
|
290
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
291
|
-
end
|
292
|
-
|
293
|
-
it "can update a nested file" do
|
294
|
-
vendorer
|
295
|
-
write('public/javascripts/jquery.js', 'Foo')
|
296
|
-
vendorer 'update'
|
297
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
298
|
-
end
|
299
|
-
|
300
|
-
it "can update a whole folder" do
|
301
|
-
write 'Vendorfile', "
|
302
|
-
folder 'public/javascripts' do
|
303
|
-
file 'jquery.js', 'http://code.jquery.com/jquery-latest.min.js'
|
304
|
-
end
|
305
|
-
file 'xxx.js', 'http://code.jquery.com/jquery-latest.min.js'
|
306
|
-
"
|
307
|
-
vendorer
|
308
|
-
write('public/javascripts/jquery.js', 'Foo')
|
309
|
-
write('xxx.js', 'Foo')
|
310
|
-
vendorer 'update public/javascripts'
|
311
|
-
read('xxx.js').should == "Foo"
|
312
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
313
|
-
end
|
314
|
-
|
315
|
-
it "can be nested multiple times" do
|
316
|
-
write 'Vendorfile', "
|
317
|
-
folder 'public' do
|
318
|
-
folder 'javascripts' do
|
319
|
-
file 'jquery.js', 'http://code.jquery.com/jquery-latest.min.js'
|
320
|
-
end
|
321
|
-
end
|
322
|
-
"
|
323
|
-
vendorer
|
324
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
325
|
-
end
|
326
|
-
|
327
|
-
it "can handle trailing slash" do
|
328
|
-
write 'Vendorfile', read('Vendorfile').sub("javascripts' do", "javascripts/' do")
|
329
|
-
output = vendorer
|
330
|
-
read('public/javascripts/jquery.js').should include('jQuery')
|
331
|
-
output.should_not include('//')
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
context "submodules" do
|
336
|
-
def create_git_repo(folder, command)
|
337
|
-
# create a git repo with a submodule
|
338
|
-
run "mkdir #{folder}"
|
339
|
-
run "cd #{folder} && git init"
|
340
|
-
run "cd #{folder} && #{command}"
|
341
|
-
run "cd #{folder} && git add ."
|
342
|
-
run "cd #{folder} && git commit -am 'initial'"
|
343
|
-
end
|
344
|
-
|
345
|
-
let(:vendorer) {
|
346
|
-
v = Vendorer.new
|
347
|
-
def v.puts(x) # silence
|
348
|
-
end
|
349
|
-
v
|
350
|
-
}
|
351
|
-
|
352
|
-
it "installs submodules" do
|
353
|
-
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub'
|
354
|
-
|
355
|
-
vendorer.folder 'plugin', 'a/.git'
|
356
|
-
|
357
|
-
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub\n"
|
358
|
-
run("ls -a plugin/sub").should include('Gemfile')
|
359
|
-
end
|
360
|
-
|
361
|
-
it "installs recursive submodules" do
|
362
|
-
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub_a'
|
363
|
-
create_git_repo 'b', 'git submodule add `cd ../a/.git && pwd` sub_b'
|
364
|
-
|
365
|
-
vendorer.folder 'plugin', 'b/.git'
|
366
|
-
|
367
|
-
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub_b\n"
|
368
|
-
run("ls -a plugin/sub_b").should == ".\n..\n.git\n.gitmodules\nsub_a\n"
|
369
|
-
run("ls -a plugin/sub_b/sub_a").should include('Gemfile')
|
370
|
-
end
|
371
|
-
|
372
|
-
it "installs recursive submodules from a branch" do
|
373
|
-
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub_a'
|
374
|
-
create_git_repo 'b', 'touch .gitmodules'
|
375
|
-
|
376
|
-
# create submodules on a branch
|
377
|
-
run "cd b && git checkout -b with_submodules"
|
378
|
-
run "cd b && git submodule add `cd ../a/.git && pwd` sub_b"
|
379
|
-
run "cd b && git add . && git commit -am 'submodules'"
|
380
|
-
run "cd b && git checkout master"
|
381
|
-
|
382
|
-
vendorer.folder 'plugin', 'b/.git', :branch => 'with_submodules'
|
383
|
-
|
384
|
-
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub_b\n"
|
385
|
-
run("ls -a plugin/sub_b").should == ".\n..\n.git\n.gitmodules\nsub_a\n"
|
386
|
-
run("ls -a plugin/sub_b/sub_a").should include('Gemfile')
|
387
|
-
end
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
describe '#rewrite' do
|
392
|
-
it "can rewrite a file to change stuff" do
|
393
|
-
write "Vendorfile", "
|
394
|
-
file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js' do |path|
|
395
|
-
rewrite(path){|content| content.gsub('j','h') }
|
396
|
-
end
|
397
|
-
"
|
398
|
-
vendorer
|
399
|
-
content = read('public/javascripts/jquery.min.js')[0..100]
|
400
|
-
content.should_not include('jQuery')
|
401
|
-
content.should include('hQuery')
|
402
|
-
end
|
403
|
-
end
|
404
|
-
|
405
|
-
describe "#parse" do
|
406
|
-
it "executes inside vendorer" do
|
407
|
-
$test = 1
|
408
|
-
v = Vendorer.new
|
409
|
-
v.parse '$test = self'
|
410
|
-
$test.should == v
|
411
|
-
end
|
412
|
-
|
413
|
-
it "fails with a nice backtrace" do
|
414
|
-
write 'Vendorfile', "\n\nfile 'XXX'\n\n"
|
415
|
-
output = vendorer '', :raise => true
|
416
|
-
output.should include("from Vendorfile:3:in `parse")
|
417
|
-
end
|
418
|
-
end
|
419
|
-
|
420
|
-
describe "#init" do
|
421
|
-
it "creates a Vendorfile via cli" do
|
422
|
-
vendorer("init")
|
423
|
-
read("Vendorfile").should include("folder")
|
424
|
-
end
|
425
|
-
|
426
|
-
context "from ruby" do
|
427
|
-
before do
|
428
|
-
Dir.chdir '../../' if RUBY_VERSION < '1.9'
|
429
|
-
end
|
430
|
-
|
431
|
-
it "creates a Vendorfile via ruby" do
|
432
|
-
Vendorer.new('init').init
|
433
|
-
read("Vendorfile").should include("folder")
|
434
|
-
end
|
435
|
-
|
436
|
-
it "created Vendorfile contains commented out examples" do
|
437
|
-
Vendorer.new('init').init
|
438
|
-
read("Vendorfile").split("\n").each { |l| l.should =~ /^(#|\s*$)/ }
|
439
|
-
end
|
440
|
-
|
441
|
-
it "created Vendorfile contains many examples" do
|
442
|
-
Vendorer.new('init').init
|
443
|
-
read("Vendorfile").should include("folder 'vendor/")
|
444
|
-
read("Vendorfile").should include("file 'vendor/")
|
445
|
-
read("Vendorfile").should include("rewrite(path)")
|
446
|
-
end
|
447
|
-
|
448
|
-
it "created Vendorfile does not contain other instructions" do
|
449
|
-
Vendorer.new('init').init
|
450
|
-
read("Vendorfile").should_not include("vendorer init")
|
451
|
-
read("Vendorfile").should_not include("Gemfile")
|
452
|
-
read("Vendorfile").should_not include("gem install")
|
453
|
-
read("Vendorfile").should_not include("```")
|
454
|
-
end
|
455
|
-
end
|
456
|
-
end
|
457
|
-
|
458
|
-
describe "#from" do
|
459
|
-
it "returns to normal after the block" do
|
460
|
-
write "Vendorfile", "
|
461
|
-
from '../../.git' do
|
462
|
-
file 'Readme.md'
|
463
|
-
end
|
464
|
-
file 'jquery.js', 'http://code.jquery.com/jquery-latest.min.js'
|
465
|
-
"
|
466
|
-
vendorer
|
467
|
-
ls(".").should =~ ['Readme.md', 'Vendorfile', 'jquery.js']
|
468
|
-
read('jquery.js').should include("jQuery")
|
469
|
-
end
|
470
|
-
|
471
|
-
it "can checkout a specific version" do
|
472
|
-
write "Vendorfile", "
|
473
|
-
from '../../.git', :tag => 'v0.1.0' do
|
474
|
-
file 'lib/vendorer/version.rb'
|
475
|
-
end
|
476
|
-
"
|
477
|
-
vendorer
|
478
|
-
read('lib/vendorer/version.rb').should include("0.1.0")
|
479
|
-
end
|
480
|
-
|
481
|
-
it "passes the path to the working copy to the block" do
|
482
|
-
write "Vendorfile", "
|
483
|
-
from('../../.git'){|path| puts `ls #\{path}` }
|
484
|
-
"
|
485
|
-
vendorer.should include('vendorer.gemspec')
|
486
|
-
end
|
487
|
-
|
488
|
-
context "with file" do
|
489
|
-
it "copies" do
|
490
|
-
write "Vendorfile", "
|
491
|
-
from '../../.git' do
|
492
|
-
file 'Readme.md'
|
493
|
-
end
|
494
|
-
"
|
495
|
-
vendorer
|
496
|
-
ls(".").should =~ ['Readme.md', 'Vendorfile']
|
497
|
-
end
|
498
|
-
|
499
|
-
it "copies to/from a nested location" do
|
500
|
-
write "Vendorfile", "
|
501
|
-
from '../../.git' do
|
502
|
-
file 'foo/bar/renamed.rb', 'lib/vendorer.rb'
|
503
|
-
end
|
504
|
-
"
|
505
|
-
vendorer
|
506
|
-
ls(".").should =~ ['foo', 'Vendorfile']
|
507
|
-
ls("./foo/bar").should =~ ['renamed.rb']
|
508
|
-
end
|
509
|
-
|
510
|
-
it "renames" do
|
511
|
-
write "Vendorfile", "
|
512
|
-
from '../../.git' do
|
513
|
-
file 'Readme.renamed', 'Readme.md'
|
514
|
-
end
|
515
|
-
"
|
516
|
-
vendorer
|
517
|
-
ls(".").should =~ ['Readme.renamed', 'Vendorfile']
|
518
|
-
end
|
519
|
-
end
|
520
|
-
|
521
|
-
context "with folder" do
|
522
|
-
it "copies" do
|
523
|
-
write "Vendorfile", "
|
524
|
-
from '../../.git' do
|
525
|
-
folder 'lib'
|
526
|
-
end
|
527
|
-
"
|
528
|
-
vendorer
|
529
|
-
ls(".").should =~ ['lib', 'Vendorfile']
|
530
|
-
ls("./lib").should =~ ['vendorer', 'vendorer.rb']
|
531
|
-
end
|
532
|
-
|
533
|
-
it "copies to/from a nested location" do
|
534
|
-
write "Vendorfile", "
|
535
|
-
from '../../.git' do
|
536
|
-
folder 'foo/bar', 'lib/vendorer'
|
537
|
-
end
|
538
|
-
"
|
539
|
-
vendorer
|
540
|
-
ls(".").should =~ ['foo', 'Vendorfile']
|
541
|
-
ls("./foo/bar").should =~ ['version.rb']
|
542
|
-
end
|
543
|
-
|
544
|
-
it "renames" do
|
545
|
-
write "Vendorfile", "
|
546
|
-
from '../../.git' do
|
547
|
-
folder 'foo', 'lib'
|
548
|
-
end
|
549
|
-
"
|
550
|
-
vendorer
|
551
|
-
ls(".").should =~ ['foo', 'Vendorfile']
|
552
|
-
ls("./foo").should =~ ['vendorer', 'vendorer.rb']
|
553
|
-
end
|
554
|
-
end
|
555
|
-
|
556
|
-
context "with folder nesting" do
|
557
|
-
it "copies" do
|
558
|
-
write "Vendorfile", "
|
559
|
-
folder 'foo' do
|
560
|
-
from '../../.git' do
|
561
|
-
folder 'lib'
|
562
|
-
file 'Gemfile'
|
563
|
-
end
|
564
|
-
end
|
565
|
-
"
|
566
|
-
vendorer
|
567
|
-
ls(".").should =~ ['foo', 'Vendorfile']
|
568
|
-
ls("./foo").should =~ ['Gemfile', 'lib']
|
569
|
-
ls("./foo/lib").should =~ ['vendorer', 'vendorer.rb']
|
570
|
-
end
|
571
|
-
end
|
572
|
-
|
573
|
-
it "gives 'not found' error for non-existent file" do
|
574
|
-
write "Vendorfile", "
|
575
|
-
from '../../.git', :tag => 'b1e6460' do
|
576
|
-
file 'bogus'
|
577
|
-
end
|
578
|
-
"
|
579
|
-
output = vendorer '', :raise => true
|
580
|
-
output.should include("'bogus' not found in ../../.git")
|
581
|
-
end
|
582
|
-
end
|
583
|
-
end
|
data/vendorer.gemspec
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
|
-
name = "vendorer"
|
3
|
-
require "#{name}/version"
|
4
|
-
|
5
|
-
Gem::Specification.new name, Vendorer::VERSION do |s|
|
6
|
-
s.summary = "Keep your vendor files up to date"
|
7
|
-
s.authors = ["Michael Grosser"]
|
8
|
-
s.email = "michael@grosser.it"
|
9
|
-
s.homepage = "http://github.com/grosser/#{name}"
|
10
|
-
s.files = `git ls-files`.split("\n")
|
11
|
-
s.license = 'MIT'
|
12
|
-
s.executables = ["vendorer"]
|
13
|
-
end
|