class WikiTipsPost::HelperCommand
Public Instance Methods
help()
click to toggle source
# File lib/wiki_tips_post/helper_command.rb, line 9 def help if name = input[:command] if cmd = @@commands[name.gsub("-", "_").to_sym] Mothership::Help.command_help(cmd) else unknown_command(name) end else Mothership::Help.basic_help(@@commands, @@global) end end
post()
click to toggle source
# File lib/wiki_tips_post/helper_command.rb, line 26 def post if input[:file] tip_content = File.read File.expand_path(input[:file]) else tip_content = input[:tip] end tag_array = input[:tags].split(',') @wikiposter = WikiPostHelper.new( :title => input[:title], :tips => tip_content, :tags => tag_array, ) puts "\ncloning repo..." @wikiposter.prepare_repo puts "\ncreating post..." @wikiposter.create_post puts "\npushing repo..." push_repo_success = @wikiposter.push_to_repo if push_repo_success puts "\nremoving temporary clone of repo..." @wikiposter.delete_local_repo_clone puts "\nsuccessfully added tip!" else puts "\npush was NOT successful" exit 1 end end