allow overriding Command builder short description with CMD_DESC variable -- close #22

This commit is contained in:
josh committed 2015-01-24 09:40:07 -05:00
1 parent 897d31ebe0
commit 02aff35222
3 files changed
+10 -5

No files matched your search

+3 -1
View File
@@ -252,7 +252,8 @@ you can use the `exclude_builders` key to the Environment constructor.
env.Command(target, sources, "CMD" => command) env.Command(target, sources, "CMD" => command)
# Example # Example
env.Command("docs.html", "docs.md", env.Command("docs.html", "docs.md",
"CMD" => ["pandoc", "-fmarkdown", "-thtml", "-o${_TARGET}", "${_SOURCES}"]) "CMD" => ["pandoc", "-fmarkdown", "-thtml", "-o${_TARGET}", "${_SOURCES}"],
"CMD_DESC" => "PANDOC")
``` ```
The command builder executes a user-defined command in order to produce the The command builder executes a user-defined command in order to produce the
@@ -389,6 +390,7 @@ http://rubydoc.info/github/holtrop/rscons/frames.
- rework Preprocess builder to consider deep dependencies - rework Preprocess builder to consider deep dependencies
- remove ${CFLAGS} from default CPP_CMD - remove ${CFLAGS} from default CPP_CMD
- fix variable references that expand to arrays in build target sources - fix variable references that expand to arrays in build target sources
- allow overriding Command builder short description with CMD_DESC variable
### v1.8.1 ### v1.8.1
+2 -1
View File
@@ -25,7 +25,8 @@ module Rscons
"_SOURCES" => sources, "_SOURCES" => sources,
}) })
command = env.build_command("${CMD}", vars) command = env.build_command("${CMD}", vars)
standard_build("CMD #{target}", target, command, sources, env, cache) cmd_desc = vars["CMD_DESC"] || "cmd_desc"
standard_build("#{cmd_desc} #{target}", target, command, sources, env, cache)
end end
end end
end end
+5 -3
View File
@@ -1,16 +1,18 @@
module Rscons module Rscons
module Builders module Builders
describe Command do describe Command do
let(:command) { ['pandoc', '-fmarkdown', '-thtml', '-o${_TARGET}', '${_SOURCES}'] } let(:command) { ['pandoc', '-fmarkdown', '-thtml', '-o${_TARGET}', '${_SOURCES}'] }
let(:env) {Environment.new} let(:env) {Environment.new}
subject {Command.new} subject {Command.new}
it "invokes the command to build the target" do it "invokes the command to build the target" do
expected_cmd = ['pandoc', '-fmarkdown', '-thtml', '-ofoo.html', 'foo.md'] expected_cmd = ['pandoc', '-fmarkdown', '-thtml', '-ofoo.html', 'foo.md']
expect(subject).to receive(:standard_build).with("CMD foo.html", "foo.html", expected_cmd, ["foo.md"], env, :cache) expect(subject).to receive(:standard_build).with("PANDOC foo.html", "foo.html", expected_cmd, ["foo.md"], env, :cache)
subject.run("foo.html", ["foo.md"], :cache, env, {'CMD' => command}) subject.run("foo.html", ["foo.md"], :cache, env,
"CMD" => command, "CMD_DESC" => "PANDOC")
end end
end end
end end
end end