Manifest/Digest Generator and Management Tool
Lets try a simple example. Lets say we have the following folder structure, using ls -R we see:
from https://github.com/rubyworks/mast
相关帖子:http://briteming.blogspot.co.uk/2014/04/rubysetup.html
DESCRIPTION
Mast is a commandline utility for generating MANIFEST and DIGEST lists. It can be useful in conjunction with packaging tools, or as a stand-alone tool for monitoring file changes.FEATURES
-
Intuitive command-line interface –simply specify what to include.
-
Self-referential header makes updating manifests easy.
-
Checksum digests can highlight file changes.
USAGE
Mast makes the process of generating manifests very easy, and even allows manifests to be updated without repeating inclusion/exclusion criteria by storing the command parameters in a comment line at the top of the generated output.Lets try a simple example. Lets say we have the following folder structure, using ls -R we see:
$ ls -R .: demo_rtar mint ./demo_rtar: Lorem_ipsum.txt lib meta web ./demo_rtar/lib: demo_rock ./demo_rtar/lib/demo_rock: tryme.rb ./demo_rtar/meta: data ./demo_rtar/web: index.html rocklobster.jpg ./mint: loremipsum.txt tryme.rbNow lets look at the same folder via 'mast'.
$ mast #!mast demo_rtar demo_rtar/Lorem_ipsum.txt demo_rtar/lib demo_rtar/lib/demo_rock demo_rtar/lib/demo_rock/tryme.rb demo_rtar/meta demo_rtar/meta/data demo_rtar/web demo_rtar/web/index.html demo_rtar/web/rocklobster.jpg mint mint/loremipsum.txt mint/tryme.rbAs you can see it has listed all the files contained in the current folder. Notice also the first line is empty except for the '#' character. This is a standard shell comment mark. We can specify special criteria to the mast command and these options will be reflected on this line. For example, lets say the mint directory is extraneous and we do not want it included in the list of files.
$ mast -x mint #!mast -x mint demo_rtar demo_rtar/Lorem_ipsum.txt demo_rtar/lib demo_rtar/lib/demo_rock demo_rtar/lib/demo_rock/tryme.rb demo_rtar/meta demo_rtar/meta/data demo_rtar/web demo_rtar/web/index.html demo_rtar/web/rocklobster.jpgSo you can see how the commandline options carry over to the top comment line of the ouput. The advantage of this is that if you save the output to a standard location, i.e. a file named MANIFEST or meta/manifest with an optional `.txt` prefix (case insensitive), then you can automaitcally update the file by calling mast --update.
$ mast -x mint > MANIFEST $ mast --update MANIFEST updated.You can also add a checksum to the file list to create a DIGEST.
$ mast -x mint -g sha1Mast also provides options for ignoring files based on their basename, as well as omitting default excludes and ignores so that all files are lists. Use the –help option for more details.
HOW TO INSTALL
To install with RubyGems simply open a console and type:$ gem install mastFor a traditional site installation use Ruby Setup (gem install setup).
$ tar -xvzf mast-1.3.0.tar.gz $ cd mast-1.3.0.tar.gz $ sudo setup.rbSee Ruby Setup for more information.
from https://github.com/rubyworks/mast
相关帖子:http://briteming.blogspot.co.uk/2014/04/rubysetup.html