Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/ember_cli/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ def process_watcher
options.fetch(:watcher) { EmberCli.configuration.watcher }
end

def silent?
options.fetch(:silent) { false }
end

def ember_build(watch: false)
line = Cocaine::CommandLine.new(paths.ember, [
"build",
("--watch" if watch),
("--watcher :watcher" if process_watcher),
("--silent" if silent?),
"--environment :environment",
"--output-path :output_path",
].compact.join(" "))
Expand Down
23 changes: 23 additions & 0 deletions spec/lib/ember_cli/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@
end
end

context 'when configured not to be silent' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

it 'exludes the `--silent` flag' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

paths = build_paths
command = build_command(paths: paths)

expect(command.build).not_to match(/--silent/)

paths = build_paths
command = build_command(paths: paths, options: { silent: false })

expect(command.build).not_to match(/--silent/)
end
end

context 'when configured to be silent' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

it 'includes includes `--silent` flag' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

paths = build_paths
command = build_command(paths: paths, options: { silent: true })

expect(command.build).to match(/--silent/)
end
end

context "when configured to watch" do
it "includes the `--watch` flag" do
paths = build_paths
Expand Down