Skip to content

Commit ce5db79

Browse files
krishandleyseanpdoyle
authored andcommitted
Ensure bower executable exists on $PATH
Adds coverage for missing `bower` executable. To deal with a missing `bower` executable, ensure the `path` is not `nil` before turning into a `Pathname`.
1 parent f510fe8 commit ce5db79

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/ember_cli/path_set.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def bower
6565
bower_path = app_options.fetch(:bower_path) { which("bower") }
6666

6767
bower_path.tap do |path|
68-
unless Pathname(path).executable?
68+
unless Pathname(path.to_s).executable?
6969
fail DependencyError.new <<-MSG.strip_heredoc
7070
Bower is required by EmberCLI
7171

spec/lib/ember_cli/path_set_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@
114114

115115
expect(path_set.bower).to eq fake_bower
116116
end
117+
118+
context "when it is missing from the $PATH" do
119+
it "raises a helpful exception" do
120+
stub_which(bower: nil)
121+
122+
path_set = build_path_set
123+
124+
expect { path_set.bower }.
125+
to raise_error(EmberCli::DependencyError, /bower is required/i)
126+
end
127+
end
117128
end
118129

119130
describe "#npm" do

0 commit comments

Comments
 (0)