Skip to content

Commit

Permalink
add cli option to gen a sample file
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Jun 14, 2011
1 parent 6a48d48 commit 7e154af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/cm
Expand Up @@ -19,6 +19,16 @@ command :doc do |c|
end end
end end


desc 'Generate Docurium config file template'
long_desc 'Generate Docurium config file template'
command :gen do |c|
c.action do |global_options,options,args|
file = args.first || 'api.docurium'
Docurium::CLI.gen(file)
end
end


pre { |global,command,options,args| true } pre { |global,command,options,args| true }


post { |global,command,options,args| true } post { |global,command,options,args| true }
Expand Down
17 changes: 17 additions & 0 deletions lib/docurium/cli.rb
Expand Up @@ -6,5 +6,22 @@ def self.doc(idir, options)
doc.generate_docs doc.generate_docs
end end


def self.gen(file)

temp = <<-TEMPLATE
{
"name": "project",
"github": "user/project",
"input": "include/lib",
"prefix": "lib_",
"output": "docs"
}
TEMPLATE
puts "Writing to #{file}"
File.open(file, 'w+') do |f|
f.write(temp)
end
end

end end
end end

0 comments on commit 7e154af

Please sign in to comment.