Class: GHWikiTools::Command
- Inherits:
-
Thor
- Object
- Thor
- GHWikiTools::Command
- Defined in:
- lib/ghwikitools/command.rb
Overview
Command is a class for making sub commands of ghwikitools.
Class Attribute Summary collapse
-
.test_mode ⇒ Object
Returns the value of attribute test_mode.
Instance Method Summary collapse
Class Attribute Details
.test_mode ⇒ Object
Returns the value of attribute test_mode.
5 6 7 |
# File 'lib/ghwikitools/command.rb', line 5 def test_mode @test_mode end |
Instance Method Details
#delete_snippet(name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ghwikitools/command.rb', line 16 def delete_snippet(name) if [:directory] puts "repositoy: %s" % [:directory] GHWikiTools.dir = [:directory] end GHWikiTools::Page.all.each do |page| if page.delete_snippet(name) puts 'deleted snippet "%s" in the page %s' % [name, page.name] end end end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ghwikitools/command.rb', line 29 def update if [:directory] puts "repositoy: %s" % [:directory] GHWikiTools.dir = [:directory] end GHWikiTools::Page.all.each do |page| if page.insert_header puts 'insert "Header" snippet metadata in the page "%s"' % page.wikiname end if page. puts 'insert "Footer" snippet metadata in the page "%s"' % page.wikiname end if page.update_snippets puts 'update snippets in the page "%s"' % page.wikiname end end end |