lib/calamum/runner.rb in calamum-1.2.0 vs lib/calamum/runner.rb in calamum-1.2.1
- old
+ new
@@ -64,11 +64,17 @@
Calamum::Config.apply(config)
@definition = Calamum::DocParser.new(load_source)
@definition.load_resources
Calamum::DocGenerator.init_base_dir
process_index
- process_pages if config[:template] == 'twitter'
+
+ if config[:template] == 'twitter'
+ process_pages
+ process_section("overview", @definition.get_description)
+ process_section("authentication", @definition.get_authentication)
+ process_errors
+ end
rescue => ex
puts_error ex.message
end
# Open and load the source file of api definition
@@ -93,9 +99,31 @@
:version => @definition.get_version
}
page = Calamum::DocGenerator.new(:index)
page.save_template('index.html', bindings)
+ end
+
+ # Bind values to overview and authentication pages and save them.
+ def process_section(section, content)
+ bindings = {
+ :section => section,
+ :name => @definition.get_name,
+ :version => @definition.get_version,
+ :description => content,
+ }
+ page = Calamum::DocGenerator.new(:section)
+ page.save_template("#{section}.html", bindings)
+ end
+
+ def process_errors
+ bindings = {
+ :name => @definition.get_name,
+ :version => @definition.get_version,
+ :errors => @definition.get_errors,
+ }
+ page = Calamum::DocGenerator.new(:errors)
+ page.save_template("errors.html", bindings)
end
# Bind values to view pages and save them.
def process_pages
bindings = {