git-story-workflow 0.9.9 → 0.9.10

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
  SHA256:
3
- metadata.gz: 7be8a8f95cb4a4ace84ff31ea834592feaee80135fc822ac5012efe48b1c4958
4
- data.tar.gz: 9d7413465c4bfba839ec517d63a28919570dd0d16af27f5daa650224d09b9513
3
+ metadata.gz: cc6fc0d57caaf1bf1ddc9479956304a9826d639dd64f738c541abdecb9e10658
4
+ data.tar.gz: 8006409b423a1237f8ab8fbf84e4453b50c15343e1caf3a16a7e308d465baba6
5
5
  SHA512:
6
- metadata.gz: f42ba31483283a339566427f233675f29bd6010571122443bc4ff82aa14a72f8d1bb17936f59fec97d3d43eb266630dbcf172d9574015ce8716bfa5c8ff585b1
7
- data.tar.gz: ffa174f376be96eeeeb76c7df8d6a7246c527117f07b3bf6a3e2286c4595728b58f232eefc3773d3627513a77246148ed118a82b86f01f659eb31b51e79072f6
6
+ metadata.gz: ed5c753dc90f1e5122cbea04a8d8146eadcdc532bb8fb0f2034860090329e0d3d8c0e5bdc7c219e775b22897659afdafe1e1d4b66ac2368017dce3171fce4bd6
7
+ data.tar.gz: 86d2cc86c1a2a5279566056f7ad17302f383a3c738f0331496012cb8a8665ca634516f801d2c8059443d9c9e602fd26ddab05226bfaa3692adef2711e615cd3f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.9
1
+ 0.9.10
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 0.9.9 ruby lib
2
+ # stub: git-story-workflow 0.9.10 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "0.9.9"
6
+ s.version = "0.9.10"
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]
@@ -223,24 +223,23 @@ class Git::Story::App
223
223
 
224
224
  command doc: 'list all production deploy tags'
225
225
  def deploy_tags
226
- capture(tags).lines.map(&:chomp)
226
+ tags.map { |t| tag_name(t) }
227
227
  end
228
228
 
229
229
  command doc: 'output the times of all production deploys'
230
230
  def deploys
231
- deploy_tags.map { |t| format_tag(t) }
231
+ tags.map { |t| format_tag(t) }
232
232
  end
233
233
  alias deploy_list deploys
234
234
 
235
235
  command doc: 'output the last production deploy tag'
236
236
  def deploy_tags_last
237
- deploy_tags.last
237
+ tag_name(tags.last)
238
238
  end
239
239
 
240
240
  command doc: 'output the time of the last production deploy'
241
241
  def deploy_last
242
- tag = deploy_tags_last
243
- format_tag(tag)
242
+ format_tag(tags.last)
244
243
  end
245
244
 
246
245
  command doc: '[REF] output log of changes since last production deploy tag'
@@ -361,12 +360,13 @@ class Git::Story::App
361
360
  private
362
361
 
363
362
  def default_ref
364
- deploy_tags.last
363
+ tags.last
365
364
  end
366
365
 
367
366
  def build_ref_range(ref)
368
- if 'previous' == ref and (previous = deploy_tags.last(2)).size == 2
369
- previous * '..'
367
+ ref = tag_name(ref)
368
+ if 'previous' == ref and (previous = tags.last(2)).size == 2
369
+ previous.map { |t| tag_name(t) } * '..'
370
370
  elsif /^(?<before>.+?)?\.\.(?<after>.+)?\z/ =~ ref
371
371
  if before && after
372
372
  "#{before}..#{after}"
@@ -383,6 +383,10 @@ class Git::Story::App
383
383
  end
384
384
 
385
385
  def tags
386
+ capture(deploy_tag_command).lines.map(&:chomp)
387
+ end
388
+
389
+ def deploy_tag_command
386
390
  fetch_tags
387
391
  if command = complex_config.story.deploy_tag_command?
388
392
  command
@@ -519,24 +523,31 @@ class Git::Story::App
519
523
 
520
524
  def tag_time(tag)
521
525
  case tag
522
- when %r(\d{4}/\d{2}/\d{2}\d{2}:\d{2})
523
- Time.strptime($&, '%Y/%m/%d%H:%M')
524
- when /\d{4}_\d{2}_\d{2}-\d{2}_\d{2}/
525
- Time.strptime($&, '%Y_%m_%d-%H_%M')
526
+ when %r(\A\d{4}/\d{2}/\d{2}\d{2}:\d{2}:\d{2} (\S+))
527
+ return Time.strptime($&, '%Y/%m/%d%H:%M'), $1
528
+ when /\d{4}_\d{2}_\d{2}-\d{2}_\d{2}\z/
529
+ return Time.strptime($&, '%Y_%m_%d-%H_%M'), tag
530
+ else
531
+ return nil, tag
526
532
  end
527
533
  end
528
534
 
535
+ def tag_name(tag)
536
+ tag_time(tag)&.last
537
+ end
538
+
529
539
  def format_tag(tag)
530
- if time = tag_time(tag)
540
+ time, tag_name = tag_time(tag)
541
+ if time
531
542
  day = Time::RFC2822_DAY_NAME[time.wday]
532
543
  "%s %s %s %s" % [
533
544
  time.iso8601.green,
534
545
  day.green,
535
- tag.to_s.yellow,
546
+ tag_name.to_s.yellow,
536
547
  "was #{Tins::Duration.new((Time.now - time).floor)} ago".green,
537
548
  ]
538
549
  else
539
- tag
550
+ tag_name
540
551
  end
541
552
  end
542
553
 
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '0.9.9'
3
+ VERSION = '0.9.10'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-story-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank