braid 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/README.md +11 -15
- data/bin/braid +20 -39
- data/braid.gemspec +1 -1
- data/lib/braid/commands/add.rb +0 -3
- data/lib/braid/commands/diff.rb +16 -7
- data/lib/braid/commands/push.rb +4 -0
- data/lib/braid/commands/status.rb +1 -3
- data/lib/braid/commands/update.rb +7 -11
- data/lib/braid/mirror.rb +11 -13
- data/lib/braid/operations.rb +4 -0
- data/lib/braid/version.rb +1 -1
- data/lib/braid.rb +0 -1
- data/spec/config_spec.rb +9 -9
- data/spec/integration/adding_spec.rb +41 -19
- data/spec/integration/diff_spec.rb +185 -0
- data/spec/{integration_helper.rb → integration/integration_helper.rb} +31 -7
- data/spec/integration/push_spec.rb +73 -12
- data/spec/integration/remove_spec.rb +59 -0
- data/spec/integration/status_spec.rb +59 -0
- data/spec/integration/updating_spec.rb +65 -23
- data/spec/mirror_spec.rb +11 -11
- data/spec/operations_spec.rb +8 -8
- metadata +8 -6
- data/lib/braid/commands/list.rb +0 -10
data/spec/mirror_spec.rb
CHANGED
@@ -3,17 +3,17 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
3
3
|
describe 'Braid::Mirror.new_from_options' do
|
4
4
|
it 'should default branch to master' do
|
5
5
|
new_from_options('git://path')
|
6
|
-
@mirror.branch.
|
6
|
+
expect(@mirror.branch).to eq('master')
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should default mirror to last path part, ignoring trailing .git' do
|
10
10
|
new_from_options('http://path.git')
|
11
|
-
@mirror.path.
|
11
|
+
expect(@mirror.path).to eq('path')
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should strip trailing slash from specified path' do
|
15
15
|
new_from_options('http://path.git', 'path' => 'vendor/tools/mytool/')
|
16
|
-
@mirror.path.
|
16
|
+
expect(@mirror.path).to eq('vendor/tools/mytool')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -32,7 +32,7 @@ describe 'Braid::Mirror#diff' do
|
|
32
32
|
set_hashes('b' * 40, 'b' * 40)
|
33
33
|
git.expects(:fetch)
|
34
34
|
git.expects(:diff_tree).never
|
35
|
-
@mirror.diff.
|
35
|
+
expect(@mirror.diff).to eq('')
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should generate a diff when the hashes do not match' do
|
@@ -40,22 +40,22 @@ describe 'Braid::Mirror#diff' do
|
|
40
40
|
diff = "diff --git a/path b/path\n"
|
41
41
|
git.expects(:fetch)
|
42
42
|
git.expects(:diff_tree).with('b' * 40, 'c' * 40).returns(diff)
|
43
|
-
@mirror.diff.
|
43
|
+
expect(@mirror.diff).to eq(diff)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'Braid::Mirror#base_revision' do
|
48
48
|
it 'should be inferred when no revision is set' do
|
49
49
|
@mirror = build_mirror
|
50
|
-
@mirror.revision.
|
50
|
+
expect(@mirror.revision).to be_nil
|
51
51
|
@mirror.expects(:inferred_revision).returns('b' * 40)
|
52
|
-
@mirror.base_revision.
|
52
|
+
expect(@mirror.base_revision).to eq('b' * 40)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should be the parsed hash for git mirrors' do
|
56
56
|
@mirror = build_mirror('revision' => 'a' * 7)
|
57
57
|
git.expects(:rev_parse).with('a' * 7).returns('a' * 40)
|
58
|
-
@mirror.base_revision.
|
58
|
+
expect(@mirror.base_revision).to eq('a' * 40)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -67,7 +67,7 @@ describe 'Braid::Mirror#inferred_revision' do
|
|
67
67
|
"commit #{'b' * 40}\n#{'t' * 40}\n"
|
68
68
|
)
|
69
69
|
git.expects(:tree_hash).with(@mirror.path, 'a' * 40).returns('t' * 40)
|
70
|
-
@mirror.send(:inferred_revision).
|
70
|
+
expect(@mirror.send(:inferred_revision)).to eq('b' * 40)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -78,11 +78,11 @@ describe 'Braid::Mirror#cached?' do
|
|
78
78
|
|
79
79
|
it 'should be true when the remote path matches the cache path' do
|
80
80
|
git.expects(:remote_url).with(@mirror.remote).returns(git_cache.path(@mirror.url))
|
81
|
-
@mirror.
|
81
|
+
expect(@mirror).to be_cached
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should be false if the remote does not point to the cache' do
|
85
85
|
git.expects(:remote_url).with(@mirror.remote).returns(@mirror.url)
|
86
|
-
@mirror.
|
86
|
+
expect(@mirror).not_to be_cached
|
87
87
|
end
|
88
88
|
end
|
data/spec/operations_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe 'Braid::Operations::Git#remote_url' do
|
|
4
4
|
it 'should use git config' do
|
5
5
|
# FIXME weak test
|
6
6
|
git.stubs(:invoke).with(:config, 'remote.braid/git/one.url').returns('git://path')
|
7
|
-
git.remote_url('braid/git/one').
|
7
|
+
expect(git.remote_url('braid/git/one')).to eq('git://path')
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -12,13 +12,13 @@ describe 'Braid::Operations::Git#rev_parse' do
|
|
12
12
|
it 'should return the full hash when a hash is found' do
|
13
13
|
full_revision = 'a' * 40
|
14
14
|
git.expects(:exec).returns([0, full_revision, ''])
|
15
|
-
git.rev_parse('a' * 7).
|
15
|
+
expect(git.rev_parse('a' * 7)).to eq(full_revision)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should raise a revision error when the hash is not found' do
|
19
19
|
ambiguous_revision = 'b' * 7
|
20
20
|
git.expects(:exec).returns([1, ambiguous_revision, 'fatal: ...'])
|
21
|
-
|
21
|
+
expect { git.rev_parse(ambiguous_revision) }.to raise_error(Braid::Operations::UnknownRevision)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -30,7 +30,7 @@ describe 'Braid::Operations::Git#version' do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should extract from git --version output' do
|
33
|
-
git.version.
|
33
|
+
expect(git.version).to eq(ACTUAL_VERSION)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -46,21 +46,21 @@ describe 'Braid::Operations::Git#require_version' do
|
|
46
46
|
it 'should return true for higher revisions' do
|
47
47
|
PASS_VERSIONS.each do |version|
|
48
48
|
set_version(version)
|
49
|
-
git.require_version(REQUIRED_VERSION).
|
49
|
+
expect(git.require_version(REQUIRED_VERSION)).to eq(true)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should return false for lower revisions' do
|
54
54
|
FAIL_VERSIONS.each do |version|
|
55
55
|
set_version(version)
|
56
|
-
git.require_version(REQUIRED_VERSION).
|
56
|
+
expect(git.require_version(REQUIRED_VERSION)).to eq(false)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe 'Braid::Operations::GitCache#path' do
|
62
62
|
it 'should use the local cache directory and strip characters' do
|
63
|
-
git_cache.path('git://path').
|
64
|
-
git_cache.path('git@domain:repository.git').
|
63
|
+
expect(git_cache.path('git://path')).to eq(File.join(Braid.local_cache_dir, 'git___path'))
|
64
|
+
expect(git_cache.path('git@domain:repository.git')).to eq(File.join(Braid.local_cache_dir, 'git_domain_repository.git'))
|
65
65
|
end
|
66
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cristi Balan
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-03-
|
13
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: main
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 3.4.4
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 3.4.4
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: mocha
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +89,6 @@ files:
|
|
89
89
|
- lib/braid/command.rb
|
90
90
|
- lib/braid/commands/add.rb
|
91
91
|
- lib/braid/commands/diff.rb
|
92
|
-
- lib/braid/commands/list.rb
|
93
92
|
- lib/braid/commands/push.rb
|
94
93
|
- lib/braid/commands/remove.rb
|
95
94
|
- lib/braid/commands/setup.rb
|
@@ -113,9 +112,12 @@ files:
|
|
113
112
|
- spec/fixtures/skit1/layouts/layout.liquid
|
114
113
|
- spec/fixtures/skit1/preview.png
|
115
114
|
- spec/integration/adding_spec.rb
|
115
|
+
- spec/integration/diff_spec.rb
|
116
|
+
- spec/integration/integration_helper.rb
|
116
117
|
- spec/integration/push_spec.rb
|
118
|
+
- spec/integration/remove_spec.rb
|
119
|
+
- spec/integration/status_spec.rb
|
117
120
|
- spec/integration/updating_spec.rb
|
118
|
-
- spec/integration_helper.rb
|
119
121
|
- spec/mirror_spec.rb
|
120
122
|
- spec/operations_spec.rb
|
121
123
|
- spec/test_helper.rb
|
data/lib/braid/commands/list.rb
DELETED