public
Description: Dependency Resolution Framework
Homepage: http://warningshot.lighthouseapp.com
Clone URL: git://github.com/coryodaniel/warningshot.git
coryodaniel (author)
Thu Feb 26 17:40:45 -0800 2009
commit  57c993689114a1ee04bdf558ec9f5607851e2ccf
tree    f9c34cc23f84172f67fbaf16c21fdb4d508566f3
parent  4bf02c372017d7458ed618f11a7c82c70c64e609
name age message
file .gitignore Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
file CHANGELOG Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
file CONTRIBUTORS Sat Nov 08 15:04:38 -0800 2008 Added ruby interface for WS to load only specif... [coryodaniel]
file LICENSE Sat Sep 20 19:58:32 -0700 2008 template files. [coryodaniel]
file README Thu Feb 05 19:55:50 -0800 2009 add log path to verbose output so its easier to... [Cory ODaniel]
file Rakefile Thu Nov 20 13:18:46 -0800 2008 Ability to register application types so warnin... [coryodaniel]
file TODO Sat Nov 08 15:04:38 -0800 2008 Added ruby interface for WS to load only specif... [coryodaniel]
directory bin/ Thu Feb 26 17:40:45 -0800 2009 exit status [coryodaniel]
directory images/ Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
directory lib/ Sun Feb 15 20:02:36 -0800 2009 filenotfound for configs expcetion [Cory ODaniel]
directory more/ Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
file resolver_spec_template.txt Fri Oct 17 18:08:01 -0700 2008 Removed some more docs Refactored File.join *st... [coryodaniel]
file resolver_template.txt Mon Jan 26 16:50:08 -0800 2009 * Resolver.branch takes a *params now * Added... [Cory ODaniel]
directory tasks/ Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
directory templates/ Mon Feb 02 19:52:45 -0800 2009 gem updates whitespace removal [Cory ODaniel]
directory test/ Thu Feb 05 19:32:09 -0800 2009 Config clones before use to preserve origian ar... [Cory ODaniel]
file warningshot.gemspec Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
file yardoc_template.txt Tue Jan 27 21:00:25 -0800 2009 Permission Resolver complete, note the notes on... [Cory ODaniel]
README
WarningShot Dependency Resolution Framework
 * Additional documentation @ http://github.com/coryodaniel/warningshot/wikis/

==== Note on RSpecs
  Currently the PermissionResolver RSpecs will probably fail that is because
  I am not sure what the best way is to write them in regards to users & groups
  that may or may not be on a remote machine.  I wrote the specs, and they work on
  my laptop (given that I have the groups/users) mentioned in the tests.
  See: ./test/spec/unit/resolvers/permission_resolver_spec.rb

==== Installing WarningShot
  WarningShot installs a little differently than most gems.  WarningShot itself has NO gem dependencies.  Gems become
  a dependency based on what Plugins/Resolvers you have installed.  By default WarningShot will not install any 
  additional gems.
  When using WarningShot if a gem is missing that is needed for a feature you are using you will receive a warning that 
  the gem
  is missing.  Optionally you can list and build all of warningshots dependencies from the command line.
  
  sudo gem install warningshot
  warningshot --list-deps (list all resolvers and their dependencies)
  warningshot --build-deps (install all gems that resolvers are dependent on)
  
  This method provides a minimalist WarningShot.  WarningShot's dependencies essentially change depending on what you 
  use
  it for.  Thats neat, not a lot of extra gems that you don't need installed being installed.
  

==== Terminology
  * Resolver
    A class that includes WarningShot::Resolver.  It should have the ability to test and resolve a type
    of dependency
      
  * Configuration
    The current configuration the WarningShot instance is running under.
    Configurations can be created with WarningShot::Config
    
  * Dependency
    A dependency is an entry in a recipe.  A dependency should consist of some means of identifying the
    dependency and optionally (but suggested) have some way of describing how it should be resolved.
      Ex: File Dependencies specify where the file should be located, and where WarningShot can download it if it
          does not exist
  
  * Test
    Tests are blocks that are registered in resolver.  They are a means of determining if a dependency is met.  Multiple 
    tests
    can be written, and may also have conditions as to whether they should run or not (a test could be environment
    specific for instance).  WarningShot will run the first test that it can based on any conditions provided.  
    Tests should always return a Boolean value
  
  * Resolution
    Resolutions are like tests in every way except instead of determine if a dependency has been met, they actually
    repair or resolve the dependency.  The gem resolver can install missing gems and the file resolver can download
    missing files
  
  * Recipes / Application Recipes
    A recipe is one or more dependency branches, the default file type is YAML, but that is configurable
    within warningshot.  A recipe can consist of one or more dependency branches.

    Example:  warningshot --templates will create a separate recipe for each branch supported.
    In the wiki 
    (http://github.com/coryodaniel/warningshot/wikis/example-merbnginx-app-recipe-once-aptquality-dependencies-are-suppo
    rted)
    is an example of a recipe that specifies dependencies of files, gems, apt binaries, etc.  Essentially all the 
    dependencies needed for
    the web server role.
    
  * DependencyTree
    After WarningShot locates all of the Machine Recipes they are parsed into the dependency tree.  The dependency
    tree is a large hash of branch names to raw hashes parsed from the Machine Recipes (YAML).
    
  * DependencyBranch
    A specific type of dependency within the dependency tree.  Examples include, :file, :gem, :directory
  
