diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 17dfac38..70db9846 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,13 +2,17 @@ ## Unreleased +## Version 0.15.1 - 2022-08-23 + +* Fix `--affected` filter [#82](https://github.com/powerhome/cobra_commander/pull/82) + ## Version 0.15.0 - 2022-08-16 +* Resolve YARN dependencies based on yarn workspaces info workspaceDependencies [#81](https://github.com/powerhome/cobra_commander/pull/81) * Add `--affected` filter to `cobra ls` and `cobra exec`, to target all components affected by changes since given branch [#80](https://github.com/powerhome/cobra_commander/pull/80) * Allows a comma separated list of components on `cobra ls` and `cobra exec` instead of a single component [#79](https://github.com/powerhome/cobra_commander/pull/79) -* Resolve YARN dependencies based on yarn workspaces info workspaceDependencies [#81](https://github.com/powerhome/cobra_commander/pull/81) -* Fix cbra.info links [#70](https://github.com/powerhome/cobra_commander/pull/70) * Replace standardrb by rubocop-powerhome [#78](https://github.com/powerhome/cobra_commander/pull/78) +* Fix cbra.info links [#70](https://github.com/powerhome/cobra_commander/pull/70) ## Version 0.14.0 - 2021-11-24 diff --git a/lib/cobra_commander/affected.rb b/lib/cobra_commander/affected.rb index 4a1e65e5..6af893fb 100644 --- a/lib/cobra_commander/affected.rb +++ b/lib/cobra_commander/affected.rb @@ -13,6 +13,10 @@ def names @names ||= all_affected.map(&:name) end + def all_affected + @all_affected ||= (@directly | @transitively).sort_by(&:name) + end + def scripts @scripts ||= paths.map { |path| File.join(path, "test.sh") } end @@ -69,10 +73,6 @@ def affected_component(component) } end - def all_affected - @all_affected ||= (@directly | @transitively).sort_by(&:name) - end - def paths @paths ||= all_affected.map(&:root_paths).flatten end diff --git a/lib/cobra_commander/version.rb b/lib/cobra_commander/version.rb index 58523bf2..930e5282 100644 --- a/lib/cobra_commander/version.rb +++ b/lib/cobra_commander/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module CobraCommander - VERSION = "0.15.0" + VERSION = "0.15.1" end diff --git a/spec/cobra_commander/cli_spec.rb b/spec/cobra_commander/cli_spec.rb index 85307096..5888fdc5 100644 --- a/spec/cobra_commander/cli_spec.rb +++ b/spec/cobra_commander/cli_spec.rb @@ -5,7 +5,7 @@ RUBY_2_7 = Gem::Version.new(RUBY_VERSION) > Gem::Version.new("2.7.0") RSpec.describe "cobra cli", type: :aruba do - let!(:umbrella) { fixture_umbrella("app") } + let(:umbrella) { fixture_umbrella("app") } let(:last_command_output) do last_command_started.output.strip.split("\n").grep_v(/warning/).join("\n") end @@ -291,6 +291,14 @@ end describe "cobra ls" do + it "lists components affected by changes in a branch" do + umbrella = fixture_umbrella("modified-app") + + run_command_and_stop("cobra ls -a #{umbrella.path} --affected master", fail_on_error: true) + + expect(last_command_output).to eq("a\nc\nd") + end + it "errors gently if component doesn't exist" do run_command_and_stop("cobra ls -a #{umbrella.path} non_existent", fail_on_error: false)