readme.md in vfs-0.3.1 vs readme.md in vfs-0.3.2
- old
+ new
@@ -20,73 +20,79 @@
** all methods should have the same performance as native system calls, except for :move and :rename. Right now they are implemented
ASAP by using copy+destroy approach, will be fixed as soon as I'll have free time to do it.
## Installation
- $ gem install vfs
- $ gem install vos
+```bash
+$ gem install vfs
+$ gem install vos
+```
## Code samples:
- gem 'vfs' # Virtual File System
- require 'vfs'
- gem 'vos' # Virtual Operating System
- require 'vos'
+```ruby
+gem 'vfs' # Virtual File System
+require 'vfs'
+gem 'vos' # Virtual Operating System
+require 'vos'
- # Connections, let's deploy our 'cool_app' project from our local box to remote server
- server = Box.new('cool_app.com') # it will use id_rsa, or You can add {user: 'me', password: 'secret'}
- me = '~'.to_dir # handy shortcut for local FS
- deploy_dir = server['apps/cool_app']
- projects = me['projects']
+# Connections, let's deploy our 'cool_app' project from our local box to remote server
+server = Box.new('cool_app.com') # it will use id_rsa, or You can add {user: 'me', password: 'secret'}
+me = '~'.to_dir # handy shortcut for local FS
+deploy_dir = server['apps/cool_app']
+projects = me['projects']
- # Working with dirs, copying dir from any source to any destination (local/remote/custom_storage_type)
- projects['cool_app'].copy_to deploy_dir
+# Working with dirs, copying dir from any source to any destination (local/remote/custom_storage_type)
+projects['cool_app'].copy_to deploy_dir
- # Working with files
- dbc = deploy_dir.file('config/database.yml') # <= the 'config' dir not exist yet
- dbc.write("user: root\npassword: secret") # <= now the 'database.yml' and parent 'config' has been created
- dbc.content =~ /database/ # => false, we forgot to add the database
- dbc.append("\ndatabase: mysql") # let's do it
- dbc.update do |content| # and add host info
- content + "\nhost: cool_app.com "
- end
+# Working with files
+dbc = deploy_dir.file('config/database.yml') # <= the 'config' dir not exist yet
+dbc.write("user: root\npassword: secret") # <= now the 'database.yml' and parent 'config' has been created
+dbc.content =~ /database/ # => false, we forgot to add the database
+dbc.append("\ndatabase: mysql") # let's do it
- projects['cool_app/config/database.yml']. # or just overwrite it with our local dev version
- copy_to! dbc
-
- # there are also streaming support (read/write/append) with &block, please go to specs for details
+dbc.update do |content| # and add host info
+ content + "\nhost: cool_app.com "
+end
+projects['cool_app/config/database.yml']. # or just overwrite it with our local dev version
+ copy_to! dbc
+
+# there are also streaming support (read/write/append) with &block, please go to specs for details
- # Checks
- deploy_dir['config'].exist? # => true
- deploy_dir.dir('config').exist? # => true
- deploy_dir.file('config').exist? # => false
- deploy_dir['config'].dir? # => true
- deploy_dir['config'].file? # => false
+# Checks
+deploy_dir['config'].exist? # => true
+deploy_dir.dir('config').exist? # => true
+deploy_dir.file('config').exist? # => false
+deploy_dir['config'].dir? # => true
+deploy_dir['config'].file? # => false
- # Navigation
- config = deploy_dir['config']
- config.parent # => </apps/cool_app>
- config['../..'] # => </>
- config['../..'].dir? # => true
- deploy_dir.entries # => list of dirs and files, also support &block
- deploy_dir.files # => list of files, also support &block
- deploy_dir.dirs # => list of dirs, also support &block
+# Navigation
+config = deploy_dir['config']
+config.parent # => </apps/cool_app>
+config['../..'] # => </>
+config['../..'].dir? # => true
+deploy_dir.entries # => list of dirs and files, also support &block
+deploy_dir.files # => list of files, also support &block
+deploy_dir.dirs # => list of dirs, also support &block
+```
- # For more please go to specs (create/update/move/copy/destroy/...)
+For more please go to specs (create/update/move/copy/destroy/...)
## Integration with [Vos][vos] (Virtual Operating System)
- server['apps/cool_app'].bash 'rails production'
+```ruby
+server['apps/cool_app'].bash 'rails production'
+```
For more details please go to [Vos][vos] project page.
Or checkout configuration I use to control my production servers [My Cluster][my_cluster] in conjunction with small
configuration tool [Cluster Management][cluster_management].
\ No newline at end of file