Sha256: d01593f2b34e570a344464dfae20cd410242b5f1abcfee665872bb7c74c38ae6
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
#:nodoc: module Zen #:nodoc: module Package ## # Base class used to store the data about packages such as the name, directory, etc. # # @author Yorick Peterse # @since 0.2.5 # class Base include ::Zen::Validation # The name of the package attr_accessor :name # The author of the package attr_accessor :author # A small description about the package attr_accessor :about # The URL to the website of the package attr_accessor :url # The root directory of the package attr_accessor :directory # Array containing the navigation items for the package attr_accessor :menu # Path to the directory containing all migrations attr_accessor :migration_dir # Array containing all controllers for the package. These classes will be used # by the ACL system. attr_accessor :controllers ## # Validates all the attributes. # # @author Yorick Peterse # @since 0.2.5 # def validate validates_presence([:name, :author, :about, :directory, :controllers]) validates_format(:name, /[a-z0-9_\-]+/) validates_filepath(:directory) if !migration_dir.nil? validates_filepath(:migration_dir) end # Check if the package hasn't been registered yet if ::Zen::Package::Registered.key?(name.to_sym) raise(::Zen::ValidationError, "The package #{name} already exists.") end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
zen-0.2.7 | lib/zen/package/base.rb |
zen-0.2.6.1 | lib/zen/package/base.rb |
zen-0.2.6 | lib/zen/package/base.rb |
zen-0.2.5 | lib/zen/package/base.rb |