Module: Broadway
- Defined in:
- lib/broadway/api.rb,
lib/broadway/base.rb,
lib/broadway/page.rb,
lib/broadway/post.rb,
lib/broadway/site.rb,
lib/broadway/asset.rb,
lib/broadway/runner.rb,
lib/broadway/convertible.rb,
lib/broadway/static_file.rb,
lib/broadway/sinatra/helpers/text_helper.rb,
lib/broadway/sinatra/helpers/partial_helper.rb,
lib/broadway/sinatra/helpers/collection_helper.rb
Defined Under Namespace
Modules: API, Convertible, Helpers, Rails, Resource, Sinatra Classes: Asset, Page, Post, Runner, Site, StaticFile
Constant Summary collapse
- VERSION =
"0.0.3"
- DEFAULTS =
Default options. Overriden by values in _config.yml or command-line opts. (Strings rather symbols used for compatability with YAML)
{ :auto => false, :server => false, :server_port => 4000, :source => ".", :destination => "_site", :lsi => false, :pygments => false, :markdown => "maruku", :permalink => "pretty", :url_type => "relative", :url => "http://localhost:4567", :locales => "locales", :language => "en-US", :maruku => { :use_tex => false, :use_divs => false, :png_engine => "blahtex", :png_dir => "images/latex", :png_url => "/images/latex" }, :layouts => "_layouts", :posts_include => [".textile", ".markdown"], :theme_path => "themes", :theme_versions => ["main"] }
Class Method Summary collapse
- .build(options = {}) ⇒ Object
-
.configuration(override) ⇒ Object
Generate a Broadway configuration Hash by merging the default options with anything in _config.yml, and adding the given options on top
override
is a Hash of config directives. - .generate(options = {}) ⇒ Object
- .process(method, options = {}) ⇒ Object
Class Method Details
.build(options = {}) ⇒ Object
103 104 105 |
# File 'lib/broadway/base.rb', line 103 def self.build( = {}) self.process(:build, ) end |
.configuration(override) ⇒ Object
Generate a Broadway configuration Hash by merging the default options with anything in _config.yml, and adding the given options on top
+override+ is a Hash of config directives
Returns Hash
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/broadway/base.rb', line 80 def self.configuration(override) # _config.yml may override default source location, but until # then, we need to know where to look for _config.yml source = override[:source] || Broadway::DEFAULTS[:source] # Get configuration from <source>/_config.yml config_file = File.join(source, "_config.yml") begin config = YAML.load_file(config_file).recursive_symbolize_keys! raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash) $stdout.puts "Configuration from #{config_file}" rescue => err $stderr.puts "WARNING: Could not read configuration. Using defaults (and options)." $stderr.puts "\t" + err.to_s config = {} end # Merge DEFAULTS < _config.yml < override config = Broadway::DEFAULTS.deep_merge(config).merge(override) config end |
.generate(options = {}) ⇒ Object
107 108 109 |
# File 'lib/broadway/base.rb', line 107 def self.generate( = {}) self.process(:process, ) end |