Skip to content

Commit

Permalink
Fix cobra --affected - revive spec (#82)
Browse files Browse the repository at this point in the history
* Fix cobra --affected - revive spec

* Bump version
  • Loading branch information
xjunior authored Aug 23, 2022
1 parent 094a097 commit ce89946
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions lib/cobra_commander/affected.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/cobra_commander/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CobraCommander
VERSION = "0.15.0"
VERSION = "0.15.1"
end
10 changes: 9 additions & 1 deletion spec/cobra_commander/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit ce89946

Please sign in to comment.