lib/calamum/runner.rb in calamum-1.1.0 vs lib/calamum/runner.rb in calamum-1.2.0
- old
+ new
@@ -47,27 +47,27 @@
:short => '-v',
:long => '--version',
:description => 'Show version number',
:proc => lambda { |x| puts Calamum::VERSION },
:exit => 0
-
+
option :sort,
:short => "-s",
:long => "--sort",
:description => "Sort the resources alphabetically",
:boolean => true,
:default => false
-
+
# Parses command line options and generates API documentation.
# See samples for details how to define meta-data for your API.
def run
parse_options
Calamum::Config.apply(config)
@definition = Calamum::DocParser.new(load_source)
@definition.load_resources
Calamum::DocGenerator.init_base_dir
- process_index
+ process_index
process_pages if config[:template] == 'twitter'
rescue => ex
puts_error ex.message
end
@@ -80,11 +80,11 @@
YAML.load(File.open(config[:source]))
else
raise 'unknown source file extension'
end
end
-
+
# Bind values to index page and save it.
def process_index
bindings = {
:url => @definition.get_url,
:name => @definition.get_name,
@@ -106,10 +106,10 @@
page = Calamum::DocGenerator.new(:view)
@definition.resources.each do |methods|
methods[1].each do |resource|
bindings.merge!(:resource => resource)
- filename = "#{resource.object_id}.html"
+ filename = "#{resource.slug}.html"
page.save_template(filename, bindings)
end
end
end