Sha256: 9b1bda99cbb796fc197f0599ec7433fd74bc0dd20f175e9fa607967922b2fc40

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# -*- encoding: UTF-8 -*-
require 'csd/application/default/base'

module CSD
  # This namespace holds all individual application Modules
  #
  module Application
  
    # This is the root class of all Applications
    #
    module Default
      
      def name
        self.to_s.demodulize.underscorize
      end
    
      def description
        about.description
      end
    
      def human
        about.human
      end
    
      def actions
        about.actions
      end
    
      def scopes(action)
        # TODO: about.scopes[:action]
        []
      end
    
      def options(action='')
        options_dir      = File.join(Path.applications, name, 'options')
        common_file      = File.join(options_dir, "common.rb")
        specific_file    = File.join(options_dir, "#{action}.rb")
        common_options   = File.file?(common_file) ? File.read(common_file) : ''
        specific_options = File.file?(specific_file) ? File.read(specific_file) : ''
        specific_options + common_options
      end
    
      protected
    
      def about
        about_file = File.join(Path.applications, name, 'about.yml')
        OpenStruct.new YAML.load_file(about_file)
      end
    
    end
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csd-0.1.7 lib/csd/application/default.rb
csd-0.1.6 lib/csd/application/default.rb