git-story-workflow 0.9.12 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/git-story-workflow.gemspec +5 -3
- data/lib/git/story/app.rb +68 -27
- data/lib/git/story/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 594fee5ac595ddfe8ae4802bfc3bf4bef2c0f7c7b2e9f3ccbf76a9cbc7d8bd12
|
4
|
+
data.tar.gz: 2b2c6dace41b40c654dcfe7be680d22bf978696976d59de42abd27bdb68e071f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf31372ba982c29af6e018ec82136bd2d254f0c728567d2ee0d1e4ccc38fe57442aafa38ad0634bc5bbc22910740113509074684dd83a024b99d509add46dc15
|
7
|
+
data.tar.gz: 600489c9074d8f73f57d8156ca440fe69332e25dc80470a736ad763bfe647b4845d580338791b59e116520d0207d2b3e976dae39ef338a726894834f25a1c2ad
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.3
|
data/git-story-workflow.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: git-story-workflow 0.
|
2
|
+
# stub: git-story-workflow 0.11.3 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "git-story-workflow".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.11.3"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2020-
|
11
|
+
s.date = "2020-07-20"
|
12
12
|
s.description = "Gem abstracting a git workflow\u2026".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["git-story".freeze]
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
|
36
36
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
37
37
|
s.add_runtime_dependency(%q<complex_config>.freeze, [">= 0"])
|
38
|
+
s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0"])
|
38
39
|
else
|
39
40
|
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
40
41
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
@@ -45,5 +46,6 @@ Gem::Specification.new do |s|
|
|
45
46
|
s.add_dependency(%q<mize>.freeze, [">= 0"])
|
46
47
|
s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
47
48
|
s.add_dependency(%q<complex_config>.freeze, [">= 0"])
|
49
|
+
s.add_dependency(%q<search_ui>.freeze, [">= 0"])
|
48
50
|
end
|
49
51
|
end
|
data/lib/git/story/app.rb
CHANGED
@@ -3,6 +3,8 @@ require 'open-uri'
|
|
3
3
|
require 'tins/go'
|
4
4
|
require 'set'
|
5
5
|
require 'infobar'
|
6
|
+
require 'search_ui'
|
7
|
+
require 'amatch'
|
6
8
|
|
7
9
|
class Git::Story::App
|
8
10
|
class ::String
|
@@ -13,6 +15,7 @@ class Git::Story::App
|
|
13
15
|
extend Git::Story::Utils
|
14
16
|
include ComplexConfig::Provider::Shortcuts
|
15
17
|
include Tins::GO
|
18
|
+
include SearchUI
|
16
19
|
|
17
20
|
annotate :command
|
18
21
|
|
@@ -33,9 +36,9 @@ class Git::Story::App
|
|
33
36
|
def initialize(argv = ARGV.dup, debug: ENV['DEBUG'].to_i == 1)
|
34
37
|
@rest_argv = (sep = argv.index('--')) ? argv.slice!(sep..-1).tap(&:shift) : []
|
35
38
|
@argv = argv
|
36
|
-
@opts
|
37
|
-
@
|
38
|
-
|
39
|
+
@opts = go 'n:', @argv
|
40
|
+
@debug = debug
|
41
|
+
determine_command
|
39
42
|
end
|
40
43
|
|
41
44
|
def run
|
@@ -47,8 +50,11 @@ class Git::Story::App
|
|
47
50
|
puts __send__(@command, *@argv)
|
48
51
|
end
|
49
52
|
else
|
50
|
-
|
51
|
-
|
53
|
+
if @command
|
54
|
+
@command = @command.inspect
|
55
|
+
else
|
56
|
+
@command = 'n/a'
|
57
|
+
end
|
52
58
|
STDERR.puts "Unknown command #{@command}\n\n#{help.join(?\n)}"
|
53
59
|
exit 1
|
54
60
|
end
|
@@ -61,7 +67,7 @@ class Git::Story::App
|
|
61
67
|
longest = command_annotations.keys.map(&:size).max
|
62
68
|
result.concat(
|
63
69
|
command_annotations.map { |name, a|
|
64
|
-
"#{name.to_s.ljust(longest)} #{a[:doc]}"
|
70
|
+
"#{name.to_s.gsub(?_, ' ').ljust(longest)} #{a[:doc]}"
|
65
71
|
}
|
66
72
|
)
|
67
73
|
end
|
@@ -314,30 +320,23 @@ class Git::Story::App
|
|
314
320
|
command doc: '[PATTERN] switch to story matching PATTERN'
|
315
321
|
def switch(pattern = nil)
|
316
322
|
fetch_commits
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
if b.size == 1
|
321
|
-
b = b.first
|
322
|
-
else
|
323
|
-
b = nil
|
324
|
-
end
|
323
|
+
if branch = pick_branch(prompt: 'Switch to story? %s')
|
324
|
+
sh "git checkout #{branch}"
|
325
|
+
return "Switched to story: #{branch}".green
|
325
326
|
end
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
else
|
337
|
-
b = nil
|
327
|
+
end
|
328
|
+
|
329
|
+
command doc: '[PATTERN] delete story branch matching PATTERN'
|
330
|
+
def delete(pattern = nil)
|
331
|
+
fetch_commits
|
332
|
+
if branch = pick_branch(prompt: 'Delete story branch? %s', symbol: ?⌦)
|
333
|
+
sh "git pull origin #{branch}"
|
334
|
+
sh "git branch -d #{branch}"
|
335
|
+
if ask(prompt: 'Delete remote branch? (y/N) ') =~ /\Ay\z/i
|
336
|
+
sh "git push origin #{branch} --delete"
|
338
337
|
end
|
338
|
+
return "Deleted story branch: #{branch}".green
|
339
339
|
end
|
340
|
-
rescue Interrupt
|
341
340
|
end
|
342
341
|
|
343
342
|
command doc: '[BRANCH] open branch on github'
|
@@ -359,6 +358,48 @@ class Git::Story::App
|
|
359
358
|
|
360
359
|
private
|
361
360
|
|
361
|
+
def determine_command
|
362
|
+
c, command = [], nil
|
363
|
+
possible_commands = []
|
364
|
+
until @argv.empty?
|
365
|
+
c << @argv.shift
|
366
|
+
command = c.join(?_).to_sym
|
367
|
+
if command_of(command)
|
368
|
+
possible_commands << [ command, @argv.dup ]
|
369
|
+
end
|
370
|
+
end
|
371
|
+
unless possible_commands.empty?
|
372
|
+
@command, argv = possible_commands.last
|
373
|
+
@argv.replace(argv)
|
374
|
+
end
|
375
|
+
self
|
376
|
+
end
|
377
|
+
|
378
|
+
def pick_branch(prompt:, symbol: ?⏻)
|
379
|
+
ss = stories.map(&:story_base_name)
|
380
|
+
branch = Search.new(
|
381
|
+
match: -> answer {
|
382
|
+
answer = answer.strip.delete(?#).downcase
|
383
|
+
|
384
|
+
matcher = Amatch::PairDistance.new(answer)
|
385
|
+
matches = ss.map { |n| [ n, -matcher.similar(n.downcase) ] }.
|
386
|
+
select { |_, s| s < 0 }.sort_by(&:last).map(&:first)
|
387
|
+
|
388
|
+
matches.empty? and matches = ss
|
389
|
+
matches.first(Tins::Terminal.lines - 1)
|
390
|
+
},
|
391
|
+
query: -> _answer, matches, selector {
|
392
|
+
matches.each_with_index.
|
393
|
+
map { |m, i| i == selector ? "#{symbol} " + Search.on_blue(m) : '┊ ' + m } * ?\n
|
394
|
+
},
|
395
|
+
found: -> _answer, matches, selector {
|
396
|
+
matches[selector]
|
397
|
+
},
|
398
|
+
prompt: prompt.bold,
|
399
|
+
output: STDOUT
|
400
|
+
).start
|
401
|
+
end
|
402
|
+
|
362
403
|
def default_ref
|
363
404
|
tags.last
|
364
405
|
end
|
data/lib/git/story/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-story-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: search_ui
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: Gem abstracting a git workflow…
|
140
154
|
email: flori@ping.de
|
141
155
|
executables:
|
@@ -172,7 +186,7 @@ homepage: http://flori.github.com/git-story-workflow
|
|
172
186
|
licenses:
|
173
187
|
- Apache-2.0
|
174
188
|
metadata: {}
|
175
|
-
post_install_message:
|
189
|
+
post_install_message:
|
176
190
|
rdoc_options:
|
177
191
|
- "--title"
|
178
192
|
- Git-story-workflow
|
@@ -192,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
206
|
version: '0'
|
193
207
|
requirements: []
|
194
208
|
rubygems_version: 3.1.2
|
195
|
-
signing_key:
|
209
|
+
signing_key:
|
196
210
|
specification_version: 4
|
197
211
|
summary: Gem abstracting a git workflow
|
198
212
|
test_files:
|