aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_ext
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib_ext')
-rw-r--r--lib/lib_ext/capistrano_connections.rb16
-rw-r--r--lib/lib_ext/gli.rb52
-rw-r--r--lib/lib_ext/markdown_document_listener.rb122
3 files changed, 0 insertions, 190 deletions
diff --git a/lib/lib_ext/capistrano_connections.rb b/lib/lib_ext/capistrano_connections.rb
deleted file mode 100644
index c46455f..0000000
--- a/lib/lib_ext/capistrano_connections.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Capistrano
- class Configuration
- module Connections
- def failed!(server)
- @failure_callback.call(server) if @failure_callback
- Thread.current[:failed_sessions] << server
- end
-
- def call_on_failure(&block)
- @failure_callback = block
- end
- end
- end
-end
-
-
diff --git a/lib/lib_ext/gli.rb b/lib/lib_ext/gli.rb
deleted file mode 100644
index f9b03be..0000000
--- a/lib/lib_ext/gli.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# print subcommands indented in the main global help screen
-#
-
-module GLI
- module Commands
- module HelpModules
- class GlobalHelpFormat
- SUB_CMD_INDENT = " "
- def format
- program_desc = @app.program_desc
- program_long_desc = @app.program_long_desc
- if program_long_desc
- wrapper = @wrapper_class.new(Terminal.instance.size[0],4)
- program_long_desc = "\n #{wrapper.wrap(program_long_desc)}\n\n" if program_long_desc
- else
- program_long_desc = "\n"
- end
-
- # build a list of commands, sort them so the commands with subcommands are at the bottom
- commands = @sorter.call(@app.commands_declaration_order.reject(&:nodoc)).sort do |a,b|
- if a.commands.any? && b.commands.any?; a.name.to_s <=> b.name.to_s
- elsif a.commands.any?; 1
- elsif b.commands.any?; -1
- else; a.name.to_s <=> b.name.to_s
- end
- end
-
- # build a list of command info ([name, description]), including subcommands if appropriate
- command_info_list = []
- commands.each do |command|
- name = [command.name, Array(command.aliases)].flatten.join(', ')
- command_info_list << [name, command.description]
- if command.commands.any?
- @sorter.call(command.commands_declaration_order).each do |cmd|
- command_info_list << [SUB_CMD_INDENT + command.name.to_s + " " + cmd.names, cmd.description + (command.get_default_command == cmd.name ? " (default)" : "")]
- end
- end
- end
-
- # display
- command_formatter = ListFormatter.new(command_info_list, @wrapper_class)
- stringio = StringIO.new
- command_formatter.output(stringio)
- commands = stringio.string
- global_option_descriptions = OptionsFormatter.new(global_flags_and_switches, @sorter, @wrapper_class).format
- GLOBAL_HELP.result(binding)
- end
- end
- end
- end
-end
diff --git a/lib/lib_ext/markdown_document_listener.rb b/lib/lib_ext/markdown_document_listener.rb
deleted file mode 100644
index 55026e9..0000000
--- a/lib/lib_ext/markdown_document_listener.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require 'stringio'
-require 'gli/commands/help_modules/arg_name_formatter'
-
-#
-# adaption of RdocDocumentListener to use Markdown
-# see http://rtomayko.github.com/ronn/ronn-format.7
-#
-
-module GLI
- module Commands
- class MarkdownDocumentListener
-
- def initialize(global_options,options,arguments)
- @io = STDOUT #File.new(File.basename($0) + ".rdoc",'w')
- @nest = ''
- @arg_name_formatter = GLI::Commands::HelpModules::ArgNameFormatter.new
- end
-
- def beginning
- end
-
- # Called when processing has completed
- def ending
- #@io.close
- end
-
- # Gives you the program description
- def program_desc(desc)
- @io.puts "== #{File.basename($0)} - #{desc}"
- @io.puts
- end
-
- def program_long_desc(desc)
- @io.puts desc
- @io.puts
- end
-
- # Gives you the program version
- def version(version)
- @io.puts "v#{version}"
- @io.puts
- end
-
- def options
- if @nest.size == 0
- @io.puts "=== Global Options"
- else
- @io.puts "#{@nest}=== Options"
- end
- end
-
- # Gives you a flag in the current context
- def flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)
- invocations = ([name] + Array(aliases)).map { |_| add_dashes(_) }.join('|')
- usage = "#{invocations} #{arg_name || 'arg'}"
- @io.puts "#{@nest}=== #{usage}"
- @io.puts
- @io.puts String(desc).strip
- @io.puts
- @io.puts "[Default Value] #{default_value || 'None'}"
- @io.puts "[Must Match] #{must_match.to_s}" unless must_match.nil?
- @io.puts String(long_desc).strip
- @io.puts
- end
-
- # Gives you a switch in the current context
- def switch(name,aliases,desc,long_desc,negetable)
- if negetable
- name = "[no-]#{name}" if name.to_s.length > 1
- aliases = aliases.map { |_| _.to_s.length > 1 ? "[no-]#{_}" : _ }
- end
- invocations = ([name] + aliases).map { |_| add_dashes(_) }.join('|')
- @io.puts "#{@nest}=== #{invocations}"
- @io.puts String(desc).strip
- @io.puts
- @io.puts String(long_desc).strip
- @io.puts
- end
-
- def end_options
- end
-
- def commands
- @io.puts "#{@nest}=== Commands"
- @nest = "#{@nest}="
- end
-
- # Gives you a command in the current context and creates a new context of this command
- def command(name,aliases,desc,long_desc,arg_name,arg_options)
- @io.puts "#{@nest}=== Command: <tt>#{([name] + aliases).join('|')} #{@arg_name_formatter.format(arg_name,arg_options)}</tt>"
- @io.puts String(desc).strip
- @io.puts
- @io.puts String(long_desc).strip
- @nest = "#{@nest}="
- end
-
- # Ends a command, and "pops" you back up one context
- def end_command(name)
- @nest.gsub!(/=$/,'')
- end
-
- # Gives you the name of the current command in the current context
- def default_command(name)
- @io.puts "[Default Command] #{name}" unless name.nil?
- end
-
- def end_commands
- @nest.gsub!(/=$/,'')
- end
-
- private
-
- def add_dashes(name)
- name = "-#{name}"
- name = "-#{name}" if name.length > 2
- name
- end
-
-
- end
- end
-end