featureparity 0.0.40 → 0.0.41

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: 9dd6a510da7bd07c87ce3c58eaa05dcd3facc6c46f3faa912f4f10680e5880de
4
- data.tar.gz: 5785e9baf74b9eb8721dca68c1e86b44e6ab69ead5ff596145816c81db8dc85b
3
+ metadata.gz: 604df9b10892e95ecb76e71ee9afaf72f2465aebee4dc40d48e3657e6219ee02
4
+ data.tar.gz: 67a7b63205f476536a6ca59999103209503d10bba27b8a11b166d686c3997770
5
5
  SHA512:
6
- metadata.gz: 0b690ed24b1913f26f8a58c3610ef4e16e158f28919c1b8b0548eefef0254fe6bd58d41f2d86fa2a014e7f22a5020eb12eed60ee85e9cbb0c5c71861efb37429
7
- data.tar.gz: 62eb7f052c5bf00cfd4d1c39c9f6b8dbae3d6e7db84c2348b8aff8c51cc0301f439f7a52c69b2a0488006c9ebe7a66779a08bdcd1e1e12709cd25010b013ae65
6
+ metadata.gz: f40525810581b7ce517d5676840671fed3fc8d93d6fc2b622af80972b64d645c5077e6b7b9144d372dbf9d6b77e31bfc9547ccb9f42bcbf8938408a46397914d
7
+ data.tar.gz: fb318ed5fbfbdd95137db59f85204ee7ed7ac79329d5879be45a5627fc2799d9479d39fe44d6484e44c8e179a4ebfa37d987304ac002378d5fb33f2fcbfc448c
@@ -91,7 +91,7 @@ module Fp
91
91
  return entry(requirement, 'in_review', nil)
92
92
  end
93
93
 
94
- progress("#{slug} ...") if sweeping
94
+ announce("#{slug} ...") if sweeping
95
95
  analysis = cached_analysis(requirement)
96
96
 
97
97
  if analysis.nil? || opts[:force] || opts[:conflicts] && analysis['conflicts'].nil?
@@ -100,13 +100,13 @@ module Fp
100
100
  result = client.analyze_requirement(requirement['id'], force: opts[:force],
101
101
  include_conflicts: opts[:conflicts])
102
102
  unless result[:ok]
103
- # Without access (or without the analyzer) every call would fail the same way.
104
103
  if [401, 402, 403, 503].include?(result[:status])
105
104
  output.error(result[:error], status: result[:status])
106
105
  exit 1
107
106
  end
108
107
  return entry(requirement, 'error', nil, error: result[:error])
109
108
  end
109
+ confirm_access
110
110
  analysis = result[:data]['analysis']
111
111
  end
112
112
 
@@ -260,6 +260,20 @@ module Fp
260
260
  line
261
261
  end
262
262
 
263
+ def announce(message)
264
+ return progress(message) if @access_confirmed
265
+
266
+ (@held_progress ||= []) << message
267
+ end
268
+
269
+ def confirm_access
270
+ return if @access_confirmed
271
+
272
+ @access_confirmed = true
273
+ Array(@held_progress).each { |message| progress(message) }
274
+ @held_progress = nil
275
+ end
276
+
263
277
  def progress(message)
264
278
  warn message unless output.json?
265
279
  end
@@ -196,6 +196,9 @@ module Fp
196
196
  elsif update[:update_available]
197
197
  "#{update[:latest_version]} — newer than this one. Run `#{update[:update_command]}` " \
198
198
  "(or `#{UpdateCheck::GEM_COMMAND}`)."
199
+ elsif update[:check_stale]
200
+ "#{update[:latest_version]} — older than this one (#{Fp::VERSION}), so the version check " \
201
+ "looks stale. #{UpdateCheck::CHANGELOG_URL} lists the newest release."
199
202
  else
200
203
  "#{update[:latest_version]} (up to date)"
201
204
  end
@@ -109,14 +109,14 @@ module Fp
109
109
  rows = []
110
110
 
111
111
  parents.each do |r|
112
- surfaces = (r['required_surfaces'] || []).join(', ')
112
+ surfaces = Parity.surface_labels(r).join(', ')
113
113
  category = r['category'] || '-'
114
114
  tags = (r['tags'] || []).join(', ')
115
115
  rows << [r['slug'], truncate(r['title'], 40), category, tags.empty? ? '-' : tags, surfaces.empty? ? '-' : surfaces, status_cell(r)]
116
116
 
117
117
  # Add children indented
118
118
  (children_by_parent[r['id']] || []).each do |child|
119
- child_surfaces = (child['required_surfaces'] || []).join(', ')
119
+ child_surfaces = Parity.surface_labels(child).join(', ')
120
120
  child_category = child['category'] || '-'
121
121
  child_tags = (child['tags'] || []).join(', ')
122
122
  rows << [" └ #{child['slug']}", truncate(child['title'], 36), child_category, child_tags.empty? ? '-' : child_tags, child_surfaces.empty? ? '-' : child_surfaces, status_cell(child)]
@@ -125,7 +125,7 @@ module Fp
125
125
 
126
126
  # Show orphans at top level
127
127
  orphans.each do |r|
128
- surfaces = (r['required_surfaces'] || []).join(', ')
128
+ surfaces = Parity.surface_labels(r).join(', ')
129
129
  category = r['category'] || '-'
130
130
  tags = (r['tags'] || []).join(', ')
131
131
  rows << [r['slug'], truncate(r['title'], 40), category, tags.empty? ? '-' : tags, surfaces.empty? ? '-' : surfaces, status_cell(r)]
@@ -128,14 +128,16 @@ module Fp
128
128
  puts "Parent: #{parent_slug || req['parent_id'] || '(none)'}"
129
129
  puts
