vendorificator 0.5.git.v0.4.0.17.g26d50d8 → 0.5.git.v0.4.0.60.g9c35209
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 +8 -8
- data/Gemfile +1 -0
- data/README.md +7 -7
- data/features/chef_cookbook.feature +4 -4
- data/features/download.feature +1 -1
- data/features/edgecases.feature +2 -2
- data/features/environment.feature +54 -3
- data/features/git.feature +5 -5
- data/features/needed.feature +2 -2
- data/features/status.feature +3 -3
- data/features/tarball.feature +5 -5
- data/features/tarball_edit.feature +1 -1
- data/features/tool.feature +4 -4
- data/features/tool_shortcuts.feature +2 -2
- data/features/vendor.feature +1 -1
- data/lib/vendorificator/cli.rb +84 -30
- data/lib/vendorificator/environment.rb +118 -44
- data/lib/vendorificator/errors.rb +1 -0
- data/lib/vendorificator/hooks/chef_cookbook.rb +1 -1
- data/lib/vendorificator/io_proxy.rb +46 -0
- data/lib/vendorificator/vendor/archive.rb +2 -2
- data/lib/vendorificator/vendor/chef_cookbook.rb +1 -1
- data/lib/vendorificator/vendor/download.rb +2 -2
- data/lib/vendorificator/vendor/git.rb +1 -1
- data/lib/vendorificator/vendor.rb +50 -24
- data/lib/vendorificator.rb +1 -0
- data/spec/spec_helper.rb +4 -3
- data/spec/vendorificator/environment_spec.rb +59 -14
- data/spec/vendorificator/vendor_spec.rb +66 -25
- metadata +3 -6
- data/spec/vendorificator/fixtures/vendorfiles/empty_vendor.rb +0 -1
- data/spec/vendorificator/fixtures/vendorfiles/vendor.rb +0 -15
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWI0NzRjOTRjNDkzZTI2NjkyY2NhZDJhYjE4NDU3NGI5ZDIyZTY4Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWQwNTNhNWFhMTY5ZDhhZWM0MjJjMTI2Y2IzZGU2ZTQ3NGY2ZGZlZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2Q1MDc2YjNmMzgxMWI1N2RhNjRmMWVkYzYzYTAyMjA4MTYzMjMwNmVkZmJi
|
10
|
+
MmNkY2FkN2VmMGM4MzdlMDFkM2VlMmZiYTM5MmRjM2VmM2M2YzJhNTk2M2Vh
|
11
|
+
M2FlNmQ5M2EzYjZhODNjYmZiNGIwZmViNGNlZmVjZDhjZTU4YjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjE3ZjE1MjYzYTc4NjFiZWU3MTM1MGI5MGE1OWQ4ZWZiZjY2NmZlMDFjNzFl
|
14
|
+
MTRhOTA1Yjc4N2ZlOTQ0ZWI3ZDk5ODAyZWFlZGJjMjE4MzhhM2FiNTA5NWJh
|
15
|
+
YTdlYjliY2MyNDIzMmFiNjY0MjQzYzhkM2RjMjhjZjEwYzM0ZjY=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -57,8 +57,8 @@ detail.
|
|
57
57
|
a Git remote
|
58
58
|
* `vendor push` will push all vendor branches, tags, and notes to
|
59
59
|
a Git remote
|
60
|
-
* `vendor diff` will show
|
61
|
-
pristine branch and
|
60
|
+
* `vendor diff` will show a `git diff` of vendor module's files between vendor
|
61
|
+
module's pristine branch and current work tree
|
62
62
|
* `vendor log` will show a `git log` of all changes made to a particular
|
63
63
|
vendor module's files that are not in module's pristine branch
|
64
64
|
|
@@ -112,10 +112,10 @@ It takes following options:
|
|
112
112
|
* `:version` - the version of module. If the module's contents should
|
113
113
|
change, increase the version, so that Vendorificator knows it needs
|
114
114
|
to re-create the module.
|
115
|
-
* `:
|
115
|
+
* `:group` - module's *group* is subdirectory of the basedir
|
116
116
|
where module's directory will be created. For example, `vendor
|
117
117
|
"foo"` will go to `vendor/foo` by default, but `vendor "foo",
|
118
|
-
:
|
118
|
+
:group => :widgets` will go to `vendor/widgets/foo`. It is also
|
119
119
|
added in a similar way to module's branch name, tag names, etc.
|
120
120
|
* `:path` - lets you specify subdirectory in which the module will be
|
121
121
|
downloaded
|
@@ -197,7 +197,7 @@ Example:
|
|
197
197
|
```ruby
|
198
198
|
git 'git://github.com/mpasternacki/nagios.git',
|
199
199
|
:branch => 'COOK-1997',
|
200
|
-
:
|
200
|
+
:group => :cookbooks,
|
201
201
|
:version => '0.20130124.2'
|
202
202
|
```
|
203
203
|
|
@@ -206,7 +206,7 @@ git 'git://github.com/mpasternacki/nagios.git',
|
|
206
206
|
Downloads an Opscode Chef cookbook from http://community.opscode.com/
|
207
207
|
website (same thing that `knife cookbook site install` does). It
|
208
208
|
resolves dependencies -- all needed modules will be downloaded by
|
209
|
-
default. Its
|
209
|
+
default. Its group defaults to `:cookbooks`. It may take the same
|
210
210
|
arguments as `archive` (but the name and possibly version is almost
|
211
211
|
always enough), plus:
|
212
212
|
|
@@ -238,7 +238,7 @@ option to add it:
|
|
238
238
|
|
239
239
|
```ruby
|
240
240
|
git 'git://github.com/user/cookbook.git',
|
241
|
-
:
|
241
|
+
:group => :cookbooks,
|
242
242
|
:hooks => 'ChefCookbookDependencies'
|
243
243
|
end
|
244
244
|
```
|
@@ -5,7 +5,7 @@ Scenario: A single cookbook, without dependencies
|
|
5
5
|
"""ruby
|
6
6
|
chef_cookbook 'apt'
|
7
7
|
"""
|
8
|
-
When I run vendor command "
|
8
|
+
When I run vendor command "install"
|
9
9
|
Then following has been conjured:
|
10
10
|
| Name | cookbooks/apt |
|
11
11
|
| With file | metadata.rb |
|
@@ -15,7 +15,7 @@ Scenario: Dependency hook
|
|
15
15
|
"""ruby
|
16
16
|
chef_cookbook 'memcached'
|
17
17
|
"""
|
18
|
-
When I run vendor command "
|
18
|
+
When I run vendor command "install"
|
19
19
|
Then following has been conjured:
|
20
20
|
| Name | cookbooks/memcached | cookbooks/runit |
|
21
21
|
| With file | metadata.rb | metadata.rb |
|
@@ -26,7 +26,7 @@ Scenario: Ignored dependency
|
|
26
26
|
chef_cookbook_ignore_dependencies ['runit']
|
27
27
|
chef_cookbook 'memcached'
|
28
28
|
"""
|
29
|
-
When I run vendor command "
|
29
|
+
When I run vendor command "install"
|
30
30
|
Then following has been conjured:
|
31
31
|
| Name | cookbooks/memcached |
|
32
32
|
| With file | metadata.rb |
|
@@ -40,7 +40,7 @@ Scenario: Ignored all dependencies
|
|
40
40
|
chef_cookbook_ignore_dependencies true
|
41
41
|
chef_cookbook 'chef-server'
|
42
42
|
"""
|
43
|
-
When I run vendor command "
|
43
|
+
When I run vendor command "install"
|
44
44
|
Then following has been conjured:
|
45
45
|
| Name | cookbooks/chef-server |
|
46
46
|
| With file | metadata.rb |
|
data/features/download.feature
CHANGED
@@ -5,7 +5,7 @@ Scenario: just URL as name
|
|
5
5
|
"""ruby
|
6
6
|
download 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1.tar.gz'
|
7
7
|
"""
|
8
|
-
When I run vendor command "
|
8
|
+
When I run vendor command "install"
|
9
9
|
Then following has been conjured:
|
10
10
|
| Name | testrepo-0.1.tar.gz |
|
11
11
|
And there's a git commit note including "ea207a" in "download_checksum"
|
data/features/edgecases.feature
CHANGED
@@ -7,7 +7,7 @@ Scenario: module with a .gitignore file
|
|
7
7
|
File.open('.gitignore', 'w') { |f| f.puts 'ignored.txt' }
|
8
8
|
end
|
9
9
|
"""
|
10
|
-
When I run vendor command "
|
10
|
+
When I run vendor command "install"
|
11
11
|
Then the following has been conjured:
|
12
12
|
| Name | ignore |
|
13
13
|
| With file | .gitignore |
|
@@ -25,7 +25,7 @@ Scenario: module with a .gitignore file
|
|
25
25
|
File.open('.gitignore', 'w') { |f| f.puts 'ignored.txt' }
|
26
26
|
end
|
27
27
|
"""
|
28
|
-
And I run vendor command "
|
28
|
+
And I run vendor command "install"
|
29
29
|
Then the file "vendor/ignore/files.txt" should not contain "ignored.txt"
|
30
30
|
And the file "vendor/ignore/ignored.txt" should contain exactly:
|
31
31
|
"""
|
@@ -8,7 +8,7 @@ Scenario: Pushing to remote repo
|
|
8
8
|
end
|
9
9
|
"""
|
10
10
|
And a remote repository
|
11
|
-
When I run vendor command "
|
11
|
+
When I run vendor command "install"
|
12
12
|
And I run vendor command "push"
|
13
13
|
Then branch "vendor/generated" exists in the remote repo
|
14
14
|
And tag "vendor/generated/0.23" exists in the remote repo
|
@@ -23,7 +23,7 @@ Scenario: Getting module information
|
|
23
23
|
end
|
24
24
|
"""
|
25
25
|
And a remote repository
|
26
|
-
When I run vendor command "
|
26
|
+
When I run vendor command "install"
|
27
27
|
And I run vendor command "info generated"
|
28
28
|
Then the last vendor output should match /Module merged version: 0.23/
|
29
29
|
And the last vendor output should match /unparsed_args/
|
@@ -36,7 +36,58 @@ Scenario: Getting revision information
|
|
36
36
|
end
|
37
37
|
"""
|
38
38
|
And a remote repository
|
39
|
-
When I run vendor command "
|
39
|
+
When I run vendor command "install"
|
40
40
|
And I run vendor command "info HEAD^2"
|
41
41
|
Then the last vendor output should match /master, vendor\/generated/
|
42
42
|
Then the last vendor output should match /:unparsed_args/
|
43
|
+
|
44
|
+
Scenario: Working with empty Vendorfile
|
45
|
+
Given a repository with following Vendorfile:
|
46
|
+
"""ruby
|
47
|
+
"""
|
48
|
+
And a remote repository
|
49
|
+
When I run vendor command "sync"
|
50
|
+
And I run vendor command "list"
|
51
|
+
Then the last vendor output should match /\A\z/
|
52
|
+
|
53
|
+
Scenario: Running tasks without Vendorfile where they don't need it
|
54
|
+
Given a directory named "foo"
|
55
|
+
When I cd to "foo"
|
56
|
+
And I run vendor command "help"
|
57
|
+
Then the last vendor output should match /diff \[MODULE \[MODULE \.\.\.\]\]/
|
58
|
+
And the last vendor output should not match /Vendorfile not found/
|
59
|
+
|
60
|
+
Scenario: Running tasks without Vendorfile where they need it
|
61
|
+
Given a directory named "foo"
|
62
|
+
When I cd to "foo"
|
63
|
+
And I run vendor command "pull"
|
64
|
+
Then the last vendor output should match /Vendorfile not found/
|
65
|
+
|
66
|
+
Scenario: Getting module list
|
67
|
+
Given a repository with following Vendorfile:
|
68
|
+
"""ruby
|
69
|
+
vendor 'generated', :version => '0.23' do |v|
|
70
|
+
File.open('README', 'w') { |f| f.puts "Hello, World!" }
|
71
|
+
end
|
72
|
+
"""
|
73
|
+
When I run vendor command "install"
|
74
|
+
And I run vendor command "list"
|
75
|
+
Then the last vendor output should match /Module: generated, version: 0.23/
|
76
|
+
|
77
|
+
Scenario: Getting list of outdated modules
|
78
|
+
Given a repository with following Vendorfile:
|
79
|
+
"""ruby
|
80
|
+
vendor 'generated', :version => '0.23' do |v|
|
81
|
+
File.open('README', 'w') { |f| f.puts "Hello, World!" }
|
82
|
+
end
|
83
|
+
"""
|
84
|
+
When I run vendor command "install"
|
85
|
+
And I change Vendorfile to:
|
86
|
+
"""ruby
|
87
|
+
vendor 'generated', :version => '0.42' do |v|
|
88
|
+
File.open('README', 'w') { |f| f.puts "Hello, Updated, World!" }
|
89
|
+
File.open('VERSION', 'w') { |f| f.puts v.version }
|
90
|
+
end
|
91
|
+
"""
|
92
|
+
And I run vendor command "outdated"
|
93
|
+
Then the last vendor output should match /outdated\s+generated/
|
data/features/git.feature
CHANGED
@@ -5,7 +5,7 @@ Scenario: Vendorificating a git repo
|
|
5
5
|
"""ruby
|
6
6
|
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo"
|
7
7
|
"""
|
8
|
-
When I run vendor command "
|
8
|
+
When I run vendor command "install"
|
9
9
|
Then following has been conjured:
|
10
10
|
| Name | testrepo |
|
11
11
|
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
|
@@ -19,7 +19,7 @@ Scenario: Vendorificating a subdirectory from a git repo
|
|
19
19
|
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
|
20
20
|
:subdirectory => 'test'
|
21
21
|
"""
|
22
|
-
When I run vendor command "
|
22
|
+
When I run vendor command "install"
|
23
23
|
Then following has been conjured:
|
24
24
|
| Name | testrepo |
|
25
25
|
| Version | 10e9ac58c77bc229d8c59a5b4eb7422916453148 |
|
@@ -33,7 +33,7 @@ Scenario: Vendorificating a certain branch from a git repo
|
|
33
33
|
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
|
34
34
|
:branch => 'topic/pink'
|
35
35
|
"""
|
36
|
-
When I run vendor command "
|
36
|
+
When I run vendor command "install"
|
37
37
|
Then following has been conjured:
|
38
38
|
| Name | testrepo |
|
39
39
|
| Version | ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c |
|
@@ -47,7 +47,7 @@ Scenario: Vendorificating a certain tag from a git repo
|
|
47
47
|
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
|
48
48
|
:tag => 'email-v0'
|
49
49
|
"""
|
50
|
-
When I run vendor command "
|
50
|
+
When I run vendor command "install"
|
51
51
|
Then following has been conjured:
|
52
52
|
| Name | testrepo |
|
53
53
|
| Version | email-v0 |
|
@@ -62,7 +62,7 @@ Scenario: Vendorificating a certain revision from a git repo
|
|
62
62
|
git "file://#{ENV['FIXTURES_DIR']}/git/testrepo",
|
63
63
|
:revision => '6ff1be'
|
64
64
|
"""
|
65
|
-
When I run vendor command "
|
65
|
+
When I run vendor command "install"
|
66
66
|
Then following has been conjured:
|
67
67
|
| Name | testrepo |
|
68
68
|
| Version | 6ff1be9c3819c93a2f41e0ddc09f252fcf154f34 |
|
data/features/needed.feature
CHANGED
@@ -6,12 +6,12 @@ Scenario: already downloaded tarball
|
|
6
6
|
archive :testrepo, :version => '0.1',
|
7
7
|
:url => 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1.tar.gz'
|
8
8
|
"""
|
9
|
-
When I run vendor command "
|
9
|
+
When I run vendor command "install"
|
10
10
|
Then I'm on "master" branch
|
11
11
|
And the last vendor output should match /module\s+testrepo/
|
12
12
|
And the last vendor output should match "testrepo-0.1.tar.gz"
|
13
13
|
|
14
|
-
When I run vendor command "
|
14
|
+
When I run vendor command "install"
|
15
15
|
Then the last vendor output should match /module\s+testrepo/
|
16
16
|
And the last vendor output should match /up to date\s+testrepo/
|
17
17
|
And the last vendor output should not match "testrepo-0.1.tar.gz"
|
data/features/status.feature
CHANGED
@@ -16,12 +16,12 @@ Scenario: status new module
|
|
16
16
|
Then the last vendor output should match /new\s+generated\/0.23/
|
17
17
|
|
18
18
|
Scenario: status up-to-date module
|
19
|
-
When I run vendor command "
|
19
|
+
When I run vendor command "install"
|
20
20
|
And I run vendor command "status"
|
21
21
|
Then the last vendor output should match /up to date\s+generated\/0.23/
|
22
22
|
|
23
23
|
Scenario: status outdated modules
|
24
|
-
When I run vendor command "
|
24
|
+
When I run vendor command "install"
|
25
25
|
And I change Vendorfile to:
|
26
26
|
"""ruby
|
27
27
|
vendor 'generated', :version => '0.42' do |v|
|
@@ -41,7 +41,7 @@ Scenario: Module's dependencies are statused if they are known
|
|
41
41
|
And I run vendor command "status"
|
42
42
|
Then the last vendor output should match /new\s+memcached/
|
43
43
|
And the last vendor output should not match "runit"
|
44
|
-
When I run vendor command "
|
44
|
+
When I run vendor command "install"
|
45
45
|
And I run vendor command "status"
|
46
46
|
Then the last vendor output should match /up to date\s+memcached/
|
47
47
|
And the last vendor output should match /up to date\s+runit/
|
data/features/tarball.feature
CHANGED
@@ -5,7 +5,7 @@ Scenario: just URL as name
|
|
5
5
|
"""ruby
|
6
6
|
archive 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1.tar.gz'
|
7
7
|
"""
|
8
|
-
When I run vendor command "
|
8
|
+
When I run vendor command "install"
|
9
9
|
Then following has been conjured:
|
10
10
|
| Name | testrepo-0.1 |
|
11
11
|
| Version | testrepo-0.1.tar.gz |
|
@@ -17,7 +17,7 @@ Scenario: URL as keyword
|
|
17
17
|
archive :testrepo,
|
18
18
|
:url => 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1.tar.gz'
|
19
19
|
"""
|
20
|
-
When I run vendor command "
|
20
|
+
When I run vendor command "install"
|
21
21
|
Then following has been conjured:
|
22
22
|
| Name | testrepo |
|
23
23
|
| Version | testrepo-0.1.tar.gz |
|
@@ -31,7 +31,7 @@ Scenario: Version & checksum
|
|
31
31
|
:version => '0.1',
|
32
32
|
:checksum => 'ea207a896f929ffb3a1dfe128332d6134a18edab7c01b97bfb2b1c7eacebe0cb'
|
33
33
|
"""
|
34
|
-
When I run vendor command "
|
34
|
+
When I run vendor command "install"
|
35
35
|
Then following has been conjured:
|
36
36
|
| Name | testrepo |
|
37
37
|
| Version | 0.1 |
|
@@ -48,7 +48,7 @@ Scenario: Wrong checksum
|
|
48
48
|
:version => '0.1',
|
49
49
|
:checksum => 'incorrect'
|
50
50
|
"""
|
51
|
-
When I run `vendor
|
51
|
+
When I run `vendor install`
|
52
52
|
Then it should fail
|
53
53
|
And following has not been conjured:
|
54
54
|
| Name | testrepo |
|
@@ -60,7 +60,7 @@ Scenario: Tarball without a root directory
|
|
60
60
|
archive :testrepo,
|
61
61
|
:url => 'http://test-assets.3ofcoins.net.s3-website-us-east-1.amazonaws.com/testrepo-0.1-noroot.tar.gz'
|
62
62
|
"""
|
63
|
-
When I run vendor command "
|
63
|
+
When I run vendor command "install"
|
64
64
|
Then following has been conjured:
|
65
65
|
| Name | testrepo |
|
66
66
|
| With file | test/alias.c |
|
data/features/tool.feature
CHANGED
@@ -20,7 +20,7 @@ Scenario: Use Gem bundler to download rubygems, and Vendorificator to vendor the
|
|
20
20
|
source "file://#{ENV['FIXTURES_DIR']}/rubygems"
|
21
21
|
gem "hello"
|
22
22
|
"""
|
23
|
-
When I run vendor command "
|
23
|
+
When I run vendor command "install"
|
24
24
|
Then following has been conjured:
|
25
25
|
| Name | bundler |
|
26
26
|
| Path | cache |
|
@@ -33,7 +33,7 @@ Scenario: Bundler correctly downloads and caches dependencies
|
|
33
33
|
source "file://#{ENV['FIXTURES_DIR']}/rubygems"
|
34
34
|
gem "first"
|
35
35
|
"""
|
36
|
-
When I run vendor command "
|
36
|
+
When I run vendor command "install"
|
37
37
|
Then following has been conjured:
|
38
38
|
| Name | bundler |
|
39
39
|
| Path | cache |
|
@@ -47,7 +47,7 @@ Scenario: directory contents are completely replaced on re-vendoring
|
|
47
47
|
source "file://#{ENV['FIXTURES_DIR']}/rubygems"
|
48
48
|
gem "hello"
|
49
49
|
"""
|
50
|
-
When I run vendor command "
|
50
|
+
When I run vendor command "install"
|
51
51
|
Then following has been conjured:
|
52
52
|
| Name | bundler |
|
53
53
|
| Path | cache |
|
@@ -58,7 +58,7 @@ Scenario: directory contents are completely replaced on re-vendoring
|
|
58
58
|
source "file://#{ENV['FIXTURES_DIR']}/rubygems"
|
59
59
|
gem "first"
|
60
60
|
"""
|
61
|
-
And I run vendor command "
|
61
|
+
And I run vendor command "install"
|
62
62
|
Then following has been conjured:
|
63
63
|
| Name | bundler |
|
64
64
|
| Path | cache |
|
@@ -14,7 +14,7 @@ Scenario: rubygems_bundler
|
|
14
14
|
source "file://#{ENV['FIXTURES_DIR']}/rubygems"
|
15
15
|
gem "hello"
|
16
16
|
"""
|
17
|
-
When I run vendor command "
|
17
|
+
When I run vendor command "install"
|
18
18
|
Then following has been conjured:
|
19
19
|
| Name | rubygems |
|
20
20
|
| Path | cache |
|
@@ -35,7 +35,7 @@ Scenario: chef_berkshelf
|
|
35
35
|
And I successfully run `berks install`
|
36
36
|
And I successfully run `git add Berksfile Berksfile.lock`
|
37
37
|
And I successfully run `git commit -m Berksfile`
|
38
|
-
When I run vendor command "
|
38
|
+
When I run vendor command "install"
|
39
39
|
Then following has been conjured:
|
40
40
|
| Name | cookbooks |
|
41
41
|
| With file | build-essential/metadata.rb |
|
data/features/vendor.feature
CHANGED
data/lib/vendorificator/cli.rb
CHANGED
@@ -14,6 +14,7 @@ require 'vendorificator'
|
|
14
14
|
|
15
15
|
module Vendorificator
|
16
16
|
class CLI < Thor
|
17
|
+
VERBOSITY_LEVELS = {1 => :quiet, 2 => :default, 3 => :chatty, 9 => :debug}
|
17
18
|
attr_reader :environment
|
18
19
|
|
19
20
|
check_unknown_options! :except => [:git, :diff, :log]
|
@@ -21,18 +22,16 @@ module Vendorificator
|
|
21
22
|
|
22
23
|
default_task :help
|
23
24
|
|
24
|
-
class_option :file,
|
25
|
-
:banner => 'PATH'
|
26
|
-
class_option :debug, :aliases => '-d', :type => :boolean, :default => false
|
27
|
-
class_option :quiet, :aliases => '-q', :type => :boolean, :default => false
|
25
|
+
class_option :file, :aliases => '-f', :type => :string, :banner => 'PATH'
|
28
26
|
class_option :modules, :aliases => '-m', :type => :string, :default => '',
|
29
27
|
:banner => 'mod1,mod2,...,modN',
|
30
28
|
:desc => 'Run only for specified modules (name or path, comma separated)'
|
31
29
|
class_option :version, :type => :boolean
|
32
|
-
class_option :
|
30
|
+
class_option :verbose, :aliases => '-v', :type => :numeric
|
33
31
|
|
34
|
-
def initialize(args=[], options={}, config={})
|
32
|
+
def initialize(args = [], options = {}, config = {})
|
35
33
|
super
|
34
|
+
parse_options
|
36
35
|
|
37
36
|
if self.options[:debug]
|
38
37
|
MiniGit.debug = true
|
@@ -43,13 +42,11 @@ module Vendorificator
|
|
43
42
|
exit
|
44
43
|
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@environment = Vendorificator::Environment.new(self.options[:file])
|
52
|
-
environment.shell = shell
|
45
|
+
@environment = Vendorificator::Environment.new(
|
46
|
+
shell,
|
47
|
+
VERBOSITY_LEVELS[self.options[:verbose]] || :default,
|
48
|
+
self.options[:file]
|
49
|
+
)
|
53
50
|
|
54
51
|
class << shell
|
55
52
|
# Make say_status always say it.
|
@@ -62,16 +59,37 @@ module Vendorificator
|
|
62
59
|
desc :sync, "Download new or updated vendor files"
|
63
60
|
method_option :update, :type => :boolean, :default => false
|
64
61
|
def sync
|
62
|
+
say_status 'DEPRECATED', 'Using vendor sync is deprecated and will be removed in future versions. Use vendor install or vendor update instead.', :yellow
|
63
|
+
environment.sync options.merge(:modules => modules)
|
64
|
+
rescue DirtyRepoError
|
65
|
+
fail! 'Repository is not clean.'
|
66
|
+
rescue MissingVendorfileError
|
67
|
+
fail! "Vendorfile not found. Vendorificator needs to run in the directory containing Vendorfile or config/vendor.rb."
|
68
|
+
end
|
69
|
+
|
70
|
+
desc :install, "Download and install new or updated vendor files"
|
71
|
+
def install(*modules)
|
65
72
|
environment.sync options.merge(:modules => modules)
|
66
73
|
rescue DirtyRepoError
|
67
74
|
fail! 'Repository is not clean.'
|
68
75
|
end
|
69
76
|
|
77
|
+
desc :update, "Update installed vendor files"
|
78
|
+
def update(*modules)
|
79
|
+
environment.sync options.merge(:modules => modules, :update => true)
|
80
|
+
rescue DirtyRepoError
|
81
|
+
fail! 'Repository is not clean.'
|
82
|
+
end
|
83
|
+
|
70
84
|
desc "status", "List known vendor modules and their status"
|
71
85
|
method_option :update, :type => :boolean, :default => false
|
72
86
|
def status
|
73
|
-
say_status 'WARNING', 'Git repository is not clean', :red unless environment.clean?
|
74
87
|
environment.config[:use_upstream_version] = options[:update]
|
88
|
+
environment.load_vendorfile
|
89
|
+
|
90
|
+
say_status 'DEPRECATED', 'Using vendor status is deprecated and will be removed in future versions', :yellow
|
91
|
+
say_status 'WARNING', 'Git repository is not clean', :red unless environment.clean?
|
92
|
+
|
75
93
|
environment.each_vendor_instance(*modules) do |mod|
|
76
94
|
status_line = mod.to_s
|
77
95
|
|
@@ -87,11 +105,25 @@ module Vendorificator
|
|
87
105
|
say_status( mod.status.to_s.gsub('_', ' '), status_line,
|
88
106
|
( mod.status == :up_to_date ? :green : :yellow ) )
|
89
107
|
end
|
108
|
+
rescue MissingVendorfileError
|
109
|
+
fail! "Vendorfile not found. Vendorificator needs to run in the directory containing Vendorfile or config/vendor.rb."
|
90
110
|
end
|
91
111
|
|
92
112
|
desc 'info MODULE', "Show module information"
|
93
113
|
def info(mod_name)
|
94
114
|
environment.info mod_name, options
|
115
|
+
rescue MissingVendorfileError
|
116
|
+
fail! "Vendorfile not found. Vendorificator needs to run in the directory containing Vendorfile or config/vendor.rb."
|
117
|
+
end
|
118
|
+
|
119
|
+
desc :list, 'List all currently installed modules'
|
120
|
+
def list
|
121
|
+
environment.list
|
122
|
+
end
|
123
|
+
|
124
|
+
desc :outdated, 'List all currently installed modules'
|
125
|
+
def outdated
|
126
|
+
environment.outdated
|
95
127
|
end
|
96
128
|
|
97
129
|
desc :pull, "Pull upstream branches from a remote repository"
|
@@ -101,6 +133,8 @@ module Vendorificator
|
|
101
133
|
environment.pull_all options
|
102
134
|
rescue DirtyRepoError
|
103
135
|
fail! 'Repository is not clean.'
|
136
|
+
rescue MissingVendorfileError
|
137
|
+
fail! "Vendorfile not found. Vendorificator needs to run in the directory containing Vendorfile or config/vendor.rb."
|
104
138
|
end
|
105
139
|
|
106
140
|
desc :push, "Push local changes back to the remote repository"
|
@@ -109,10 +143,12 @@ module Vendorificator
|
|
109
143
|
environment.push options
|
110
144
|
rescue DirtyRepoError
|
111
145
|
fail! 'Repository is not clean.'
|
146
|
+
rescue MissingVendorfileError
|
147
|
+
fail! "Vendorfile not found. Vendorificator needs to run in the directory containing Vendorfile or config/vendor.rb."
|
112
148
|
end
|
113
149
|
|
114
|
-
desc "git GIT_COMMAND [
|
115
|
-
"Run a git command for specified
|
150
|
+
desc "git GIT_COMMAND [MODULE [MODULE ...]] [-- GIT_OPTIONS]",
|
151
|
+
"Run a git command for specified module(s)"
|
116
152
|
long_desc <<EOF
|
117
153
|
Run a git command for specified modules. Within GIT_ARGS arguments,
|
118
154
|
you can use @MERGED@ and @PATH@ tags, which will be substituted with
|
@@ -122,17 +158,18 @@ module Vendorificator
|
|
122
158
|
The 'diff' and 'log' commands are simple aliases for 'git' command.
|
123
159
|
|
124
160
|
Examples:
|
125
|
-
vendor git log @MERGED@..HEAD -- @PATH@ # basic 'vendor log'
|
126
|
-
vendor git diff --stat @MERGED@ -- @PATH@ # 'vendor diff', as diffstat
|
161
|
+
vendor git log my_module -- @MERGED@..HEAD -- @PATH@ # basic 'vendor log'
|
162
|
+
vendor git diff module1 module2 -- --stat @MERGED@ -- @PATH@ # 'vendor diff', as diffstat
|
127
163
|
EOF
|
128
164
|
def git(command, *args)
|
165
|
+
modules, git_options = split_git_options(args)
|
129
166
|
environment.each_vendor_instance(*modules) do |mod|
|
130
167
|
unless mod.merged
|
131
|
-
say_status 'unmerged', mod.to_s, :red
|
168
|
+
say_status 'unmerged', mod.to_s, :red
|
132
169
|
next
|
133
170
|
end
|
134
171
|
|
135
|
-
actual_args =
|
172
|
+
actual_args = git_options.dup.map do |arg|
|
136
173
|
arg.
|
137
174
|
gsub('@MERGED@', mod.merged).
|
138
175
|
gsub('@PATH@', mod.work_dir)
|
@@ -143,16 +180,18 @@ EOF
|
|
143
180
|
end
|
144
181
|
end
|
145
182
|
|
146
|
-
desc "diff [
|
183
|
+
desc "diff [MODULE [MODULE ...]] [-- GIT_OPTIONS]",
|
147
184
|
"Show differences between work tree and upstream module(s)"
|
148
185
|
def diff(*args)
|
149
|
-
|
186
|
+
modules, git_options = split_git_options(args)
|
187
|
+
invoke :git, %w'diff' + modules + %w'--' + git_options + %w'@MERGED@ -- @PATH@'
|
150
188
|
end
|
151
189
|
|
152
|
-
desc "log [
|
190
|
+
desc "log [MODULE [MODULE ...]] [-- GIT_OPTIONS]",
|
153
191
|
"Show git log of commits added to upstream module(s)"
|
154
192
|
def log(*args)
|
155
|
-
|
193
|
+
modules, git_options = split_git_options(args)
|
194
|
+
invoke :git, %w'log' + modules + %w'--' + git_options + %w'@MERGED@..HEAD -- @PATH@'
|
156
195
|
end
|
157
196
|
|
158
197
|
desc :pry, 'Pry into the binding', :hide => true
|
@@ -184,21 +223,36 @@ EOF
|
|
184
223
|
|
185
224
|
private
|
186
225
|
|
226
|
+
# Private: Parses general vendorificator options.
|
227
|
+
#
|
228
|
+
# Returns nothing.
|
229
|
+
def parse_options
|
230
|
+
if options[:version]
|
231
|
+
say "Vendorificator #{Vendorificator::VERSION}"
|
232
|
+
exit
|
233
|
+
end
|
234
|
+
|
235
|
+
if options[:verbose] && (!VERBOSITY_LEVELS.keys.include? options[:verbose])
|
236
|
+
fail! "Unknown verbosity level: #{options[:verbose].inspect}"
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
187
240
|
def split_git_options(args)
|
188
|
-
case i = args.index('--
|
189
|
-
when nil then [
|
190
|
-
when 0 then [
|
191
|
-
else [
|
241
|
+
case i = args.index('--')
|
242
|
+
when nil then [args, []]
|
243
|
+
when 0 then [[], args[1..-1]]
|
244
|
+
else [args[0..(i - 1)], args[(i + 1)..-1]]
|
192
245
|
end
|
193
246
|
end
|
194
247
|
|
195
248
|
def modules
|
249
|
+
say_status 'DEPRECATED', 'Using --modules option is deprecated and will be removed in future versions.', :yellow unless options[:modules].empty?
|
196
250
|
options[:modules].split(',').map(&:strip)
|
197
251
|
end
|
198
252
|
|
199
|
-
def fail!(message, exception_message='I give up.')
|
253
|
+
def fail!(message, exception_message = 'I give up.')
|
200
254
|
say_status('FATAL', message, :red)
|
201
|
-
raise Thor::Error,
|
255
|
+
raise Thor::Error, exception_message
|
202
256
|
end
|
203
257
|
|
204
258
|
end
|