git-story-workflow 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/git-story-workflow.gemspec +3 -3
- data/lib/git/story/app.rb +39 -23
- data/lib/git/story/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c437719bf4e7298ee339477a48e37e6652a028876c7c1ef524953a24792b4099
|
4
|
+
data.tar.gz: 2dfe54728f5d8ad1d0655ad6e9c1706e905ae952af8678812002bb2fc6b20f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d32bb92036c60fbea1492caa8c79fc211d96aa60adc389386d9e8ed585d3613c8a3abf8562c19fafdf68450a6a21a3b4ff297a0df94ac111ff7a5317aa3b1942
|
7
|
+
data.tar.gz: 571614a5c236d81ea10bbe3628ff5bbf2812d6d1b2f68b479fcb2c0d02c6b2c55d54cbb367e3b3bf49592c8ef4e5b03cbc58f8098df6e7f276d018716135b85c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
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.0 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.0"
|
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-02-
|
11
|
+
s.date = "2020-02-28"
|
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]
|
data/lib/git/story/app.rb
CHANGED
@@ -317,34 +317,25 @@ class Git::Story::App
|
|
317
317
|
command doc: '[PATTERN] switch to story matching PATTERN'
|
318
318
|
def switch(pattern = nil)
|
319
319
|
fetch_commits
|
320
|
-
|
321
|
-
branch = Search.new(
|
322
|
-
match: -> answer {
|
323
|
-
answer = answer.strip.delete(?#).downcase
|
324
|
-
|
325
|
-
matcher = Amatch::PairDistance.new(answer)
|
326
|
-
matches = ss.map { |n| [ n, -matcher.similar(n.downcase) ] }.
|
327
|
-
select { |_, s| s < 0 }.sort_by(&:last).map(&:first)
|
328
|
-
|
329
|
-
matches.empty? and matches = ss
|
330
|
-
matches.first(Tins::Terminal.lines - 1)
|
331
|
-
},
|
332
|
-
query: -> _answer, matches, selector {
|
333
|
-
matches.each_with_index.
|
334
|
-
map { |m, i| i == selector ? '⏻ ' + Search.on_blue(m) : '┊ ' + m } * ?\n
|
335
|
-
},
|
336
|
-
found: -> _answer, matches, selector {
|
337
|
-
matches[selector]
|
338
|
-
},
|
339
|
-
prompt: 'Story? %s'.bold,
|
340
|
-
output: STDOUT
|
341
|
-
).start
|
342
|
-
if branch
|
320
|
+
if branch = pick_branch(prompt: 'Switch to story? %s')
|
343
321
|
sh "git checkout #{branch}"
|
344
322
|
return "Switched to story: #{branch}".green
|
345
323
|
end
|
346
324
|
end
|
347
325
|
|
326
|
+
command doc: '[PATTERN] delete story branch matching PATTERN'
|
327
|
+
def delete(pattern = nil)
|
328
|
+
fetch_commits
|
329
|
+
if branch = pick_branch(prompt: 'Delete story branch? %s', symbol: ?⌦)
|
330
|
+
sh "git pull origin #{branch}"
|
331
|
+
sh "git branch -d #{branch}"
|
332
|
+
if ask(prompt: 'Delete remote branch? (y/N) ') =~ /\Ay\z/i
|
333
|
+
sh "git push origin #{branch} --delete"
|
334
|
+
end
|
335
|
+
return "Deleted story branch: #{branch}".green
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
348
339
|
command doc: '[BRANCH] open branch on github'
|
349
340
|
def github(branch = current(check: false))
|
350
341
|
if url = github_url(branch)
|
@@ -364,6 +355,31 @@ class Git::Story::App
|
|
364
355
|
|
365
356
|
private
|
366
357
|
|
358
|
+
def pick_branch(prompt:, symbol: ?⏻)
|
359
|
+
ss = stories.map(&:story_base_name)
|
360
|
+
branch = Search.new(
|
361
|
+
match: -> answer {
|
362
|
+
answer = answer.strip.delete(?#).downcase
|
363
|
+
|
364
|
+
matcher = Amatch::PairDistance.new(answer)
|
365
|
+
matches = ss.map { |n| [ n, -matcher.similar(n.downcase) ] }.
|
366
|
+
select { |_, s| s < 0 }.sort_by(&:last).map(&:first)
|
367
|
+
|
368
|
+
matches.empty? and matches = ss
|
369
|
+
matches.first(Tins::Terminal.lines - 1)
|
370
|
+
},
|
371
|
+
query: -> _answer, matches, selector {
|
372
|
+
matches.each_with_index.
|
373
|
+
map { |m, i| i == selector ? "#{symbol} " + Search.on_blue(m) : '┊ ' + m } * ?\n
|
374
|
+
},
|
375
|
+
found: -> _answer, matches, selector {
|
376
|
+
matches[selector]
|
377
|
+
},
|
378
|
+
prompt: prompt.bold,
|
379
|
+
output: STDOUT
|
380
|
+
).start
|
381
|
+
end
|
382
|
+
|
367
383
|
def default_ref
|
368
384
|
tags.last
|
369
385
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|