Class: Rwm::Commands::Affected
- Inherits:
-
Object
- Object
- Rwm::Commands::Affected
- Defined in:
- lib/rwm/commands/affected.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Affected
constructor
A new instance of Affected.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Affected
Returns a new instance of Affected.
8 9 10 11 12 13 |
# File 'lib/rwm/commands/affected.rb', line 8 def initialize(argv) @argv = argv @committed_only = false @base_branch = nil end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rwm/commands/affected.rb', line 15 def run workspace = Workspace.find graph = DependencyGraph.load(workspace) detector = AffectedDetector.new(workspace, graph, committed_only: @committed_only, base_branch: @base_branch) affected = detector.affected_packages directly_changed = detector.directly_changed_packages if affected.empty? puts "No packages affected." return 0 end puts "Base branch: #{detector.base_branch}" puts "Affected packages (#{affected.size}):" puts affected.each do |pkg| marker = directly_changed.include?(pkg) ? "(changed)" : "(dependent)" puts " #{pkg.name} #{marker}" end 0 end |