# Encoding: UTF-8

[{beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby -wKU\n\nSUPPORT = ENV['TM_SUPPORT_PATH']\nCOMP_XML = ENV['TM_BUNDLE_PATH']+\"/support/data/ant_completions.xml\"\n\nrequire \"rexml/document\"\nrequire SUPPORT + '/lib/escape'\nrequire SUPPORT + '/lib/exit_codes'\nrequire SUPPORT + '/lib/osx/plist'\n\nword = STDIN.read.strip\nTextMate.exit_show_tool_tip(\"Please select a term to complete.\") if word.empty?\n\nsearch_results = [];\nant_doc = REXML::Document.new File.new(COMP_XML)\nant_doc.elements.each( \"completion_list/*\" ) do |tag|\n\n    n = tag.local_name\n    \n    if n[/^\#{word}/i]\n        \n        snip_num = 1;\n        tag.attributes.each do |name, value| \n            tag.attributes[name] = '${' + snip_num.to_s + ':' + value + '}'\n            snip_num = snip_num + 1\n        end\n        \n        unless tag.text == nil\n            if tag.text == \" \"\n                tag.text = \"$0\"\n            else\n                tag.text = '${' + snip_num.to_s + ':' + tag.text + '}'\n            end\n        end\n        \n        search_results.push( { 'title' => n , 'data' => tag.to_s.gsub( \"'\", '\"' ) }  )\n        \n    end\n    \nend\n\nTextMate.exit_show_tool_tip( \"No completion found.\" ) if search_results.empty?\n\nif search_results.size > 1\n    \n\tplist = { 'menuItems' => search_results }.to_plist\t\n\tres = OSX::PropertyList::load( `\#{e_sh ENV['DIALOG']} -up \#{e_sh plist}` )\n\t\n\tTextMate.exit_discard() unless res.has_key? 'selectedMenuItem'\n\tchoice = res['selectedMenuItem']['data']\n\nelse\n\n\tchoice = search_results.pop['data']\n\nend\n\nprint choice",
  fallbackInput: "word",
  input: "selection",
  keyEquivalent: "~",
  name: "Auto Complete Tag",
  output: "insertAsSnippet",
  scope: "text.xml.ant",
  uuid: "4BCBC20D-A418-412D-AD95-1CBB62AF1760"},
 {beforeRunningCommand: "nop",
  command: 
   ". \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\n\nrequire_cmd \"${TM_ANT:=ant}\" \"Ant was not found, please ensure that it has been installed and your \\$PATH is set correctly.\"\n\nhtml_header \"Ant Build\"\n\nTM_PROJECT_DIR=`dirname \"$TM_PROJECT_FILEPATH\"`;\n\n#TM_ANT_BUILD_PARSER=htmlize_ant.py\n\nif [[ \"$TM_ANT_BUILD_PARSER\" == \"\" ]]; then \n\tTM_ANT_BUILD_PARSER=pre\nfi\n\nif [[ -f \"$TM_PROJECT_DIR/$TM_ANT_BUILD_FILE\" ]]; then\n \n\t\"$TM_ANT\" -buildfile \"$TM_PROJECT_DIR/$TM_ANT_BUILD_FILE\" | \"$TM_ANT_BUILD_PARSER\"\n\nelif [[ -f \"$TM_ANT_BUILD_FILE\" ]]; then\n\t\n\t\"$TM_ANT\" -buildfile \"$TM_ANT_BUILD_FILE\" | \"$TM_ANT_BUILD_PARSER\"\n\t\nelse\n\n\t\"$TM_ANT\" -find build.xml | \"$TM_ANT_BUILD_PARSER\"\n\nfi\n",
  input: "none",
  keyEquivalent: "@b",
  name: "Build",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "C7888301-C304-4EF2-A15F-5681A7D6D13C"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby\n\nSUPPORT = ENV['TM_SUPPORT_PATH']\n\nrequire SUPPORT + '/lib/exit_codes'\nrequire SUPPORT + '/lib/escape'\nrequire SUPPORT + '/lib/textmate'\nrequire SUPPORT + '/lib/ui'\nrequire SUPPORT + '/lib/tm/process'\nrequire SUPPORT + '/lib/web_preview'\nrequire 'rexml/document'\n\nSTDOUT.sync = true\n\ntm_ant = 'ant' \ntm_ant = (ENV['TM_ANT'] == nil) ? 'ant' : ENV['TM_ANT']\n\nTextMate.require_cmd \"\#{tm_ant}\"\nTextMate.min_support 10895\n\nputs html_head( :window_title => \"Ant Build (target)\", :page_title => \"Build (target)\" );\n\nbase_dir = \"\"\nant_build_file = \"\" \nant_build_file = ENV['TM_ANT_BUILD_FILE'] if ENV['TM_ANT_BUILD_FILE'] != nil\nproject_base_path = File.dirname( ENV['TM_PROJECT_FILEPATH'] ) if ENV['TM_PROJECT_FILEPATH'] != nil\nant_build_file = project_base_path + \"/\" + ant_build_file if ant_build_file != \"\"\n\nif File.exists?( ant_build_file )\n  source = REXML::Document.new( File.open( ant_build_file, \"r\"))\nelse \n  source = REXML::Document.new(STDIN.read)\n  ant_build_file = ENV['TM_FILEPATH']\nend\n\nif source.root.attributes['default']\n\tdefault_target = source.root.attributes['default']\nend\n\n# Creates a menu item for the UI.menu.\ndef menu_item targ\n\t{ 'title' => targ.attributes['name'], 'description' => targ.attributes['description'].to_s }\nend\n\nant_targets = []\nsource.each_element('//target'){ |targ|\n\tif targ.attributes['name'] == default_target\n\t\tdefault_target = menu_item(targ)\n\telse\n\t\tant_targets << menu_item(targ)\n\tend\n}\n\nif ant_targets.empty? and default_target == nil\n\tTextMate.exit_show_html( \"<h1>No targets found.</h1>\")\nend\n\nant_targets = ant_targets.sort {| a,b | a['title'] <=> b['title'] }\n\nif default_target\n\tant_targets = ant_targets.unshift({'title' => '-'}) if ant_targets.size > 0\n\tant_targets = ant_targets.unshift(default_target) \nend\n\nres = TextMate::UI.menu(ant_targets)\nTextMate.exit_discard() if res == nil\nselected_target = res['title']\nselected_desc = res['description']\n\nputs \"<h1>\#{selected_target}:</h1><p>\#{selected_desc}</p><pre>\"\n\nTextMate::Process.run(\"ant -buildfile \#{ant_build_file} \#{selected_target}\", :interactive_input => false) do |str|\n\tSTDOUT << htmlize(str, :no_newline_after_br => true)\nend\n\nputs \"</pre>\"\nhtml_footer\n\n",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "~@b",
  name: "Build Target",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "05BC9A24-B64E-42D6-8177-326518E65EE0"},
 {beforeRunningCommand: "nop",
  command: "antdoc.rb;",
  fallbackInput: "word",
  input: "selection",
  keyEquivalent: "^h",
  name: "Documentation for Word / Selection",
  output: "discard",
  scope: "text.xml.ant",
  uuid: "464D4A8B-64A9-4C9E-BC94-65DBD5D16117"},
 {beforeRunningCommand: "nop",
  command: 
   ". \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\nhtml_header \"Apache Ant Bundle Help\" \"Ant\"\n\n\"$TM_SUPPORT_PATH/lib/markdown_to_help.rb\" < \"$TM_BUNDLE_PATH/README.mdown\"\n\nhtml_footer",
  input: "none",
  name: "Help",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "B34D55F6-17C3-4698-973F-FDE059BEB675"},
 {beforeRunningCommand: "nop",
  command: 
   "require_cmd \"${TM_ANT:=ant}\" \"Ant was not found, please ensure that it has been installed and your \\$PATH is set correctly.\"\n\nif [ \"$TM_FILEPATH\" == \"\" ]; then\n\texit_show_tool_tip \"Please open an ant file to scan for ant targets.\";\nfi\n\n\"$TM_ANT\" -p -f \"$TM_FILEPATH\"",
  input: "none",
  name: "List Targets",
  output: "showAsTooltip",
  scope: "text.xml.ant",
  uuid: "9BF3D042-E77C-4E89-9E8C-18A81AE3923B"},
 {beforeRunningCommand: "nop",
  command: 
   "# Where there is no manual path specified try the one default location Apple may have installed the manual at, otherwise fall back to the ant.apache.org site.\nif [[ \"$TM_ANT_MANUAL_PATH\" == \"\" ]]; then\n\tTM_ANT_MANUAL_PATH=\"/Developer/Java/Ant/docs/manual\"\nfi\n\nif [[ -f \"$TM_ANT_MANUAL_PATH/index.html\" ]]; then\n\n\techo \"<meta http-equiv=\\\"refresh\\\" content=\\\"0; tm-file://$TM_ANT_MANUAL_PATH/index.html\\\">\"\n\nelse\t\n\n\techo \"<meta http-equiv=\\\"refresh\\\" content=\\\"0; http://ant.apache.org/manual/index.html\\\" >\"\n\nfi",
  input: "none",
  name: "Manual",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "DADF5411-0178-43B9-A4E1-4FAADA22DF16"},
 {beforeRunningCommand: "saveActiveFile",
  command: 
   ". \"$TM_SUPPORT_PATH/lib/webpreview.sh\"\n\nrequire_cmd \"${TM_ANT:=ant}\" \"Ant was not found, please ensure that it has been installed and your \\$PATH is set correctly.\"\n\nhtml_header \"Ant Run\"\n\nif [[ \"$TM_ANT_BUILD_PARSER\" == \"\" ]]; then \n\tTM_ANT_BUILD_PARSER=pre\nfi\n\n\"$TM_ANT\" -buildfile \"$TM_FILEPATH\" | \"$TM_ANT_BUILD_PARSER\"",
  input: "none",
  keyEquivalent: "@r",
  name: "Run",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "7B5E4852-8B66-461F-A32A-A820625256A5"},
 {beforeRunningCommand: "nop",
  command: 
   "if [[ -f \"$TM_ANT_DTD_FILE\" ]]; then\n\t\n\txmllint --noout --dtdvalid \"$TM_ANT_DTD_FILE\" - && echo \"XML syntax OK, DTD Valid\";\n\nelse\n\n\txmllint --noout - && echo \"XML syntax OK\";\n\nfi\n",
  input: "document",
  keyEquivalent: "^V",
  name: "Validate Build File",
  output: "showAsTooltip",
  scope: "text.xml.ant",
  uuid: "080190AE-FCEF-47BF-86E2-6CC48C8B3E8B"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby\n\n# NOTE: We output to tmp as the document doesn't render when piped directly to \"Show as HTML\"\ntmp_build_uri = \"/tmp/tm_ant_build.xml\"\n\ndoc_arr = STDIN.read\ndoc_arr = doc_arr.split( \"\\n\" )\ndoc_arr.unshift('<?xml version=\"1.0\"?>') if doc_arr[0] !~ /<?xml\\s+version/\ndoc_arr.insert( 1, '<?xml-stylesheet type=\"text/xsl\" href=\"' + ENV['TM_BUNDLE_SUPPORT'] + '/style/ant2html.xsl\"?>' )\ntmp_build_xml = File.open( tmp_build_uri, \"w\" )\ndoc_arr.each { |line| tmp_build_xml.puts line }\ntmp_build_xml.close()\n\n`cp \"$TM_BUNDLE_SUPPORT/style/ant2html.css\" \"/tmp/ant2html.css\"`\n\nputs \"<meta http-equiv=\\\"refresh\\\" content=\\\"0; tm-file://\#{tmp_build_uri}\\\">\"\n",
  input: "document",
  name: "View as HTML",
  output: "showAsHTML",
  scope: "text.xml.ant",
  uuid: "62CAE21C-2269-489F-B5AB-3E652AE6E51F"}]
