flash_flow 1.2.2 → 1.2.3.alpha
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/flash_flow/cmd_runner.rb +21 -5
- data/lib/flash_flow/data/base.rb +1 -11
- data/lib/flash_flow/data/collection.rb +1 -1
- data/lib/flash_flow/data/store.rb +4 -2
- data/lib/flash_flow/deploy.rb +31 -48
- data/lib/flash_flow/git.rb +25 -11
- data/lib/flash_flow/issue_tracker.rb +1 -1
- data/lib/flash_flow/merge_master/status.rb +1 -1
- data/lib/flash_flow/resolve.rb +18 -35
- data/lib/flash_flow/shadow_repo.rb +7 -14
- data/lib/flash_flow/version.rb +1 -1
- data/test/lib/data/test_store.rb +3 -0
- data/test/lib/test_deploy.rb +6 -8
- data/test/lib/test_git.rb +4 -4
- data/test/lib/test_resolve.rb +0 -29
- data/test/minitest_helper.rb +6 -4
- data/update_gem.sh +5 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73df87f225f53804b6f04bc3974e7ad50a2e7593
|
4
|
+
data.tar.gz: 36469747a24560104ed64c357b64412ef7a0ef33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f194f1021154559949b9a1256d792aa90a2b385a96f0a6577bddad4b3d829e7a2ebd37a07e2073fc8e6feca552908f2a758b56a47805c0e5cf5605469477d6
|
7
|
+
data.tar.gz: 5ac260eae49b4b4d5d57a00a3a88956cb3c7368eb675b7331ea57af87c0c0e4d449b9e6421bab009512586b8d90ff713f477f58b43884555f267eb7dc9d32a72
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,11 @@ require 'open3'
|
|
3
3
|
|
4
4
|
module FlashFlow
|
5
5
|
class CmdRunner
|
6
|
-
|
6
|
+
LOG_NONE = :log_none
|
7
|
+
LOG_CMD = :log_cmd
|
8
|
+
|
9
|
+
attr_reader :dry_run, :last_command, :last_stderr, :last_stdout
|
10
|
+
attr_accessor :dir
|
7
11
|
|
8
12
|
def initialize(opts={})
|
9
13
|
@dir = opts[:dir] || '.'
|
@@ -11,7 +15,7 @@ module FlashFlow
|
|
11
15
|
@logger = opts[:logger] || Logger.new('/dev/null')
|
12
16
|
end
|
13
17
|
|
14
|
-
def run(cmd)
|
18
|
+
def run(cmd, opts={})
|
15
19
|
@last_command = cmd
|
16
20
|
if dry_run
|
17
21
|
puts "#{dir}$ #{cmd}"
|
@@ -24,14 +28,26 @@ module FlashFlow
|
|
24
28
|
@success = wait_thr.value.success?
|
25
29
|
end
|
26
30
|
end
|
27
|
-
|
28
|
-
last_stdout.split("\n").each { |line| @logger.debug(line) }
|
29
|
-
last_stderr.split("\n").each { |line| @logger.debug(line) }
|
31
|
+
log(cmd, opts[:log])
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def last_success?
|
34
36
|
@success
|
35
37
|
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def log(cmd, log_what)
|
42
|
+
if log_what == LOG_NONE
|
43
|
+
# Do nothing
|
44
|
+
else
|
45
|
+
@logger.debug("#{dir}$ #{cmd}")
|
46
|
+
unless log_what == LOG_CMD
|
47
|
+
last_stdout.split("\n").each { |line| @logger.debug(line) }
|
48
|
+
last_stderr.split("\n").each { |line| @logger.debug(line) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
data/lib/flash_flow/data/base.rb
CHANGED
@@ -46,9 +46,7 @@ module FlashFlow
|
|
46
46
|
|
47
47
|
def backwards_compatible_store
|
48
48
|
@backwards_compatible_store ||= begin
|
49
|
-
hash =
|
50
|
-
@store.get
|
51
|
-
end
|
49
|
+
hash = @store.get
|
52
50
|
|
53
51
|
hash.has_key?('branches') ? hash : { 'branches' => hash }
|
54
52
|
end
|
@@ -57,14 +55,6 @@ module FlashFlow
|
|
57
55
|
def saved_branches
|
58
56
|
Collection.from_hash(@git.remotes, backwards_compatible_store['branches']).to_a
|
59
57
|
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def in_shadow_repo
|
64
|
-
ShadowRepo.new(@git).in_dir do
|
65
|
-
yield
|
66
|
-
end
|
67
|
-
end
|
68
58
|
end
|
69
59
|
end
|
70
60
|
end
|
@@ -63,7 +63,7 @@ module FlashFlow
|
|
63
63
|
branch = merged_branches[full_ref]
|
64
64
|
|
65
65
|
branch.created_at = info.created_at
|
66
|
-
branch.resolutions =
|
66
|
+
branch.resolutions = info.resolutions.to_h.merge(branch.resolutions.to_h)
|
67
67
|
branch.stories = info.stories.to_a | merged_branches[full_ref].stories.to_a
|
68
68
|
if branch.fail?
|
69
69
|
branch.conflict_sha ||= info.conflict_sha
|
@@ -20,12 +20,14 @@ module FlashFlow
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def write(branches, file=nil)
|
23
|
-
@git.
|
23
|
+
@git.in_dir do
|
24
24
|
file ||= File.open(@filename, 'w')
|
25
25
|
file.puts JSON.pretty_generate(sort_branches(branches))
|
26
26
|
file.close
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
+
@git.in_temp_merge_branch do
|
30
|
+
@git.add_and_commit(@filename, 'Branch Info', add: {force: true})
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
data/lib/flash_flow/deploy.rb
CHANGED
@@ -18,7 +18,8 @@ module FlashFlow
|
|
18
18
|
@rerere_forget = opts[:rerere_forget]
|
19
19
|
@stories = [opts[:stories]].flatten.compact
|
20
20
|
|
21
|
-
@
|
21
|
+
@local_git = Git.new(Config.configuration.git, logger)
|
22
|
+
@git = ShadowGit.new(Config.configuration.git, logger)
|
22
23
|
@lock = Lock::Base.new(Config.configuration.lock)
|
23
24
|
@notifier = Notifier::Base.new(Config.configuration.notifier)
|
24
25
|
@data = Data::Base.new(Config.configuration.branches, Config.configuration.branch_info_file, @git, logger: logger)
|
@@ -31,45 +32,42 @@ module FlashFlow
|
|
31
32
|
def run
|
32
33
|
check_version
|
33
34
|
check_repo
|
34
|
-
puts "Building #{@
|
35
|
-
logger.info "\n\n### Beginning #{@
|
36
|
-
|
35
|
+
puts "Building #{@local_git.merge_branch}... Log can be found in #{FlashFlow::Config.configuration.log_file}"
|
36
|
+
logger.info "\n\n### Beginning #{@local_git.merge_branch} merge ###\n\n"
|
37
37
|
|
38
38
|
begin
|
39
39
|
open_pull_request
|
40
40
|
|
41
|
-
|
42
|
-
@
|
43
|
-
|
44
|
-
@git.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
commit_rerere
|
53
|
-
end
|
54
|
-
|
55
|
-
@git.copy_temp_to_merge_branch
|
56
|
-
@git.delete_temp_merge_branch
|
57
|
-
@git.push_merge_branch
|
41
|
+
@lock.with_lock do
|
42
|
+
@git.fetch(@git.merge_remote)
|
43
|
+
@git.in_original_merge_branch do
|
44
|
+
@git.initialize_rerere
|
45
|
+
end
|
46
|
+
|
47
|
+
@git.reset_temp_merge_branch
|
48
|
+
@git.in_temp_merge_branch do
|
49
|
+
merge_branches
|
50
|
+
commit_branch_info
|
51
|
+
commit_rerere
|
58
52
|
end
|
53
|
+
|
54
|
+
@git.copy_temp_to_merge_branch
|
55
|
+
@git.delete_temp_merge_branch
|
56
|
+
@git.push_merge_branch
|
59
57
|
end
|
60
58
|
|
61
59
|
print_errors
|
62
|
-
logger.info "### Finished #{@
|
60
|
+
logger.info "### Finished #{@local_git.merge_branch} merge ###"
|
63
61
|
rescue Lock::Error, OutOfSyncWithRemote => e
|
64
62
|
puts 'Failure!'
|
65
63
|
puts e.message
|
66
64
|
ensure
|
67
|
-
@
|
65
|
+
@local_git.run("checkout #{@local_git.working_branch}")
|
68
66
|
end
|
69
67
|
end
|
70
68
|
|
71
69
|
def check_repo
|
72
|
-
if @
|
70
|
+
if @local_git.staged_and_working_dir_files.any?
|
73
71
|
raise RuntimeError.new('You have changes in your working directory. Please stash and try again')
|
74
72
|
end
|
75
73
|
end
|
@@ -112,7 +110,7 @@ module FlashFlow
|
|
112
110
|
raise RuntimeError.new("No remote found for #{branch.remote_url}. Please run 'git remote add *your_remote_name* #{branch.remote_url}' and try again.")
|
113
111
|
end
|
114
112
|
|
115
|
-
fetch(branch.remote)
|
113
|
+
@git.fetch(branch.remote)
|
116
114
|
git_merge(branch, branch.ref == @git.working_branch)
|
117
115
|
end
|
118
116
|
end
|
@@ -142,17 +140,17 @@ module FlashFlow
|
|
142
140
|
end
|
143
141
|
|
144
142
|
def open_pull_request
|
145
|
-
return false if [@
|
143
|
+
return false if [@local_git.master_branch, @local_git.merge_branch].include?(@local_git.working_branch)
|
146
144
|
|
147
145
|
# TODO - This should use the actual remote for the branch we're on
|
148
|
-
@
|
149
|
-
raise OutOfSyncWithRemote.new("Your branch is out of sync with the remote. If you want to force push, run 'flash_flow -f'") unless @
|
146
|
+
@local_git.push(@local_git.working_branch, force: @force)
|
147
|
+
raise OutOfSyncWithRemote.new("Your branch is out of sync with the remote. If you want to force push, run 'flash_flow -f'") unless @local_git.last_success?
|
150
148
|
|
151
149
|
# TODO - This should use the actual remote for the branch we're on
|
152
150
|
if @do_not_merge
|
153
|
-
@data.remove_from_merge(@
|
151
|
+
@data.remove_from_merge(@local_git.merge_remote, @local_git.working_branch)
|
154
152
|
else
|
155
|
-
@data.add_to_merge(@
|
153
|
+
@data.add_to_merge(@local_git.merge_remote, @local_git.working_branch)
|
156
154
|
end
|
157
155
|
end
|
158
156
|
|
@@ -164,10 +162,10 @@ module FlashFlow
|
|
164
162
|
errors = []
|
165
163
|
branch_not_merged = nil
|
166
164
|
@data.failures.each do |full_ref, failure|
|
167
|
-
if failure.ref == @
|
168
|
-
branch_not_merged = "ERROR: Your branch did not merge to #{@
|
165
|
+
if failure.ref == @local_git.working_branch
|
166
|
+
branch_not_merged = "ERROR: Your branch did not merge to #{@local_git.merge_branch}. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
|
169
167
|
else
|
170
|
-
errors << "WARNING: Unable to merge branch #{failure.remote}/#{failure.ref} to #{@
|
168
|
+
errors << "WARNING: Unable to merge branch #{failure.remote}/#{failure.ref} to #{@local_git.merge_branch} due to conflicts."
|
171
169
|
end
|
172
170
|
end
|
173
171
|
errors << branch_not_merged if branch_not_merged
|
@@ -179,20 +177,5 @@ module FlashFlow
|
|
179
177
|
end
|
180
178
|
end
|
181
179
|
|
182
|
-
private
|
183
|
-
|
184
|
-
def in_shadow_repo
|
185
|
-
ShadowRepo.new(@git, logger: logger).in_dir do
|
186
|
-
yield
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def fetch(remote)
|
191
|
-
@fetched_remotes ||= {}
|
192
|
-
unless @fetched_remotes[remote]
|
193
|
-
@git.fetch(remote)
|
194
|
-
@fetched_remotes[remote] = true
|
195
|
-
end
|
196
|
-
end
|
197
180
|
end
|
198
181
|
end
|
data/lib/flash_flow/git.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'flash_flow/cmd_runner'
|
2
|
+
require 'shellwords'
|
2
3
|
|
3
4
|
module FlashFlow
|
4
5
|
class Git
|
@@ -22,6 +23,12 @@ module FlashFlow
|
|
22
23
|
@working_branch = current_branch
|
23
24
|
end
|
24
25
|
|
26
|
+
def in_dir
|
27
|
+
Dir.chdir(@cmd_runner.dir) do
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
25
32
|
def last_stdout
|
26
33
|
@cmd_runner.last_stdout
|
27
34
|
end
|
@@ -34,8 +41,8 @@ module FlashFlow
|
|
34
41
|
@cmd_runner.last_success?
|
35
42
|
end
|
36
43
|
|
37
|
-
def run(cmd)
|
38
|
-
@cmd_runner.run("git #{cmd}")
|
44
|
+
def run(cmd, opts={})
|
45
|
+
@cmd_runner.run("git #{cmd}", opts)
|
39
46
|
end
|
40
47
|
|
41
48
|
def add_and_commit(files, message, opts={})
|
@@ -53,7 +60,11 @@ module FlashFlow
|
|
53
60
|
end
|
54
61
|
|
55
62
|
def fetch(remote)
|
56
|
-
|
63
|
+
@fetched_remotes ||= {}
|
64
|
+
unless @fetched_remotes[remote]
|
65
|
+
run("fetch #{remote}")
|
66
|
+
@fetched_remotes[remote] = true
|
67
|
+
end
|
57
68
|
end
|
58
69
|
|
59
70
|
def master_branch_contains?(ref)
|
@@ -73,7 +84,7 @@ module FlashFlow
|
|
73
84
|
end
|
74
85
|
|
75
86
|
def read_file_from_merge_branch(filename)
|
76
|
-
run("show #{merge_remote}/#{merge_branch}:#{filename}")
|
87
|
+
run("show #{merge_remote}/#{merge_branch}:#{filename}", log: CmdRunner::LOG_CMD)
|
77
88
|
last_stdout
|
78
89
|
end
|
79
90
|
|
@@ -113,9 +124,11 @@ module FlashFlow
|
|
113
124
|
end
|
114
125
|
|
115
126
|
def unresolved_conflicts
|
116
|
-
|
117
|
-
|
118
|
-
|
127
|
+
in_dir do
|
128
|
+
conflicted_files.map do |file|
|
129
|
+
File.open(file) { |f| f.grep(/>>>>/) }.empty? ? nil : file
|
130
|
+
end.compact
|
131
|
+
end
|
119
132
|
end
|
120
133
|
|
121
134
|
def resolutions(files)
|
@@ -128,10 +141,10 @@ module FlashFlow
|
|
128
141
|
|
129
142
|
# git rerere doesn't give you a deterministic way to determine which resolution was used
|
130
143
|
def resolution_candidates(file)
|
131
|
-
@cmd_runner.run("diff -q --from-file #{file} .git/rr-cache/*/postimage")
|
144
|
+
@cmd_runner.run("diff -q --from-file #{file} .git/rr-cache/*/postimage", log: CmdRunner::LOG_CMD)
|
132
145
|
different_files = split_diff_lines(@cmd_runner.last_stdout)
|
133
146
|
|
134
|
-
@cmd_runner.run('ls -la .git/rr-cache/*/postimage')
|
147
|
+
@cmd_runner.run('ls -la .git/rr-cache/*/postimage', log: CmdRunner::LOG_CMD)
|
135
148
|
all_files = split_diff_lines(@cmd_runner.last_stdout)
|
136
149
|
|
137
150
|
all_files - different_files
|
@@ -237,14 +250,15 @@ module FlashFlow
|
|
237
250
|
|
238
251
|
def squash_commits
|
239
252
|
# There are three commits created by flash flow that we don't need in the message
|
240
|
-
run("log #{merge_remote}/#{merge_branch}..#{merge_branch}~3")
|
253
|
+
run("log #{merge_remote}/#{merge_branch}..#{merge_branch}~3", log: CmdRunner::LOG_CMD)
|
241
254
|
log = last_stdout
|
242
255
|
|
243
256
|
# Get all the files that differ between existing acceptance and new acceptance
|
244
257
|
run("diff --name-only #{merge_remote}/#{merge_branch} #{merge_branch}")
|
245
258
|
files = last_stdout.split("\n")
|
246
259
|
run("reset #{merge_remote}/#{merge_branch}")
|
247
|
-
|
260
|
+
|
261
|
+
run("add -f #{files.map { |f| "\"#{Shellwords.escape(f)}\"" }.join(" ")}")
|
248
262
|
|
249
263
|
run("commit -m '#{commit_message(log)}'")
|
250
264
|
end
|
@@ -7,7 +7,7 @@ module FlashFlow
|
|
7
7
|
|
8
8
|
def initialize(issue_tracker_config, branches_config, branch_info_file, git_config, opts={})
|
9
9
|
@issue_tracker = IssueTracker::Base.new(issue_tracker_config)
|
10
|
-
@collection = Data::Base.new(branches_config, branch_info_file,
|
10
|
+
@collection = Data::Base.new(branches_config, branch_info_file, ShadowGit.new(git_config)).merged_branches
|
11
11
|
end
|
12
12
|
|
13
13
|
def status(filename=nil)
|
data/lib/flash_flow/resolve.rb
CHANGED
@@ -12,7 +12,7 @@ module FlashFlow
|
|
12
12
|
@logger = opts[:logger]
|
13
13
|
@branch_info_file = branch_info_file
|
14
14
|
@cmd_runner = CmdRunner.new(logger: @logger)
|
15
|
-
@git =
|
15
|
+
@git = ShadowGit.new(git_config, @logger)
|
16
16
|
end
|
17
17
|
|
18
18
|
def manual_instructions
|
@@ -23,24 +23,22 @@ module FlashFlow
|
|
23
23
|
def start
|
24
24
|
check_for_conflict
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
merge_conflicted
|
26
|
+
in_working_branch do
|
27
|
+
merge_conflicted
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
if unresolved_conflicts.empty?
|
30
|
+
puts "You have already resolved all conflicts."
|
31
|
+
else
|
32
|
+
launch_bash
|
34
33
|
|
35
|
-
|
34
|
+
rerere
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
36
|
+
unless unresolved_conflicts.empty?
|
37
|
+
puts "There are still unresolved conflicts in these files:\n#{unresolved_conflicts.join("\n")}\n\n"
|
40
38
|
end
|
41
|
-
|
42
|
-
git_reset
|
43
39
|
end
|
40
|
+
|
41
|
+
git_reset
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
@@ -102,42 +100,27 @@ Run the following commands to fix the merge conflict and then re-run flash_flow:
|
|
102
100
|
private
|
103
101
|
|
104
102
|
def data
|
105
|
-
|
106
|
-
|
107
|
-
in_shadow_repo do
|
108
|
-
@data = Data::Base.new({}, @branch_info_file, @git, logger: @logger)
|
109
|
-
end
|
110
|
-
|
111
|
-
@data
|
112
|
-
|
103
|
+
@data ||= Data::Base.new({}, @branch_info_file, @git, logger: @logger)
|
113
104
|
end
|
114
105
|
|
115
106
|
def branch
|
116
107
|
@branch ||= data.saved_branches.detect { |branch| branch.ref == working_branch }
|
117
108
|
end
|
118
109
|
|
119
|
-
def shadow_repo
|
120
|
-
@shadow_repo ||= ShadowRepo.new(@git, logger: @logger)
|
121
|
-
end
|
122
|
-
|
123
|
-
def in_shadow_repo
|
124
|
-
shadow_repo.in_dir do
|
125
|
-
yield
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
110
|
def working_branch
|
130
111
|
@git.working_branch
|
131
112
|
end
|
132
113
|
|
133
114
|
def in_working_branch
|
134
|
-
@git.
|
135
|
-
|
115
|
+
@git.in_dir do
|
116
|
+
@git.in_branch(working_branch) do
|
117
|
+
yield
|
118
|
+
end
|
136
119
|
end
|
137
120
|
end
|
138
121
|
|
139
122
|
def flash_flow_directory
|
140
|
-
|
123
|
+
@git.flash_flow_dir
|
141
124
|
end
|
142
125
|
|
143
126
|
def init_file_contents
|
@@ -3,24 +3,17 @@ require 'logger'
|
|
3
3
|
require 'flash_flow/git'
|
4
4
|
|
5
5
|
module FlashFlow
|
6
|
-
class
|
6
|
+
class ShadowGit < Git
|
7
7
|
|
8
|
+
def initialize(config, logger=nil)
|
9
|
+
super
|
8
10
|
|
9
|
-
def initialize(git, opts={})
|
10
|
-
@git = git
|
11
|
-
@cmd_runner = CmdRunner.new(logger: opts[:logger])
|
12
|
-
end
|
13
|
-
|
14
|
-
def in_dir(opts={})
|
15
|
-
opts = { reset: true, go_back: true }.merge(opts)
|
16
11
|
create_shadow_repo
|
12
|
+
@cmd_runner.dir = flash_flow_dir
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
yield
|
23
|
-
end
|
14
|
+
run("clean -x -f")
|
15
|
+
fetch(merge_remote)
|
16
|
+
run("reset --hard HEAD")
|
24
17
|
end
|
25
18
|
|
26
19
|
def create_shadow_repo
|
data/lib/flash_flow/version.rb
CHANGED
data/test/lib/data/test_store.rb
CHANGED
data/test/lib/test_deploy.rb
CHANGED
@@ -59,7 +59,7 @@ module FlashFlow
|
|
59
59
|
|
60
60
|
current_branch_error = "ERROR: Your branch did not merge to test_acceptance. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
|
61
61
|
|
62
|
-
@deploy.instance_variable_get('@
|
62
|
+
@deploy.instance_variable_get('@local_git'.to_sym).stub(:working_branch, 'pushing_branch') do
|
63
63
|
assert_equal(current_branch_error, @deploy.format_errors)
|
64
64
|
end
|
65
65
|
end
|
@@ -73,12 +73,10 @@ module FlashFlow
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_check_out_to_working_branch
|
76
|
-
@deploy.stub(:
|
77
|
-
@deploy.stub(:
|
78
|
-
|
79
|
-
|
80
|
-
assert_output(/Failure!/) { @deploy.run }
|
81
|
-
end
|
76
|
+
@deploy.stub(:check_repo, true) do
|
77
|
+
@deploy.stub(:check_version, true) do
|
78
|
+
Lock::Base.stub_any_instance(:with_lock, -> { raise Lock::Error }) do
|
79
|
+
assert_output(/Failure!/) { @deploy.run }
|
82
80
|
end
|
83
81
|
end
|
84
82
|
end
|
@@ -137,7 +135,7 @@ module FlashFlow
|
|
137
135
|
|
138
136
|
def test_ignore_pushing_master_or_acceptance
|
139
137
|
['test_master', 'test_acceptance'].each do |branch|
|
140
|
-
@deploy.instance_variable_get('@
|
138
|
+
@deploy.instance_variable_get('@local_git'.to_sym).stub(:working_branch, branch) do
|
141
139
|
refute(@deploy.open_pull_request)
|
142
140
|
end
|
143
141
|
end
|
data/test/lib/test_git.rb
CHANGED
@@ -40,15 +40,15 @@ module FlashFlow
|
|
40
40
|
@cmd_runner.expect(:run, true, ['rm -rf rr-cache/*'])
|
41
41
|
@cmd_runner.expect(:run, true, ['cp -R .git/rr-cache/xyz rr-cache/'])
|
42
42
|
@cmd_runner.expect(:run, true, ['cp -R .git/rr-cache/abc rr-cache/'])
|
43
|
-
@cmd_runner.expect(:run, true, ['git add rr-cache/'])
|
44
|
-
@cmd_runner.expect(:run, true, ["git commit -m 'Update rr-cache'"])
|
43
|
+
@cmd_runner.expect(:run, true, ['git add rr-cache/', {}])
|
44
|
+
@cmd_runner.expect(:run, true, ["git commit -m 'Update rr-cache'", {}])
|
45
45
|
|
46
46
|
instance.commit_rerere(['xyz', 'abc'])
|
47
47
|
@cmd_runner.verify
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_read_file_from_merge_branch
|
51
|
-
@cmd_runner.expect(:run, true, ["git show origin/acceptance:SomeFilename.txt"])
|
51
|
+
@cmd_runner.expect(:run, true, ["git show origin/acceptance:SomeFilename.txt", log: CmdRunner::LOG_CMD])
|
52
52
|
@cmd_runner.expect(:last_stdout, 'some_json', [])
|
53
53
|
@git_args['use_rerere'] = false
|
54
54
|
|
@@ -65,7 +65,7 @@ module FlashFlow
|
|
65
65
|
|
66
66
|
def setup_cmd_runner
|
67
67
|
cmd_runner = Minitest::Mock.new
|
68
|
-
cmd_runner.expect(:run, true, ['git rev-parse --abbrev-ref HEAD'])
|
68
|
+
cmd_runner.expect(:run, true, ['git rev-parse --abbrev-ref HEAD', {}])
|
69
69
|
cmd_runner.expect(:last_stdout, 'current_branch', [])
|
70
70
|
cmd_runner
|
71
71
|
end
|
data/test/lib/test_resolve.rb
CHANGED
@@ -4,10 +4,6 @@ module FlashFlow
|
|
4
4
|
class TestResolve< Minitest::Test
|
5
5
|
|
6
6
|
class ResolveTester < Resolve
|
7
|
-
def in_shadow_repo
|
8
|
-
yield
|
9
|
-
end
|
10
|
-
|
11
7
|
def in_working_branch
|
12
8
|
yield
|
13
9
|
end
|
@@ -71,30 +67,5 @@ module FlashFlow
|
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
74
|
-
|
75
|
-
|
76
|
-
# def start
|
77
|
-
# if unresolved_conflicts.empty?
|
78
|
-
# puts "You have already resolved all conflicts."
|
79
|
-
# else
|
80
|
-
# launch_bash
|
81
|
-
# @git.run("rerere")
|
82
|
-
#
|
83
|
-
# unless unresolved_conflicts.empty?
|
84
|
-
# puts "There are still unresolved conflicts in these files:\n#{unresolved_conflicts.join("\n")}\n\n"
|
85
|
-
# end
|
86
|
-
# end
|
87
|
-
#
|
88
|
-
# @git.run("reset --hard HEAD")
|
89
|
-
# end
|
90
|
-
# end
|
91
|
-
# end
|
92
|
-
|
93
|
-
|
94
|
-
private
|
95
|
-
|
96
|
-
def shadow_repo
|
97
|
-
Minitest::Mock.new.expect(:in_dir, true)
|
98
|
-
end
|
99
70
|
end
|
100
71
|
end
|
data/test/minitest_helper.rb
CHANGED
@@ -7,11 +7,13 @@ ENV['GH_TOKEN'] = 'fake_token'
|
|
7
7
|
class Minitest::Test
|
8
8
|
|
9
9
|
class TestCmdRunner < Minitest::Mock
|
10
|
+
LOG_NONE = :log_none
|
11
|
+
LOG_CMD = :log_cmd
|
12
|
+
|
10
13
|
def initialize(opts={}); super(); end
|
11
|
-
def run(_); end
|
12
|
-
def last_success
|
13
|
-
|
14
|
-
end
|
14
|
+
def run(_, opts={}); end
|
15
|
+
def last_success?; true; end
|
16
|
+
def dir=(other); other; end
|
15
17
|
def last_stdout; ''; end
|
16
18
|
def last_stderr; ''; end
|
17
19
|
def last_command; ''; end
|
data/update_gem.sh
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flashfunders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- test/lib/test_notifier.rb
|
202
202
|
- test/lib/test_resolve.rb
|
203
203
|
- test/minitest_helper.rb
|
204
|
+
- update_gem.sh
|
204
205
|
homepage: https://github.com/FlashFunders/flash_flow
|
205
206
|
licenses:
|
206
207
|
- MIT
|
@@ -216,9 +217,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
217
|
version: '0'
|
217
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
219
|
requirements:
|
219
|
-
- - "
|
220
|
+
- - ">"
|
220
221
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
222
|
+
version: 1.3.1
|
222
223
|
requirements: []
|
223
224
|
rubyforge_project:
|
224
225
|
rubygems_version: 2.2.2
|