130
130
 
131
- surfaces = req['required_surfaces'] || []
131
+ surfaces = Parity.surface_labels(req)
132
132
  puts 'Required Surfaces:'
133
133
  if surfaces.empty?
134
134
  puts ' (none)'
135
135
  else
136
136
  surfaces.each { |s| puts " - #{s}" }
137
137
  end
138
- if req['pending_change_kind'] == 'modification' && Parity.under_review?(req)
138
+ if Array(req['proposed_surfaces']).any?
139
+ puts ' (A proposed surface is not required until a human approves the proposal)'
140
+ elsif req['pending_change_kind'] == 'modification' && Parity.under_review?(req)
139
141
  puts ' (Surfaces may change — a proposal is awaiting review)'
140
142
  end
141
143
  puts
@@ -928,13 +928,20 @@ module Fp
928
928
  'parent_skipped' => 'parent was skipped'
929
929
  }.freeze
930
930
 
931
- # Build a brief summary of skip reasons for the error message when nothing is drafted.
931
+ SKIP_COUNTS = {
932
+ 'has_pending_change' => ['already has a change awaiting review', 'already have a change awaiting review'],
933
+ 'already_includes_surface' => ['already names this surface', 'already name this surface'],
934
+ 'archived' => %w[archived archived],
935
+ 'parent_skipped' => ['whose parent was skipped', 'whose parent was skipped']
936
+ }.freeze
937
+
932
938
  def skipped_summary(skipped)
933
939
  return '' if skipped.empty?
934
940
 
935
941
  by_reason = skipped.group_by { |row| row['reason'] }
936
942
  parts = by_reason.map do |reason, rows|
937
- "#{rows.size} #{SKIP_REASONS[reason] || reason}"
943
+ one, many = SKIP_COUNTS[reason] || [reason, reason]
944
+ "#{rows.size} #{rows.size == 1 ? one : many}"
938
945
  end
939
946
  "#{skipped.size} skipped (#{parts.join(', ')}). "
940
947
  end
@@ -37,10 +37,10 @@ module Fp
37
37
  attr_writer :installer
38
38
 
39
39
  def installer
40
- @installer ||= lambda do
40
+ @installer ||= lambda do |version|
41
41
  out, status = Open3.capture2e(
42
42
  Gem.ruby, '-e', 'require "rubygems/gem_runner"; Gem::GemRunner.new.run(ARGV)',
43
- 'install', 'featureparity'
43
+ 'install', 'featureparity', '--version', version
44
44
  )
45
45
  [out, status.success?]
46
46
  end
@@ -59,7 +59,7 @@ module Fp
59
59
  end
60
60
 
61
61
  unless status[:update_available]
62
- return output.success(status.merge(updated: false)) { puts "fp #{Fp::VERSION} is the latest version." }
62
+ return output.success(status.merge(updated: false)) { puts current_line(status) }
63
63
  end
64
64
 
65
65
  if opts[:check]
@@ -74,9 +74,16 @@ module Fp
74
74
 
75
75
  private
76
76
 
77
+ def current_line(status)
78
+ return "fp #{Fp::VERSION} is the latest version." unless status[:check_stale]
79
+
80
+ "fp #{Fp::VERSION} is newer than the latest version the API reports (#{status[:latest_version]}), " \
81
+ 'so there is nothing to install. The version check looks stale.'
82
+ end
83
+
77
84
  def install(status)
78
85
  puts "Installing fp #{status[:latest_version]} (you have #{Fp::VERSION})..." unless output.json?
79
- log, ok = self.class.installer.call
86
+ log, ok = self.class.installer.call(status[:latest_version])
80
87
 
81
88
  unless ok
82
89
  output.error("The update failed. Run `#{UpdateCheck::GEM_COMMAND}` to see why.\n#{log.to_s.lines.last(5).join}".strip)
@@ -85,7 +92,7 @@ module Fp
85
92
 
86
93
  payload = status.merge(updated: true, next_steps: AFTER_UPDATE.map(&:first), changelog_url: UpdateCheck::CHANGELOG_URL)
87
94
  output.success(payload) do
88
- puts "✓ fp is updated. `fp version` shows what's installed."
95
+ puts "✓ fp #{status[:latest_version]} is installed."
89
96
  puts "What changed: #{UpdateCheck::CHANGELOG_URL}"
90
97
  puts
91
98
  puts 'Next, in each repo that uses fp:'
data/lib/fp/parity.rb CHANGED
@@ -80,6 +80,13 @@ module Fp
80
80
  # What a status column prints for a requirement: its status, except that one awaiting
81
81
  # review is called that, and a proposal against it is named either way.
82
82
  # active | draft | draft (removal proposed) | awaiting review (modification proposed)
83
+ def self.surface_labels(requirement)
84
+ proposed = Array(requirement['proposed_surfaces'])
85
+ Array(requirement['required_surfaces']).map do |surface|
86
+ proposed.include?(surface) ? "#{surface} (proposed)" : surface
87
+ end
88
+ end
89
+
83
90
  def self.status_label(requirement)
84
91
  status = under_review?(requirement) ? UNDER_REVIEW_LABEL : requirement['status'].to_s
85
92
  kind = requirement['pending_change_kind'].to_s
@@ -61,6 +61,7 @@ module Fp
61
61
  current_version: Fp::VERSION,
62
62
  latest_version: latest,
63
63
  update_available: latest ? newer?(latest) : false,
64
+ check_stale: latest ? newer?(Fp::VERSION, latest) : false,
64
65
  update_command: UPDATE_COMMAND
65
66
  }
66
67
  end
data/lib/fp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fp
4
- VERSION = '0.0.40'
4
+ VERSION = '0.0.41'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featureparity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.40
4
+ version: 0.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla