Created
March 11, 2016 05:41
-
-
Save chewmanfoo/49d3872bbbfcb1294326 to your computer and use it in GitHub Desktop.
ruby file write doesn't work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tmpdir' | |
require 'fileutils' | |
_role="test" | |
Dir.mktmpdir do |dir| | |
git_dir="#{dir}" | |
`git clone http://10.23.227.82/control/corpit-env_control.git #{dir}` | |
File.open("#{dir}/Puppetfile.temp", "w") do |out_file| | |
File.foreach("#{dir}/Puppetfile") do |line| | |
out_file.puts line unless (line.include? "profile_#{_role}") | |
end | |
end | |
FileUtils.mv("#{dir}/Puppetfile", "#{dir}/Puppetfile.temp") | |
`ls #{dir}` | |
`cat #{dir}/Puppetfile.temp` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment