-
-
Save tamouse/1f73c79b5e4675e498b7 to your computer and use it in GitHub Desktop.
reading a file from inside a rake task
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
$ be rake read_file | |
"---\nstuff: this is some stuff\n and:\n - this\n - is\n - some\n - nonesense\nooerr: Hi, Mate!\n" | |
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
--- | |
stuff: this is some stuff | |
and: | |
- this | |
- is | |
- some | |
- nonesense | |
ooerr: Hi, Mate! |
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
desc "read a file inside rake" | |
task :read_file do |t| | |
path = File.join(Rails.root,"db","data.yml") | |
puts File.open(path).read.inspect | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment