Module: Yodel
- Defined in:
- lib/yodel/version.rb,
lib/yodel/config/yodel.rb,
lib/yodel/mime_types/yodel.rb,
lib/yodel/application/yodel.rb
Constant Summary collapse
- VERSION =
'0.0.7'
- MODELS_DIRECTORY_NAME =
'models'
- PUBLIC_DIRECTORY_NAME =
'public'
- LAYOUTS_DIRECTORY_NAME =
'layouts'
- PARTIALS_DIRECTORY_NAME =
'partials'
- MIGRATIONS_DIRECTORY_NAME =
'migrations'
- ATTACHMENTS_DIRECTORY_NAME =
'attachments'
- EXTENSION_LIB_DIRECTORY_NAME =
'lib'
- YODEL_MIGRATIONS_DIRECTORY_NAME =
'yodel'
- EXTENSION_MIGRATIONS_DIRECTORY_NAME =
'extensions'
- SITE_MIGRATIONS_DIRECTORY_NAME =
'site'
- SITE_YML_FILE_NAME =
'site.yml'
Class Method Summary collapse
- .config ⇒ Object
- .db ⇒ Object
- .env ⇒ Object
- .extensions ⇒ Object
- .load_extensions ⇒ Object
- .mime_type(name, &block) ⇒ Object
- .mime_types(&block) ⇒ Object
Class Method Details
.config ⇒ Object
14 15 16 |
# File 'lib/yodel/config/yodel.rb', line 14 def self.config @config ||= YodelConfig.new end |
.db ⇒ Object
2 3 4 |
# File 'lib/yodel/application/yodel.rb', line 2 def self.db @db ||= Mongo::Connection.new(Yodel.config.database_hostname, Yodel.config.database_port).db(Yodel.config.database) end |
.env ⇒ Object
18 19 20 |
# File 'lib/yodel/config/yodel.rb', line 18 def self.env @env ||= Environment.new end |
.extensions ⇒ Object
6 7 8 |
# File 'lib/yodel/application/yodel.rb', line 6 def self.extensions @extensions ||= {} end |
.load_extensions ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yodel/application/yodel.rb', line 10 def self.load_extensions if Yodel.config.extensions_folder Dir[File.join(Yodel.config.extensions_folder, '/*')].each do |path| next unless File.directory?(path) && File.basename(path).start_with?('yodel_') extension = FolderExtension.new(path) extension.load! end else # find the latest version of each yodel extension latest_gem_version = {} Gem::Specification.find_all do |gem| next unless gem.name.start_with?('yodel_') if !latest_gem_version.key?(gem.name) || gem.version > latest_gem_version[gem.name].version latest_gem_version[gem.name] = gem end end # only load the latest versions latest_gem_version.each_value do |gem| extension = GemExtension.new(gem) extension.load! end end end |
.mime_type(name, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/yodel/mime_types/yodel.rb', line 10 def self.mime_type(name, &block) mime_type = MimeType.new(name) mime_type.instance_eval &block mime_types << mime_type end |
.mime_types(&block) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/yodel/mime_types/yodel.rb', line 2 def self.mime_types(&block) if block_given? instance_eval &block else @mime_type_set ||= MimeTypeSet.new end end |