Sha256: 87ae5c6724dce6286302958026ef51e583affd4a3bcb7cfd1d71249bf7ef1d4b

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

require 'rubygems'
require 'bivouac/template'
require 'fileutils'
require File.dirname($0) + '/../config/environment.rb'

BASE_URL = "http://bivouac.rubyforge.org/svn/trunk/plugins/"

module Bivouac
  class Plugin
    def initialize( argv )
      # Command (install, list, ...)
      @command = argv.shift
      
      # Plugin arguments.
      # Example :
      #   script/plugin install roo_s_tent will_paginate
      # @script_arguments = ['roo_s_tent', 'will_paginate']
      @script_arguments = argv.dup
      
      # Application environment
      @app = Bivouac::Environment.new( )
      
      # ...
    end
    
    def run
      send( @command.to_sym )
    end
    
    private
    
    def install
      FileUtils::cd( File.dirname($0) + '/../plugins' )
      
      r = system "svn", "co", "#{BASE_URL}#{@script_arguments}"
      if r == false
        raise $?
      end
    end
    
    def list
      puts "Not yet implemented!"
    end
  end
end

Bivouac::Plugin.new( ARGV ).run( )

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bivouac-0.1.4 lib/bivouac/commands/plugin.rb
bivouac-0.1.5 lib/bivouac/commands/plugin.rb
bivouac-0.1.6 lib/bivouac/commands/plugin.rb