We need a “valid” method thtat determines if a string is suitable for use in the gem specification.
Enumerate all the annoations for the given config and tag. This will search for all athe annotations and display them on standard output.
# File lib/bones/annotation_extractor.rb, line 23 23: def self.enumerate( config, tag, id = nil, opts = {} ) 24: extractor = new(config, tag, id) 25: extractor.display(extractor.find, opts) 26: end
Creates a new annotation extractor configured to use the config open strcut and to search for the given tag (which can be more than one tag via a regular expression ‘or’ operation — i.e. THIS|THAT|OTHER)
# File lib/bones/annotation_extractor.rb, line 34 34: def initialize( config, tag, id) 35: @config = config 36: @tag = tag 37: @id = @id_rgxp = nil 38: 39: unless id.nil? or id.empty? 40: @id = id 41: @id_rgxp = Regexp.new(Regexp.escape(id), Regexp::IGNORECASE) 42: end 43: end
Print the results of the annotation extraction to the screen. If the :tags option is set to true, then the annotation tag will be displayed.
# File lib/bones/annotation_extractor.rb, line 89 89: def display( results, opts = {} ) 90: results.keys.sort.each do |file| 91: puts "#{file}:" 92: results[file].each do |note| 93: puts " * #{note.to_s(opts)}" 94: end 95: puts 96: end 97: end
# File lib/bones/smtp_tls.rb, line 55 55: def do_helo(helodomain) 56: begin 57: if @esmtp 58: ehlo helodomain 59: else 60: helo helodomain 61: end 62: rescue Net::ProtocolError 63: if @esmtp 64: @esmtp = false 65: @error_occured = false 66: retry 67: end 68: raise 69: end 70: end
# File lib/bones/smtp_tls.rb, line 16 16: def do_start(helodomain, user, secret, authtype) 17: raise IOError, 'SMTP session already started' if @started 18: 19: if user or secret 20: if 3 == self.method(:check_auth_args).arity 21: check_auth_args(user, secret, authtype) 22: else 23: check_auth_args(user, secret) 24: end 25: end 26: 27: sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) } 28: @socket = Net::InternetMessageIO.new(sock) 29: @socket.read_timeout = 60 #@read_timeout 30: @socket.debug_output = STDERR #@debug_output 31: 32: check_response(critical { recv_response() }) 33: do_helo(helodomain) 34: 35: raise 'openssl library not installed' unless defined?(OpenSSL) 36: starttls 37: ssl = OpenSSL::SSL::SSLSocket.new(sock) 38: ssl.sync_close = true 39: ssl.connect 40: @socket = Net::InternetMessageIO.new(ssl) 41: @socket.read_timeout = 60 #@read_timeout 42: @socket.debug_output = STDERR #@debug_output 43: do_helo(helodomain) 44: 45: authenticate user, secret, authtype if user 46: @started = true 47: ensure 48: unless @started 49: # authentication failed, cancel connection. 50: @socket.close if not @started and @socket and not @socket.closed? 51: @socket = nil 52: end 53: end
Adds the given arguments to the include path if they are not already there
# File lib/bones/helpers.rb, line 85 85: def ensure_in_path( *args ) 86: args.each do |path| 87: path = File.expand_path(path) 88: $:.unshift(path) if test(dd, path) and not $:.include?(path) 89: end 90: end
Extract any annotations from the given file using the regular expression pattern provided.
# File lib/bones/annotation_extractor.rb, line 68 68: def extract_annotations_from( file, pattern ) 69: lineno = 0 70: result = File.readlines(file).inject([]) do |list, line| 71: lineno += 1 72: next list unless m = pattern.match(line) 73: next list << Annotation.new(lineno, m[1], m[2]) unless id 74: 75: text = m[2] 76: if text =~ @id_rgxp 77: text.gsub!(@id_rgxp) {|str| ::Bones::Colors.green(str)} if config.colorize 78: list << Annotation.new(lineno, m[1], text) 79: end 80: list 81: end 82: result.empty? ? {} : { file => result } 83: end
Iterate over all the files in the project and extract annotations from the those files. Returns the results as a hash for display.
# File lib/bones/annotation_extractor.rb, line 48 48: def find 49: results = {} 50: rgxp = /(#{tag}):?\s*(.*?)(?:\s*(?:-?%>|\*+\/))?$/ 51: 52: extensions = config.notes.extensions.dup 53: exclude = if config.notes.exclude.empty? then nil 54: else Regexp.new(config.notes.exclude.join('|')) end 55: 56: config.gem.files.each do |fn| 57: next if exclude && exclude =~ fn 58: next unless extensions.include? File.extname(fn) 59: results.update(extract_annotations_from(fn, rgxp)) 60: end 61: 62: results 63: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.