Garlic plugin
Plugin details
Documentation
ruby script/plugin install git://github.com/ianwhite/garlic.git
Example
==============
To see garlic in action, download resources_controller, a rails plugin that uses garlic for CI.
git clone git://github.com/ianwhite/resources_controller
cd resources_controller
cp garlic_example.rb garlic.rb # you might like to look at this file and edit\
# it if you have local clones of rails and rspec
rake get_garlic
rake garlic:all
This will clone all the required git repos (done only once), set up the target railses (done once), then run the targets.
Notes:
==========
To run the specs again, you can do rake garlic:run
If you’ve made changes upstream, or want to check againts other upstream changes rake garlic:all
To configure the dependencies and targets, take a look at the top level Rakefile
resources_controller doesn’t work with 1.2.3, to test this try adding
target '1.2.3', :tag => 'v1.2.3'
in garlic.rb, then running
rake garlic:prepare rake garlic:run
and you’ll see that it fails against 1.2.3
Example config
=================
In case you don’t feel like downloading the above repo, here’s the config:
garlic do # default paths are 'garlic/work', and 'garlic/repos' work_path "my/work" repo_path "my/repos" repo 'rails', :url => 'git://github.com/rails/rails'#, :local => "~/dev/vendor/rails" repo 'rspec', :url => 'git://github.com/dchelimsky/rspec'#, :local => "~/dev/vendor/rspec" repo 'rspec-rails', :url => 'git://github.com/dchelimsky/rspec-rails'#, :local => "~/dev/vendor/rspec-rails" repo 'resources_controller', :path => '.' target 'edge' target '2.0-stable', :branch => 'origin/2-0-stable' target '2.0.2', :tag => 'v2.0.2' all_targets do prepare do plugin 'resources_controller', :clone => true plugin 'rspec' plugin('rspec-rails') { sh "script/generate rspec -f" } end run do cd("vendor/plugins/resources_controller") { sh "rake spec:rcov:verify" } end end end
Using it in your own app/plugin
=========================
To use garlic on one of your plugins/apps to this:
1. Add the following to your main Rakefile (at the bottom is ok)
# load up garlic if it's here if File.directory?(File.join(File.dirname(__FILE__), 'garlic')) require File.join(File.dirname(__FILE__), 'garlic/lib/garlic_tasks') require File.join(File.dirname(__FILE__), 'garlic') end
2. Edit your garlic.rb file to specify what should be done.
Here’s an example: you are garlicing a plugin called acts_as_vixen, and you want to run ‘rake test’ in that plugin, against the 1.2.x and 2.0.x stable branches of rails, ad 1.2.3.
Also assuming that you have a local clone of rails in ~/clones/rails
garlic do repo 'rails', :url => 'git://github.com/rails/rails', :local => '~/clones/rails' repo 'acts_as_vixen', :url => '.' target '1.2.3', :tag => 'v1.2.3' target '1.2-stable', :branch => 'origin/1-2-stable' target '2.0-stable', :branch => 'origin/2-0-stable' all_targets do prepare do plugin 'acts_as_vixen' end run do cd "vendor/plugins/acts_as_vixen" do sh "rake test" end end end end
3. Get garlic:
git clone git://github.com/ianwhite/garlic.git garlic
(and ignore it in your repo)
echo "garlic/*" >> .gitignore
4. Run it:
rake garlic:all
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 7 months ago

