Sha256: 0e1a43040d0f9ce0891b662c347ca9877592a216eb0aff128f6b9c5e51d2e17e

Contents?: true

Size: 1.66 KB

Versions: 10

Compression:

Stored size: 1.66 KB

Contents

module Rid
  # Rid Commands module defines the available Rid commands.
  # A Rid command is a commander command.
  # See http://github.com/visionmedia/commander for more information.
  #
  module Commands
    # Returns the version specified in VERSION file at project root.
    #
    def self.version
      versionfile = File.expand_path('../../../VERSION', __FILE__)
      File.read(versionfile) if File.file?(versionfile)
    end

    program :name, 'Rid: Rest in development.'
    program :version, version
    program :description, <<-STR
Rid is a toolkit to relax in web development.

    Based on CouchDB you get a distributed,
    high scaling web application infrastructure with Rid.
    
    Rid commands are distributed as RubyGems. Explore more Rid commands via
    'gem list --remote rid-'
    
    Type 'rid help command'
    to get information about each command.
    STR

    program :help, 'Author', 'Johannes Jörg Schmidt, TF <schmidt@netzmerk.com>'

    global_option '-q', '--quiet', 'Supress status output'

    global_option '-b BEHAVIOR', '--behavior BEHAVIOR', String, 'Can be skip, pretend and force'

    default_command :help

    # List all installed rid gems, which starts with rid-.
    #
    def self.gems
      Gem.path.
        map { |p| Dir[File.join(p, 'gems/rid-*')] }.
        flatten.
        map { |g| File.basename(g).sub /-(\d+\.)*(\d+)$/, '' }.
        uniq.
        sort
    end

    private

    # require rid gem and do not care if that fails.
    #
    def self.require_rid_gem(gem)
      begin
        require gem
      rescue LoadError
        return
      end
    end

    # actually load all rid gems
    gems.each { |g| require_rid_gem(g) }
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
rid-core-1.5.2 lib/rid/commands.rb
rid-core-1.5.1 lib/rid/commands.rb
rid-core-1.5.0 lib/rid/commands.rb
rid-core-1.4.0 lib/rid/commands.rb
rid-core-1.3.0 lib/rid/commands.rb
rid-core-1.2.0 lib/rid/commands.rb
rid-core-1.1.0 lib/rid/commands.rb
rid-core-1.0.3 lib/rid/commands.rb
rid-1.0.3 lib/rid/commands.rb
rid-1.0.2 lib/rid/commands.rb