Class: Documentator::Runner
- Inherits:
-
Boson::Runner
- Object
- Boson::Runner
- Documentator::Runner
- Includes:
- FileUtils
- Defined in:
- lib/documentator.rb
Instance Method Summary collapse
Instance Method Details
#bootstrap ⇒ Object
11 12 13 14 15 16 |
# File 'lib/documentator.rb', line 11 def bootstrap create_default_dir! Dir[bootstrap_path.join("*")].each do |file| cp(file, doc_path).tap { puts "✓ #{File.basename(file, File.extname(file))} created!" } end end |
#import(locale, *templates) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/documentator.rb', line 19 def import(locale, *templates) templates.each do |template| begin unless File.exists?(doc_path) puts "You should run `bootstrap` before trying to import documentation" exit 1 end cp(templates_path.join(locale, "#{template}.md"), doc_path) puts "✓ File #{template} copied." rescue Errno::ENOENT puts "x File #{template} not found." end end end |
#list(locale = nil) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/documentator.rb', line 35 def list(locale = nil) Dir[templates_path.join(locale || "*")].each do |locale| puts "* #{File.basename(locale)}" Dir[templates_path.join(locale, "*")].each do |file| puts " * #{File.basename(file, File.extname(file))}" end end end |