Class: CobraCommander::Affected
- Inherits:
-
Object
- Object
- CobraCommander::Affected
- Defined in:
- lib/cobra_commander/affected.rb
Overview
Calculates directly & transitively affected components
Instance Method Summary collapse
- #directly ⇒ Object
-
#initialize(umbrella, changes) ⇒ Affected
constructor
A new instance of Affected.
-
#json_representation ⇒ Object
rubocop:disable Metrics/MethodLength.
- #names ⇒ Object
- #scripts ⇒ Object
- #transitively ⇒ Object
Constructor Details
#initialize(umbrella, changes) ⇒ Affected
Returns a new instance of Affected.
6 7 8 9 10 |
# File 'lib/cobra_commander/affected.rb', line 6 def initialize(umbrella, changes) @umbrella = umbrella @changes = changes run! end |
Instance Method Details
#directly ⇒ Object
20 21 22 |
# File 'lib/cobra_commander/affected.rb', line 20 def directly @directly.map(&method(:affected_component)) end |
#json_representation ⇒ Object
rubocop:disable Metrics/MethodLength
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cobra_commander/affected.rb', line 28 def json_representation # rubocop:disable Metrics/MethodLength { changed_files: @changes, directly_affected_components: directly, transitively_affected_components: transitively, test_scripts: scripts, component_names: names, languages: { ruby: contains_ruby?, javascript: contains_js?, }, }.to_json end |
#names ⇒ Object
12 13 14 |
# File 'lib/cobra_commander/affected.rb', line 12 def names @names ||= all_affected.map(&:name) end |
#scripts ⇒ Object
16 17 18 |
# File 'lib/cobra_commander/affected.rb', line 16 def scripts @scripts ||= paths.map { |path| File.join(path, "test.sh") } end |
#transitively ⇒ Object
24 25 26 |
# File 'lib/cobra_commander/affected.rb', line 24 def transitively @transitively.map(&method(:affected_component)) end |