git-story-workflow 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4c20550b1d7acae8a4c07063bf9fe5595fe765f
4
- data.tar.gz: ec6b8237bec95f699b29ac6205f5e5c2c5df33a5
3
+ metadata.gz: 604d9f538483bddd638458e260340f843912626f
4
+ data.tar.gz: c4f7f61e8f34a2a270de9ef49de90440c67a2e91
5
5
  SHA512:
6
- metadata.gz: afa3fdd4e4596e3ff713f2b4f762ca8601e2e3ac38d98dc57c87ca2039579f4e2879cdd94bbff5e9b37a2d28f6460aefdc2041cb594a28b4078875c62ce6f522
7
- data.tar.gz: 73af0f031ef420fa7fe548f35b7faf63edde671452c6629fb775d2f8253b05df29633dda7f168516be01f2c83c6b8890ac643e7257e0b7e66689b1f07f9eec53
6
+ metadata.gz: ca18fef7ef837044280e3c856857d4f7dc5d2196ff486a3d98f673333474d224b342dc6352d01960fa65f0a6ae55417b6c544c817547ac9ef7aeaa3025a5e54f
7
+ data.tar.gz: a4a5fb4c523a2a6a7eb6a912cbb8fd4134d786a27f4253b566630764a4134564856bb83c264bf38019b5e402d7d44d396a59f916351a9fee76330df67be8fad8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 0.0.6 ruby lib
2
+ # stub: git-story-workflow 0.0.7 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "0.0.6"
6
+ s.version = "0.0.7"
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 = "2017-10-05"
11
+ s.date = "2017-10-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]
data/lib/git/story/app.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'time'
2
+
1
3
  class Git::Story::App
2
4
  class ::String
3
5
  include Term::ANSIColor
@@ -18,6 +20,10 @@ class Git::Story::App
18
20
  attr_accessor :story_base_name
19
21
 
20
22
  attr_accessor :story_id
23
+
24
+ attr_accessor :story_created_at
25
+
26
+ attr_accessor :story_author
21
27
  end
22
28
 
23
29
  def initialize(argv = ARGV, debug: ENV['DEBUG'].to_i == 1)
@@ -78,11 +84,21 @@ class Git::Story::App
78
84
  end
79
85
  end
80
86
 
81
- command doc: 'list all stories'
82
- def list(mark_red: current(check: false))
87
+ command doc: '[AUTHOR] list all stories'
88
+ def list(author = nil, mark_red: current(check: false))
83
89
  stories.map { |b|
90
+ next if author && !b.story_author.include?(author)
84
91
  (bn = b.story_base_name) == mark_red ? bn.red : bn.green
85
- }
92
+ }.compact
93
+ end
94
+
95
+ command doc: '[AUTHOR] list all stories with details'
96
+ def list_details(author = nil, mark_red: current(check: false))
97
+ stories.sort_by { |b| -b.story_created_at.to_f }.map { |b|
98
+ next if author && !b.story_author.include?(author)
99
+ name = (bn = b.story_base_name) == mark_red ? bn.red : bn.green
100
+ "#{name} #{b.story_author} #{b.story_created_at.iso8601.yellow}"
101
+ }.compact
86
102
  end
87
103
 
88
104
  command doc: 'list all production deploy tags'
@@ -232,17 +248,25 @@ class Git::Story::App
232
248
 
233
249
  def stories
234
250
  sh 'git remote prune origin', error: false
235
- capture("git branch -r | grep -e '^ *origin/'").lines.map do |l|
236
- b = l.strip
237
- b_base = File.basename(b)
238
- if b_base =~ BRANCH_NAME_REGEX
239
- b.extend StoryAccessors
240
- b.story_base_name = b_base
241
- b.story_name = $1
242
- b.story_id = $2.to_i
243
- b
244
- end
245
- end.compact
251
+ refs = capture("git for-each-ref --format='%(refname);%(committerdate);%(authorname) %(authoremail)'")
252
+ refs = refs.lines.map { |l|
253
+ r = l.chomp.split(?;)
254
+ next unless r[0] =~ %r(/origin/)
255
+ r[0] = File.basename(r[0])
256
+ next unless r[0] =~ BRANCH_NAME_REGEX
257
+ r[1] = Time.parse(r[1])
258
+ r
259
+ }.compact.map do |r|
260
+ b = r[0]
261
+ b =~ BRANCH_NAME_REGEX
262
+ b.extend StoryAccessors
263
+ b.story_base_name = r[0]
264
+ b.story_name = $1
265
+ b.story_id = $2.to_i
266
+ b.story_created_at = r[1]
267
+ b.story_author = r[2]
268
+ b
269
+ end
246
270
  end
247
271
 
248
272
  def current_branch
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
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: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-05 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar