Created
August 23, 2010 20:02
-
-
Save slawosz/546218 to your computer and use it in GitHub Desktop.
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
== Installation | |
require 'dir_dsl' | |
== Usage | |
Directory 'foo' in current directory, with subdirectory 'bar' and file 'baz' | |
Dir 'foo' do | |
dir 'bar' | |
file 'baz' | |
end | |
Directories can be nested infinietly, example below will create foo/foo_bar/foo_baz/foo_bar_baz: | |
Dir 'foo' do | |
dir 'foo_bar' do | |
dir 'foo_baz' do | |
dir 'foo_bar_baz' | |
end | |
end | |
end | |
Files can be created in any nested directories: | |
Dir 'foo' do | |
dir 'foo_bar' do | |
dir 'foo_baz' do | |
dir 'foo_bar_baz' | |
file 'bar_baz.file' | |
end | |
end | |
end | |
First directory can be created in any root directory: | |
Dir 'main', :in => '~/user_home' | |
File inside directory can be copies of other files: | |
file 'hosts', :copy => '/etc/hosts' | |
You can pass content of file explicity: | |
file 'hosts', '127.0.0.1 google.com' | |
For longer content you can use block and here document: | |
file 'hosts' do | |
<< EOF | |
127.0.0.1 google.com | |
127.0.0.1 my_awsome_app | |
127.0.0.1 localhost | |
EOF | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment