Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e900e74342 | ||
|
|
62ae3f162d | ||
|
|
099d26f33c | ||
|
|
89562c584a |
No files matched your search
@@ -564,6 +564,16 @@ http://www.rubydoc.info/github/holtrop/rscons/master.
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
### v1.14.0
|
||||||
|
|
||||||
|
#### New Features
|
||||||
|
|
||||||
|
- #45 - Add Rscons::VarSet#values_at
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
- #44 - Environment#print_builder_run_message should support string commands
|
||||||
|
|
||||||
### v1.13.0
|
### v1.13.0
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.echo = :command
|
||||||
|
env.Install("inst.exe", "install.rb")
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class MyBuilder < Rscons::Builder
|
||||||
|
def run(options)
|
||||||
|
env, target = options.values_at(:env, :target)
|
||||||
|
env.print_builder_run_message("MyBuilder #{target}", "MyBuilder #{target} command")
|
||||||
|
target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.echo = :command
|
||||||
|
env.add_builder(MyBuilder.new)
|
||||||
|
env.MyBuilder("foo")
|
||||||
|
end
|
||||||
@@ -20,8 +20,7 @@ module Rscons
|
|||||||
Ansi.write($stderr, :red, "Error: `#{target}' already exists and is not a directory", :reset, "\n")
|
Ansi.write($stderr, :red, "Error: `#{target}' already exists and is not a directory", :reset, "\n")
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
desc = "Directory #{target}"
|
env.print_builder_run_message("Directory #{target}", nil)
|
||||||
env.print_builder_run_message(desc, desc)
|
|
||||||
cache.mkdir_p(target)
|
cache.mkdir_p(target)
|
||||||
target
|
target
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ module Rscons
|
|||||||
# Check the cache and copy if necessary
|
# Check the cache and copy if necessary
|
||||||
unless cache.up_to_date?(dest, :Copy, [src], env)
|
unless cache.up_to_date?(dest, :Copy, [src], env)
|
||||||
unless printed_message
|
unless printed_message
|
||||||
desc = "#{name} #{target}"
|
env.print_builder_run_message("#{name} #{target}", nil)
|
||||||
env.print_builder_run_message(desc, desc)
|
|
||||||
printed_message = true
|
printed_message = true
|
||||||
end
|
end
|
||||||
cache.mkdir_p(File.dirname(dest))
|
cache.mkdir_p(File.dirname(dest))
|
||||||
|
|||||||
@@ -885,7 +885,13 @@ module Rscons
|
|||||||
def print_builder_run_message(short_description, command)
|
def print_builder_run_message(short_description, command)
|
||||||
case @echo
|
case @echo
|
||||||
when :command
|
when :command
|
||||||
message = command_to_s(command) if command
|
if command.is_a?(Array)
|
||||||
|
message = command_to_s(command)
|
||||||
|
elsif command.is_a?(String)
|
||||||
|
message = command
|
||||||
|
elsif short_description.is_a?(String)
|
||||||
|
message = short_description
|
||||||
|
end
|
||||||
when :short
|
when :short
|
||||||
message = short_description if short_description
|
message = short_description if short_description
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -143,6 +143,19 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Return an array containing the values associated with the given keys.
|
||||||
|
#
|
||||||
|
# @param keys [Array<String, Symbol>]
|
||||||
|
# Keys to look up in the VarSet.
|
||||||
|
#
|
||||||
|
# @return [Array]
|
||||||
|
# An array containing the values associated with the given keys.
|
||||||
|
def values_at(*keys)
|
||||||
|
keys.map do |key|
|
||||||
|
self[key]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Move all VarSet variables into the copy-on-access list.
|
# Move all VarSet variables into the copy-on-access list.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# gem version
|
# gem version
|
||||||
VERSION = "1.13.0"
|
VERSION = "1.14.0"
|
||||||
end
|
end
|
||||||
@@ -769,6 +769,22 @@ EOF
|
|||||||
expect(lines(result.stdout)).to eq ["165"]
|
expect(lines(result.stdout)).to eq ["165"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "prints a builder's short description with 'command' echo mode if there is no command" do
|
||||||
|
test_dir("build_dir")
|
||||||
|
|
||||||
|
result = run_test(rsconsfile: "echo_command_ruby_builder.rb")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(lines(result.stdout)).to eq ["Install inst.exe"]
|
||||||
|
end
|
||||||
|
|
||||||
|
it "supports a string for a builder's echoed 'command' with Environment#print_builder_run_message" do
|
||||||
|
test_dir("build_dir")
|
||||||
|
|
||||||
|
result = run_test(rsconsfile: "echo_command_string.rb")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(lines(result.stdout)).to eq ["MyBuilder foo command"]
|
||||||
|
end
|
||||||
|
|
||||||
context "colored output" do
|
context "colored output" do
|
||||||
it "does not output in color with --color=off" do
|
it "does not output in color with --color=off" do
|
||||||
test_dir("simple")
|
test_dir("simple")
|
||||||
|
|||||||
@@ -199,5 +199,14 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#values_at" do
|
||||||
|
it "returns an array of the values associated with the given keys" do
|
||||||
|
v = VarSet.new({"fuz" => "a string", "foo" => 42, "bar" => :baz,
|
||||||
|
"qax" => [3, 6], "qux" => {a: :b}})
|
||||||
|
expect(v.values_at).to eq []
|
||||||
|
expect(v.values_at(*%w[fuz qux qax])).to eq ["a string", {a: :b}, [3, 6]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user