add Copy builder as a copy of Install

This commit is contained in:
Josh Holtrop 2015-02-07 09:57:44 -05:00
parent f678803a5d
commit 4eedea2563
3 changed files with 23 additions and 1 deletions

View File

@ -22,8 +22,9 @@ module Rscons
# Names of the default builders which will be added to all newly created # Names of the default builders which will be added to all newly created
# {Environment} objects. # {Environment} objects.
DEFAULT_BUILDERS = [ DEFAULT_BUILDERS = [
:Command,
:CFile, :CFile,
:Command,
:Copy,
:Directory, :Directory,
:Disassemble, :Disassemble,
:Install, :Install,

View File

@ -54,6 +54,10 @@ module Rscons
target if (target_is_dir ? Dir.exists?(target) : File.exists?(target)) target if (target_is_dir ? Dir.exists?(target) : File.exists?(target))
end end
end end
class Copy < Install; end
end end
end end

View File

@ -859,6 +859,23 @@ EOF
expect(lines).to eq(["Install inst.exe"]) expect(lines).to eq(["Install inst.exe"])
end end
it "operates the same as a Copy builder" do
env = base_env.clone do |env|
lines
env.Copy("inst.exe", "simple.exe")
end
expect(lines).to eq(["Copy inst.exe"])
env.Copy("inst.exe", "simple.exe")
env.process
expect(lines).to eq([])
expect(File.exists?("inst.exe")).to be_truthy
expect(File.read("inst.exe", mode: "rb")).to eq(File.read("simple.exe", mode: "rb"))
FileUtils.rm("inst.exe")
env.Copy("inst.exe", "simple.exe")
env.process
expect(lines).to eq(["Copy inst.exe"])
end
it "copies a file to the target directory name" do it "copies a file to the target directory name" do
env = base_env.clone do |env| env = base_env.clone do |env|
lines lines