learn-test 3.3.0.pre.4 → 3.3.0.pre.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bcb52a7bdd3a25aa1938ba7d13b929bb52e2ecae2107810dd074ad400a04c1c
|
4
|
+
data.tar.gz: f5fbd110ec71a7be53ef29ee44debbfa5febff13d70cdd6633624bae7fd9ccd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae93ca8deccd1c7879ba6b22aee84b64b92d85826ebfcf188c02bdccfb07935df88e661d75d4dfe0453bdbe02fbef4f0e2dcc15b020950191be07e9017c3b25
|
7
|
+
data.tar.gz: 4462b95bd0165cf7693b63aab7faab069e02a99f6c96ac47bea33d2a44d427a6b78b1c834abe5148732c1ff062ddc5e0959e282884dc8487a24d18659776f1c0
|
@@ -10,7 +10,6 @@ module LearnTest
|
|
10
10
|
module Wip
|
11
11
|
class Base < ::Git::Path
|
12
12
|
TEMPFILE = '.wip'
|
13
|
-
PREFIX = 'refs/wip/'
|
14
13
|
|
15
14
|
attr_reader :working_branch, :wip_branch
|
16
15
|
|
@@ -25,7 +24,7 @@ module LearnTest
|
|
25
24
|
|
26
25
|
@tmp = Tempfile.new(TEMPFILE)
|
27
26
|
@working_branch = Branch.new(base: @base, name: current_branch)
|
28
|
-
@wip_branch =
|
27
|
+
@wip_branch = Reference.new(base: @base, name: current_branch)
|
29
28
|
end
|
30
29
|
|
31
30
|
def process!
|
@@ -44,9 +43,6 @@ module LearnTest
|
|
44
43
|
new_tree = build_new_tree(@wip_branch.parent)
|
45
44
|
@base.diff(new_tree, @wip_branch.parent)
|
46
45
|
|
47
|
-
# tree_diff = @base.diff(new_tree, @wip_branch.parent)
|
48
|
-
# raise NoChangesError, @wip_branch if tree_diff.count.zero?
|
49
|
-
|
50
46
|
commit = @base.commit_tree(new_tree, parent: @wip_branch.parent)
|
51
47
|
|
52
48
|
@base.lib.send(:command, 'update-ref', ['-m', @message, @wip_branch, commit.objectish])
|
@@ -16,11 +16,13 @@ module LearnTest
|
|
16
16
|
begin
|
17
17
|
@base.revparse(@name)
|
18
18
|
rescue ::Git::GitExecuteError => e
|
19
|
+
regex = LearnTest::Git::Wip::NoCommitsError::REGEX
|
20
|
+
|
19
21
|
if raise_no_commits
|
20
|
-
raise e.message.match(
|
22
|
+
raise e.message.match(regex) ? LearnTest::Git::Wip::NoCommitsError.new(@name) : e
|
21
23
|
end
|
22
24
|
|
23
|
-
raise unless e.message.match(
|
25
|
+
raise unless e.message.match(regex)
|
24
26
|
|
25
27
|
false
|
26
28
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LearnTest
|
4
|
+
module Git
|
5
|
+
module Wip
|
6
|
+
class Reference < Branch
|
7
|
+
attr_accessor :parent
|
8
|
+
|
9
|
+
PREFIX = 'refs/wip/'
|
10
|
+
|
11
|
+
def initialize(base:, name:)
|
12
|
+
dir = File.join(base.repo.path, PREFIX)
|
13
|
+
Dir.mkdir(dir, 0755) unless Dir.exist?(dir)
|
14
|
+
|
15
|
+
super(base: base, name: "#{PREFIX}#{name}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/learn_test/version.rb
CHANGED
@@ -39,19 +39,20 @@ describe LearnTest::Git::Wip::Base do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
context 'no
|
43
|
-
before(:each) { initialize_repo
|
42
|
+
context 'no refs/wip' do
|
43
|
+
before(:each) { initialize_repo }
|
44
44
|
|
45
|
-
it 'should
|
46
|
-
expect
|
45
|
+
it 'should create refs/wip' do
|
46
|
+
expect(Dir).to receive(:mkdir).with("#{path}/.git/refs/wip/", 0755)
|
47
|
+
instance.process!
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
|
51
|
-
before(:each) { initialize_repo }
|
51
|
+
context 'no commits' do
|
52
|
+
before(:each) { initialize_repo(commit: false) }
|
52
53
|
|
53
54
|
it 'should raise' do
|
54
|
-
expect { instance.process! }.to raise_error(LearnTest::Git::Wip::
|
55
|
+
expect { instance.process! }.to raise_error(LearnTest::Git::Wip::NoCommitsError)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.0.pre.
|
4
|
+
version: 3.3.0.pre.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/learn_test/git/wip/base.rb
|
186
186
|
- lib/learn_test/git/wip/branch.rb
|
187
187
|
- lib/learn_test/git/wip/error.rb
|
188
|
+
- lib/learn_test/git/wip/reference.rb
|
188
189
|
- lib/learn_test/github_interactor.rb
|
189
190
|
- lib/learn_test/js_strategy.rb
|
190
191
|
- lib/learn_test/learn_oauth_token_parser.rb
|