git-story-workflow 1.3.0 → 1.4.0

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: 63e47013d8d5c62bf7f3b02c334ab8a6cfb6e200d54506042a8552005fabcd03
4
- data.tar.gz: 23b3d417eb765ec8d842a06c927c14c3bc79c9e45a488bb1be395ed35ff856e3
3
+ metadata.gz: 04601b201fea90d5e5054d3e61881533d1d5c87b8fb9f4d0c23ab71b74fbda4d
4
+ data.tar.gz: 3991c64783f6d63815273b6475597a87731a7737cbfc41e2050919c18ec5c1af
5
5
  SHA512:
6
- metadata.gz: fe79a45d3ba9663fa4b7240fc13e6379b4847282669333ee89c44012226fce6179064152b5c6b345ed57a89fc85e6d1c3fc55e6e561e5a81ef8543be1203bb47
7
- data.tar.gz: f710599f822a1711c4fc5f7c7731db03b9fbed0e298e3f15fdf4304654c4f5ac20bbf955f51a5c2984eae49db6150f960a3fb43b479272253e5c36141b368ad3
6
+ metadata.gz: 34536de7b1148214bd5fa6a09dfee1ac876ff16a0d4a9543eb34b08ae92aac111d264bc8b0aefb4bdde112b76c9867ebd7622e58f771ffce411e2a9aee3e2a9e
7
+ data.tar.gz: 9ecadc6812f41148ad7e79b0184b694a19ec593a041b93626972f9ad2100f6b6b7a6c51962a1e16ceb86222a0800794f2538086b8ad5d7666d406a1fb4e45cd6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.4.0
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 1.3.0 ruby lib
2
+ # stub: git-story-workflow 1.4.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "1.3.0"
6
+ s.version = "1.4.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 = "2021-05-21"
11
+ s.date = "2021-08-17"
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]
@@ -2,11 +2,14 @@
2
2
  # Installed by the git-story gem
3
3
 
4
4
  require 'tempfile'
5
+ require 'complex_config/rude'
6
+ include ComplexConfig::Provider::Shortcuts
5
7
 
6
8
  class CommitMesssageParser
7
9
  def initialize
8
10
  @line_index = 0
9
11
  @story_number_found = false
12
+ @story_number_done = false
10
13
  @message_data = []
11
14
  end
12
15
 
@@ -16,10 +19,20 @@ class CommitMesssageParser
16
19
  @story_number_found
17
20
  end
18
21
 
22
+ def story_number_done?
23
+ @story_number_done
24
+ end
25
+
19
26
  def parse(template)
20
27
  @message_data = template.readlines
21
28
  @message_data.each do |line|
22
- line =~ /\[.*#\d+.*\]/ and @story_number_found = true
29
+ if /^\s*\[.*(?:#\d+|TODO|(?<done>DONE)).*\]/i =~ line
30
+ @story_number_found = true
31
+ if @story_number_done = !!done
32
+ @message_data.slice!(@line_index)
33
+ next
34
+ end
35
+ end
23
36
  if line =~ /^\s*#/
24
37
  break
25
38
  else
@@ -49,21 +62,31 @@ story_numbers =
49
62
  break $1.split(/_/)
50
63
  } || []
51
64
  story_numbers.map!(&:chomp)
52
- unless story_numbers.empty?
53
- Tempfile.open('commit') do |output|
54
- File.open(ARGV.first) do |template|
55
- message_parsed = CommitMesssageParser.new.parse(template)
56
- if message_parsed.story_number_found?
57
- output.puts message_parsed.total
58
- else
59
- output.puts message_parsed.data, "",
60
- "[#{story_numbers.map { |story_number| "##{story_number}" } * ' '}]",
61
- "", message_parsed.footer
62
- end
63
- output.rewind
64
- File.open(ARGV.first, 'w') do |message|
65
- message.write output.read
65
+ Tempfile.open('commit') do |output|
66
+ File.open(ARGV.first) do |template|
67
+ message_parsed = CommitMesssageParser.new.parse(template)
68
+ if message_parsed.story_number_found?
69
+ output.puts message_parsed.total
70
+ elsif complex_config.todo_nudging? && story_numbers.empty? && !message_parsed.story_number_done?
71
+ output.puts message_parsed.data, "", "[TODO]", "", message_parsed.footer
72
+ else
73
+ full_message = [ message_parsed.data, "", ]
74
+ if prefix = complex_config.story.pivotal_reference_prefix?
75
+ pivotal_reference = -> number { "%s-%u" % [ prefix, number ] }
76
+ full_message.concat(
77
+ story_numbers.each_with_index.map { |story_number, i| "#{i + 1}. " + pivotal_reference.(story_number) }
78
+ )
79
+ full_message << ""
66
80
  end
81
+ full_message <<
82
+ "[#{story_numbers.map { |story_number| "##{story_number}" } * ' '}]" <<
83
+ "" <<
84
+ message_parsed.footer
85
+ output.puts full_message
86
+ end
87
+ output.rewind
88
+ File.open(ARGV.first, 'w') do |message|
89
+ message.write output.read
67
90
  end
68
91
  end
69
92
  end
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
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: 1.3.0
4
+ version: 1.4.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: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar