vendorer 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/vendorer/version.rb +1 -1
- data/lib/vendorer.rb +1 -0
- data/spec/vendorer_spec.rb +62 -6
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/vendorer/version.rb
CHANGED
data/lib/vendorer.rb
CHANGED
@@ -30,6 +30,7 @@ class Vendorer
|
|
30
30
|
if commit = (options[:ref] || options[:tag] || options[:branch])
|
31
31
|
run "cd #{path} && git checkout '#{commit}'"
|
32
32
|
end
|
33
|
+
run("cd #{path} && git submodule update --init --recursive")
|
33
34
|
run "rm -rf #{path}/.git"
|
34
35
|
yield path if block_given?
|
35
36
|
end
|
data/spec/vendorer_spec.rb
CHANGED
@@ -2,8 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Vendorer do
|
4
4
|
before do
|
5
|
+
Dir.chdir File.dirname(File.dirname(__FILE__))
|
5
6
|
`rm -rf spec/tmp`
|
6
7
|
`mkdir spec/tmp`
|
8
|
+
Dir.chdir 'spec/tmp'
|
7
9
|
end
|
8
10
|
|
9
11
|
after do
|
@@ -11,29 +13,29 @@ describe Vendorer do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def write(file, content)
|
14
|
-
File.open(
|
16
|
+
File.open(file,'w'){|f| f.write(content) }
|
15
17
|
end
|
16
18
|
|
17
19
|
def read(file)
|
18
|
-
File.read(
|
20
|
+
File.read(file)
|
19
21
|
end
|
20
22
|
|
21
23
|
def size(file)
|
22
|
-
File.size(
|
24
|
+
File.size(file)
|
23
25
|
end
|
24
26
|
|
25
27
|
def run(cmd)
|
26
|
-
result =
|
28
|
+
result = `#{cmd} 2>&1`
|
27
29
|
raise result unless $?.success?
|
28
30
|
result
|
29
31
|
end
|
30
32
|
|
31
33
|
def ls(path)
|
32
|
-
`ls
|
34
|
+
`ls #{path} 2>&1`.split("\n")
|
33
35
|
end
|
34
36
|
|
35
37
|
def vendorer(args='', options={})
|
36
|
-
out = `
|
38
|
+
out = `bundle exec ../../bin/vendorer #{args} 2>&1`
|
37
39
|
raise out if $?.success? == !!options[:raise]
|
38
40
|
out
|
39
41
|
end
|
@@ -302,6 +304,60 @@ describe Vendorer do
|
|
302
304
|
read('public/javascripts/jquery.js').should include('jQuery')
|
303
305
|
end
|
304
306
|
end
|
307
|
+
|
308
|
+
context "submodules" do
|
309
|
+
def create_git_repo(folder, command)
|
310
|
+
# create a git repo with a submodule
|
311
|
+
run "mkdir #{folder}"
|
312
|
+
run "cd #{folder} && git init"
|
313
|
+
run "cd #{folder} && #{command}"
|
314
|
+
run "cd #{folder} && git add ."
|
315
|
+
run "cd #{folder} && git commit -am 'initial'"
|
316
|
+
end
|
317
|
+
|
318
|
+
let(:vendorer){
|
319
|
+
v = Vendorer.new
|
320
|
+
def v.puts(x);end # silence
|
321
|
+
v
|
322
|
+
}
|
323
|
+
|
324
|
+
it "installs submodules" do
|
325
|
+
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub'
|
326
|
+
|
327
|
+
vendorer.folder 'plugin', 'a/.git'
|
328
|
+
|
329
|
+
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub\n"
|
330
|
+
run("ls -a plugin/sub").should include('Gemfile')
|
331
|
+
end
|
332
|
+
|
333
|
+
it "installs recursive submodules" do
|
334
|
+
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub_a'
|
335
|
+
create_git_repo 'b', 'git submodule add `cd ../a/.git && pwd` sub_b'
|
336
|
+
|
337
|
+
vendorer.folder 'plugin', 'b/.git'
|
338
|
+
|
339
|
+
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub_b\n"
|
340
|
+
run("ls -a plugin/sub_b").should == ".\n..\n.git\n.gitmodules\nsub_a\n"
|
341
|
+
run("ls -a plugin/sub_b/sub_a").should include('Gemfile')
|
342
|
+
end
|
343
|
+
|
344
|
+
it "installs recursive submodules from a branch" do
|
345
|
+
create_git_repo 'a', 'git submodule add `cd ../../../.git && pwd` sub_a'
|
346
|
+
create_git_repo 'b', 'touch .gitmodules'
|
347
|
+
|
348
|
+
# create submodules on a branch
|
349
|
+
run "cd b && git co -b with_submodules"
|
350
|
+
run "cd b && git submodule add `cd ../a/.git && pwd` sub_b"
|
351
|
+
run "cd b && git add . && git commit -am 'submodules'"
|
352
|
+
run "cd b && git checkout master"
|
353
|
+
|
354
|
+
vendorer.folder 'plugin', 'b/.git', :branch => 'with_submodules'
|
355
|
+
|
356
|
+
run("ls -a plugin").should == ".\n..\n.gitmodules\nsub_b\n"
|
357
|
+
run("ls -a plugin/sub_b").should == ".\n..\n.git\n.gitmodules\nsub_a\n"
|
358
|
+
run("ls -a plugin/sub_b/sub_a").should include('Gemfile')
|
359
|
+
end
|
360
|
+
end
|
305
361
|
end
|
306
362
|
|
307
363
|
describe '#rewrite' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vendorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: michael@grosser.it
|
@@ -44,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
44
|
version: '0'
|
45
45
|
segments:
|
46
46
|
- 0
|
47
|
-
hash:
|
47
|
+
hash: -191468703
|
48
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
segments:
|
55
55
|
- 0
|
56
|
-
hash:
|
56
|
+
hash: -191468703
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
59
|
rubygems_version: 1.8.10
|