Custom automation for installing/uninstalling/upgrading your local machine environment
- Mac OS X
Nothing! Well thats not entirely true... the dependencies are already available by default on OS X
- Ruby >= 1.8.7
- Bash >= 3.2
- Create a
Yuyifile
file in your home folder (see below for examples)
If you are running yuyi on a brand new machine, you will need to run sudo to install Yuyi to the system installed ruby
sudo gem install yuyi
Other you can just install it normally...
gem install yuyi
sources:
local: ~/Documents/Rolls
yuyi: https://github.com/brewster1134/Yuyi-Rolls.git
rolls:
google_chrome:
ruby:
versions: ['2.0.0-p353']
Make sure to include a colon (:) at the end of each roll name.
If a roll accepts arguments, indent the key/value pairs below the roll name. You will be prompted with roll options when Yuyi runs, and the opportunity to change them before anything is installed.
Then just run yuyi
Use yuyi to install development dependencies
yuyi https://raw.githubusercontent.com/brewster1134/Yuyi/master/Yuyifile
bundle install
// run guard to watch the source files and automatically run tests when you make changes
bundle exec rake yuyi
// run rspec tests on the yuyi library
bundle exec rake yuyi:test
// run rspec tests on the rolls specified in a given menu
bundle exec rake yuyi:test:rolls
// run rspec tests on the library and the rolld
bundle exec rake yuyi:test:all
< Yuyu::Roll
The roll class needs to inherit from Yuyi::Rollinstall
A block to install a rolluninstall
A block to uninstall a rollupgrade
A block to upgrade a rollinstalled?
A block to tests if your roll is already installed or not
dependencies
Declare dependencies (supports multiple arguments) that your roll depends onoptions
A hash of options (and a nested hash of option meta data * see example below *)
title
Returns a string of the roll title.options
Returns the roll options.run
This will run a system command.command
A string of the command you wish to runverbose
If true, will show formatted output & errors. This is enabled when running yuyi with the-V
or--VERBOSE
flag
command?
Returns true or false if a command succeeds or fails. Good for using in theinstalled?
blockwrite_to_file
Will add lines of text to a file. Good for using in theinstall
block. Accepts multiple string arguments to be written as separate lines.delete_from_file
Will remove lines of text to a file. Good for using in theuninstall
block. Accepts multiple string arguments to be written as separate lines.
class MyRoll < Yuyi::Roll
options({
:version => {
:description => 'The specific version you would like to install',
:example => '1.0', # optional
:default => '2.0', # optional
:required => true # optional - shows option in red
}
})
dependencies :homebrew, :foo
install do
dependencies :hombrew_cask if options[:version] == '2.0' # add dependencies conditionally
run 'brew install my_roll', :verbose => true
write_to_file '~/.bash_profile', "# #{title}"
end
uninstall do
run 'brew uninstall my_roll'
delete_from_file '~/.bash_profile', "# #{title}"
end
upgrade do
run 'brew upgrade my_roll'
end
installed? do
# simply check for a command
command? 'brew'
# or check the output of a command
run('brew list') =~ /myroll/
end
end