==== How it works
  * WarningShot - Factory class that creates and runs DependencyResolver
  * DependencyResolver - Locates Resolver classes, creates a dependency tree, and matches resolvers to resolution 
  branches
  * Resolver - Class that can be included to create plugins.  Composed of tests and resolutions that can determine if a 
  dependency was met, and if not, how to fix it
  
==== Command Line Examples
For a list of all flags do: warningshot --help

  - Details on Resolvers
    warningshot --version
    
  - Loading specific resolvers
    warningshot --oload=gem,file                         # => Only gem and file resolvers will be run
    warningshot --pload=directory,file                   # => Only loads specified gems and loads in specified order
    warningshot --resolvers=/path/to/my/resolvers/*.rb   # => Glob to find additional resolvers

  - Creating Recipe templates
    warningshot --templates=./path/to/where/you/want/templates
    
  - Warningshot's Dependencies
    warningshot --list-deps                              # => Depedencies per Resolver
    warningshot --build-deps                            # => Installs everything a full fledged warningshot needs


==== Ruby API

  - Configuring WarningShot
  config = WarningShot::Config.create do |c|
    c[:environment]  = 'development'
    c[:resolve]      = false
    c[:config_paths] = ['.'  / 'config' / 'warningshot']
    c[:application]  = '.'
    c[:log_path]     = '.' / 'log' / 'warningshot.log'
    c[:log_level]    = :debug
    c[:growl]        = false
    c[:verbose]      = true
    c[:]
  end
  
  - Interfacing with a DependencyResolver
  dependency_resolver = WarningShot.fire!(config)
  dependency_resolver.stats                       # => Hash of statistics
  
  dependency_resolver.resolvers                   # => Array of all executed resolvers
  
  dependency_resolver.resolvers.first.dependencies #=> Set of all loaded dependencies
  
  dependency_resolver.resolver.first.passed     # => Array of passed dependencies
  dependency_resolver.resolver.first.failed     # => Array of failed dependencies
  dependency_resolver.resolver.first.unresolved # => Array of unresolved dependencies
  dependency_resolver.resolver.first.resolved   # => Array of resolved dependencies
  
  - Callbacks
  WarningShot.before do 
    puts 'this would run before the DepenencyResolver was created in #fire!'
  end
  
  WarningShot.after do
    puts 'this would run after the DepenencyResolver was processed in #fire!'
  end
  
  WarningShot::AnyResolverYouWant.before :test do
    puts 'this would run before the #test! method on the chosen resolver'
  end
  
  WarningShot::AnotherFunResolver.after :test do
    puts 'this would run after the #test! method'
  end
  
  WarningShot::AnotherResolver.before :resolution do
    puts 'this would run before the #resolve! method'
  end
  
  WarningShot::AnotherResolver.after :resolution do
    puts 'this would run after the #resolve! method'
  end
  
==== Components
 * Ruby API
 * Resolvers
 * Config Files
 
 
==== Using Machine Recipes
 * Coming Soon

 
==== How the dependency tree works
 * Coming Soon


==== Extending WarningShot
 * Writing a Resolver (Coming Soon)
    * Kernel#require vs Resolver#add_dependency
 * Modifying Resolvers at run-time (Coming Soon)


==== Contributing
 * Source available @: 
    https://github.com/coryodaniel/warningshot/tree
 
 * Bug reports / feature requests @:
    http://warningshot.lighthouseapp.com/projects/17241-warningshot/overview
 
 * Online Documentation available @:
    http://github.com/coryodaniel/warningshot/wikis
    
 * RubyForge Project @:
    http://rubyforge.org/projects/warning-shot/
 
 * All modifications should also have applicable rpsecs
    http://rspec.info/
    
 * A dummy gem has been created for testing the GemResolver
    https://rubyforge.org/projects/ws-dummy/
    http://github.com/coryodaniel/ws-dummy/tree/master
    gem install ws-dummy
 
 * All code should be documented using YARD
    http://yard.rubyforge.org/
    A template is available file://./yardoc_template.txt
    Generate Yardoc with: yardoc --output-dir ./doc/yard --private --protected --readme README